upfluence-thrift 2.6.8 → 2.7.4

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.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/benchmark/{gen-rb/benchmark_constants.rb → benchmark_constants.rb} +1 -1
  3. data/benchmark/{gen-rb/benchmark_service.rb → benchmark_service.rb} +2 -2
  4. data/benchmark/{gen-rb/benchmark_types.rb → benchmark_types.rb} +1 -1
  5. data/ext/struct.c +5 -1
  6. data/lib/thrift/base_stream.rb +85 -0
  7. data/lib/thrift/bidi_stream.rb +183 -0
  8. data/lib/thrift/client.rb +84 -17
  9. data/lib/thrift/inbound_stream.rb +72 -0
  10. data/lib/thrift/middleware.rb +42 -0
  11. data/lib/thrift/outbound_stream.rb +52 -0
  12. data/lib/thrift/processor.rb +287 -47
  13. data/lib/thrift/protocol/base_protocol.rb +35 -33
  14. data/lib/thrift/protocol/binary_protocol.rb +8 -1
  15. data/lib/thrift/protocol/binary_protocol_accelerated.rb +8 -0
  16. data/lib/thrift/protocol/compact_protocol.rb +8 -0
  17. data/lib/thrift/protocol/json_protocol.rb +21 -4
  18. data/lib/thrift/protocol/multiplexed_protocol.rb +5 -1
  19. data/lib/thrift/server/base_server.rb +8 -2
  20. data/lib/thrift/server/nonblocking_server.rb +5 -4
  21. data/lib/thrift/server/simple_server.rb +5 -1
  22. data/lib/thrift/server/thread_pool_server.rb +5 -1
  23. data/lib/thrift/server/threaded_server.rb +5 -1
  24. data/lib/thrift/transport/base_server_transport.rb +1 -1
  25. data/lib/thrift/transport/base_transport.rb +8 -0
  26. data/lib/thrift/transport/buffered_transport.rb +9 -1
  27. data/lib/thrift/transport/framed_transport.rb +9 -1
  28. data/lib/thrift/transport/http_client_transport.rb +4 -0
  29. data/lib/thrift/transport/io_stream_transport.rb +4 -1
  30. data/lib/thrift/transport/memory_buffer_transport.rb +4 -0
  31. data/lib/thrift/transport/server_socket.rb +5 -0
  32. data/lib/thrift/transport/socket.rb +21 -17
  33. data/lib/thrift/transport/ssl_server_socket.rb +41 -0
  34. data/lib/thrift/transport/ssl_socket.rb +51 -0
  35. data/lib/thrift/transport/unix_server_socket.rb +5 -1
  36. data/lib/thrift/transport/unix_socket.rb +5 -1
  37. data/lib/thrift/types/annotation/deprecation/deprecation_constants.rb +1 -1
  38. data/lib/thrift/types/annotation/deprecation/deprecation_types.rb +2 -2
  39. data/lib/thrift/types/annotation/exception/exception_constants.rb +17 -0
  40. data/lib/thrift/types/annotation/exception/exception_types.rb +44 -0
  41. data/lib/thrift/types/annotation/naming/naming_constants.rb +1 -1
  42. data/lib/thrift/types/annotation/naming/naming_types.rb +2 -2
  43. data/lib/thrift/types/annotation/rpc/rpc_constants.rb +17 -0
  44. data/lib/thrift/types/annotation/rpc/rpc_types.rb +74 -0
  45. data/lib/thrift/types/annotation_definition/annotation_definition_constants.rb +15 -0
  46. data/lib/thrift/types/annotation_definition/annotation_definition_types.rb +116 -0
  47. data/lib/thrift/types/constant_definition/constant_definition_constants.rb +15 -0
  48. data/lib/thrift/types/constant_definition/constant_definition_types.rb +292 -0
  49. data/lib/thrift/types/core/core_constants.rb +15 -0
  50. data/lib/thrift/types/core/core_types.rb +58 -0
  51. data/lib/thrift/types/enum_definition/enum_definition_constants.rb +15 -0
  52. data/lib/thrift/types/enum_definition/enum_definition_types.rb +106 -0
  53. data/lib/thrift/types/known/any/any_constants.rb +1 -1
  54. data/lib/thrift/types/known/any/any_types.rb +2 -2
  55. data/lib/thrift/types/known/duration/duration_constants.rb +1 -1
  56. data/lib/thrift/types/known/duration/duration_types.rb +2 -2
  57. data/lib/thrift/types/known/timestamp/timestamp_constants.rb +1 -1
  58. data/lib/thrift/types/known/timestamp/timestamp_types.rb +2 -2
  59. data/lib/thrift/types/plugin/plugin.rb +139 -0
  60. data/lib/thrift/types/plugin/plugin_constants.rb +15 -0
  61. data/lib/thrift/types/plugin/plugin_types.rb +106 -0
  62. data/lib/thrift/types/program_definition/program_definition_constants.rb +15 -0
  63. data/lib/thrift/types/program_definition/program_definition_types.rb +137 -0
  64. data/lib/thrift/types/service_definition/service_definition_constants.rb +15 -0
  65. data/lib/thrift/types/service_definition/service_definition_types.rb +160 -0
  66. data/lib/thrift/types/struct_definition/struct_definition_constants.rb +15 -0
  67. data/lib/thrift/types/struct_definition/struct_definition_types.rb +157 -0
  68. data/lib/thrift/types/type_definition/type_definition_constants.rb +15 -0
  69. data/lib/thrift/types/type_definition/type_definition_types.rb +242 -0
  70. data/lib/thrift/types/value/value_constants.rb +1 -1
  71. data/lib/thrift/types/value/value_types.rb +50 -51
  72. data/lib/thrift/types.rb +11 -3
  73. data/lib/thrift/union.rb +3 -6
  74. data/lib/thrift.rb +6 -0
  75. data/lib/types/annotation/deprecation/deprecation_constants.rb +16 -0
  76. data/lib/types/annotation/deprecation/deprecation_types.rb +42 -0
  77. data/lib/types/annotation/naming/naming_constants.rb +16 -0
  78. data/lib/types/annotation/naming/naming_types.rb +57 -0
  79. data/lib/types/annotation_definition/annotation_definition_constants.rb +14 -0
  80. data/lib/types/annotation_definition/annotation_definition_types.rb +114 -0
  81. data/lib/types/constant_definition/constant_definition_constants.rb +14 -0
  82. data/lib/types/constant_definition/constant_definition_types.rb +290 -0
  83. data/lib/types/core/core_constants.rb +14 -0
  84. data/lib/types/core/core_types.rb +56 -0
  85. data/lib/types/enum_definition/enum_definition_constants.rb +14 -0
  86. data/lib/types/enum_definition/enum_definition_types.rb +104 -0
  87. data/lib/types/known/any/any_constants.rb +16 -0
  88. data/lib/types/known/any/any_types.rb +59 -0
  89. data/lib/types/known/duration/duration_constants.rb +16 -0
  90. data/lib/types/known/duration/duration_types.rb +59 -0
  91. data/lib/types/known/timestamp/timestamp_constants.rb +16 -0
  92. data/lib/types/known/timestamp/timestamp_types.rb +59 -0
  93. data/lib/types/plugin/plugin.rb +137 -0
  94. data/lib/types/plugin/plugin_constants.rb +14 -0
  95. data/lib/types/plugin/plugin_types.rb +104 -0
  96. data/lib/types/program_definition/program_definition_constants.rb +14 -0
  97. data/lib/types/program_definition/program_definition_types.rb +135 -0
  98. data/lib/types/service_definition/service_definition_constants.rb +14 -0
  99. data/lib/types/service_definition/service_definition_types.rb +158 -0
  100. data/lib/types/struct_definition/struct_definition_constants.rb +14 -0
  101. data/lib/types/struct_definition/struct_definition_types.rb +155 -0
  102. data/lib/types/type_definition/type_definition_constants.rb +14 -0
  103. data/lib/types/type_definition/type_definition_types.rb +240 -0
  104. data/lib/types/value/value_constants.rb +14 -0
  105. data/lib/types/value/value_types.rb +330 -0
  106. data/spec/{gen-rb/base → base}/base_service.rb +2 -2
  107. data/spec/{gen-rb/base → base}/base_service_constants.rb +1 -1
  108. data/spec/{gen-rb/base → base}/base_service_types.rb +1 -1
  109. data/spec/base_protocol_spec.rb +79 -71
  110. data/spec/base_transport_spec.rb +155 -117
  111. data/spec/binary_protocol_accelerated_spec.rb +6 -2
  112. data/spec/binary_protocol_spec.rb +16 -8
  113. data/spec/binary_protocol_spec_shared.rb +77 -77
  114. data/spec/bytes_spec.rb +38 -38
  115. data/spec/client_spec.rb +48 -50
  116. data/spec/compact_protocol_spec.rb +59 -46
  117. data/spec/exception_spec.rb +54 -54
  118. data/spec/{gen-rb/extended → extended}/extended_service.rb +2 -2
  119. data/spec/{gen-rb/extended → extended}/extended_service_constants.rb +1 -1
  120. data/spec/{gen-rb/extended → extended}/extended_service_types.rb +1 -1
  121. data/spec/flat_spec.rb +5 -5
  122. data/spec/gen-rb/flat/namespaced_nonblocking_service.rb +4 -4
  123. data/spec/gen-rb/flat/referenced_constants.rb +1 -1
  124. data/spec/gen-rb/flat/referenced_types.rb +1 -1
  125. data/spec/gen-rb/flat/thrift_namespaced_spec_constants.rb +1 -1
  126. data/spec/gen-rb/flat/thrift_namespaced_spec_types.rb +1 -1
  127. data/spec/http_client_spec.rb +96 -43
  128. data/spec/json_protocol_spec.rb +170 -131
  129. data/spec/namespaced_spec.rb +24 -27
  130. data/spec/{gen-rb/namespaced_spec_namespace → namespaced_spec_namespace}/namespaced_nonblocking_service.rb +4 -4
  131. data/spec/{gen-rb/namespaced_spec_namespace → namespaced_spec_namespace}/thrift_namespaced_spec_constants.rb +1 -1
  132. data/spec/{gen-rb/namespaced_spec_namespace → namespaced_spec_namespace}/thrift_namespaced_spec_types.rb +1 -1
  133. data/spec/nonblocking_server_spec.rb +16 -16
  134. data/spec/{gen-rb/nonblocking_service.rb → nonblocking_service.rb} +4 -4
  135. data/spec/{gen-rb/other_namespace → other_namespace}/referenced_constants.rb +1 -1
  136. data/spec/{gen-rb/other_namespace → other_namespace}/referenced_types.rb +1 -1
  137. data/spec/processor_spec.rb +42 -31
  138. data/spec/rack_application_spec.rb +22 -26
  139. data/spec/serializer_spec.rb +20 -20
  140. data/spec/server_socket_spec.rb +27 -22
  141. data/spec/server_spec.rb +91 -51
  142. data/spec/socket_spec.rb +23 -16
  143. data/spec/socket_spec_shared.rb +31 -31
  144. data/spec/spec_helper.rb +1 -1
  145. data/spec/ssl_server_socket_spec.rb +34 -0
  146. data/spec/ssl_socket_spec.rb +78 -0
  147. data/spec/streaming_spec.rb +442 -0
  148. data/spec/struct_nested_containers_spec.rb +24 -24
  149. data/spec/struct_spec.rb +120 -120
  150. data/spec/thin_http_server_spec.rb +71 -28
  151. data/spec/{gen-rb/thrift_spec_constants.rb → thrift_spec_constants.rb} +1 -1
  152. data/spec/{gen-rb/thrift_spec_types.rb → thrift_spec_types.rb} +16 -16
  153. data/spec/types/known/any_spec.rb +2 -2
  154. data/spec/types/known/duration_spec.rb +1 -1
  155. data/spec/types/known/timestamp_spec.rb +1 -1
  156. data/spec/types/value_spec.rb +2 -1
  157. data/spec/types_spec.rb +56 -53
  158. data/spec/union_spec.rb +51 -40
  159. data/spec/unix_socket_spec.rb +43 -34
  160. data/test/debug_proto/gen-rb/debug_proto_test_constants.rb +267 -260
  161. data/test/debug_proto/gen-rb/debug_proto_test_types.rb +1481 -1416
  162. data/test/debug_proto/gen-rb/empty_service.rb +31 -27
  163. data/test/debug_proto/gen-rb/inherited.rb +102 -98
  164. data/test/debug_proto/gen-rb/reverse_order_service.rb +112 -108
  165. data/test/debug_proto/gen-rb/service_for_exception_with_a_map.rb +99 -95
  166. data/test/debug_proto/gen-rb/srv.rb +525 -406
  167. metadata +178 -41
data/spec/struct_spec.rb CHANGED
@@ -25,7 +25,7 @@ describe 'Struct' do
25
25
  it "should iterate over all fields properly" do
26
26
  fields = {}
27
27
  SpecNamespace::Foo.new.each_field { |fid,field_info| fields[fid] = field_info }
28
- fields.should == SpecNamespace::Foo::FIELDS
28
+ expect(fields).to eq(SpecNamespace::Foo::FIELDS)
29
29
  end
30
30
 
31
31
  it "should initialize all fields to defaults" do
@@ -39,19 +39,19 @@ describe 'Struct' do
39
39
  end
40
40
 
41
41
  def validate_default_arguments(object)
42
- object.simple.should == 53
43
- object.words.should == "words"
44
- object.hello.should == SpecNamespace::Hello.new(:greeting => 'hello, world!')
45
- object.ints.should == [1, 2, 2, 3]
46
- object.complex.should be_nil
47
- object.shorts.should == Set.new([5, 17, 239])
42
+ expect(object.simple).to eq(53)
43
+ expect(object.words).to eq("words")
44
+ expect(object.hello).to eq(SpecNamespace::Hello.new(:greeting => 'hello, world!'))
45
+ expect(object.ints).to eq([1, 2, 2, 3])
46
+ expect(object.complex).to be_nil
47
+ expect(object.shorts).to eq(Set.new([5, 17, 239]))
48
48
  end
49
49
 
50
50
  it "should not share default values between instances" do
51
51
  begin
52
52
  struct = SpecNamespace::Foo.new
53
53
  struct.ints << 17
54
- SpecNamespace::Foo.new.ints.should == [1,2,2,3]
54
+ expect(SpecNamespace::Foo.new.ints).to eq([1,2,2,3])
55
55
  ensure
56
56
  # ensure no leakage to other tests
57
57
  SpecNamespace::Foo::FIELDS[4][:default] = [1,2,2,3]
@@ -60,48 +60,48 @@ describe 'Struct' do
60
60
 
61
61
  it "should properly initialize boolean values" do
62
62
  struct = SpecNamespace::BoolStruct.new(:yesno => false)
63
- struct.yesno.should be_false
63
+ expect(struct.yesno).to be_falsey
64
64
  end
65
65
 
66
66
  it "should have proper == semantics" do
67
- SpecNamespace::Foo.new.should_not == SpecNamespace::Hello.new
68
- SpecNamespace::Foo.new.should == SpecNamespace::Foo.new
69
- SpecNamespace::Foo.new(:simple => 52).should_not == SpecNamespace::Foo.new
67
+ expect(SpecNamespace::Foo.new).not_to eq(SpecNamespace::Hello.new)
68
+ expect(SpecNamespace::Foo.new).to eq(SpecNamespace::Foo.new)
69
+ expect(SpecNamespace::Foo.new(:simple => 52)).not_to eq(SpecNamespace::Foo.new)
70
70
  end
71
71
 
72
72
  it "should print enum value names in inspect" do
73
- SpecNamespace::StructWithSomeEnum.new(:some_enum => SpecNamespace::SomeEnum::ONE).inspect.should == "<SpecNamespace::StructWithSomeEnum some_enum:ONE (0)>"
73
+ expect(SpecNamespace::StructWithSomeEnum.new(:some_enum => SpecNamespace::SomeEnum::ONE).inspect).to eq("<SpecNamespace::StructWithSomeEnum some_enum:ONE (0)>")
74
74
 
75
- SpecNamespace::StructWithEnumMap.new(:my_map => {SpecNamespace::SomeEnum::ONE => [SpecNamespace::SomeEnum::TWO]}).inspect.should == "<SpecNamespace::StructWithEnumMap my_map:{ONE (0): [TWO (1)]}>"
75
+ expect(SpecNamespace::StructWithEnumMap.new(:my_map => {SpecNamespace::SomeEnum::ONE => [SpecNamespace::SomeEnum::TWO]}).inspect).to eq("<SpecNamespace::StructWithEnumMap my_map:{ONE (0): [TWO (1)]}>")
76
76
  end
77
77
 
78
78
  it "should pretty print binary fields" do
79
- SpecNamespace::Foo2.new(:my_binary => "\001\002\003").inspect.should == "<SpecNamespace::Foo2 my_binary:010203>"
79
+ expect(SpecNamespace::Foo2.new(:my_binary => "\001\002\003").inspect).to eq("<SpecNamespace::Foo2 my_binary:010203>")
80
80
  end
81
81
 
82
82
  it "should offer field? methods" do
83
- SpecNamespace::Foo.new.opt_string?.should be_false
84
- SpecNamespace::Foo.new(:simple => 52).simple?.should be_true
85
- SpecNamespace::Foo.new(:my_bool => false).my_bool?.should be_true
86
- SpecNamespace::Foo.new(:my_bool => true).my_bool?.should be_true
83
+ expect(SpecNamespace::Foo.new.opt_string?).to be_falsey
84
+ expect(SpecNamespace::Foo.new(:simple => 52).simple?).to be_truthy
85
+ expect(SpecNamespace::Foo.new(:my_bool => false).my_bool?).to be_truthy
86
+ expect(SpecNamespace::Foo.new(:my_bool => true).my_bool?).to be_truthy
87
87
  end
88
88
 
89
89
  it "should be comparable" do
90
90
  s1 = SpecNamespace::StructWithSomeEnum.new(:some_enum => SpecNamespace::SomeEnum::ONE)
91
91
  s2 = SpecNamespace::StructWithSomeEnum.new(:some_enum => SpecNamespace::SomeEnum::TWO)
92
92
 
93
- (s1 <=> s2).should == -1
94
- (s2 <=> s1).should == 1
95
- (s1 <=> s1).should == 0
96
- (s1 <=> SpecNamespace::StructWithSomeEnum.new()).should == -1
93
+ expect(s1 <=> s2).to eq(-1)
94
+ expect(s2 <=> s1).to eq(1)
95
+ expect(s1 <=> s1).to eq(0)
96
+ expect(s1 <=> SpecNamespace::StructWithSomeEnum.new()).to eq(-1)
97
97
  end
98
98
 
99
99
  it "should read itself off the wire" do
100
100
  struct = SpecNamespace::Foo.new
101
- prot = Thrift::BaseProtocol.new(mock("transport"))
102
- prot.should_receive(:read_struct_begin).twice
103
- prot.should_receive(:read_struct_end).twice
104
- prot.should_receive(:read_field_begin).and_return(
101
+ prot = Thrift::BaseProtocol.new(double("transport"))
102
+ expect(prot).to receive(:read_struct_begin).twice
103
+ expect(prot).to receive(:read_struct_end).twice
104
+ expect(prot).to receive(:read_field_begin).and_return(
105
105
  ['complex', Thrift::Types::MAP, 5], # Foo
106
106
  ['words', Thrift::Types::STRING, 2], # Foo
107
107
  ['hello', Thrift::Types::STRUCT, 3], # Foo
@@ -112,49 +112,49 @@ describe 'Struct' do
112
112
  ['shorts', Thrift::Types::SET, 6], # Foo
113
113
  [nil, Thrift::Types::STOP, 0] # Hello
114
114
  )
115
- prot.should_receive(:read_field_end).exactly(7).times
116
- prot.should_receive(:read_map_begin).and_return(
115
+ expect(prot).to receive(:read_field_end).exactly(7).times
116
+ expect(prot).to receive(:read_map_begin).and_return(
117
117
  [Thrift::Types::I32, Thrift::Types::MAP, 2], # complex
118
118
  [Thrift::Types::STRING, Thrift::Types::DOUBLE, 2], # complex/1/value
119
119
  [Thrift::Types::STRING, Thrift::Types::DOUBLE, 1] # complex/2/value
120
120
  )
121
- prot.should_receive(:read_map_end).exactly(3).times
122
- prot.should_receive(:read_list_begin).and_return([Thrift::Types::I32, 4])
123
- prot.should_receive(:read_list_end)
124
- prot.should_receive(:read_set_begin).and_return([Thrift::Types::I16, 2])
125
- prot.should_receive(:read_set_end)
126
- prot.should_receive(:read_i32).and_return(
121
+ expect(prot).to receive(:read_map_end).exactly(3).times
122
+ expect(prot).to receive(:read_list_begin).and_return([Thrift::Types::I32, 4])
123
+ expect(prot).to receive(:read_list_end)
124
+ expect(prot).to receive(:read_set_begin).and_return([Thrift::Types::I16, 2])
125
+ expect(prot).to receive(:read_set_end)
126
+ expect(prot).to receive(:read_i32).and_return(
127
127
  1, 14, # complex keys
128
128
  42, # simple
129
129
  4, 23, 4, 29 # ints
130
130
  )
131
- prot.should_receive(:read_string).and_return("pi", "e", "feigenbaum", "apple banana", "what's up?")
132
- prot.should_receive(:read_double).and_return(Math::PI, Math::E, 4.669201609)
133
- prot.should_receive(:read_i16).and_return(2, 3)
134
- prot.should_not_receive(:skip)
131
+ expect(prot).to receive(:read_string).and_return("pi", "e", "feigenbaum", "apple banana", "what's up?")
132
+ expect(prot).to receive(:read_double).and_return(Math::PI, Math::E, 4.669201609)
133
+ expect(prot).to receive(:read_i16).and_return(2, 3)
134
+ expect(prot).not_to receive(:skip)
135
135
  struct.read(prot)
136
136
 
137
- struct.simple.should == 42
138
- struct.complex.should == {1 => {"pi" => Math::PI, "e" => Math::E}, 14 => {"feigenbaum" => 4.669201609}}
139
- struct.hello.should == SpecNamespace::Hello.new(:greeting => "what's up?")
140
- struct.words.should == "apple banana"
141
- struct.ints.should == [4, 23, 4, 29]
142
- struct.shorts.should == Set.new([3, 2])
137
+ expect(struct.simple).to eq(42)
138
+ expect(struct.complex).to eq({1 => {"pi" => Math::PI, "e" => Math::E}, 14 => {"feigenbaum" => 4.669201609}})
139
+ expect(struct.hello).to eq(SpecNamespace::Hello.new(:greeting => "what's up?"))
140
+ expect(struct.words).to eq("apple banana")
141
+ expect(struct.ints).to eq([4, 23, 4, 29])
142
+ expect(struct.shorts).to eq(Set.new([3, 2]))
143
143
  end
144
144
 
145
145
  it "should serialize false boolean fields correctly" do
146
146
  b = SpecNamespace::BoolStruct.new(:yesno => false)
147
147
  prot = Thrift::BinaryProtocol.new(Thrift::MemoryBufferTransport.new)
148
- prot.should_receive(:write_bool).with(false)
148
+ expect(prot).to receive(:write_bool).with(false)
149
149
  b.write(prot)
150
150
  end
151
151
 
152
152
  it "should skip unexpected fields in structs and use default values" do
153
153
  struct = SpecNamespace::Foo.new
154
- prot = Thrift::BaseProtocol.new(mock("transport"))
155
- prot.should_receive(:read_struct_begin)
156
- prot.should_receive(:read_struct_end)
157
- prot.should_receive(:read_field_begin).and_return(
154
+ prot = Thrift::BaseProtocol.new(double("transport"))
155
+ expect(prot).to receive(:read_struct_begin)
156
+ expect(prot).to receive(:read_struct_end)
157
+ expect(prot).to receive(:read_field_begin).and_return(
158
158
  ['simple', Thrift::Types::I32, 1],
159
159
  ['complex', Thrift::Types::STRUCT, 5],
160
160
  ['thinz', Thrift::Types::MAP, 7],
@@ -162,55 +162,55 @@ describe 'Struct' do
162
162
  ['words', Thrift::Types::STRING, 2],
163
163
  [nil, Thrift::Types::STOP, 0]
164
164
  )
165
- prot.should_receive(:read_field_end).exactly(5).times
166
- prot.should_receive(:read_i32).and_return(42)
167
- prot.should_receive(:read_string).and_return("foobar")
168
- prot.should_receive(:skip).with(Thrift::Types::STRUCT)
169
- prot.should_receive(:skip).with(Thrift::Types::MAP)
165
+ expect(prot).to receive(:read_field_end).exactly(5).times
166
+ expect(prot).to receive(:read_i32).and_return(42)
167
+ expect(prot).to receive(:read_string).and_return("foobar")
168
+ expect(prot).to receive(:skip).with(Thrift::Types::STRUCT)
169
+ expect(prot).to receive(:skip).with(Thrift::Types::MAP)
170
170
  # prot.should_receive(:read_map_begin).and_return([Thrift::Types::I32, Thrift::Types::I32, 0])
171
171
  # prot.should_receive(:read_map_end)
172
- prot.should_receive(:skip).with(Thrift::Types::I32)
172
+ expect(prot).to receive(:skip).with(Thrift::Types::I32)
173
173
  struct.read(prot)
174
174
 
175
- struct.simple.should == 42
176
- struct.complex.should be_nil
177
- struct.words.should == "foobar"
178
- struct.hello.should == SpecNamespace::Hello.new(:greeting => 'hello, world!')
179
- struct.ints.should == [1, 2, 2, 3]
180
- struct.shorts.should == Set.new([5, 17, 239])
175
+ expect(struct.simple).to eq(42)
176
+ expect(struct.complex).to be_nil
177
+ expect(struct.words).to eq("foobar")
178
+ expect(struct.hello).to eq(SpecNamespace::Hello.new(:greeting => 'hello, world!'))
179
+ expect(struct.ints).to eq([1, 2, 2, 3])
180
+ expect(struct.shorts).to eq(Set.new([5, 17, 239]))
181
181
  end
182
182
 
183
183
  it "should write itself to the wire" do
184
- prot = Thrift::BaseProtocol.new(mock("transport")) #mock("Protocol")
185
- prot.should_receive(:write_struct_begin).with("SpecNamespace::Foo")
186
- prot.should_receive(:write_struct_begin).with("SpecNamespace::Hello")
187
- prot.should_receive(:write_struct_end).twice
188
- prot.should_receive(:write_field_begin).with('ints', Thrift::Types::LIST, 4)
189
- prot.should_receive(:write_i32).with(1)
190
- prot.should_receive(:write_i32).with(2).twice
191
- prot.should_receive(:write_i32).with(3)
192
- prot.should_receive(:write_field_begin).with('complex', Thrift::Types::MAP, 5)
193
- prot.should_receive(:write_i32).with(5)
194
- prot.should_receive(:write_string).with('foo')
195
- prot.should_receive(:write_double).with(1.23)
196
- prot.should_receive(:write_field_begin).with('shorts', Thrift::Types::SET, 6)
197
- prot.should_receive(:write_i16).with(5)
198
- prot.should_receive(:write_i16).with(17)
199
- prot.should_receive(:write_i16).with(239)
200
- prot.should_receive(:write_field_stop).twice
201
- prot.should_receive(:write_field_end).exactly(6).times
202
- prot.should_receive(:write_field_begin).with('simple', Thrift::Types::I32, 1)
203
- prot.should_receive(:write_i32).with(53)
204
- prot.should_receive(:write_field_begin).with('hello', Thrift::Types::STRUCT, 3)
205
- prot.should_receive(:write_field_begin).with('greeting', Thrift::Types::STRING, 1)
206
- prot.should_receive(:write_string).with('hello, world!')
207
- prot.should_receive(:write_map_begin).with(Thrift::Types::I32, Thrift::Types::MAP, 1)
208
- prot.should_receive(:write_map_begin).with(Thrift::Types::STRING, Thrift::Types::DOUBLE, 1)
209
- prot.should_receive(:write_map_end).twice
210
- prot.should_receive(:write_list_begin).with(Thrift::Types::I32, 4)
211
- prot.should_receive(:write_list_end)
212
- prot.should_receive(:write_set_begin).with(Thrift::Types::I16, 3)
213
- prot.should_receive(:write_set_end)
184
+ prot = Thrift::BaseProtocol.new(double("transport")) #mock("Protocol")
185
+ expect(prot).to receive(:write_struct_begin).with("SpecNamespace::Foo")
186
+ expect(prot).to receive(:write_struct_begin).with("SpecNamespace::Hello")
187
+ expect(prot).to receive(:write_struct_end).twice
188
+ expect(prot).to receive(:write_field_begin).with('ints', Thrift::Types::LIST, 4)
189
+ expect(prot).to receive(:write_i32).with(1)
190
+ expect(prot).to receive(:write_i32).with(2).twice
191
+ expect(prot).to receive(:write_i32).with(3)
192
+ expect(prot).to receive(:write_field_begin).with('complex', Thrift::Types::MAP, 5)
193
+ expect(prot).to receive(:write_i32).with(5)
194
+ expect(prot).to receive(:write_string).with('foo')
195
+ expect(prot).to receive(:write_double).with(1.23)
196
+ expect(prot).to receive(:write_field_begin).with('shorts', Thrift::Types::SET, 6)
197
+ expect(prot).to receive(:write_i16).with(5)
198
+ expect(prot).to receive(:write_i16).with(17)
199
+ expect(prot).to receive(:write_i16).with(239)
200
+ expect(prot).to receive(:write_field_stop).twice
201
+ expect(prot).to receive(:write_field_end).exactly(6).times
202
+ expect(prot).to receive(:write_field_begin).with('simple', Thrift::Types::I32, 1)
203
+ expect(prot).to receive(:write_i32).with(53)
204
+ expect(prot).to receive(:write_field_begin).with('hello', Thrift::Types::STRUCT, 3)
205
+ expect(prot).to receive(:write_field_begin).with('greeting', Thrift::Types::STRING, 1)
206
+ expect(prot).to receive(:write_string).with('hello, world!')
207
+ expect(prot).to receive(:write_map_begin).with(Thrift::Types::I32, Thrift::Types::MAP, 1)
208
+ expect(prot).to receive(:write_map_begin).with(Thrift::Types::STRING, Thrift::Types::DOUBLE, 1)
209
+ expect(prot).to receive(:write_map_end).twice
210
+ expect(prot).to receive(:write_list_begin).with(Thrift::Types::I32, 4)
211
+ expect(prot).to receive(:write_list_end)
212
+ expect(prot).to receive(:write_set_begin).with(Thrift::Types::I16, 3)
213
+ expect(prot).to receive(:write_set_end)
214
214
 
215
215
  struct = SpecNamespace::Foo.new
216
216
  struct.words = nil
@@ -221,50 +221,50 @@ describe 'Struct' do
221
221
  it "should raise an exception if presented with an unknown container" do
222
222
  # yeah this is silly, but I'm going for code coverage here
223
223
  struct = SpecNamespace::Foo.new
224
- lambda { struct.send :write_container, nil, nil, {:type => "foo"} }.should raise_error(StandardError, "Not a container type: foo")
224
+ expect { struct.send :write_container, nil, nil, {:type => "foo"} }.to raise_error(StandardError, "Not a container type: foo")
225
225
  end
226
226
 
227
227
  it "should support optional type-checking in Thrift::Struct.new" do
228
228
  Thrift.type_checking = true
229
229
  begin
230
- lambda { SpecNamespace::Hello.new(:greeting => 3) }.should raise_error(Thrift::TypeError, "Expected Types::STRING, received Integer for field greeting")
230
+ expect { SpecNamespace::Hello.new(:greeting => 3) }.to raise_error(Thrift::TypeError, /Expected Types::STRING, received (Integer|Fixnum) for field greeting/)
231
231
  ensure
232
232
  Thrift.type_checking = false
233
233
  end
234
- lambda { SpecNamespace::Hello.new(:greeting => 3) }.should_not raise_error(Thrift::TypeError)
234
+ expect { SpecNamespace::Hello.new(:greeting => 3) }.not_to raise_error
235
235
  end
236
236
 
237
237
  it "should support optional type-checking in field accessors" do
238
238
  Thrift.type_checking = true
239
239
  begin
240
240
  hello = SpecNamespace::Hello.new
241
- lambda { hello.greeting = 3 }.should raise_error(Thrift::TypeError, "Expected Types::STRING, received Integer for field greeting")
241
+ expect { hello.greeting = 3 }.to raise_error(Thrift::TypeError, /Expected Types::STRING, received (Integer|Fixnum) for field greeting/)
242
242
  ensure
243
243
  Thrift.type_checking = false
244
244
  end
245
- lambda { hello.greeting = 3 }.should_not raise_error(Thrift::TypeError)
245
+ expect { hello.greeting = 3 }.not_to raise_error
246
246
  end
247
247
 
248
248
  it "should raise an exception when unknown types are given to Thrift::Struct.new" do
249
- lambda { SpecNamespace::Hello.new(:fish => 'salmon') }.should raise_error(Exception, "Unknown key given to SpecNamespace::Hello.new: fish")
249
+ expect { SpecNamespace::Hello.new(:fish => 'salmon') }.to raise_error(Exception, "Unknown key given to SpecNamespace::Hello.new: fish")
250
250
  end
251
251
 
252
252
  it "should support `raise Xception, 'message'` for Exception structs" do
253
253
  begin
254
254
  raise SpecNamespace::Xception, "something happened"
255
255
  rescue Thrift::Exception => e
256
- e.message.should == "something happened"
257
- e.code.should == 1
256
+ expect(e.message).to eq("something happened")
257
+ expect(e.code).to eq(1)
258
258
  # ensure it gets serialized properly, this is the really important part
259
- prot = Thrift::BaseProtocol.new(mock("trans"))
260
- prot.should_receive(:write_struct_begin).with("SpecNamespace::Xception")
261
- prot.should_receive(:write_struct_end)
262
- prot.should_receive(:write_field_begin).with('message', Thrift::Types::STRING, 1)#, "something happened")
263
- prot.should_receive(:write_string).with("something happened")
264
- prot.should_receive(:write_field_begin).with('code', Thrift::Types::I32, 2)#, 1)
265
- prot.should_receive(:write_i32).with(1)
266
- prot.should_receive(:write_field_stop)
267
- prot.should_receive(:write_field_end).twice
259
+ prot = Thrift::BaseProtocol.new(double("trans"))
260
+ expect(prot).to receive(:write_struct_begin).with("SpecNamespace::Xception")
261
+ expect(prot).to receive(:write_struct_end)
262
+ expect(prot).to receive(:write_field_begin).with('message', Thrift::Types::STRING, 1)#, "something happened")
263
+ expect(prot).to receive(:write_string).with("something happened")
264
+ expect(prot).to receive(:write_field_begin).with('code', Thrift::Types::I32, 2)#, 1)
265
+ expect(prot).to receive(:write_i32).with(1)
266
+ expect(prot).to receive(:write_field_stop)
267
+ expect(prot).to receive(:write_field_end).twice
268
268
 
269
269
  e.write(prot)
270
270
  end
@@ -274,17 +274,17 @@ describe 'Struct' do
274
274
  begin
275
275
  raise SpecNamespace::Xception, :message => "something happened", :code => 5
276
276
  rescue Thrift::Exception => e
277
- e.message.should == "something happened"
278
- e.code.should == 5
279
- prot = Thrift::BaseProtocol.new(mock("trans"))
280
- prot.should_receive(:write_struct_begin).with("SpecNamespace::Xception")
281
- prot.should_receive(:write_struct_end)
282
- prot.should_receive(:write_field_begin).with('message', Thrift::Types::STRING, 1)
283
- prot.should_receive(:write_string).with("something happened")
284
- prot.should_receive(:write_field_begin).with('code', Thrift::Types::I32, 2)
285
- prot.should_receive(:write_i32).with(5)
286
- prot.should_receive(:write_field_stop)
287
- prot.should_receive(:write_field_end).twice
277
+ expect(e.message).to eq("something happened")
278
+ expect(e.code).to eq(5)
279
+ prot = Thrift::BaseProtocol.new(double("trans"))
280
+ expect(prot).to receive(:write_struct_begin).with("SpecNamespace::Xception")
281
+ expect(prot).to receive(:write_struct_end)
282
+ expect(prot).to receive(:write_field_begin).with('message', Thrift::Types::STRING, 1)
283
+ expect(prot).to receive(:write_string).with("something happened")
284
+ expect(prot).to receive(:write_field_begin).with('code', Thrift::Types::I32, 2)
285
+ expect(prot).to receive(:write_i32).with(5)
286
+ expect(prot).to receive(:write_field_stop)
287
+ expect(prot).to receive(:write_field_end).twice
288
288
 
289
289
  e.write(prot)
290
290
  end
@@ -23,64 +23,107 @@ require 'thrift/server/thin_http_server'
23
23
  require 'thrift/server/rack_application'
24
24
 
25
25
  describe Thrift::ThinHTTPServer do
26
+ let(:processor) { double('processor') }
26
27
 
27
- let(:processor) { mock('processor') }
28
-
29
- describe "#initialize" do
30
-
31
- context "when using the defaults" do
32
-
28
+ describe '#initialize' do
29
+ context 'when using the defaults' do
33
30
  it "binds to port 80, with host 0.0.0.0, a path of '/'" do
34
- Thin::Server.should_receive(:new).with('0.0.0.0', 80, an_instance_of(Rack::Builder))
31
+ expect(Thin::Server).to receive(:new).with('0.0.0.0', 80, an_instance_of(Rack::Builder))
35
32
  Thrift::ThinHTTPServer.new(processor)
36
33
  end
37
34
 
38
35
  it 'creates a ThinHTTPServer::RackApplicationContext' do
39
- Thrift::RackApplication.should_receive(:for).with("/", processor, an_instance_of(Thrift::BinaryProtocolFactory)).and_return(anything)
36
+ expect(Thrift::RackApplication).to receive(:for).with('/', processor,
37
+ an_instance_of(Thrift::BinaryProtocolFactory)).and_return(anything)
40
38
  Thrift::ThinHTTPServer.new(processor)
41
39
  end
42
40
 
43
- it "uses the BinaryProtocolFactory" do
44
- Thrift::BinaryProtocolFactory.should_receive(:new)
41
+ it 'uses the BinaryProtocolFactory' do
42
+ expect(Thrift::BinaryProtocolFactory).to receive(:new)
45
43
  Thrift::ThinHTTPServer.new(processor)
46
44
  end
47
-
48
45
  end
49
46
 
50
- context "when using the options" do
51
-
47
+ context 'when using the options' do
52
48
  it 'accepts :ip, :port, :path' do
53
- ip = "192.168.0.1"
49
+ ip = '192.168.0.1'
54
50
  port = 3000
55
- path = "/thin"
56
- Thin::Server.should_receive(:new).with(ip, port, an_instance_of(Rack::Builder))
51
+ path = '/thin'
52
+ expect(Thin::Server).to receive(:new).with(ip, port, an_instance_of(Rack::Builder))
57
53
  Thrift::ThinHTTPServer.new(processor,
58
- :ip => ip,
59
- :port => port,
60
- :path => path)
54
+ ip: ip,
55
+ port: port,
56
+ path: path)
61
57
  end
62
58
 
63
59
  it 'creates a ThinHTTPServer::RackApplicationContext with a different protocol factory' do
64
- Thrift::RackApplication.should_receive(:for).with("/", processor, an_instance_of(Thrift::JsonProtocolFactory)).and_return(anything)
60
+ expect(Thrift::RackApplication).to receive(:for).with('/', processor,
61
+ an_instance_of(Thrift::JsonProtocolFactory)).and_return(anything)
65
62
  Thrift::ThinHTTPServer.new(processor,
66
- :protocol_factory => Thrift::JsonProtocolFactory.new)
63
+ protocol_factory: Thrift::JsonProtocolFactory.new)
67
64
  end
68
-
69
65
  end
70
-
71
66
  end
72
67
 
73
- describe "#serve" do
74
-
68
+ describe '#serve' do
75
69
  it 'starts the Thin server' do
76
- underlying_thin_server = mock('thin server', :start => true)
77
- Thin::Server.stub(:new).and_return(underlying_thin_server)
70
+ underlying_thin_server = double('thin server', start: true)
71
+ allow(Thin::Server).to receive(:new).and_return(underlying_thin_server)
78
72
 
79
73
  thin_thrift_server = Thrift::ThinHTTPServer.new(processor)
80
74
 
81
- underlying_thin_server.should_receive(:start)
75
+ expect(underlying_thin_server).to receive(:start)
82
76
  thin_thrift_server.serve
83
77
  end
84
78
  end
79
+ end
80
+
81
+ describe Thrift::RackApplication do
82
+ include Rack::Test::Methods
83
+
84
+ let(:processor) { double('processor') }
85
+ let(:protocol_factory) { double('protocol factory') }
86
+
87
+ def app
88
+ Thrift::RackApplication.for('/', processor, protocol_factory)
89
+ end
90
+
91
+ context '404 response' do
92
+ it 'receives a non-POST' do
93
+ header('Content-Type', 'application/x-thrift')
94
+ get '/'
95
+ expect(last_response.status).to be 404
96
+ end
97
+
98
+ it 'receives a header other than application/x-thrift' do
99
+ header('Content-Type', 'application/json')
100
+ post '/'
101
+ expect(last_response.status).to be 404
102
+ end
103
+ end
104
+
105
+ context '200 response' do
106
+ before do
107
+ allow(protocol_factory).to receive(:get_protocol)
108
+ allow(processor).to receive(:process)
109
+ end
85
110
 
111
+ it 'creates an IOStreamTransport' do
112
+ header('Content-Type', 'application/x-thrift')
113
+ expect(Thrift::IOStreamTransport).to receive(:new).with(an_instance_of(StringIO), an_instance_of(Rack::Response))
114
+ post '/'
115
+ end
116
+
117
+ it 'fetches the right protocol based on the Transport' do
118
+ header('Content-Type', 'application/x-thrift')
119
+ expect(protocol_factory).to receive(:get_protocol).with(an_instance_of(Thrift::IOStreamTransport))
120
+ post '/'
121
+ end
122
+
123
+ it 'status code 200' do
124
+ header('Content-Type', 'application/x-thrift')
125
+ post '/'
126
+ expect(last_response.ok?).to be_truthy
127
+ end
128
+ end
86
129
  end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler ()
2
+ # Autogenerated by Thrift Compiler (v0.0.1-upfluence)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler ()
2
+ # Autogenerated by Thrift Compiler (v0.0.1-upfluence)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
@@ -201,11 +201,11 @@ module SpecNamespace
201
201
 
202
202
  FIELDS = {
203
203
  # A doc string
204
- THRIFT_FIELD_INDEX_STRING_FIELD => {type: ::Thrift::Types::STRING, name: 'string_field', legacy_annotations: THRIFT_FIELD_STRING_FIELD_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_STRING_FIELD_STRUCTURED_ANNOTATIONS},
205
- THRIFT_FIELD_INDEX_I32_FIELD => {type: ::Thrift::Types::I32, name: 'i32_field', legacy_annotations: THRIFT_FIELD_I32_FIELD_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_I32_FIELD_STRUCTURED_ANNOTATIONS},
206
- THRIFT_FIELD_INDEX_OTHER_I32_FIELD => {type: ::Thrift::Types::I32, name: 'other_i32_field', legacy_annotations: THRIFT_FIELD_OTHER_I32_FIELD_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_OTHER_I32_FIELD_STRUCTURED_ANNOTATIONS},
207
- THRIFT_FIELD_INDEX_ENUM_FIELD => {type: ::Thrift::Types::I32, name: 'enum_field', enum_class: ::SpecNamespace::SomeEnum, legacy_annotations: THRIFT_FIELD_ENUM_FIELD_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_ENUM_FIELD_STRUCTURED_ANNOTATIONS},
208
- THRIFT_FIELD_INDEX_BINARY_FIELD => {type: ::Thrift::Types::STRING, name: 'binary_field', binary: true, legacy_annotations: THRIFT_FIELD_BINARY_FIELD_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_BINARY_FIELD_STRUCTURED_ANNOTATIONS}
204
+ THRIFT_FIELD_INDEX_STRING_FIELD => {type: ::Thrift::Types::STRING, name: 'string_field', optional: true, legacy_annotations: THRIFT_FIELD_STRING_FIELD_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_STRING_FIELD_STRUCTURED_ANNOTATIONS},
205
+ THRIFT_FIELD_INDEX_I32_FIELD => {type: ::Thrift::Types::I32, name: 'i32_field', optional: true, legacy_annotations: THRIFT_FIELD_I32_FIELD_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_I32_FIELD_STRUCTURED_ANNOTATIONS},
206
+ THRIFT_FIELD_INDEX_OTHER_I32_FIELD => {type: ::Thrift::Types::I32, name: 'other_i32_field', optional: true, legacy_annotations: THRIFT_FIELD_OTHER_I32_FIELD_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_OTHER_I32_FIELD_STRUCTURED_ANNOTATIONS},
207
+ THRIFT_FIELD_INDEX_ENUM_FIELD => {type: ::Thrift::Types::I32, name: 'enum_field', optional: true, enum_class: ::SpecNamespace::SomeEnum, legacy_annotations: THRIFT_FIELD_ENUM_FIELD_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_ENUM_FIELD_STRUCTURED_ANNOTATIONS},
208
+ THRIFT_FIELD_INDEX_BINARY_FIELD => {type: ::Thrift::Types::STRING, name: 'binary_field', binary: true, optional: true, legacy_annotations: THRIFT_FIELD_BINARY_FIELD_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_BINARY_FIELD_STRUCTURED_ANNOTATIONS}
209
209
  }
210
210
 
211
211
  def struct_fields; FIELDS; end
@@ -667,16 +667,16 @@ module SpecNamespace
667
667
  ].freeze
668
668
 
669
669
  FIELDS = {
670
- THRIFT_FIELD_INDEX_IM_TRUE => {type: ::Thrift::Types::BOOL, name: 'im_true', legacy_annotations: THRIFT_FIELD_IM_TRUE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_IM_TRUE_STRUCTURED_ANNOTATIONS},
671
- THRIFT_FIELD_INDEX_A_BITE => {type: ::Thrift::Types::BYTE, name: 'a_bite', legacy_annotations: THRIFT_FIELD_A_BITE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_A_BITE_STRUCTURED_ANNOTATIONS},
672
- THRIFT_FIELD_INDEX_INTEGER16 => {type: ::Thrift::Types::I16, name: 'integer16', legacy_annotations: THRIFT_FIELD_INTEGER16_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_INTEGER16_STRUCTURED_ANNOTATIONS},
673
- THRIFT_FIELD_INDEX_INTEGER32 => {type: ::Thrift::Types::I32, name: 'integer32', legacy_annotations: THRIFT_FIELD_INTEGER32_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_INTEGER32_STRUCTURED_ANNOTATIONS},
674
- THRIFT_FIELD_INDEX_INTEGER64 => {type: ::Thrift::Types::I64, name: 'integer64', legacy_annotations: THRIFT_FIELD_INTEGER64_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_INTEGER64_STRUCTURED_ANNOTATIONS},
675
- THRIFT_FIELD_INDEX_DOUBLE_PRECISION => {type: ::Thrift::Types::DOUBLE, name: 'double_precision', legacy_annotations: THRIFT_FIELD_DOUBLE_PRECISION_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_DOUBLE_PRECISION_STRUCTURED_ANNOTATIONS},
676
- THRIFT_FIELD_INDEX_SOME_CHARACTERS => {type: ::Thrift::Types::STRING, name: 'some_characters', legacy_annotations: THRIFT_FIELD_SOME_CHARACTERS_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_SOME_CHARACTERS_STRUCTURED_ANNOTATIONS},
677
- THRIFT_FIELD_INDEX_OTHER_I32 => {type: ::Thrift::Types::I32, name: 'other_i32', legacy_annotations: THRIFT_FIELD_OTHER_I32_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_OTHER_I32_STRUCTURED_ANNOTATIONS},
678
- THRIFT_FIELD_INDEX_SOME_ENUM => {type: ::Thrift::Types::I32, name: 'some_enum', enum_class: ::SpecNamespace::SomeEnum, legacy_annotations: THRIFT_FIELD_SOME_ENUM_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_SOME_ENUM_STRUCTURED_ANNOTATIONS},
679
- THRIFT_FIELD_INDEX_MY_MAP => {type: ::Thrift::Types::MAP, name: 'my_map', key: {type: ::Thrift::Types::I32, enum_class: ::SpecNamespace::SomeEnum}, value: {type: ::Thrift::Types::LIST, element: {type: ::Thrift::Types::I32, enum_class: ::SpecNamespace::SomeEnum}}, legacy_annotations: THRIFT_FIELD_MY_MAP_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_MY_MAP_STRUCTURED_ANNOTATIONS}
670
+ THRIFT_FIELD_INDEX_IM_TRUE => {type: ::Thrift::Types::BOOL, name: 'im_true', optional: true, legacy_annotations: THRIFT_FIELD_IM_TRUE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_IM_TRUE_STRUCTURED_ANNOTATIONS},
671
+ THRIFT_FIELD_INDEX_A_BITE => {type: ::Thrift::Types::BYTE, name: 'a_bite', optional: true, legacy_annotations: THRIFT_FIELD_A_BITE_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_A_BITE_STRUCTURED_ANNOTATIONS},
672
+ THRIFT_FIELD_INDEX_INTEGER16 => {type: ::Thrift::Types::I16, name: 'integer16', optional: true, legacy_annotations: THRIFT_FIELD_INTEGER16_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_INTEGER16_STRUCTURED_ANNOTATIONS},
673
+ THRIFT_FIELD_INDEX_INTEGER32 => {type: ::Thrift::Types::I32, name: 'integer32', optional: true, legacy_annotations: THRIFT_FIELD_INTEGER32_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_INTEGER32_STRUCTURED_ANNOTATIONS},
674
+ THRIFT_FIELD_INDEX_INTEGER64 => {type: ::Thrift::Types::I64, name: 'integer64', optional: true, legacy_annotations: THRIFT_FIELD_INTEGER64_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_INTEGER64_STRUCTURED_ANNOTATIONS},
675
+ THRIFT_FIELD_INDEX_DOUBLE_PRECISION => {type: ::Thrift::Types::DOUBLE, name: 'double_precision', optional: true, legacy_annotations: THRIFT_FIELD_DOUBLE_PRECISION_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_DOUBLE_PRECISION_STRUCTURED_ANNOTATIONS},
676
+ THRIFT_FIELD_INDEX_SOME_CHARACTERS => {type: ::Thrift::Types::STRING, name: 'some_characters', optional: true, legacy_annotations: THRIFT_FIELD_SOME_CHARACTERS_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_SOME_CHARACTERS_STRUCTURED_ANNOTATIONS},
677
+ THRIFT_FIELD_INDEX_OTHER_I32 => {type: ::Thrift::Types::I32, name: 'other_i32', optional: true, legacy_annotations: THRIFT_FIELD_OTHER_I32_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_OTHER_I32_STRUCTURED_ANNOTATIONS},
678
+ THRIFT_FIELD_INDEX_SOME_ENUM => {type: ::Thrift::Types::I32, name: 'some_enum', optional: true, enum_class: ::SpecNamespace::SomeEnum, legacy_annotations: THRIFT_FIELD_SOME_ENUM_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_SOME_ENUM_STRUCTURED_ANNOTATIONS},
679
+ THRIFT_FIELD_INDEX_MY_MAP => {type: ::Thrift::Types::MAP, name: 'my_map', key: {type: ::Thrift::Types::I32, enum_class: ::SpecNamespace::SomeEnum}, value: {type: ::Thrift::Types::LIST, element: {type: ::Thrift::Types::I32, enum_class: ::SpecNamespace::SomeEnum}}, optional: true, legacy_annotations: THRIFT_FIELD_MY_MAP_LEGACY_ANNOTATIONS, structured_annotations: THRIFT_FIELD_MY_MAP_STRUCTURED_ANNOTATIONS}
680
680
  }
681
681
 
682
682
  def struct_fields; FIELDS; end
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
- require 'thrift/types/value'
3
- require 'thrift/types/known/any'
2
+ require 'thrift/types/value/value'
3
+ require 'thrift/types/known/any/any'
4
4
 
5
5
  describe 'Thrift::Types::Known::Any' do
6
6
  describe 'encode' do
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
- require 'thrift/types/known/duration'
2
+ require 'thrift/types/known/duration/duration'
3
3
 
4
4
  describe 'Thrift::Types::Known::Duration' do
5
5
  context 'from_number' do
@@ -1,5 +1,5 @@
1
1
  require 'spec_helper'
2
- require 'thrift/types/known/timestamp'
2
+ require 'thrift/types/known/timestamp/timestamp'
3
3
 
4
4
  describe 'Thrift::Types::Known::Timestamp' do
5
5
  context 'from_time' do
@@ -1,6 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'json'
3
- require 'thrift/types/value'
3
+ require 'thrift/types/value/value'
4
+
4
5
 
5
6
  class LocalObject
6
7
  def initialize(foo, bar)