thrift 0.0.751142 → 0.0.810255.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -1
- data/Manifest +47 -44
- data/README +19 -6
- data/Rakefile +1 -1
- data/benchmark/Benchmark.thrift +19 -0
- data/benchmark/benchmark.rb +20 -3
- data/benchmark/client.rb +20 -2
- data/benchmark/server.rb +22 -4
- data/benchmark/thin_server.rb +22 -4
- data/ext/binary_protocol_accelerated.c +32 -21
- data/ext/binary_protocol_accelerated.h +19 -0
- data/ext/compact_protocol.c +665 -0
- data/ext/compact_protocol.h +20 -0
- data/ext/constants.h +19 -1
- data/ext/extconf.rb +19 -0
- data/ext/macros.h +41 -0
- data/ext/memory_buffer.c +29 -5
- data/ext/memory_buffer.h +19 -0
- data/ext/protocol.c +20 -1
- data/ext/protocol.h +19 -0
- data/ext/struct.c +115 -83
- data/ext/struct.h +19 -0
- data/ext/thrift_native.c +23 -2
- data/lib/thrift/client.rb +19 -1
- data/lib/thrift/core_ext/fixnum.rb +29 -0
- data/lib/thrift/core_ext.rb +23 -0
- data/lib/thrift/exceptions.rb +19 -2
- data/lib/thrift/processor.rb +19 -1
- data/lib/thrift/protocol/base_protocol.rb +290 -0
- data/lib/thrift/protocol/{binaryprotocol.rb → binary_protocol.rb} +27 -15
- data/lib/thrift/protocol/binary_protocol_accelerated.rb +35 -0
- data/lib/thrift/protocol/compact_protocol.rb +422 -0
- data/lib/thrift/serializer/deserializer.rb +33 -0
- data/lib/thrift/serializer/serializer.rb +34 -0
- data/lib/thrift/server/base_server.rb +31 -0
- data/lib/thrift/server/{httpserver.rb → mongrel_http_server.rb} +19 -5
- data/lib/thrift/server/{nonblockingserver.rb → nonblocking_server.rb} +42 -24
- data/lib/thrift/server/simple_server.rb +43 -0
- data/lib/thrift/server/thread_pool_server.rb +75 -0
- data/lib/thrift/server/threaded_server.rb +47 -0
- data/lib/thrift/struct.rb +73 -47
- data/lib/thrift/thrift_native.rb +24 -0
- data/lib/thrift/transport/base_server_transport.rb +37 -0
- data/lib/thrift/transport/base_transport.rb +70 -0
- data/lib/thrift/transport/buffered_transport.rb +77 -0
- data/lib/thrift/transport/framed_transport.rb +90 -0
- data/lib/thrift/transport/http_client_transport.rb +45 -0
- data/lib/thrift/transport/io_stream_transport.rb +39 -0
- data/lib/thrift/transport/memory_buffer_transport.rb +96 -0
- data/lib/thrift/transport/server_socket.rb +63 -0
- data/lib/thrift/transport/socket.rb +22 -53
- data/lib/thrift/transport/unix_server_socket.rb +60 -0
- data/lib/thrift/transport/unix_socket.rb +40 -0
- data/lib/thrift/types.rb +20 -2
- data/lib/thrift.rb +50 -19
- data/script/proto_benchmark.rb +121 -0
- data/script/read_struct.rb +43 -0
- data/script/write_struct.rb +30 -0
- data/spec/ThriftSpec.thrift +40 -2
- data/spec/{protocol_spec.rb → base_protocol_spec.rb} +25 -7
- data/spec/{transport_spec.rb → base_transport_spec.rb} +44 -52
- data/spec/binary_protocol_accelerated_spec.rb +41 -0
- data/spec/{binaryprotocol_spec.rb → binary_protocol_spec.rb} +20 -2
- data/spec/{binaryprotocol_spec_shared.rb → binary_protocol_spec_shared.rb} +117 -16
- data/spec/client_spec.rb +23 -4
- data/spec/compact_protocol_spec.rb +117 -0
- data/spec/exception_spec.rb +19 -0
- data/spec/http_client_spec.rb +49 -0
- data/spec/{httpserver_spec.rb → mongrel_http_server_spec.rb} +26 -7
- data/spec/{nonblockingserver_spec.rb → nonblocking_server_spec.rb} +25 -5
- data/spec/processor_spec.rb +19 -0
- data/spec/serializer_spec.rb +27 -10
- data/spec/server_socket_spec.rb +80 -0
- data/spec/server_spec.rb +35 -16
- data/spec/socket_spec.rb +19 -55
- data/spec/socket_spec_shared.rb +19 -0
- data/spec/spec_helper.rb +34 -9
- data/spec/struct_spec.rb +26 -18
- data/spec/types_spec.rb +19 -1
- data/spec/{unixsocket_spec.rb → unix_socket_spec.rb} +19 -1
- data/thrift.gemspec +6 -6
- data.tar.gz.sig +0 -0
- metadata +80 -70
- metadata.gz.sig +0 -0
- data/COPYING +0 -14
- data/LICENSE +0 -14
- data/Makefile.am +0 -15
- data/benchmark/gen-rb/BenchmarkService.rb +0 -81
- data/benchmark/gen-rb/Benchmark_constants.rb +0 -11
- data/benchmark/gen-rb/Benchmark_types.rb +0 -10
- data/lib/thrift/deprecation.rb +0 -155
- data/lib/thrift/protocol/binaryprotocolaccelerated.rb +0 -19
- data/lib/thrift/protocol/tbinaryprotocol.rb +0 -2
- data/lib/thrift/protocol/tprotocol.rb +0 -2
- data/lib/thrift/protocol.rb +0 -270
- data/lib/thrift/serializer.rb +0 -27
- data/lib/thrift/server/thttpserver.rb +0 -2
- data/lib/thrift/server/tserver.rb +0 -2
- data/lib/thrift/server.rb +0 -135
- data/lib/thrift/thrift.rb +0 -14
- data/lib/thrift/transport/httpclient.rb +0 -29
- data/lib/thrift/transport/thttpclient.rb +0 -2
- data/lib/thrift/transport/tsocket.rb +0 -2
- data/lib/thrift/transport/ttransport.rb +0 -2
- data/lib/thrift/transport/unixsocket.rb +0 -58
- data/lib/thrift/transport.rb +0 -319
- data/spec/backwards_compatibility_spec.rb +0 -136
- data/spec/binaryprotocolaccelerated_spec.rb +0 -101
- data/spec/deprecation_spec.rb +0 -443
- data/spec/gen-rb/NonblockingService.rb +0 -268
- data/spec/gen-rb/ThriftSpec_constants.rb +0 -11
- data/spec/gen-rb/ThriftSpec_types.rb +0 -134
- data/spec/httpclient_spec.rb +0 -31
data/spec/deprecation_spec.rb
DELETED
@@ -1,443 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/spec_helper'
|
2
|
-
|
3
|
-
shared_examples_for "deprecation" do
|
4
|
-
before(:all) do
|
5
|
-
# ensure deprecation is turned on
|
6
|
-
Thrift.send :remove_const, :DEPRECATION
|
7
|
-
Thrift.const_set :DEPRECATION, true
|
8
|
-
end
|
9
|
-
|
10
|
-
after(:all) do
|
11
|
-
# now turn it off again
|
12
|
-
# no other specs should want it
|
13
|
-
Thrift.send :remove_const, :DEPRECATION
|
14
|
-
Thrift.const_set :DEPRECATION, false
|
15
|
-
end
|
16
|
-
|
17
|
-
before(:each) do
|
18
|
-
Thrift::DeprecationProxy.reset_deprecation_warnings
|
19
|
-
end
|
20
|
-
|
21
|
-
def ensure_const_removed(name, &block)
|
22
|
-
begin
|
23
|
-
block.call
|
24
|
-
ensure
|
25
|
-
Object.send :remove_const, name if Object.const_defined? name
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe 'deprecate!' do
|
31
|
-
it_should_behave_like "deprecation"
|
32
|
-
|
33
|
-
def stub_stderr(callstr, offset=1)
|
34
|
-
STDERR.should_receive(:puts).with("Warning: calling deprecated method #{callstr}")
|
35
|
-
line = caller.first[/\d+$/].to_i + offset
|
36
|
-
STDERR.should_receive(:puts).with(" from #{__FILE__}:#{line}")
|
37
|
-
end
|
38
|
-
|
39
|
-
it "should work for Module methods" do
|
40
|
-
mod = Module.new do
|
41
|
-
class << self
|
42
|
-
def new
|
43
|
-
"new"
|
44
|
-
end
|
45
|
-
deprecate! :old => :new
|
46
|
-
end
|
47
|
-
end
|
48
|
-
stub_stderr "#{mod.inspect}.old"
|
49
|
-
mod.old.should == "new"
|
50
|
-
end
|
51
|
-
|
52
|
-
it "should work with Modules that extend themselves" do
|
53
|
-
mod = Module.new do
|
54
|
-
extend self
|
55
|
-
def new
|
56
|
-
"new"
|
57
|
-
end
|
58
|
-
deprecate! :old => :new
|
59
|
-
end
|
60
|
-
stub_stderr "#{mod.inspect}.old"
|
61
|
-
mod.old.should == "new"
|
62
|
-
end
|
63
|
-
|
64
|
-
it "should work wtih Class methods" do
|
65
|
-
klass = Class.new do
|
66
|
-
class << self
|
67
|
-
def new
|
68
|
-
"new"
|
69
|
-
end
|
70
|
-
deprecate! :old => :new
|
71
|
-
end
|
72
|
-
end
|
73
|
-
stub_stderr "#{klass.inspect}.old"
|
74
|
-
klass.old.should == "new"
|
75
|
-
end
|
76
|
-
|
77
|
-
it "should work with Classes that include Modules" do
|
78
|
-
mod = Module.new do
|
79
|
-
def new
|
80
|
-
"new"
|
81
|
-
end
|
82
|
-
deprecate! :old => :new
|
83
|
-
end
|
84
|
-
klass = Class.new do
|
85
|
-
include mod
|
86
|
-
end
|
87
|
-
stub_stderr "#{klass.inspect}#old"
|
88
|
-
klass.new.old.should == "new"
|
89
|
-
end
|
90
|
-
|
91
|
-
it "should work with instance methods" do
|
92
|
-
klass = Class.new do
|
93
|
-
def new
|
94
|
-
"new"
|
95
|
-
end
|
96
|
-
deprecate! :old => :new
|
97
|
-
end
|
98
|
-
stub_stderr "#{klass.inspect}#old"
|
99
|
-
klass.new.old.should == "new"
|
100
|
-
end
|
101
|
-
|
102
|
-
it "should work with multiple method names" do
|
103
|
-
klass = Class.new do
|
104
|
-
def new1
|
105
|
-
"new 1"
|
106
|
-
end
|
107
|
-
def new2
|
108
|
-
"new 2"
|
109
|
-
end
|
110
|
-
deprecate! :old1 => :new1, :old2 => :new2
|
111
|
-
end
|
112
|
-
stub_stderr("#{klass.inspect}#old1", 3).ordered
|
113
|
-
stub_stderr("#{klass.inspect}#old2", 3).ordered
|
114
|
-
inst = klass.new
|
115
|
-
inst.old1.should == "new 1"
|
116
|
-
inst.old2.should == "new 2"
|
117
|
-
end
|
118
|
-
|
119
|
-
it "should only log a message once, even across multiple instances" do
|
120
|
-
klass = Class.new do
|
121
|
-
def new
|
122
|
-
"new"
|
123
|
-
end
|
124
|
-
deprecate! :old => :new
|
125
|
-
end
|
126
|
-
stub_stderr("#{klass.inspect}#old").once
|
127
|
-
klass.new.old.should == "new"
|
128
|
-
klass.new.old.should == "new"
|
129
|
-
end
|
130
|
-
|
131
|
-
it "should pass arguments" do
|
132
|
-
klass = Class.new do
|
133
|
-
def new(a, b)
|
134
|
-
"new: #{a + b}"
|
135
|
-
end
|
136
|
-
deprecate! :old => :new
|
137
|
-
end
|
138
|
-
stub_stderr("#{klass.inspect}#old")
|
139
|
-
klass.new.old(3, 5).should == "new: 8"
|
140
|
-
end
|
141
|
-
|
142
|
-
it "should pass blocks" do
|
143
|
-
klass = Class.new do
|
144
|
-
def new
|
145
|
-
"new #{yield}"
|
146
|
-
end
|
147
|
-
deprecate! :old => :new
|
148
|
-
end
|
149
|
-
stub_stderr("#{klass.inspect}#old")
|
150
|
-
klass.new.old { "block" }.should == "new block"
|
151
|
-
end
|
152
|
-
|
153
|
-
it "should not freeze the definition of the new method" do
|
154
|
-
klass = Class.new do
|
155
|
-
def new
|
156
|
-
"new"
|
157
|
-
end
|
158
|
-
deprecate! :old => :new
|
159
|
-
end
|
160
|
-
klass.send :define_method, :new do
|
161
|
-
"new 2"
|
162
|
-
end
|
163
|
-
stub_stderr("#{klass.inspect}#old")
|
164
|
-
klass.new.old.should == "new 2"
|
165
|
-
end
|
166
|
-
|
167
|
-
it "should call the forwarded method in the same context as the original" do
|
168
|
-
klass = Class.new do
|
169
|
-
def myself
|
170
|
-
self
|
171
|
-
end
|
172
|
-
deprecate! :me => :myself
|
173
|
-
end
|
174
|
-
inst = klass.new
|
175
|
-
stub_stderr("#{klass.inspect}#me")
|
176
|
-
inst.me.should eql(inst.myself)
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
describe "deprecate_class!" do
|
181
|
-
it_should_behave_like "deprecation"
|
182
|
-
|
183
|
-
def stub_stderr_jruby(klass)
|
184
|
-
return unless defined? JRUBY_VERSION
|
185
|
-
stub_stderr(klass, nil, caller.first)
|
186
|
-
end
|
187
|
-
|
188
|
-
def stub_stderr_mri(klass, offset=1)
|
189
|
-
return if defined? JRUBY_VERSION
|
190
|
-
stub_stderr(klass, offset, caller.first)
|
191
|
-
end
|
192
|
-
|
193
|
-
def stub_stderr(klass, offset=1, called=nil)
|
194
|
-
STDERR.should_receive(:puts).with("Warning: class #{klass} is deprecated")
|
195
|
-
if offset
|
196
|
-
line = (called || caller.first)[/\d+$/].to_i + offset
|
197
|
-
STDERR.should_receive(:puts).with(" from #{__FILE__}:#{line}")
|
198
|
-
else
|
199
|
-
STDERR.should_receive(:puts).with(/^ from #{Regexp.escape(__FILE__)}:/)
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
203
|
-
it "should create a new global constant that points to the old one" do
|
204
|
-
ensure_const_removed :DeprecationSpecOldClass do
|
205
|
-
klass = Class.new do
|
206
|
-
def foo
|
207
|
-
"foo"
|
208
|
-
end
|
209
|
-
end
|
210
|
-
deprecate_class! :DeprecationSpecOldClass => klass
|
211
|
-
stub_stderr(:DeprecationSpecOldClass)
|
212
|
-
::DeprecationSpecOldClass.should eql(klass)
|
213
|
-
::DeprecationSpecOldClass.new.foo.should == "foo"
|
214
|
-
end
|
215
|
-
end
|
216
|
-
|
217
|
-
it "should create a global constant even from inside a module" do
|
218
|
-
ensure_const_removed :DeprecationSpecOldClass do
|
219
|
-
klass = nil #define scoping
|
220
|
-
Module.new do
|
221
|
-
klass = Class.new do
|
222
|
-
def foo
|
223
|
-
"foo"
|
224
|
-
end
|
225
|
-
end
|
226
|
-
deprecate_class! :DeprecationSpecOldClass => klass
|
227
|
-
end
|
228
|
-
stub_stderr(:DeprecationSpecOldClass)
|
229
|
-
::DeprecationSpecOldClass.should eql(klass)
|
230
|
-
::DeprecationSpecOldClass.new.foo.should == "foo"
|
231
|
-
end
|
232
|
-
end
|
233
|
-
|
234
|
-
it "should not prevent the deprecated class from being a superclass" do
|
235
|
-
ensure_const_removed :DeprecationSpecOldClass do
|
236
|
-
klass = Class.new do
|
237
|
-
def foo
|
238
|
-
"foo"
|
239
|
-
end
|
240
|
-
end
|
241
|
-
deprecate_class! :DeprecationSpecOldClass => klass
|
242
|
-
stub_stderr_jruby(:DeprecationSpecOldClass)
|
243
|
-
subklass = Class.new(::DeprecationSpecOldClass) do
|
244
|
-
def foo
|
245
|
-
"subclass #{super}"
|
246
|
-
end
|
247
|
-
end
|
248
|
-
stub_stderr_mri(:DeprecationSpecOldClass)
|
249
|
-
subklass.superclass.should eql(klass)
|
250
|
-
subklass.new.foo.should == "subclass foo"
|
251
|
-
end
|
252
|
-
end
|
253
|
-
|
254
|
-
it "should not bleed info between deprecations" do
|
255
|
-
ensure_const_removed :DeprecationSpecOldClass do
|
256
|
-
ensure_const_removed :DeprecationSpecOldClass2 do
|
257
|
-
klass = Class.new do
|
258
|
-
def foo
|
259
|
-
"foo"
|
260
|
-
end
|
261
|
-
end
|
262
|
-
deprecate_class! :DeprecationSpecOldClass => klass
|
263
|
-
klass2 = Class.new do
|
264
|
-
def bar
|
265
|
-
"bar"
|
266
|
-
end
|
267
|
-
end
|
268
|
-
deprecate_class! :DeprecationSpecOldClass2 => klass2
|
269
|
-
stub_stderr(:DeprecationSpecOldClass)
|
270
|
-
::DeprecationSpecOldClass.new.foo.should == "foo"
|
271
|
-
stub_stderr(:DeprecationSpecOldClass2)
|
272
|
-
::DeprecationSpecOldClass2.new.bar.should == "bar"
|
273
|
-
end
|
274
|
-
end
|
275
|
-
end
|
276
|
-
|
277
|
-
it "should work when Object.inherited calls a method on self" do
|
278
|
-
ensure_const_removed :DeprecationSpecOldClass do
|
279
|
-
old_inherited = Object.method(:inherited)
|
280
|
-
begin
|
281
|
-
(class << Object;self;end).class_eval do
|
282
|
-
define_method :inherited do |cls|
|
283
|
-
cls.inspect
|
284
|
-
old_inherited.call(cls)
|
285
|
-
end
|
286
|
-
end
|
287
|
-
klass = Class.new do
|
288
|
-
def foo
|
289
|
-
"foo"
|
290
|
-
end
|
291
|
-
end
|
292
|
-
STDERR.should_receive(:puts).exactly(0).times
|
293
|
-
lambda { deprecate_class! :DeprecationSpecOldClass => klass }.should_not raise_error
|
294
|
-
ensure
|
295
|
-
(class << Object;self;end).class_eval do
|
296
|
-
define_method :inherited, old_inherited
|
297
|
-
end
|
298
|
-
end
|
299
|
-
end
|
300
|
-
end
|
301
|
-
end
|
302
|
-
|
303
|
-
describe "deprecate_module!" do
|
304
|
-
it_should_behave_like "deprecation"
|
305
|
-
|
306
|
-
def stub_stderr_jruby(mod)
|
307
|
-
return unless defined? JRUBY_VERSION
|
308
|
-
stub_stderr(mod, nil, caller.first)
|
309
|
-
end
|
310
|
-
|
311
|
-
def stub_stderr_mri(mod, offset=1)
|
312
|
-
return if defined? JRUBY_VERSION
|
313
|
-
stub_stderr(mod, offset, caller.first)
|
314
|
-
end
|
315
|
-
|
316
|
-
def stub_stderr(mod, offset=1, called=nil)
|
317
|
-
STDERR.should_receive(:puts).with("Warning: module #{mod} is deprecated")
|
318
|
-
source = Regexp.escape(__FILE__) + ":"
|
319
|
-
if offset
|
320
|
-
line = (called || caller.first)[/\d+$/].to_i + offset
|
321
|
-
source += Regexp.escape(line.to_s)
|
322
|
-
else
|
323
|
-
source += "\d+"
|
324
|
-
end
|
325
|
-
STDERR.should_receive(:puts).with(/^ from #{source}(?::in `[^']+')?$/)
|
326
|
-
end
|
327
|
-
|
328
|
-
it "should create a new global constant that points to the old one" do
|
329
|
-
ensure_const_removed :DeprecationSpecOldModule do
|
330
|
-
mod = Module.new do
|
331
|
-
def self.foo
|
332
|
-
"foo"
|
333
|
-
end
|
334
|
-
end
|
335
|
-
deprecate_module! :DeprecationSpecOldModule => mod
|
336
|
-
stub_stderr(:DeprecationSpecOldModule)
|
337
|
-
::DeprecationSpecOldModule.should eql(mod)
|
338
|
-
::DeprecationSpecOldModule.foo.should == "foo"
|
339
|
-
end
|
340
|
-
end
|
341
|
-
|
342
|
-
it "should create a global constant even from inside a module" do
|
343
|
-
ensure_const_removed :DeprecationSpecOldModule do
|
344
|
-
mod = nil # scoping
|
345
|
-
Module.new do
|
346
|
-
mod = Module.new do
|
347
|
-
def self.foo
|
348
|
-
"foo"
|
349
|
-
end
|
350
|
-
end
|
351
|
-
deprecate_module! :DeprecationSpecOldModule => mod
|
352
|
-
end
|
353
|
-
stub_stderr(:DeprecationSpecOldModule)
|
354
|
-
::DeprecationSpecOldModule.should eql(mod)
|
355
|
-
::DeprecationSpecOldModule.foo.should == "foo"
|
356
|
-
end
|
357
|
-
end
|
358
|
-
|
359
|
-
it "should work for modules that extend themselves" do
|
360
|
-
ensure_const_removed :DeprecationSpecOldModule do
|
361
|
-
mod = Module.new do
|
362
|
-
extend self
|
363
|
-
def foo
|
364
|
-
"foo"
|
365
|
-
end
|
366
|
-
end
|
367
|
-
deprecate_module! :DeprecationSpecOldModule => mod
|
368
|
-
stub_stderr(:DeprecationSpecOldModule)
|
369
|
-
::DeprecationSpecOldModule.should eql(mod)
|
370
|
-
::DeprecationSpecOldModule.foo.should == "foo"
|
371
|
-
end
|
372
|
-
end
|
373
|
-
|
374
|
-
it "should work for modules included in other modules" do
|
375
|
-
ensure_const_removed :DeprecationSpecOldModule do
|
376
|
-
mod = Module.new do
|
377
|
-
def foo
|
378
|
-
"foo"
|
379
|
-
end
|
380
|
-
end
|
381
|
-
deprecate_module! :DeprecationSpecOldModule => mod
|
382
|
-
stub_stderr_jruby(:DeprecationSpecOldModule)
|
383
|
-
mod2 = Module.new do
|
384
|
-
class << self
|
385
|
-
include ::DeprecationSpecOldModule
|
386
|
-
end
|
387
|
-
end
|
388
|
-
stub_stderr_mri(:DeprecationSpecOldModule)
|
389
|
-
mod2.foo.should == "foo"
|
390
|
-
end
|
391
|
-
end
|
392
|
-
|
393
|
-
it "should work for modules included in classes" do
|
394
|
-
ensure_const_removed :DeprecationSpecOldModule do
|
395
|
-
mod = Module.new do
|
396
|
-
def foo
|
397
|
-
"foo"
|
398
|
-
end
|
399
|
-
end
|
400
|
-
deprecate_module! :DeprecationSpecOldModule => mod
|
401
|
-
stub_stderr_jruby(:DeprecationSpecOldModule)
|
402
|
-
klass = Class.new do
|
403
|
-
include ::DeprecationSpecOldModule
|
404
|
-
end
|
405
|
-
stub_stderr_mri(:DeprecationSpecOldModule)
|
406
|
-
klass.new.foo.should == "foo"
|
407
|
-
end
|
408
|
-
end
|
409
|
-
|
410
|
-
it "should not bleed info between deprecations" do
|
411
|
-
ensure_const_removed :DeprecationSpecOldModule do
|
412
|
-
ensure_const_removed :DeprecationSpecOldModule2 do
|
413
|
-
mod = Module.new do
|
414
|
-
def self.foo
|
415
|
-
"foo"
|
416
|
-
end
|
417
|
-
end
|
418
|
-
deprecate_module! :DeprecationSpecOldModule => mod
|
419
|
-
mod2 = Module.new do
|
420
|
-
def self.bar
|
421
|
-
"bar"
|
422
|
-
end
|
423
|
-
end
|
424
|
-
deprecate_module! :DeprecationSpecOldModule2 => mod2
|
425
|
-
stub_stderr(:DeprecationSpecOldModule)
|
426
|
-
::DeprecationSpecOldModule.foo.should == "foo"
|
427
|
-
stub_stderr(:DeprecationSpecOldModule2)
|
428
|
-
::DeprecationSpecOldModule2.bar.should == "bar"
|
429
|
-
end
|
430
|
-
end
|
431
|
-
end
|
432
|
-
|
433
|
-
it "should skip thrift library code when printing caller" do
|
434
|
-
klass = Class.new do
|
435
|
-
include ThriftStruct
|
436
|
-
FIELDS = {
|
437
|
-
1 => {:name => "foo", :type => Thrift::Types::STRING}
|
438
|
-
}
|
439
|
-
end
|
440
|
-
stub_stderr('ThriftStruct')
|
441
|
-
klass.new(:foo => "foo")
|
442
|
-
end
|
443
|
-
end
|
@@ -1,268 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Autogenerated by Thrift
|
3
|
-
#
|
4
|
-
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
-
#
|
6
|
-
|
7
|
-
require 'thrift'
|
8
|
-
require 'thrift/protocol'
|
9
|
-
require File.dirname(__FILE__) + '/ThriftSpec_types'
|
10
|
-
|
11
|
-
module SpecNamespace
|
12
|
-
module NonblockingService
|
13
|
-
class Client
|
14
|
-
include ::Thrift::Client
|
15
|
-
|
16
|
-
def greeting(english)
|
17
|
-
send_greeting(english)
|
18
|
-
return recv_greeting()
|
19
|
-
end
|
20
|
-
|
21
|
-
def send_greeting(english)
|
22
|
-
send_message('greeting', Greeting_args, :english => english)
|
23
|
-
end
|
24
|
-
|
25
|
-
def recv_greeting()
|
26
|
-
result = receive_message(Greeting_result)
|
27
|
-
return result.success unless result.success.nil?
|
28
|
-
raise Thrift::ApplicationException.new(Thrift::ApplicationException::MISSING_RESULT, 'greeting failed: unknown result')
|
29
|
-
end
|
30
|
-
|
31
|
-
def block()
|
32
|
-
send_block()
|
33
|
-
return recv_block()
|
34
|
-
end
|
35
|
-
|
36
|
-
def send_block()
|
37
|
-
send_message('block', Block_args)
|
38
|
-
end
|
39
|
-
|
40
|
-
def recv_block()
|
41
|
-
result = receive_message(Block_result)
|
42
|
-
return result.success unless result.success.nil?
|
43
|
-
raise Thrift::ApplicationException.new(Thrift::ApplicationException::MISSING_RESULT, 'block failed: unknown result')
|
44
|
-
end
|
45
|
-
|
46
|
-
def unblock(n)
|
47
|
-
send_unblock(n)
|
48
|
-
end
|
49
|
-
|
50
|
-
def send_unblock(n)
|
51
|
-
send_message('unblock', Unblock_args, :n => n)
|
52
|
-
end
|
53
|
-
def shutdown()
|
54
|
-
send_shutdown()
|
55
|
-
end
|
56
|
-
|
57
|
-
def send_shutdown()
|
58
|
-
send_message('shutdown', Shutdown_args)
|
59
|
-
end
|
60
|
-
def sleep(seconds)
|
61
|
-
send_sleep(seconds)
|
62
|
-
recv_sleep()
|
63
|
-
end
|
64
|
-
|
65
|
-
def send_sleep(seconds)
|
66
|
-
send_message('sleep', Sleep_args, :seconds => seconds)
|
67
|
-
end
|
68
|
-
|
69
|
-
def recv_sleep()
|
70
|
-
result = receive_message(Sleep_result)
|
71
|
-
return
|
72
|
-
end
|
73
|
-
|
74
|
-
end
|
75
|
-
|
76
|
-
class Processor
|
77
|
-
include ::Thrift::Processor
|
78
|
-
|
79
|
-
def process_greeting(seqid, iprot, oprot)
|
80
|
-
args = read_args(iprot, Greeting_args)
|
81
|
-
result = Greeting_result.new()
|
82
|
-
result.success = @handler.greeting(args.english)
|
83
|
-
write_result(result, oprot, 'greeting', seqid)
|
84
|
-
end
|
85
|
-
|
86
|
-
def process_block(seqid, iprot, oprot)
|
87
|
-
args = read_args(iprot, Block_args)
|
88
|
-
result = Block_result.new()
|
89
|
-
result.success = @handler.block()
|
90
|
-
write_result(result, oprot, 'block', seqid)
|
91
|
-
end
|
92
|
-
|
93
|
-
def process_unblock(seqid, iprot, oprot)
|
94
|
-
args = read_args(iprot, Unblock_args)
|
95
|
-
@handler.unblock(args.n)
|
96
|
-
return
|
97
|
-
end
|
98
|
-
|
99
|
-
def process_shutdown(seqid, iprot, oprot)
|
100
|
-
args = read_args(iprot, Shutdown_args)
|
101
|
-
@handler.shutdown()
|
102
|
-
return
|
103
|
-
end
|
104
|
-
|
105
|
-
def process_sleep(seqid, iprot, oprot)
|
106
|
-
args = read_args(iprot, Sleep_args)
|
107
|
-
result = Sleep_result.new()
|
108
|
-
@handler.sleep(args.seconds)
|
109
|
-
write_result(result, oprot, 'sleep', seqid)
|
110
|
-
end
|
111
|
-
|
112
|
-
end
|
113
|
-
|
114
|
-
# HELPER FUNCTIONS AND STRUCTURES
|
115
|
-
|
116
|
-
class Greeting_args
|
117
|
-
include ::Thrift::Struct
|
118
|
-
ENGLISH = 1
|
119
|
-
|
120
|
-
Thrift::Struct.field_accessor self, :english
|
121
|
-
FIELDS = {
|
122
|
-
ENGLISH => {:type => Thrift::Types::BOOL, :name => 'english'}
|
123
|
-
}
|
124
|
-
|
125
|
-
def struct_fields; FIELDS; end
|
126
|
-
|
127
|
-
def validate
|
128
|
-
end
|
129
|
-
|
130
|
-
end
|
131
|
-
|
132
|
-
class Greeting_result
|
133
|
-
include ::Thrift::Struct
|
134
|
-
SUCCESS = 0
|
135
|
-
|
136
|
-
Thrift::Struct.field_accessor self, :success
|
137
|
-
FIELDS = {
|
138
|
-
SUCCESS => {:type => Thrift::Types::STRUCT, :name => 'success', :class => SpecNamespace::Hello}
|
139
|
-
}
|
140
|
-
|
141
|
-
def struct_fields; FIELDS; end
|
142
|
-
|
143
|
-
def validate
|
144
|
-
end
|
145
|
-
|
146
|
-
end
|
147
|
-
|
148
|
-
class Block_args
|
149
|
-
include ::Thrift::Struct
|
150
|
-
|
151
|
-
FIELDS = {
|
152
|
-
|
153
|
-
}
|
154
|
-
|
155
|
-
def struct_fields; FIELDS; end
|
156
|
-
|
157
|
-
def validate
|
158
|
-
end
|
159
|
-
|
160
|
-
end
|
161
|
-
|
162
|
-
class Block_result
|
163
|
-
include ::Thrift::Struct
|
164
|
-
SUCCESS = 0
|
165
|
-
|
166
|
-
Thrift::Struct.field_accessor self, :success
|
167
|
-
FIELDS = {
|
168
|
-
SUCCESS => {:type => Thrift::Types::BOOL, :name => 'success'}
|
169
|
-
}
|
170
|
-
|
171
|
-
def struct_fields; FIELDS; end
|
172
|
-
|
173
|
-
def validate
|
174
|
-
end
|
175
|
-
|
176
|
-
end
|
177
|
-
|
178
|
-
class Unblock_args
|
179
|
-
include ::Thrift::Struct
|
180
|
-
N = 1
|
181
|
-
|
182
|
-
Thrift::Struct.field_accessor self, :n
|
183
|
-
FIELDS = {
|
184
|
-
N => {:type => Thrift::Types::I32, :name => 'n'}
|
185
|
-
}
|
186
|
-
|
187
|
-
def struct_fields; FIELDS; end
|
188
|
-
|
189
|
-
def validate
|
190
|
-
end
|
191
|
-
|
192
|
-
end
|
193
|
-
|
194
|
-
class Unblock_result
|
195
|
-
include ::Thrift::Struct
|
196
|
-
|
197
|
-
FIELDS = {
|
198
|
-
|
199
|
-
}
|
200
|
-
|
201
|
-
def struct_fields; FIELDS; end
|
202
|
-
|
203
|
-
def validate
|
204
|
-
end
|
205
|
-
|
206
|
-
end
|
207
|
-
|
208
|
-
class Shutdown_args
|
209
|
-
include ::Thrift::Struct
|
210
|
-
|
211
|
-
FIELDS = {
|
212
|
-
|
213
|
-
}
|
214
|
-
|
215
|
-
def struct_fields; FIELDS; end
|
216
|
-
|
217
|
-
def validate
|
218
|
-
end
|
219
|
-
|
220
|
-
end
|
221
|
-
|
222
|
-
class Shutdown_result
|
223
|
-
include ::Thrift::Struct
|
224
|
-
|
225
|
-
FIELDS = {
|
226
|
-
|
227
|
-
}
|
228
|
-
|
229
|
-
def struct_fields; FIELDS; end
|
230
|
-
|
231
|
-
def validate
|
232
|
-
end
|
233
|
-
|
234
|
-
end
|
235
|
-
|
236
|
-
class Sleep_args
|
237
|
-
include ::Thrift::Struct
|
238
|
-
SECONDS = 1
|
239
|
-
|
240
|
-
Thrift::Struct.field_accessor self, :seconds
|
241
|
-
FIELDS = {
|
242
|
-
SECONDS => {:type => Thrift::Types::DOUBLE, :name => 'seconds'}
|
243
|
-
}
|
244
|
-
|
245
|
-
def struct_fields; FIELDS; end
|
246
|
-
|
247
|
-
def validate
|
248
|
-
end
|
249
|
-
|
250
|
-
end
|
251
|
-
|
252
|
-
class Sleep_result
|
253
|
-
include ::Thrift::Struct
|
254
|
-
|
255
|
-
FIELDS = {
|
256
|
-
|
257
|
-
}
|
258
|
-
|
259
|
-
def struct_fields; FIELDS; end
|
260
|
-
|
261
|
-
def validate
|
262
|
-
end
|
263
|
-
|
264
|
-
end
|
265
|
-
|
266
|
-
end
|
267
|
-
|
268
|
-
end
|