summaryrefslogtreecommitdiff
path: root/lib/rb
diff options
context:
space:
mode:
authorjfarrell <jfarrell@apache.org>2015-01-29 23:42:05 -0500
committerjfarrell <jfarrell@apache.org>2015-01-29 23:42:05 -0500
commit8f2596ad546451c50e48425e37eddc9195c5807e (patch)
tree8f657506c5512fb239b1d85aafe9beede2e5e9a1 /lib/rb
parent4e16718e998df64e0e3c9a01ddb85af32f344933 (diff)
downloadthrift-8f2596ad546451c50e48425e37eddc9195c5807e.tar.gz
THRIFT-2961: Service inheritance does not work with namespaced Ruby code
Client: rb Patch: Jan Brauer This closes #364 commit 111c4e77a78c1a82f526923f13534bb0027ef33f Author: Jan Brauer <jan@jimdo.com> Date: 2015-01-29T22:01:26Z Make 'extends' work with 'rb:namespaced'. commit 34cab3d7c77bd5e8325ac4f30f1091429c35905e Author: Jan Brauer <jan@jimdo.com> Date: 2015-01-29T22:25:03Z Add test for namespaced service extension
Diffstat (limited to 'lib/rb')
-rw-r--r--lib/rb/Rakefile2
-rw-r--r--lib/rb/spec/BaseService.thrift27
-rw-r--r--lib/rb/spec/ExtendedService.thrift25
-rw-r--r--lib/rb/spec/namespaced_spec.rb5
4 files changed, 59 insertions, 0 deletions
diff --git a/lib/rb/Rakefile b/lib/rb/Rakefile
index 8f1c4fec3..9dc8324dc 100644
--- a/lib/rb/Rakefile
+++ b/lib/rb/Rakefile
@@ -48,6 +48,8 @@ namespace :'gen-rb' do
task :'namespaced_spec' do
dir = File.dirname(__FILE__) + '/spec'
sh THRIFT, '--gen', 'rb:namespaced', '-recurse', '-o', dir, "#{dir}/ThriftNamespacedSpec.thrift"
+ sh THRIFT, '--gen', 'rb:namespaced', '-recurse', '-o', dir, "#{dir}/BaseService.thrift"
+ sh THRIFT, '--gen', 'rb:namespaced', '-recurse', '-o', dir, "#{dir}/ExtendedService.thrift"
end
task :'flat_spec' do
diff --git a/lib/rb/spec/BaseService.thrift b/lib/rb/spec/BaseService.thrift
new file mode 100644
index 000000000..5c7d32a6c
--- /dev/null
+++ b/lib/rb/spec/BaseService.thrift
@@ -0,0 +1,27 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+namespace rb Base
+
+struct Hello {
+ 1: string greeting = "hello world"
+}
+
+service BaseService {
+ Hello greeting(1:bool english)
+}
diff --git a/lib/rb/spec/ExtendedService.thrift b/lib/rb/spec/ExtendedService.thrift
new file mode 100644
index 000000000..1a6b705aa
--- /dev/null
+++ b/lib/rb/spec/ExtendedService.thrift
@@ -0,0 +1,25 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+namespace rb Extended
+
+include "BaseService.thrift"
+
+service ExtendedService extends BaseService.BaseService {
+ void ping()
+}
diff --git a/lib/rb/spec/namespaced_spec.rb b/lib/rb/spec/namespaced_spec.rb
index 8d4f88be1..31379d964 100644
--- a/lib/rb/spec/namespaced_spec.rb
+++ b/lib/rb/spec/namespaced_spec.rb
@@ -59,4 +59,9 @@ describe 'namespaced generation' do
it "required an included file" do
defined?(OtherNamespace::SomeEnum).should be_true
end
+
+ it "extended a service" do
+ require "extended/extended_service"
+ end
+
end