thrift 0.9.2.0 → 0.9.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/binary_protocol_accelerated.c +12 -12
- data/lib/thrift.rb +2 -0
- data/lib/thrift/multiplexed_processor.rb +76 -0
- data/lib/thrift/processor.rb +16 -5
- data/lib/thrift/protocol/multiplexed_protocol.rb +40 -0
- data/lib/thrift/protocol/protocol_decorator.rb +194 -0
- data/lib/thrift/union.rb +3 -6
- data/spec/BaseService.thrift +27 -0
- data/spec/ExtendedService.thrift +25 -0
- data/spec/flat_spec.rb +62 -0
- data/spec/namespaced_spec.rb +5 -0
- data/spec/spec_helper.rb +3 -0
- data/spec/union_spec.rb +5 -0
- metadata +14 -2
@@ -283,27 +283,27 @@ VALUE rb_thrift_binary_proto_read_message_end(VALUE self) {
|
|
283
283
|
return Qnil;
|
284
284
|
}
|
285
285
|
|
286
|
-
VALUE
|
286
|
+
VALUE rb_thrift_binary_proto_read_struct_begin(VALUE self) {
|
287
287
|
return Qnil;
|
288
288
|
}
|
289
289
|
|
290
|
-
VALUE
|
290
|
+
VALUE rb_thrift_binary_proto_read_struct_end(VALUE self) {
|
291
291
|
return Qnil;
|
292
292
|
}
|
293
293
|
|
294
|
-
VALUE
|
294
|
+
VALUE rb_thrift_binary_proto_read_field_end(VALUE self) {
|
295
295
|
return Qnil;
|
296
296
|
}
|
297
297
|
|
298
|
-
VALUE
|
298
|
+
VALUE rb_thrift_binary_proto_read_map_end(VALUE self) {
|
299
299
|
return Qnil;
|
300
300
|
}
|
301
301
|
|
302
|
-
VALUE
|
302
|
+
VALUE rb_thrift_binary_proto_read_list_end(VALUE self) {
|
303
303
|
return Qnil;
|
304
304
|
}
|
305
305
|
|
306
|
-
VALUE
|
306
|
+
VALUE rb_thrift_binary_proto_read_set_end(VALUE self) {
|
307
307
|
return Qnil;
|
308
308
|
}
|
309
309
|
|
@@ -449,12 +449,12 @@ void Init_binary_protocol_accelerated() {
|
|
449
449
|
rb_define_method(bpa_class, "read_binary", rb_thrift_binary_proto_read_binary, 0);
|
450
450
|
// unused methods
|
451
451
|
rb_define_method(bpa_class, "read_message_end", rb_thrift_binary_proto_read_message_end, 0);
|
452
|
-
rb_define_method(bpa_class, "read_struct_begin",
|
453
|
-
rb_define_method(bpa_class, "read_struct_end",
|
454
|
-
rb_define_method(bpa_class, "read_field_end",
|
455
|
-
rb_define_method(bpa_class, "read_map_end",
|
456
|
-
rb_define_method(bpa_class, "read_list_end",
|
457
|
-
rb_define_method(bpa_class, "read_set_end",
|
452
|
+
rb_define_method(bpa_class, "read_struct_begin", rb_thrift_binary_proto_read_struct_begin, 0);
|
453
|
+
rb_define_method(bpa_class, "read_struct_end", rb_thrift_binary_proto_read_struct_end, 0);
|
454
|
+
rb_define_method(bpa_class, "read_field_end", rb_thrift_binary_proto_read_field_end, 0);
|
455
|
+
rb_define_method(bpa_class, "read_map_end", rb_thrift_binary_proto_read_map_end, 0);
|
456
|
+
rb_define_method(bpa_class, "read_list_end", rb_thrift_binary_proto_read_list_end, 0);
|
457
|
+
rb_define_method(bpa_class, "read_set_end", rb_thrift_binary_proto_read_set_end, 0);
|
458
458
|
|
459
459
|
rbuf_ivar_id = rb_intern("@rbuf");
|
460
460
|
}
|
data/lib/thrift.rb
CHANGED
@@ -27,6 +27,7 @@ require 'thrift/core_ext'
|
|
27
27
|
require 'thrift/exceptions'
|
28
28
|
require 'thrift/types'
|
29
29
|
require 'thrift/processor'
|
30
|
+
require 'thrift/multiplexed_processor'
|
30
31
|
require 'thrift/client'
|
31
32
|
require 'thrift/struct'
|
32
33
|
require 'thrift/union'
|
@@ -42,6 +43,7 @@ require 'thrift/protocol/binary_protocol'
|
|
42
43
|
require 'thrift/protocol/binary_protocol_accelerated'
|
43
44
|
require 'thrift/protocol/compact_protocol'
|
44
45
|
require 'thrift/protocol/json_protocol'
|
46
|
+
require 'thrift/protocol/multiplexed_protocol'
|
45
47
|
|
46
48
|
# transport
|
47
49
|
require 'thrift/transport/base_transport'
|
@@ -0,0 +1,76 @@
|
|
1
|
+
#
|
2
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
# or more contributor license agreements. See the NOTICE file
|
4
|
+
# distributed with this work for additional information
|
5
|
+
# regarding copyright ownership. The ASF licenses this file
|
6
|
+
# to you under the Apache License, Version 2.0 (the
|
7
|
+
# "License"); you may not use this file except in compliance
|
8
|
+
# with the License. You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing,
|
13
|
+
# software distributed under the License is distributed on an
|
14
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
# KIND, either express or implied. See the License for the
|
16
|
+
# specific language governing permissions and limitations
|
17
|
+
# under the License.
|
18
|
+
|
19
|
+
require 'thrift/protocol/protocol_decorator'
|
20
|
+
require 'thrift/protocol/base_protocol'
|
21
|
+
|
22
|
+
module Thrift
|
23
|
+
class MultiplexedProcessor
|
24
|
+
def initialize
|
25
|
+
@actual_processors = {}
|
26
|
+
end
|
27
|
+
|
28
|
+
def register_processor(service_name, processor)
|
29
|
+
@actual_processors[service_name] = processor
|
30
|
+
end
|
31
|
+
|
32
|
+
def process(iprot, oprot)
|
33
|
+
name, type, seqid = iprot.read_message_begin
|
34
|
+
check_type(type)
|
35
|
+
check_separator(name)
|
36
|
+
service_name, method = name.split(':')
|
37
|
+
processor(service_name).process(StoredMessageProtocol.new(iprot, [method, type, seqid]), oprot)
|
38
|
+
end
|
39
|
+
|
40
|
+
protected
|
41
|
+
|
42
|
+
def processor(service_name)
|
43
|
+
if @actual_processors.has_key?(service_name)
|
44
|
+
@actual_processors[service_name]
|
45
|
+
else
|
46
|
+
raise Thrift::Exception.new("Service name not found: #{service_name}. Did you forget to call #{self.class.name}#register_processor?")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def check_type(type)
|
51
|
+
unless [MessageTypes::CALL, MessageTypes::ONEWAY].include?(type)
|
52
|
+
raise Thrift::Exception.new('This should not have happened!?')
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def check_separator(name)
|
57
|
+
if name.count(':') < 1
|
58
|
+
raise Thrift::Exception.new("Service name not found in message name: #{name}. Did you forget to use a Thrift::Protocol::MultiplexedProtocol in your client?")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
class StoredMessageProtocol < BaseProtocol
|
64
|
+
|
65
|
+
include ProtocolDecorator
|
66
|
+
|
67
|
+
def initialize(protocol, message_begin)
|
68
|
+
super(protocol)
|
69
|
+
@message_begin = message_begin
|
70
|
+
end
|
71
|
+
|
72
|
+
def read_message_begin
|
73
|
+
@message_begin
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
data/lib/thrift/processor.rb
CHANGED
@@ -26,16 +26,18 @@ module Thrift
|
|
26
26
|
def process(iprot, oprot)
|
27
27
|
name, type, seqid = iprot.read_message_begin
|
28
28
|
if respond_to?("process_#{name}")
|
29
|
-
|
29
|
+
begin
|
30
|
+
send("process_#{name}", seqid, iprot, oprot)
|
31
|
+
rescue => e
|
32
|
+
x = ApplicationException.new(ApplicationException::INTERNAL_ERROR, 'Internal error')
|
33
|
+
write_error(x, oprot, name, seqid)
|
34
|
+
end
|
30
35
|
true
|
31
36
|
else
|
32
37
|
iprot.skip(Types::STRUCT)
|
33
38
|
iprot.read_message_end
|
34
39
|
x = ApplicationException.new(ApplicationException::UNKNOWN_METHOD, 'Unknown function '+name)
|
35
|
-
|
36
|
-
x.write(oprot)
|
37
|
-
oprot.write_message_end
|
38
|
-
oprot.trans.flush
|
40
|
+
write_error(x, oprot, name, seqid)
|
39
41
|
false
|
40
42
|
end
|
41
43
|
end
|
@@ -53,5 +55,14 @@ module Thrift
|
|
53
55
|
oprot.write_message_end
|
54
56
|
oprot.trans.flush
|
55
57
|
end
|
58
|
+
|
59
|
+
def write_error(err, oprot, name, seqid)
|
60
|
+
p 'write_error'
|
61
|
+
oprot.write_message_begin(name, MessageTypes::EXCEPTION, seqid)
|
62
|
+
err.write(oprot)
|
63
|
+
oprot.write_message_end
|
64
|
+
oprot.trans.flush
|
65
|
+
p 'write_error end'
|
66
|
+
end
|
56
67
|
end
|
57
68
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
#
|
2
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
# or more contributor license agreements. See the NOTICE file
|
4
|
+
# distributed with this work for additional information
|
5
|
+
# regarding copyright ownership. The ASF licenses this file
|
6
|
+
# to you under the Apache License, Version 2.0 (the
|
7
|
+
# "License"); you may not use this file except in compliance
|
8
|
+
# with the License. You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing,
|
13
|
+
# software distributed under the License is distributed on an
|
14
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
# KIND, either express or implied. See the License for the
|
16
|
+
# specific language governing permissions and limitations
|
17
|
+
# under the License.
|
18
|
+
|
19
|
+
require 'thrift/protocol/protocol_decorator'
|
20
|
+
|
21
|
+
module Thrift
|
22
|
+
class MultiplexedProtocol < BaseProtocol
|
23
|
+
|
24
|
+
include ProtocolDecorator
|
25
|
+
|
26
|
+
def initialize(protocol, service_name)
|
27
|
+
super(protocol)
|
28
|
+
@service_name = service_name
|
29
|
+
end
|
30
|
+
|
31
|
+
def write_message_begin(name, type, seqid)
|
32
|
+
case type
|
33
|
+
when MessageTypes::CALL, MessageTypes::ONEWAY
|
34
|
+
@protocol.write_message_begin("#{@service_name}:#{name}", type, seqid)
|
35
|
+
else
|
36
|
+
@protocol.write_message_begin(name, type, seqid)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,194 @@
|
|
1
|
+
#
|
2
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
# or more contributor license agreements. See the NOTICE file
|
4
|
+
# distributed with this work for additional information
|
5
|
+
# regarding copyright ownership. The ASF licenses this file
|
6
|
+
# to you under the Apache License, Version 2.0 (the
|
7
|
+
# "License"); you may not use this file except in compliance
|
8
|
+
# with the License. You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing,
|
13
|
+
# software distributed under the License is distributed on an
|
14
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
# KIND, either express or implied. See the License for the
|
16
|
+
# specific language governing permissions and limitations
|
17
|
+
# under the License.
|
18
|
+
|
19
|
+
module Thrift
|
20
|
+
module ProtocolDecorator
|
21
|
+
|
22
|
+
def initialize(protocol)
|
23
|
+
@protocol = protocol
|
24
|
+
end
|
25
|
+
|
26
|
+
def trans
|
27
|
+
@protocol.trans
|
28
|
+
end
|
29
|
+
|
30
|
+
def write_message_begin(name, type, seqid)
|
31
|
+
@protocol.write_message_begin
|
32
|
+
end
|
33
|
+
|
34
|
+
def write_message_end
|
35
|
+
@protocol.write_message_end
|
36
|
+
end
|
37
|
+
|
38
|
+
def write_struct_begin(name)
|
39
|
+
@protocol.write_struct_begin(name)
|
40
|
+
end
|
41
|
+
|
42
|
+
def write_struct_end
|
43
|
+
@protocol.write_struct_end
|
44
|
+
end
|
45
|
+
|
46
|
+
def write_field_begin(name, type, id)
|
47
|
+
@protocol.write_field_begin(name, type, id)
|
48
|
+
end
|
49
|
+
|
50
|
+
def write_field_end
|
51
|
+
@protocol.write_field_end
|
52
|
+
end
|
53
|
+
|
54
|
+
def write_field_stop
|
55
|
+
@protocol.write_field_stop
|
56
|
+
end
|
57
|
+
|
58
|
+
def write_map_begin(ktype, vtype, size)
|
59
|
+
@protocol.write_map_begin(ktype, vtype, size)
|
60
|
+
end
|
61
|
+
|
62
|
+
def write_map_end
|
63
|
+
@protocol.write_map_end
|
64
|
+
end
|
65
|
+
|
66
|
+
def write_list_begin(etype, size)
|
67
|
+
@protocol.write_list_begin(etype, size)
|
68
|
+
end
|
69
|
+
|
70
|
+
def write_list_end
|
71
|
+
@protocol.write_list_end
|
72
|
+
end
|
73
|
+
|
74
|
+
def write_set_begin(etype, size)
|
75
|
+
@protocol.write_set_begin(etype, size)
|
76
|
+
end
|
77
|
+
|
78
|
+
def write_set_end
|
79
|
+
@protocol.write_set_end
|
80
|
+
end
|
81
|
+
|
82
|
+
def write_bool(bool)
|
83
|
+
@protocol.write_bool(bool)
|
84
|
+
end
|
85
|
+
|
86
|
+
def write_byte(byte)
|
87
|
+
@protocol.write_byte(byte)
|
88
|
+
end
|
89
|
+
|
90
|
+
def write_i16(i16)
|
91
|
+
@protocol.write_i16(i16)
|
92
|
+
end
|
93
|
+
|
94
|
+
def write_i32(i32)
|
95
|
+
@protocol.write_i32(i32)
|
96
|
+
end
|
97
|
+
|
98
|
+
def write_i64(i64)
|
99
|
+
@protocol.write_i64(i64)
|
100
|
+
end
|
101
|
+
|
102
|
+
def write_double(dub)
|
103
|
+
@protocol.write_double(dub)
|
104
|
+
end
|
105
|
+
|
106
|
+
def write_string(str)
|
107
|
+
@protocol.write_string(str)
|
108
|
+
end
|
109
|
+
|
110
|
+
def write_binary(buf)
|
111
|
+
@protocol.write_binary(buf)
|
112
|
+
end
|
113
|
+
|
114
|
+
def read_message_begin
|
115
|
+
@protocol.read_message_begin
|
116
|
+
end
|
117
|
+
|
118
|
+
def read_message_end
|
119
|
+
@protocol.read_message_end
|
120
|
+
end
|
121
|
+
|
122
|
+
def read_struct_begin
|
123
|
+
@protocol.read_struct_begin
|
124
|
+
end
|
125
|
+
|
126
|
+
def read_struct_end
|
127
|
+
@protocol.read_struct_end
|
128
|
+
end
|
129
|
+
|
130
|
+
def read_field_begin
|
131
|
+
@protocol.read_field_begin
|
132
|
+
end
|
133
|
+
|
134
|
+
def read_field_end
|
135
|
+
@protocol.read_field_end
|
136
|
+
end
|
137
|
+
|
138
|
+
def read_map_begin
|
139
|
+
@protocol.read_map_begin
|
140
|
+
end
|
141
|
+
|
142
|
+
def read_map_end
|
143
|
+
@protocol.read_map_end
|
144
|
+
end
|
145
|
+
|
146
|
+
def read_list_begin
|
147
|
+
@protocol.read_list_begin
|
148
|
+
end
|
149
|
+
|
150
|
+
def read_list_end
|
151
|
+
@protocol.read_list_end
|
152
|
+
end
|
153
|
+
|
154
|
+
def read_set_begin
|
155
|
+
@protocol.read_set_begin
|
156
|
+
end
|
157
|
+
|
158
|
+
def read_set_end
|
159
|
+
@protocol.read_set_end
|
160
|
+
end
|
161
|
+
|
162
|
+
def read_bool
|
163
|
+
@protocol.read_bool
|
164
|
+
end
|
165
|
+
|
166
|
+
def read_byte
|
167
|
+
@protocol.read_byte
|
168
|
+
end
|
169
|
+
|
170
|
+
def read_i16
|
171
|
+
@protocol.read_i16
|
172
|
+
end
|
173
|
+
|
174
|
+
def read_i32
|
175
|
+
@protocol.read_i32
|
176
|
+
end
|
177
|
+
|
178
|
+
def read_i64
|
179
|
+
@protocol.read_i64
|
180
|
+
end
|
181
|
+
|
182
|
+
def read_double
|
183
|
+
@protocol.read_double
|
184
|
+
end
|
185
|
+
|
186
|
+
def read_string
|
187
|
+
@protocol.read_string
|
188
|
+
end
|
189
|
+
|
190
|
+
def read_binary
|
191
|
+
@protocol.read_binary
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
data/lib/thrift/union.rb
CHANGED
@@ -87,12 +87,9 @@ module Thrift
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def ==(other)
|
90
|
-
other
|
91
|
-
end
|
92
|
-
|
93
|
-
def eql?(other)
|
94
|
-
self.class == other.class && self == other
|
90
|
+
other.equal?(self) || other.instance_of?(self.class) && @setfield == other.get_set_field && @value == other.get_value
|
95
91
|
end
|
92
|
+
alias_method :eql?, :==
|
96
93
|
|
97
94
|
def hash
|
98
95
|
[self.class.name, @setfield, @value].hash
|
@@ -176,4 +173,4 @@ module Thrift
|
|
176
173
|
end
|
177
174
|
end
|
178
175
|
end
|
179
|
-
end
|
176
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
namespace rb Base
|
20
|
+
|
21
|
+
struct Hello {
|
22
|
+
1: string greeting = "hello world"
|
23
|
+
}
|
24
|
+
|
25
|
+
service BaseService {
|
26
|
+
Hello greeting(1:bool english)
|
27
|
+
}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
namespace rb Extended
|
20
|
+
|
21
|
+
include "BaseService.thrift"
|
22
|
+
|
23
|
+
service ExtendedService extends BaseService.BaseService {
|
24
|
+
void ping()
|
25
|
+
}
|
data/spec/flat_spec.rb
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
#
|
2
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
3
|
+
# or more contributor license agreements. See the NOTICE file
|
4
|
+
# distributed with this work for additional information
|
5
|
+
# regarding copyright ownership. The ASF licenses this file
|
6
|
+
# to you under the Apache License, Version 2.0 (the
|
7
|
+
# "License"); you may not use this file except in compliance
|
8
|
+
# with the License. You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing,
|
13
|
+
# software distributed under the License is distributed on an
|
14
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
15
|
+
# KIND, either express or implied. See the License for the
|
16
|
+
# specific language governing permissions and limitations
|
17
|
+
# under the License.
|
18
|
+
#
|
19
|
+
|
20
|
+
require 'spec_helper'
|
21
|
+
|
22
|
+
describe 'generation' do
|
23
|
+
before do
|
24
|
+
require 'namespaced_nonblocking_service'
|
25
|
+
end
|
26
|
+
|
27
|
+
it "did not generate the wrong files" do
|
28
|
+
prefix = File.expand_path("../gen-rb/flat", __FILE__)
|
29
|
+
["namespaced_spec_namespace/namespaced_nonblocking_service.rb",
|
30
|
+
"namespaced_spec_namespace/thrift_namespaced_spec_constants.rb",
|
31
|
+
"namespaced_spec_namespace/thrift_namespaced_spec_types.rb",
|
32
|
+
"other_namespace/referenced_constants.rb",
|
33
|
+
"other_namespace/referenced_types.rb"
|
34
|
+
].each do |name|
|
35
|
+
File.exist?(File.join(prefix, name)).should_not be_true
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
it "generated the right files" do
|
40
|
+
prefix = File.expand_path("../gen-rb/flat", __FILE__)
|
41
|
+
["namespaced_nonblocking_service.rb",
|
42
|
+
"thrift_namespaced_spec_constants.rb",
|
43
|
+
"thrift_namespaced_spec_types.rb",
|
44
|
+
"referenced_constants.rb",
|
45
|
+
"referenced_types.rb"
|
46
|
+
].each do |name|
|
47
|
+
File.exist?(File.join(prefix, name)).should be_true
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
it "has a service class in the right place" do
|
52
|
+
defined?(NamespacedSpecNamespace::NamespacedNonblockingService).should be_true
|
53
|
+
end
|
54
|
+
|
55
|
+
it "has a struct in the right place" do
|
56
|
+
defined?(NamespacedSpecNamespace::Hello).should be_true
|
57
|
+
end
|
58
|
+
|
59
|
+
it "required an included file" do
|
60
|
+
defined?(OtherNamespace::SomeEnum).should be_true
|
61
|
+
end
|
62
|
+
end
|
data/spec/namespaced_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
data/spec/union_spec.rb
CHANGED
@@ -53,6 +53,11 @@ describe 'Union' do
|
|
53
53
|
union.should_not == nil
|
54
54
|
end
|
55
55
|
|
56
|
+
it "should not be equal with an empty String" do
|
57
|
+
union = SpecNamespace::My_union.new
|
58
|
+
union.should_not == ''
|
59
|
+
end
|
60
|
+
|
56
61
|
it "should not equate two different unions, i32 vs. string" do
|
57
62
|
union = SpecNamespace::My_union.new(:integer32, 25)
|
58
63
|
other_union = SpecNamespace::My_union.new(:some_characters, "blah!")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thrift
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-09-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -138,12 +138,15 @@ extra_rdoc_files:
|
|
138
138
|
- lib/thrift/core_ext/fixnum.rb
|
139
139
|
- lib/thrift/core_ext.rb
|
140
140
|
- lib/thrift/exceptions.rb
|
141
|
+
- lib/thrift/multiplexed_processor.rb
|
141
142
|
- lib/thrift/processor.rb
|
142
143
|
- lib/thrift/protocol/base_protocol.rb
|
143
144
|
- lib/thrift/protocol/binary_protocol.rb
|
144
145
|
- lib/thrift/protocol/binary_protocol_accelerated.rb
|
145
146
|
- lib/thrift/protocol/compact_protocol.rb
|
146
147
|
- lib/thrift/protocol/json_protocol.rb
|
148
|
+
- lib/thrift/protocol/multiplexed_protocol.rb
|
149
|
+
- lib/thrift/protocol/protocol_decorator.rb
|
147
150
|
- lib/thrift/serializer/deserializer.rb
|
148
151
|
- lib/thrift/serializer/serializer.rb
|
149
152
|
- lib/thrift/server/base_server.rb
|
@@ -176,12 +179,15 @@ files:
|
|
176
179
|
- lib/thrift/core_ext/fixnum.rb
|
177
180
|
- lib/thrift/core_ext.rb
|
178
181
|
- lib/thrift/exceptions.rb
|
182
|
+
- lib/thrift/multiplexed_processor.rb
|
179
183
|
- lib/thrift/processor.rb
|
180
184
|
- lib/thrift/protocol/base_protocol.rb
|
181
185
|
- lib/thrift/protocol/binary_protocol.rb
|
182
186
|
- lib/thrift/protocol/binary_protocol_accelerated.rb
|
183
187
|
- lib/thrift/protocol/compact_protocol.rb
|
184
188
|
- lib/thrift/protocol/json_protocol.rb
|
189
|
+
- lib/thrift/protocol/multiplexed_protocol.rb
|
190
|
+
- lib/thrift/protocol/protocol_decorator.rb
|
185
191
|
- lib/thrift/serializer/deserializer.rb
|
186
192
|
- lib/thrift/serializer/serializer.rb
|
187
193
|
- lib/thrift/server/base_server.rb
|
@@ -210,6 +216,7 @@ files:
|
|
210
216
|
- lib/thrift.rb
|
211
217
|
- spec/base_protocol_spec.rb
|
212
218
|
- spec/base_transport_spec.rb
|
219
|
+
- spec/BaseService.thrift
|
213
220
|
- spec/binary_protocol_accelerated_spec.rb
|
214
221
|
- spec/binary_protocol_spec.rb
|
215
222
|
- spec/binary_protocol_spec_shared.rb
|
@@ -217,6 +224,8 @@ files:
|
|
217
224
|
- spec/client_spec.rb
|
218
225
|
- spec/compact_protocol_spec.rb
|
219
226
|
- spec/exception_spec.rb
|
227
|
+
- spec/ExtendedService.thrift
|
228
|
+
- spec/flat_spec.rb
|
220
229
|
- spec/http_client_spec.rb
|
221
230
|
- spec/json_protocol_spec.rb
|
222
231
|
- spec/namespaced_spec.rb
|
@@ -296,6 +305,7 @@ summary: Ruby bindings for Apache Thrift
|
|
296
305
|
test_files:
|
297
306
|
- spec/base_protocol_spec.rb
|
298
307
|
- spec/base_transport_spec.rb
|
308
|
+
- spec/BaseService.thrift
|
299
309
|
- spec/binary_protocol_accelerated_spec.rb
|
300
310
|
- spec/binary_protocol_spec.rb
|
301
311
|
- spec/binary_protocol_spec_shared.rb
|
@@ -303,6 +313,8 @@ test_files:
|
|
303
313
|
- spec/client_spec.rb
|
304
314
|
- spec/compact_protocol_spec.rb
|
305
315
|
- spec/exception_spec.rb
|
316
|
+
- spec/ExtendedService.thrift
|
317
|
+
- spec/flat_spec.rb
|
306
318
|
- spec/http_client_spec.rb
|
307
319
|
- spec/json_protocol_spec.rb
|
308
320
|
- spec/namespaced_spec.rb
|