thrift 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/ext/binary_protocol_accelerated.c +19 -3
- data/ext/compact_protocol.c +21 -7
- data/ext/constants.h +1 -5
- data/ext/extconf.rb +1 -1
- data/ext/protocol.c +0 -185
- data/ext/protocol.h +0 -20
- data/ext/struct.c +0 -3
- data/ext/thrift_native.c +1 -11
- data/lib/thrift.rb +1 -0
- data/lib/thrift/exceptions.rb +3 -0
- data/lib/thrift/protocol/base_protocol.rb +87 -10
- data/lib/thrift/protocol/binary_protocol.rb +13 -5
- data/lib/thrift/protocol/compact_protocol.rb +14 -7
- data/lib/thrift/protocol/json_protocol.rb +19 -15
- data/lib/thrift/server/mongrel_http_server.rb +2 -0
- data/lib/thrift/server/thin_http_server.rb +91 -0
- data/lib/thrift/struct.rb +1 -1
- data/lib/thrift/struct_union.rb +2 -2
- data/lib/thrift/transport/http_client_transport.rb +4 -1
- data/spec/base_protocol_spec.rb +65 -7
- data/spec/binary_protocol_spec_shared.rb +30 -0
- data/spec/compact_protocol_spec.rb +1 -3
- data/spec/http_client_spec.rb +49 -0
- data/spec/json_protocol_spec.rb +2 -2
- data/spec/thin_http_server_spec.rb +140 -0
- data/spec/union_spec.rb +13 -1
- metadata +113 -93
- data/benchmark/gen-rb/benchmark_constants.rb +0 -11
- data/benchmark/gen-rb/benchmark_service.rb +0 -80
- data/benchmark/gen-rb/benchmark_types.rb +0 -10
- data/spec/gen-rb/nonblocking_service.rb +0 -272
- data/spec/gen-rb/thrift_spec_constants.rb +0 -11
- data/spec/gen-rb/thrift_spec_types.rb +0 -538
- data/spec/mongrel_http_server_spec.rb +0 -114
- data/test/debug_proto/gen-rb/debug_proto_test_constants.rb +0 -274
- data/test/debug_proto/gen-rb/debug_proto_test_types.rb +0 -761
- data/test/debug_proto/gen-rb/empty_service.rb +0 -24
- data/test/debug_proto/gen-rb/inherited.rb +0 -79
- data/test/debug_proto/gen-rb/reverse_order_service.rb +0 -82
- data/test/debug_proto/gen-rb/service_for_exception_with_a_map.rb +0 -81
- data/test/debug_proto/gen-rb/srv.rb +0 -330
data/spec/base_protocol_spec.rb
CHANGED
@@ -33,14 +33,21 @@ describe 'BaseProtocol' do
|
|
33
33
|
@prot.trans.should eql(@trans)
|
34
34
|
end
|
35
35
|
|
36
|
-
it
|
36
|
+
it 'should write out a field nicely (deprecated write_field signature)' do
|
37
37
|
@prot.should_receive(:write_field_begin).with('field', 'type', 'fid').ordered
|
38
|
-
@prot.should_receive(:write_type).with('type', 'value').ordered
|
38
|
+
@prot.should_receive(:write_type).with({:name => 'field', :type => 'type'}, 'value').ordered
|
39
39
|
@prot.should_receive(:write_field_end).ordered
|
40
40
|
@prot.write_field('field', 'type', 'fid', 'value')
|
41
41
|
end
|
42
42
|
|
43
|
-
it
|
43
|
+
it 'should write out a field nicely' do
|
44
|
+
@prot.should_receive(:write_field_begin).with('field', 'type', 'fid').ordered
|
45
|
+
@prot.should_receive(:write_type).with({:name => 'field', :type => 'type', :binary => false}, 'value').ordered
|
46
|
+
@prot.should_receive(:write_field_end).ordered
|
47
|
+
@prot.write_field({:name => 'field', :type => 'type', :binary => false}, 'fid', 'value')
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'should write out the different types (deprecated write_type signature)' do
|
44
51
|
@prot.should_receive(:write_bool).with('bool').ordered
|
45
52
|
@prot.should_receive(:write_byte).with('byte').ordered
|
46
53
|
@prot.should_receive(:write_double).with('double').ordered
|
@@ -60,11 +67,37 @@ describe 'BaseProtocol' do
|
|
60
67
|
@prot.write_type(Thrift::Types::STRUCT, struct)
|
61
68
|
# all other types are not implemented
|
62
69
|
[Thrift::Types::STOP, Thrift::Types::VOID, Thrift::Types::MAP, Thrift::Types::SET, Thrift::Types::LIST].each do |type|
|
63
|
-
|
70
|
+
expect { @prot.write_type(type, type.to_s) }.to raise_error(NotImplementedError)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
it 'should write out the different types' do
|
75
|
+
@prot.should_receive(:write_bool).with('bool').ordered
|
76
|
+
@prot.should_receive(:write_byte).with('byte').ordered
|
77
|
+
@prot.should_receive(:write_double).with('double').ordered
|
78
|
+
@prot.should_receive(:write_i16).with('i16').ordered
|
79
|
+
@prot.should_receive(:write_i32).with('i32').ordered
|
80
|
+
@prot.should_receive(:write_i64).with('i64').ordered
|
81
|
+
@prot.should_receive(:write_string).with('string').ordered
|
82
|
+
@prot.should_receive(:write_binary).with('binary').ordered
|
83
|
+
struct = mock('Struct')
|
84
|
+
struct.should_receive(:write).with(@prot).ordered
|
85
|
+
@prot.write_type({:type => Thrift::Types::BOOL}, 'bool')
|
86
|
+
@prot.write_type({:type => Thrift::Types::BYTE}, 'byte')
|
87
|
+
@prot.write_type({:type => Thrift::Types::DOUBLE}, 'double')
|
88
|
+
@prot.write_type({:type => Thrift::Types::I16}, 'i16')
|
89
|
+
@prot.write_type({:type => Thrift::Types::I32}, 'i32')
|
90
|
+
@prot.write_type({:type => Thrift::Types::I64}, 'i64')
|
91
|
+
@prot.write_type({:type => Thrift::Types::STRING}, 'string')
|
92
|
+
@prot.write_type({:type => Thrift::Types::STRING, :binary => true}, 'binary')
|
93
|
+
@prot.write_type({:type => Thrift::Types::STRUCT}, struct)
|
94
|
+
# all other types are not implemented
|
95
|
+
[Thrift::Types::STOP, Thrift::Types::VOID, Thrift::Types::MAP, Thrift::Types::SET, Thrift::Types::LIST].each do |type|
|
96
|
+
expect { @prot.write_type({:type => type}, type.to_s) }.to raise_error(NotImplementedError)
|
64
97
|
end
|
65
98
|
end
|
66
99
|
|
67
|
-
it
|
100
|
+
it 'should read the different types (deprecated read_type signature)' do
|
68
101
|
@prot.should_receive(:read_bool).ordered
|
69
102
|
@prot.should_receive(:read_byte).ordered
|
70
103
|
@prot.should_receive(:read_i16).ordered
|
@@ -80,8 +113,33 @@ describe 'BaseProtocol' do
|
|
80
113
|
@prot.read_type(Thrift::Types::DOUBLE)
|
81
114
|
@prot.read_type(Thrift::Types::STRING)
|
82
115
|
# all other types are not implemented
|
83
|
-
[Thrift::Types::STOP, Thrift::Types::VOID, Thrift::Types::MAP,
|
84
|
-
|
116
|
+
[Thrift::Types::STOP, Thrift::Types::VOID, Thrift::Types::MAP,
|
117
|
+
Thrift::Types::SET, Thrift::Types::LIST, Thrift::Types::STRUCT].each do |type|
|
118
|
+
expect { @prot.read_type(type) }.to raise_error(NotImplementedError)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
it 'should read the different types' do
|
123
|
+
@prot.should_receive(:read_bool).ordered
|
124
|
+
@prot.should_receive(:read_byte).ordered
|
125
|
+
@prot.should_receive(:read_i16).ordered
|
126
|
+
@prot.should_receive(:read_i32).ordered
|
127
|
+
@prot.should_receive(:read_i64).ordered
|
128
|
+
@prot.should_receive(:read_double).ordered
|
129
|
+
@prot.should_receive(:read_string).ordered
|
130
|
+
@prot.should_receive(:read_binary).ordered
|
131
|
+
@prot.read_type({:type => Thrift::Types::BOOL})
|
132
|
+
@prot.read_type({:type => Thrift::Types::BYTE})
|
133
|
+
@prot.read_type({:type => Thrift::Types::I16})
|
134
|
+
@prot.read_type({:type => Thrift::Types::I32})
|
135
|
+
@prot.read_type({:type => Thrift::Types::I64})
|
136
|
+
@prot.read_type({:type => Thrift::Types::DOUBLE})
|
137
|
+
@prot.read_type({:type => Thrift::Types::STRING})
|
138
|
+
@prot.read_type({:type => Thrift::Types::STRING, :binary => true})
|
139
|
+
# all other types are not implemented
|
140
|
+
[Thrift::Types::STOP, Thrift::Types::VOID, Thrift::Types::MAP,
|
141
|
+
Thrift::Types::SET, Thrift::Types::LIST, Thrift::Types::STRUCT].each do |type|
|
142
|
+
expect { @prot.read_type({:type => type}) }.to raise_error(NotImplementedError)
|
85
143
|
end
|
86
144
|
end
|
87
145
|
|
@@ -219,6 +219,14 @@ shared_examples_for 'a binary protocol' do
|
|
219
219
|
a.encoding.should == Encoding::BINARY
|
220
220
|
a.unpack('C*').should == [0x00, 0x00, 0x00, 0x07, 0x61, 0x62, 0x63, 0x20, 0xE2, 0x82, 0xAC]
|
221
221
|
end
|
222
|
+
|
223
|
+
it 'should write a binary string' do
|
224
|
+
buffer = [0, 1, 2, 3].pack('C*')
|
225
|
+
@prot.write_binary(buffer)
|
226
|
+
a = @trans.read(@trans.available)
|
227
|
+
a.encoding.should == Encoding::BINARY
|
228
|
+
a.unpack('C*').should == [0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x02, 0x03]
|
229
|
+
end
|
222
230
|
else
|
223
231
|
it 'should write a string' do
|
224
232
|
str = 'abc'
|
@@ -226,6 +234,13 @@ shared_examples_for 'a binary protocol' do
|
|
226
234
|
a = @trans.read(@trans.available)
|
227
235
|
a.unpack('C*').should == [0x00, 0x00, 0x00, 0x03, 0x61, 0x62, 0x63]
|
228
236
|
end
|
237
|
+
|
238
|
+
it 'should write a binary string' do
|
239
|
+
buffer = [0, 1, 2, 3].pack('C*')
|
240
|
+
@prot.write_binary(buffer)
|
241
|
+
a = @trans.read(@trans.available)
|
242
|
+
a.unpack('C*').should == [0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x02, 0x03]
|
243
|
+
end
|
229
244
|
end
|
230
245
|
|
231
246
|
it "should error gracefully when trying to write a nil string" do
|
@@ -342,6 +357,14 @@ shared_examples_for 'a binary protocol' do
|
|
342
357
|
a.should == "\u20AC".encode('UTF-8')
|
343
358
|
a.encoding.should == Encoding::UTF_8
|
344
359
|
end
|
360
|
+
|
361
|
+
it 'should read a binary string' do
|
362
|
+
buffer = [0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x02, 0x03].pack('C*')
|
363
|
+
@trans.write(buffer)
|
364
|
+
a = @prot.read_binary
|
365
|
+
a.should == [0x00, 0x01, 0x02, 0x03].pack('C*')
|
366
|
+
a.encoding.should == Encoding::BINARY
|
367
|
+
end
|
345
368
|
else
|
346
369
|
it 'should read a string' do
|
347
370
|
# i32 of value 3, followed by three characters/UTF-8 bytes 'a', 'b', 'c'
|
@@ -349,6 +372,13 @@ shared_examples_for 'a binary protocol' do
|
|
349
372
|
@trans.write(buffer)
|
350
373
|
@prot.read_string.should == 'abc'
|
351
374
|
end
|
375
|
+
|
376
|
+
it 'should read a binary string' do
|
377
|
+
buffer = [0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x02, 0x03].pack('C*')
|
378
|
+
@trans.write(buffer)
|
379
|
+
a = @prot.read_binary
|
380
|
+
a.should == [0x00, 0x01, 0x02, 0x03].pack('C*')
|
381
|
+
end
|
352
382
|
end
|
353
383
|
|
354
384
|
it "should perform a complete rpc with no args or return" do
|
@@ -134,12 +134,10 @@ describe Thrift::CompactProtocol do
|
|
134
134
|
end
|
135
135
|
|
136
136
|
def writer(sym)
|
137
|
-
sym = sym == :binary ? :string : sym
|
138
137
|
"write_#{sym.to_s}"
|
139
138
|
end
|
140
139
|
|
141
140
|
def reader(sym)
|
142
|
-
sym = sym == :binary ? :string : sym
|
143
141
|
"read_#{sym.to_s}"
|
144
142
|
end
|
145
|
-
end
|
143
|
+
end
|
data/spec/http_client_spec.rb
CHANGED
@@ -68,4 +68,53 @@ describe 'Thrift::HTTPClientTransport' do
|
|
68
68
|
@client.flush
|
69
69
|
end
|
70
70
|
end
|
71
|
+
|
72
|
+
describe 'ssl enabled' do
|
73
|
+
before(:each) do
|
74
|
+
@service_path = "/path/to/service?param=value"
|
75
|
+
@server_uri = "https://my.domain.com"
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should use SSL for https" do
|
79
|
+
client = Thrift::HTTPClientTransport.new("#{@server_uri}#{@service_path}")
|
80
|
+
|
81
|
+
client.write "test"
|
82
|
+
|
83
|
+
Net::HTTP.should_receive(:new).with("my.domain.com", 443).and_return do
|
84
|
+
mock("Net::HTTP").tap do |http|
|
85
|
+
http.should_receive(:use_ssl=).with(true)
|
86
|
+
http.should_receive(:verify_mode=).with(OpenSSL::SSL::VERIFY_PEER)
|
87
|
+
http.should_receive(:post).with(@service_path, "test",
|
88
|
+
"Content-Type" => "application/x-thrift").and_return do
|
89
|
+
mock("Net::HTTPOK").tap do |response|
|
90
|
+
response.should_receive(:body).and_return "data"
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
client.flush
|
96
|
+
client.read(4).should == "data"
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should set SSL verify mode when specified" do
|
100
|
+
client = Thrift::HTTPClientTransport.new("#{@server_uri}#{@service_path}",
|
101
|
+
:ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE)
|
102
|
+
|
103
|
+
client.write "test"
|
104
|
+
Net::HTTP.should_receive(:new).with("my.domain.com", 443).and_return do
|
105
|
+
mock("Net::HTTP").tap do |http|
|
106
|
+
http.should_receive(:use_ssl=).with(true)
|
107
|
+
http.should_receive(:verify_mode=).with(OpenSSL::SSL::VERIFY_NONE)
|
108
|
+
http.should_receive(:post).with(@service_path, "test",
|
109
|
+
"Content-Type" => "application/x-thrift").and_return do
|
110
|
+
mock("Net::HTTPOK").tap do |response|
|
111
|
+
response.should_receive(:body).and_return "data"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
client.flush
|
117
|
+
client.read(4).should == "data"
|
118
|
+
end
|
119
|
+
end
|
71
120
|
end
|
data/spec/json_protocol_spec.rb
CHANGED
@@ -435,8 +435,8 @@ describe 'JsonProtocol' do
|
|
435
435
|
end
|
436
436
|
|
437
437
|
it "should read set begin" do
|
438
|
-
@trans.write("[")
|
439
|
-
@prot.read_set_begin.should ==
|
438
|
+
@trans.write("[\"rec\",2\"\"")
|
439
|
+
@prot.read_set_begin.should == [12, 2]
|
440
440
|
end
|
441
441
|
|
442
442
|
it "should read set end" do
|
@@ -0,0 +1,140 @@
|
|
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
|
+
require 'rack/test'
|
22
|
+
|
23
|
+
describe Thrift::ThinHTTPServer do
|
24
|
+
|
25
|
+
let(:processor) { mock('processor') }
|
26
|
+
|
27
|
+
describe "#initialize" do
|
28
|
+
|
29
|
+
context "when using the defaults" do
|
30
|
+
|
31
|
+
it "binds to port 80, with host 0.0.0.0, a path of '/'" do
|
32
|
+
Thin::Server.should_receive(:new).with('0.0.0.0', 80, an_instance_of(Rack::Builder))
|
33
|
+
Thrift::ThinHTTPServer.new(processor)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'creates a ThinHTTPServer::RackApplicationContext' do
|
37
|
+
Thrift::ThinHTTPServer::RackApplication.should_receive(:for).with("/", processor, an_instance_of(Thrift::BinaryProtocolFactory)).and_return(anything)
|
38
|
+
Thrift::ThinHTTPServer.new(processor)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "uses the BinaryProtocolFactory" do
|
42
|
+
Thrift::BinaryProtocolFactory.should_receive(:new)
|
43
|
+
Thrift::ThinHTTPServer.new(processor)
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
context "when using the options" do
|
49
|
+
|
50
|
+
it 'accepts :ip, :port, :path' do
|
51
|
+
ip = "192.168.0.1"
|
52
|
+
port = 3000
|
53
|
+
path = "/thin"
|
54
|
+
Thin::Server.should_receive(:new).with(ip, port, an_instance_of(Rack::Builder))
|
55
|
+
Thrift::ThinHTTPServer.new(processor,
|
56
|
+
:ip => ip,
|
57
|
+
:port => port,
|
58
|
+
:path => path)
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'creates a ThinHTTPServer::RackApplicationContext with a different protocol factory' do
|
62
|
+
Thrift::ThinHTTPServer::RackApplication.should_receive(:for).with("/", processor, an_instance_of(Thrift::JsonProtocolFactory)).and_return(anything)
|
63
|
+
Thrift::ThinHTTPServer.new(processor,
|
64
|
+
:protocol_factory => Thrift::JsonProtocolFactory.new)
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
describe "#serve" do
|
72
|
+
|
73
|
+
it 'starts the Thin server' do
|
74
|
+
underlying_thin_server = mock('thin server', :start => true)
|
75
|
+
Thin::Server.stub(:new).and_return(underlying_thin_server)
|
76
|
+
|
77
|
+
thin_thrift_server = Thrift::ThinHTTPServer.new(processor)
|
78
|
+
|
79
|
+
underlying_thin_server.should_receive(:start)
|
80
|
+
thin_thrift_server.serve
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
describe Thrift::ThinHTTPServer::RackApplication do
|
87
|
+
include Rack::Test::Methods
|
88
|
+
|
89
|
+
let(:processor) { mock('processor') }
|
90
|
+
let(:protocol_factory) { mock('protocol factory') }
|
91
|
+
|
92
|
+
def app
|
93
|
+
Thrift::ThinHTTPServer::RackApplication.for("/", processor, protocol_factory)
|
94
|
+
end
|
95
|
+
|
96
|
+
context "404 response" do
|
97
|
+
|
98
|
+
it 'receives a non-POST' do
|
99
|
+
header('Content-Type', "application/x-thrift")
|
100
|
+
get "/"
|
101
|
+
last_response.status.should be 404
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'receives a header other than application/x-thrift' do
|
105
|
+
header('Content-Type', "application/json")
|
106
|
+
post "/"
|
107
|
+
last_response.status.should be 404
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
context "200 response" do
|
113
|
+
|
114
|
+
before do
|
115
|
+
protocol_factory.stub(:get_protocol)
|
116
|
+
processor.stub(:process)
|
117
|
+
end
|
118
|
+
|
119
|
+
it 'creates an IOStreamTransport' do
|
120
|
+
header('Content-Type', "application/x-thrift")
|
121
|
+
Thrift::IOStreamTransport.should_receive(:new).with(an_instance_of(Rack::Lint::InputWrapper), an_instance_of(Rack::Response))
|
122
|
+
post "/"
|
123
|
+
end
|
124
|
+
|
125
|
+
it 'fetches the right protocol based on the Transport' do
|
126
|
+
header('Content-Type', "application/x-thrift")
|
127
|
+
protocol_factory.should_receive(:get_protocol).with(an_instance_of(Thrift::IOStreamTransport))
|
128
|
+
post "/"
|
129
|
+
end
|
130
|
+
|
131
|
+
it 'status code 200' do
|
132
|
+
header('Content-Type', "application/x-thrift")
|
133
|
+
post "/"
|
134
|
+
last_response.ok?.should be_true
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
138
|
+
|
139
|
+
end
|
140
|
+
|
data/spec/union_spec.rb
CHANGED
@@ -93,7 +93,7 @@ describe 'Union' do
|
|
93
93
|
lambda { union.some_characters }.should raise_error(RuntimeError, "some_characters is not union's set field.")
|
94
94
|
end
|
95
95
|
|
96
|
-
it "should serialize correctly" do
|
96
|
+
it "should serialize to binary correctly" do
|
97
97
|
trans = Thrift::MemoryBufferTransport.new
|
98
98
|
proto = Thrift::BinaryProtocol.new(trans)
|
99
99
|
|
@@ -105,6 +105,18 @@ describe 'Union' do
|
|
105
105
|
other_union.should == union
|
106
106
|
end
|
107
107
|
|
108
|
+
it "should serialize to json correctly" do
|
109
|
+
trans = Thrift::MemoryBufferTransport.new
|
110
|
+
proto = Thrift::JsonProtocol.new(trans)
|
111
|
+
|
112
|
+
union = SpecNamespace::My_union.new(:integer32, 25)
|
113
|
+
union.write(proto)
|
114
|
+
|
115
|
+
other_union = SpecNamespace::My_union.new(:integer32, 25)
|
116
|
+
other_union.read(proto)
|
117
|
+
other_union.should == union
|
118
|
+
end
|
119
|
+
|
108
120
|
it "should raise when validating unset union" do
|
109
121
|
union = SpecNamespace::My_union.new
|
110
122
|
lambda { union.validate }.should raise_error(StandardError, "Union fields are not set.")
|
metadata
CHANGED
@@ -1,72 +1,106 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: thrift
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
segments:
|
6
|
-
- 0
|
7
|
-
- 9
|
8
|
-
- 0
|
9
|
-
version: 0.9.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.1
|
10
5
|
platform: ruby
|
11
|
-
authors:
|
6
|
+
authors:
|
12
7
|
- Thrift Developers
|
13
8
|
autorequire:
|
14
9
|
bindir: bin
|
15
10
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
segments:
|
26
|
-
- 0
|
27
|
-
version: "0"
|
28
|
-
requirement: *id001
|
29
|
-
name: rake
|
30
|
-
prerelease: false
|
11
|
+
date: 2013-08-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.10.0
|
31
20
|
type: :development
|
32
|
-
|
33
|
-
version_requirements:
|
34
|
-
requirements:
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
35
24
|
- - ~>
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
segments:
|
38
|
-
- 2
|
39
|
-
- 10
|
40
|
-
- 0
|
25
|
+
- !ruby/object:Gem::Version
|
41
26
|
version: 2.10.0
|
42
|
-
|
43
|
-
name:
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rack
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.5.2
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.5.2
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rack-test
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.6.2
|
48
|
+
type: :development
|
44
49
|
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.6.2
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: thin
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.5.0
|
45
62
|
type: :development
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
version_requirements: &id003 !ruby/object:Gem::Requirement
|
48
|
-
requirements:
|
49
|
-
- - "="
|
50
|
-
- !ruby/object:Gem::Version
|
51
|
-
segments:
|
52
|
-
- 1
|
53
|
-
- 2
|
54
|
-
- 0
|
55
|
-
- pre
|
56
|
-
- 2
|
57
|
-
version: 1.2.0.pre2
|
58
|
-
requirement: *id003
|
59
|
-
name: mongrel
|
60
63
|
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.5.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.3.1
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.3.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
61
90
|
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ! '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
62
97
|
description: Ruby bindings for the Apache Thrift RPC system
|
63
|
-
email:
|
98
|
+
email:
|
64
99
|
- dev@thrift.apache.org
|
65
100
|
executables: []
|
66
|
-
|
67
|
-
extensions:
|
101
|
+
extensions:
|
68
102
|
- ext/extconf.rb
|
69
|
-
extra_rdoc_files:
|
103
|
+
extra_rdoc_files:
|
70
104
|
- CHANGELOG
|
71
105
|
- README
|
72
106
|
- ext/binary_protocol_accelerated.c
|
@@ -104,6 +138,7 @@ extra_rdoc_files:
|
|
104
138
|
- lib/thrift/server/mongrel_http_server.rb
|
105
139
|
- lib/thrift/server/nonblocking_server.rb
|
106
140
|
- lib/thrift/server/simple_server.rb
|
141
|
+
- lib/thrift/server/thin_http_server.rb
|
107
142
|
- lib/thrift/server/thread_pool_server.rb
|
108
143
|
- lib/thrift/server/threaded_server.rb
|
109
144
|
- lib/thrift/struct.rb
|
@@ -123,7 +158,7 @@ extra_rdoc_files:
|
|
123
158
|
- lib/thrift/types.rb
|
124
159
|
- lib/thrift/union.rb
|
125
160
|
- lib/thrift.rb
|
126
|
-
files:
|
161
|
+
files:
|
127
162
|
- lib/thrift/bytes.rb
|
128
163
|
- lib/thrift/client.rb
|
129
164
|
- lib/thrift/core_ext/fixnum.rb
|
@@ -141,6 +176,7 @@ files:
|
|
141
176
|
- lib/thrift/server/mongrel_http_server.rb
|
142
177
|
- lib/thrift/server/nonblocking_server.rb
|
143
178
|
- lib/thrift/server/simple_server.rb
|
179
|
+
- lib/thrift/server/thin_http_server.rb
|
144
180
|
- lib/thrift/server/thread_pool_server.rb
|
145
181
|
- lib/thrift/server/threaded_server.rb
|
146
182
|
- lib/thrift/struct.rb
|
@@ -169,12 +205,8 @@ files:
|
|
169
205
|
- spec/client_spec.rb
|
170
206
|
- spec/compact_protocol_spec.rb
|
171
207
|
- spec/exception_spec.rb
|
172
|
-
- spec/gen-rb/nonblocking_service.rb
|
173
|
-
- spec/gen-rb/thrift_spec_constants.rb
|
174
|
-
- spec/gen-rb/thrift_spec_types.rb
|
175
208
|
- spec/http_client_spec.rb
|
176
209
|
- spec/json_protocol_spec.rb
|
177
|
-
- spec/mongrel_http_server_spec.rb
|
178
210
|
- spec/nonblocking_server_spec.rb
|
179
211
|
- spec/processor_spec.rb
|
180
212
|
- spec/serializer_spec.rb
|
@@ -185,6 +217,7 @@ files:
|
|
185
217
|
- spec/spec_helper.rb
|
186
218
|
- spec/struct_nested_containers_spec.rb
|
187
219
|
- spec/struct_spec.rb
|
220
|
+
- spec/thin_http_server_spec.rb
|
188
221
|
- spec/ThriftSpec.thrift
|
189
222
|
- spec/types_spec.rb
|
190
223
|
- spec/union_spec.rb
|
@@ -209,50 +242,43 @@ files:
|
|
209
242
|
- ext/strlcpy.h
|
210
243
|
- ext/struct.h
|
211
244
|
- ext/extconf.rb
|
212
|
-
|
245
|
+
- benchmark/benchmark.rb
|
246
|
+
- benchmark/Benchmark.thrift
|
247
|
+
- benchmark/client.rb
|
248
|
+
- benchmark/server.rb
|
249
|
+
- benchmark/thin_server.rb
|
213
250
|
homepage: http://thrift.apache.org
|
214
|
-
licenses:
|
251
|
+
licenses:
|
215
252
|
- Apache 2.0
|
253
|
+
metadata: {}
|
216
254
|
post_install_message:
|
217
|
-
rdoc_options:
|
255
|
+
rdoc_options:
|
218
256
|
- --line-numbers
|
219
257
|
- --inline-source
|
220
258
|
- --title
|
221
259
|
- Thrift
|
222
260
|
- --main
|
223
261
|
- README
|
224
|
-
require_paths:
|
262
|
+
require_paths:
|
225
263
|
- lib
|
226
264
|
- ext
|
227
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
228
|
-
requirements:
|
229
|
-
- -
|
230
|
-
- !ruby/object:Gem::Version
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
- !ruby/object:Gem::Version
|
238
|
-
segments:
|
239
|
-
- 0
|
240
|
-
version: "0"
|
265
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
266
|
+
requirements:
|
267
|
+
- - ! '>='
|
268
|
+
- !ruby/object:Gem::Version
|
269
|
+
version: '0'
|
270
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
271
|
+
requirements:
|
272
|
+
- - ! '>='
|
273
|
+
- !ruby/object:Gem::Version
|
274
|
+
version: '0'
|
241
275
|
requirements: []
|
242
|
-
|
243
276
|
rubyforge_project: thrift
|
244
|
-
rubygems_version:
|
277
|
+
rubygems_version: 2.0.6
|
245
278
|
signing_key:
|
246
|
-
specification_version:
|
279
|
+
specification_version: 4
|
247
280
|
summary: Ruby bindings for Apache Thrift
|
248
|
-
test_files:
|
249
|
-
- test/debug_proto/gen-rb/debug_proto_test_constants.rb
|
250
|
-
- test/debug_proto/gen-rb/debug_proto_test_types.rb
|
251
|
-
- test/debug_proto/gen-rb/empty_service.rb
|
252
|
-
- test/debug_proto/gen-rb/inherited.rb
|
253
|
-
- test/debug_proto/gen-rb/reverse_order_service.rb
|
254
|
-
- test/debug_proto/gen-rb/service_for_exception_with_a_map.rb
|
255
|
-
- test/debug_proto/gen-rb/srv.rb
|
281
|
+
test_files:
|
256
282
|
- spec/base_protocol_spec.rb
|
257
283
|
- spec/base_transport_spec.rb
|
258
284
|
- spec/binary_protocol_accelerated_spec.rb
|
@@ -262,12 +288,8 @@ test_files:
|
|
262
288
|
- spec/client_spec.rb
|
263
289
|
- spec/compact_protocol_spec.rb
|
264
290
|
- spec/exception_spec.rb
|
265
|
-
- spec/gen-rb/nonblocking_service.rb
|
266
|
-
- spec/gen-rb/thrift_spec_constants.rb
|
267
|
-
- spec/gen-rb/thrift_spec_types.rb
|
268
291
|
- spec/http_client_spec.rb
|
269
292
|
- spec/json_protocol_spec.rb
|
270
|
-
- spec/mongrel_http_server_spec.rb
|
271
293
|
- spec/nonblocking_server_spec.rb
|
272
294
|
- spec/processor_spec.rb
|
273
295
|
- spec/serializer_spec.rb
|
@@ -278,6 +300,7 @@ test_files:
|
|
278
300
|
- spec/spec_helper.rb
|
279
301
|
- spec/struct_nested_containers_spec.rb
|
280
302
|
- spec/struct_spec.rb
|
303
|
+
- spec/thin_http_server_spec.rb
|
281
304
|
- spec/ThriftSpec.thrift
|
282
305
|
- spec/types_spec.rb
|
283
306
|
- spec/union_spec.rb
|
@@ -285,8 +308,5 @@ test_files:
|
|
285
308
|
- benchmark/benchmark.rb
|
286
309
|
- benchmark/Benchmark.thrift
|
287
310
|
- benchmark/client.rb
|
288
|
-
- benchmark/gen-rb/benchmark_constants.rb
|
289
|
-
- benchmark/gen-rb/benchmark_service.rb
|
290
|
-
- benchmark/gen-rb/benchmark_types.rb
|
291
311
|
- benchmark/server.rb
|
292
312
|
- benchmark/thin_server.rb
|