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.
- checksums.yaml +4 -4
- data/benchmark/{gen-rb/benchmark_constants.rb → benchmark_constants.rb} +1 -1
- data/benchmark/{gen-rb/benchmark_service.rb → benchmark_service.rb} +2 -2
- data/benchmark/{gen-rb/benchmark_types.rb → benchmark_types.rb} +1 -1
- data/ext/struct.c +5 -1
- data/lib/thrift/base_stream.rb +85 -0
- data/lib/thrift/bidi_stream.rb +183 -0
- data/lib/thrift/client.rb +84 -17
- data/lib/thrift/inbound_stream.rb +72 -0
- data/lib/thrift/middleware.rb +42 -0
- data/lib/thrift/outbound_stream.rb +52 -0
- data/lib/thrift/processor.rb +287 -47
- data/lib/thrift/protocol/base_protocol.rb +35 -33
- data/lib/thrift/protocol/binary_protocol.rb +8 -1
- data/lib/thrift/protocol/binary_protocol_accelerated.rb +8 -0
- data/lib/thrift/protocol/compact_protocol.rb +8 -0
- data/lib/thrift/protocol/json_protocol.rb +21 -4
- data/lib/thrift/protocol/multiplexed_protocol.rb +5 -1
- data/lib/thrift/server/base_server.rb +8 -2
- data/lib/thrift/server/nonblocking_server.rb +5 -4
- data/lib/thrift/server/simple_server.rb +5 -1
- data/lib/thrift/server/thread_pool_server.rb +5 -1
- data/lib/thrift/server/threaded_server.rb +5 -1
- data/lib/thrift/transport/base_server_transport.rb +1 -1
- data/lib/thrift/transport/base_transport.rb +8 -0
- data/lib/thrift/transport/buffered_transport.rb +9 -1
- data/lib/thrift/transport/framed_transport.rb +9 -1
- data/lib/thrift/transport/http_client_transport.rb +4 -0
- data/lib/thrift/transport/io_stream_transport.rb +4 -1
- data/lib/thrift/transport/memory_buffer_transport.rb +4 -0
- data/lib/thrift/transport/server_socket.rb +5 -0
- data/lib/thrift/transport/socket.rb +21 -17
- data/lib/thrift/transport/ssl_server_socket.rb +41 -0
- data/lib/thrift/transport/ssl_socket.rb +51 -0
- data/lib/thrift/transport/unix_server_socket.rb +5 -1
- data/lib/thrift/transport/unix_socket.rb +5 -1
- data/lib/thrift/types/annotation/deprecation/deprecation_constants.rb +1 -1
- data/lib/thrift/types/annotation/deprecation/deprecation_types.rb +2 -2
- data/lib/thrift/types/annotation/exception/exception_constants.rb +17 -0
- data/lib/thrift/types/annotation/exception/exception_types.rb +44 -0
- data/lib/thrift/types/annotation/naming/naming_constants.rb +1 -1
- data/lib/thrift/types/annotation/naming/naming_types.rb +2 -2
- data/lib/thrift/types/annotation/rpc/rpc_constants.rb +17 -0
- data/lib/thrift/types/annotation/rpc/rpc_types.rb +74 -0
- data/lib/thrift/types/annotation_definition/annotation_definition_constants.rb +15 -0
- data/lib/thrift/types/annotation_definition/annotation_definition_types.rb +116 -0
- data/lib/thrift/types/constant_definition/constant_definition_constants.rb +15 -0
- data/lib/thrift/types/constant_definition/constant_definition_types.rb +292 -0
- data/lib/thrift/types/core/core_constants.rb +15 -0
- data/lib/thrift/types/core/core_types.rb +58 -0
- data/lib/thrift/types/enum_definition/enum_definition_constants.rb +15 -0
- data/lib/thrift/types/enum_definition/enum_definition_types.rb +106 -0
- data/lib/thrift/types/known/any/any_constants.rb +1 -1
- data/lib/thrift/types/known/any/any_types.rb +2 -2
- data/lib/thrift/types/known/duration/duration_constants.rb +1 -1
- data/lib/thrift/types/known/duration/duration_types.rb +2 -2
- data/lib/thrift/types/known/timestamp/timestamp_constants.rb +1 -1
- data/lib/thrift/types/known/timestamp/timestamp_types.rb +2 -2
- data/lib/thrift/types/plugin/plugin.rb +139 -0
- data/lib/thrift/types/plugin/plugin_constants.rb +15 -0
- data/lib/thrift/types/plugin/plugin_types.rb +106 -0
- data/lib/thrift/types/program_definition/program_definition_constants.rb +15 -0
- data/lib/thrift/types/program_definition/program_definition_types.rb +137 -0
- data/lib/thrift/types/service_definition/service_definition_constants.rb +15 -0
- data/lib/thrift/types/service_definition/service_definition_types.rb +160 -0
- data/lib/thrift/types/struct_definition/struct_definition_constants.rb +15 -0
- data/lib/thrift/types/struct_definition/struct_definition_types.rb +157 -0
- data/lib/thrift/types/type_definition/type_definition_constants.rb +15 -0
- data/lib/thrift/types/type_definition/type_definition_types.rb +242 -0
- data/lib/thrift/types/value/value_constants.rb +1 -1
- data/lib/thrift/types/value/value_types.rb +50 -51
- data/lib/thrift/types.rb +11 -3
- data/lib/thrift/union.rb +3 -6
- data/lib/thrift.rb +6 -0
- data/lib/types/annotation/deprecation/deprecation_constants.rb +16 -0
- data/lib/types/annotation/deprecation/deprecation_types.rb +42 -0
- data/lib/types/annotation/naming/naming_constants.rb +16 -0
- data/lib/types/annotation/naming/naming_types.rb +57 -0
- data/lib/types/annotation_definition/annotation_definition_constants.rb +14 -0
- data/lib/types/annotation_definition/annotation_definition_types.rb +114 -0
- data/lib/types/constant_definition/constant_definition_constants.rb +14 -0
- data/lib/types/constant_definition/constant_definition_types.rb +290 -0
- data/lib/types/core/core_constants.rb +14 -0
- data/lib/types/core/core_types.rb +56 -0
- data/lib/types/enum_definition/enum_definition_constants.rb +14 -0
- data/lib/types/enum_definition/enum_definition_types.rb +104 -0
- data/lib/types/known/any/any_constants.rb +16 -0
- data/lib/types/known/any/any_types.rb +59 -0
- data/lib/types/known/duration/duration_constants.rb +16 -0
- data/lib/types/known/duration/duration_types.rb +59 -0
- data/lib/types/known/timestamp/timestamp_constants.rb +16 -0
- data/lib/types/known/timestamp/timestamp_types.rb +59 -0
- data/lib/types/plugin/plugin.rb +137 -0
- data/lib/types/plugin/plugin_constants.rb +14 -0
- data/lib/types/plugin/plugin_types.rb +104 -0
- data/lib/types/program_definition/program_definition_constants.rb +14 -0
- data/lib/types/program_definition/program_definition_types.rb +135 -0
- data/lib/types/service_definition/service_definition_constants.rb +14 -0
- data/lib/types/service_definition/service_definition_types.rb +158 -0
- data/lib/types/struct_definition/struct_definition_constants.rb +14 -0
- data/lib/types/struct_definition/struct_definition_types.rb +155 -0
- data/lib/types/type_definition/type_definition_constants.rb +14 -0
- data/lib/types/type_definition/type_definition_types.rb +240 -0
- data/lib/types/value/value_constants.rb +14 -0
- data/lib/types/value/value_types.rb +330 -0
- data/spec/{gen-rb/base → base}/base_service.rb +2 -2
- data/spec/{gen-rb/base → base}/base_service_constants.rb +1 -1
- data/spec/{gen-rb/base → base}/base_service_types.rb +1 -1
- data/spec/base_protocol_spec.rb +79 -71
- data/spec/base_transport_spec.rb +155 -117
- data/spec/binary_protocol_accelerated_spec.rb +6 -2
- data/spec/binary_protocol_spec.rb +16 -8
- data/spec/binary_protocol_spec_shared.rb +77 -77
- data/spec/bytes_spec.rb +38 -38
- data/spec/client_spec.rb +48 -50
- data/spec/compact_protocol_spec.rb +59 -46
- data/spec/exception_spec.rb +54 -54
- data/spec/{gen-rb/extended → extended}/extended_service.rb +2 -2
- data/spec/{gen-rb/extended → extended}/extended_service_constants.rb +1 -1
- data/spec/{gen-rb/extended → extended}/extended_service_types.rb +1 -1
- data/spec/flat_spec.rb +5 -5
- data/spec/gen-rb/flat/namespaced_nonblocking_service.rb +4 -4
- data/spec/gen-rb/flat/referenced_constants.rb +1 -1
- data/spec/gen-rb/flat/referenced_types.rb +1 -1
- data/spec/gen-rb/flat/thrift_namespaced_spec_constants.rb +1 -1
- data/spec/gen-rb/flat/thrift_namespaced_spec_types.rb +1 -1
- data/spec/http_client_spec.rb +96 -43
- data/spec/json_protocol_spec.rb +170 -131
- data/spec/namespaced_spec.rb +24 -27
- data/spec/{gen-rb/namespaced_spec_namespace → namespaced_spec_namespace}/namespaced_nonblocking_service.rb +4 -4
- data/spec/{gen-rb/namespaced_spec_namespace → namespaced_spec_namespace}/thrift_namespaced_spec_constants.rb +1 -1
- data/spec/{gen-rb/namespaced_spec_namespace → namespaced_spec_namespace}/thrift_namespaced_spec_types.rb +1 -1
- data/spec/nonblocking_server_spec.rb +16 -16
- data/spec/{gen-rb/nonblocking_service.rb → nonblocking_service.rb} +4 -4
- data/spec/{gen-rb/other_namespace → other_namespace}/referenced_constants.rb +1 -1
- data/spec/{gen-rb/other_namespace → other_namespace}/referenced_types.rb +1 -1
- data/spec/processor_spec.rb +42 -31
- data/spec/rack_application_spec.rb +22 -26
- data/spec/serializer_spec.rb +20 -20
- data/spec/server_socket_spec.rb +27 -22
- data/spec/server_spec.rb +91 -51
- data/spec/socket_spec.rb +23 -16
- data/spec/socket_spec_shared.rb +31 -31
- data/spec/spec_helper.rb +1 -1
- data/spec/ssl_server_socket_spec.rb +34 -0
- data/spec/ssl_socket_spec.rb +78 -0
- data/spec/streaming_spec.rb +442 -0
- data/spec/struct_nested_containers_spec.rb +24 -24
- data/spec/struct_spec.rb +120 -120
- data/spec/thin_http_server_spec.rb +71 -28
- data/spec/{gen-rb/thrift_spec_constants.rb → thrift_spec_constants.rb} +1 -1
- data/spec/{gen-rb/thrift_spec_types.rb → thrift_spec_types.rb} +16 -16
- data/spec/types/known/any_spec.rb +2 -2
- data/spec/types/known/duration_spec.rb +1 -1
- data/spec/types/known/timestamp_spec.rb +1 -1
- data/spec/types/value_spec.rb +2 -1
- data/spec/types_spec.rb +56 -53
- data/spec/union_spec.rb +51 -40
- data/spec/unix_socket_spec.rb +43 -34
- data/test/debug_proto/gen-rb/debug_proto_test_constants.rb +267 -260
- data/test/debug_proto/gen-rb/debug_proto_test_types.rb +1481 -1416
- data/test/debug_proto/gen-rb/empty_service.rb +31 -27
- data/test/debug_proto/gen-rb/inherited.rb +102 -98
- data/test/debug_proto/gen-rb/reverse_order_service.rb +112 -108
- data/test/debug_proto/gen-rb/service_for_exception_with_a_map.rb +99 -95
- data/test/debug_proto/gen-rb/srv.rb +525 -406
- metadata +178 -41
data/spec/json_protocol_spec.rb
CHANGED
|
@@ -47,252 +47,257 @@ describe 'JsonProtocol' do
|
|
|
47
47
|
|
|
48
48
|
it "should write json escaped char" do
|
|
49
49
|
@prot.write_json_escape_char("\n")
|
|
50
|
-
@trans.read(@trans.available).
|
|
50
|
+
expect(@trans.read(@trans.available)).to eq('\u000a')
|
|
51
51
|
|
|
52
52
|
@prot.write_json_escape_char(" ")
|
|
53
|
-
@trans.read(@trans.available).
|
|
53
|
+
expect(@trans.read(@trans.available)).to eq('\u0020')
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
it "should write json char" do
|
|
57
57
|
@prot.write_json_char("\n")
|
|
58
|
-
@trans.read(@trans.available).
|
|
58
|
+
expect(@trans.read(@trans.available)).to eq('\\n')
|
|
59
59
|
|
|
60
60
|
@prot.write_json_char(" ")
|
|
61
|
-
@trans.read(@trans.available).
|
|
61
|
+
expect(@trans.read(@trans.available)).to eq(' ')
|
|
62
62
|
|
|
63
63
|
@prot.write_json_char("\\")
|
|
64
|
-
@trans.read(@trans.available).
|
|
64
|
+
expect(@trans.read(@trans.available)).to eq("\\\\")
|
|
65
65
|
|
|
66
66
|
@prot.write_json_char("@")
|
|
67
|
-
@trans.read(@trans.available).
|
|
67
|
+
expect(@trans.read(@trans.available)).to eq('@')
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
it "should write json string" do
|
|
71
71
|
@prot.write_json_string("this is a \\ json\nstring")
|
|
72
|
-
@trans.read(@trans.available).
|
|
72
|
+
expect(@trans.read(@trans.available)).to eq("\"this is a \\\\ json\\nstring\"")
|
|
73
73
|
end
|
|
74
74
|
|
|
75
75
|
it "should write json base64" do
|
|
76
76
|
@prot.write_json_base64("this is a base64 string")
|
|
77
|
-
@trans.read(@trans.available).
|
|
77
|
+
expect(@trans.read(@trans.available)).to eq("\"dGhpcyBpcyBhIGJhc2U2NCBzdHJpbmc=\"")
|
|
78
78
|
end
|
|
79
79
|
|
|
80
80
|
it "should write json integer" do
|
|
81
81
|
@prot.write_json_integer(45)
|
|
82
|
-
@trans.read(@trans.available).
|
|
82
|
+
expect(@trans.read(@trans.available)).to eq("45")
|
|
83
83
|
|
|
84
84
|
@prot.write_json_integer(33000)
|
|
85
|
-
@trans.read(@trans.available).
|
|
85
|
+
expect(@trans.read(@trans.available)).to eq("33000")
|
|
86
86
|
|
|
87
87
|
@prot.write_json_integer(3000000000)
|
|
88
|
-
@trans.read(@trans.available).
|
|
88
|
+
expect(@trans.read(@trans.available)).to eq("3000000000")
|
|
89
89
|
|
|
90
90
|
@prot.write_json_integer(6000000000)
|
|
91
|
-
@trans.read(@trans.available).
|
|
91
|
+
expect(@trans.read(@trans.available)).to eq("6000000000")
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
it "should write json double" do
|
|
95
95
|
@prot.write_json_double(12.3)
|
|
96
|
-
@trans.read(@trans.available).
|
|
96
|
+
expect(@trans.read(@trans.available)).to eq("12.3")
|
|
97
97
|
|
|
98
98
|
@prot.write_json_double(-3.21)
|
|
99
|
-
@trans.read(@trans.available).
|
|
99
|
+
expect(@trans.read(@trans.available)).to eq("-3.21")
|
|
100
100
|
|
|
101
101
|
@prot.write_json_double(((+1.0/0.0)/(+1.0/0.0)))
|
|
102
|
-
@trans.read(@trans.available).
|
|
102
|
+
expect(@trans.read(@trans.available)).to eq("\"NaN\"")
|
|
103
103
|
|
|
104
104
|
@prot.write_json_double((+1.0/0.0))
|
|
105
|
-
@trans.read(@trans.available).
|
|
105
|
+
expect(@trans.read(@trans.available)).to eq("\"Infinity\"")
|
|
106
106
|
|
|
107
107
|
@prot.write_json_double((-1.0/0.0))
|
|
108
|
-
@trans.read(@trans.available).
|
|
108
|
+
expect(@trans.read(@trans.available)).to eq("\"-Infinity\"")
|
|
109
109
|
end
|
|
110
110
|
|
|
111
111
|
it "should write json object start" do
|
|
112
112
|
@prot.write_json_object_start
|
|
113
|
-
@trans.read(@trans.available).
|
|
113
|
+
expect(@trans.read(@trans.available)).to eq("{")
|
|
114
114
|
end
|
|
115
115
|
|
|
116
116
|
it "should write json object end" do
|
|
117
117
|
@prot.write_json_object_end
|
|
118
|
-
@trans.read(@trans.available).
|
|
118
|
+
expect(@trans.read(@trans.available)).to eq("}")
|
|
119
119
|
end
|
|
120
120
|
|
|
121
121
|
it "should write json array start" do
|
|
122
122
|
@prot.write_json_array_start
|
|
123
|
-
@trans.read(@trans.available).
|
|
123
|
+
expect(@trans.read(@trans.available)).to eq("[")
|
|
124
124
|
end
|
|
125
125
|
|
|
126
126
|
it "should write json array end" do
|
|
127
127
|
@prot.write_json_array_end
|
|
128
|
-
@trans.read(@trans.available).
|
|
128
|
+
expect(@trans.read(@trans.available)).to eq("]")
|
|
129
129
|
end
|
|
130
130
|
|
|
131
131
|
it "should write message begin" do
|
|
132
132
|
@prot.write_message_begin("name", 12, 32)
|
|
133
|
-
@trans.read(@trans.available).
|
|
133
|
+
expect(@trans.read(@trans.available)).to eq("[1,\"name\",12,32")
|
|
134
134
|
end
|
|
135
135
|
|
|
136
136
|
it "should write message end" do
|
|
137
137
|
@prot.write_message_end
|
|
138
|
-
@trans.read(@trans.available).
|
|
138
|
+
expect(@trans.read(@trans.available)).to eq("]")
|
|
139
139
|
end
|
|
140
140
|
|
|
141
141
|
it "should write struct begin" do
|
|
142
142
|
@prot.write_struct_begin("name")
|
|
143
|
-
@trans.read(@trans.available).
|
|
143
|
+
expect(@trans.read(@trans.available)).to eq("{")
|
|
144
144
|
end
|
|
145
145
|
|
|
146
146
|
it "should write struct end" do
|
|
147
147
|
@prot.write_struct_end
|
|
148
|
-
@trans.read(@trans.available).
|
|
148
|
+
expect(@trans.read(@trans.available)).to eq("}")
|
|
149
149
|
end
|
|
150
150
|
|
|
151
151
|
it "should write field begin" do
|
|
152
152
|
@prot.write_field_begin("name", Thrift::Types::STRUCT, 32)
|
|
153
|
-
@trans.read(@trans.available).
|
|
153
|
+
expect(@trans.read(@trans.available)).to eq("32{\"rec\"")
|
|
154
154
|
end
|
|
155
155
|
|
|
156
156
|
it "should write field end" do
|
|
157
157
|
@prot.write_field_end
|
|
158
|
-
@trans.read(@trans.available).
|
|
158
|
+
expect(@trans.read(@trans.available)).to eq("}")
|
|
159
159
|
end
|
|
160
160
|
|
|
161
161
|
it "should write field stop" do
|
|
162
162
|
@prot.write_field_stop
|
|
163
|
-
@trans.read(@trans.available).
|
|
163
|
+
expect(@trans.read(@trans.available)).to eq("")
|
|
164
164
|
end
|
|
165
165
|
|
|
166
166
|
it "should write map begin" do
|
|
167
167
|
@prot.write_map_begin(Thrift::Types::STRUCT, Thrift::Types::LIST, 32)
|
|
168
|
-
@trans.read(@trans.available).
|
|
168
|
+
expect(@trans.read(@trans.available)).to eq("[\"rec\",\"lst\",32,{")
|
|
169
169
|
end
|
|
170
170
|
|
|
171
171
|
it "should write map end" do
|
|
172
172
|
@prot.write_map_end
|
|
173
|
-
@trans.read(@trans.available).
|
|
173
|
+
expect(@trans.read(@trans.available)).to eq("}]")
|
|
174
174
|
end
|
|
175
175
|
|
|
176
176
|
it "should write list begin" do
|
|
177
177
|
@prot.write_list_begin(Thrift::Types::STRUCT, 32)
|
|
178
|
-
@trans.read(@trans.available).
|
|
178
|
+
expect(@trans.read(@trans.available)).to eq("[\"rec\",32")
|
|
179
179
|
end
|
|
180
180
|
|
|
181
181
|
it "should write list end" do
|
|
182
182
|
@prot.write_list_end
|
|
183
|
-
@trans.read(@trans.available).
|
|
183
|
+
expect(@trans.read(@trans.available)).to eq("]")
|
|
184
184
|
end
|
|
185
185
|
|
|
186
186
|
it "should write set begin" do
|
|
187
187
|
@prot.write_set_begin(Thrift::Types::STRUCT, 32)
|
|
188
|
-
@trans.read(@trans.available).
|
|
188
|
+
expect(@trans.read(@trans.available)).to eq("[\"rec\",32")
|
|
189
189
|
end
|
|
190
190
|
|
|
191
191
|
it "should write set end" do
|
|
192
192
|
@prot.write_set_end
|
|
193
|
-
@trans.read(@trans.available).
|
|
193
|
+
expect(@trans.read(@trans.available)).to eq("]")
|
|
194
194
|
end
|
|
195
195
|
|
|
196
196
|
it "should write bool" do
|
|
197
197
|
@prot.write_bool(true)
|
|
198
|
-
@trans.read(@trans.available).
|
|
198
|
+
expect(@trans.read(@trans.available)).to eq("1")
|
|
199
199
|
|
|
200
200
|
@prot.write_bool(false)
|
|
201
|
-
@trans.read(@trans.available).
|
|
201
|
+
expect(@trans.read(@trans.available)).to eq("0")
|
|
202
202
|
end
|
|
203
203
|
|
|
204
204
|
it "should write byte" do
|
|
205
205
|
@prot.write_byte(100)
|
|
206
|
-
@trans.read(@trans.available).
|
|
206
|
+
expect(@trans.read(@trans.available)).to eq("100")
|
|
207
207
|
end
|
|
208
208
|
|
|
209
209
|
it "should write i16" do
|
|
210
210
|
@prot.write_i16(1000)
|
|
211
|
-
@trans.read(@trans.available).
|
|
211
|
+
expect(@trans.read(@trans.available)).to eq("1000")
|
|
212
212
|
end
|
|
213
213
|
|
|
214
214
|
it "should write i32" do
|
|
215
215
|
@prot.write_i32(3000000000)
|
|
216
|
-
@trans.read(@trans.available).
|
|
216
|
+
expect(@trans.read(@trans.available)).to eq("3000000000")
|
|
217
217
|
end
|
|
218
218
|
|
|
219
219
|
it "should write i64" do
|
|
220
220
|
@prot.write_i64(6000000000)
|
|
221
|
-
@trans.read(@trans.available).
|
|
221
|
+
expect(@trans.read(@trans.available)).to eq("6000000000")
|
|
222
222
|
end
|
|
223
223
|
|
|
224
224
|
it "should write double" do
|
|
225
225
|
@prot.write_double(1.23)
|
|
226
|
-
@trans.read(@trans.available).
|
|
226
|
+
expect(@trans.read(@trans.available)).to eq("1.23")
|
|
227
227
|
|
|
228
228
|
@prot.write_double(-32.1)
|
|
229
|
-
@trans.read(@trans.available).
|
|
229
|
+
expect(@trans.read(@trans.available)).to eq("-32.1")
|
|
230
230
|
|
|
231
231
|
@prot.write_double(((+1.0/0.0)/(+1.0/0.0)))
|
|
232
|
-
@trans.read(@trans.available).
|
|
232
|
+
expect(@trans.read(@trans.available)).to eq("\"NaN\"")
|
|
233
233
|
|
|
234
234
|
@prot.write_double((+1.0/0.0))
|
|
235
|
-
@trans.read(@trans.available).
|
|
235
|
+
expect(@trans.read(@trans.available)).to eq("\"Infinity\"")
|
|
236
236
|
|
|
237
237
|
@prot.write_double((-1.0/0.0))
|
|
238
|
-
@trans.read(@trans.available).
|
|
238
|
+
expect(@trans.read(@trans.available)).to eq("\"-Infinity\"")
|
|
239
239
|
end
|
|
240
240
|
|
|
241
241
|
if RUBY_VERSION >= '1.9'
|
|
242
242
|
it 'should write string' do
|
|
243
243
|
@prot.write_string('this is a test string')
|
|
244
244
|
a = @trans.read(@trans.available)
|
|
245
|
-
a.
|
|
246
|
-
a.encoding.
|
|
245
|
+
expect(a).to eq('"this is a test string"'.force_encoding(Encoding::BINARY))
|
|
246
|
+
expect(a.encoding).to eq(Encoding::BINARY)
|
|
247
247
|
end
|
|
248
248
|
|
|
249
249
|
it 'should write string with unicode characters' do
|
|
250
250
|
@prot.write_string("this is a test string with unicode characters: \u20AC \u20AD")
|
|
251
251
|
a = @trans.read(@trans.available)
|
|
252
|
-
a.
|
|
253
|
-
a.encoding.
|
|
252
|
+
expect(a).to eq("\"this is a test string with unicode characters: \u20AC \u20AD\"".force_encoding(Encoding::BINARY))
|
|
253
|
+
expect(a.encoding).to eq(Encoding::BINARY)
|
|
254
254
|
end
|
|
255
255
|
else
|
|
256
256
|
it 'should write string' do
|
|
257
257
|
@prot.write_string('this is a test string')
|
|
258
|
-
@trans.read(@trans.available).
|
|
258
|
+
expect(@trans.read(@trans.available)).to eq('"this is a test string"')
|
|
259
259
|
end
|
|
260
260
|
end
|
|
261
261
|
|
|
262
262
|
it "should write binary" do
|
|
263
263
|
@prot.write_binary("this is a base64 string")
|
|
264
|
-
@trans.read(@trans.available).
|
|
264
|
+
expect(@trans.read(@trans.available)).to eq("\"dGhpcyBpcyBhIGJhc2U2NCBzdHJpbmc=\"")
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
it "should write long binary" do
|
|
268
|
+
@prot.write_binary((0...256).to_a.pack('C*'))
|
|
269
|
+
expect(@trans.read(@trans.available)).to eq("\"AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w==\"")
|
|
265
270
|
end
|
|
266
271
|
|
|
267
272
|
it "should get type name for type id" do
|
|
268
273
|
expect {@prot.get_type_name_for_type_id(Thrift::Types::STOP)}.to raise_error(NotImplementedError)
|
|
269
274
|
expect {@prot.get_type_name_for_type_id(Thrift::Types::VOID)}.to raise_error(NotImplementedError)
|
|
270
|
-
@prot.get_type_name_for_type_id(Thrift::Types::BOOL).
|
|
271
|
-
@prot.get_type_name_for_type_id(Thrift::Types::BYTE).
|
|
272
|
-
@prot.get_type_name_for_type_id(Thrift::Types::DOUBLE).
|
|
273
|
-
@prot.get_type_name_for_type_id(Thrift::Types::I16).
|
|
274
|
-
@prot.get_type_name_for_type_id(Thrift::Types::I32).
|
|
275
|
-
@prot.get_type_name_for_type_id(Thrift::Types::I64).
|
|
276
|
-
@prot.get_type_name_for_type_id(Thrift::Types::STRING).
|
|
277
|
-
@prot.get_type_name_for_type_id(Thrift::Types::STRUCT).
|
|
278
|
-
@prot.get_type_name_for_type_id(Thrift::Types::MAP).
|
|
279
|
-
@prot.get_type_name_for_type_id(Thrift::Types::SET).
|
|
280
|
-
@prot.get_type_name_for_type_id(Thrift::Types::LIST).
|
|
275
|
+
expect(@prot.get_type_name_for_type_id(Thrift::Types::BOOL)).to eq("tf")
|
|
276
|
+
expect(@prot.get_type_name_for_type_id(Thrift::Types::BYTE)).to eq("i8")
|
|
277
|
+
expect(@prot.get_type_name_for_type_id(Thrift::Types::DOUBLE)).to eq("dbl")
|
|
278
|
+
expect(@prot.get_type_name_for_type_id(Thrift::Types::I16)).to eq("i16")
|
|
279
|
+
expect(@prot.get_type_name_for_type_id(Thrift::Types::I32)).to eq("i32")
|
|
280
|
+
expect(@prot.get_type_name_for_type_id(Thrift::Types::I64)).to eq("i64")
|
|
281
|
+
expect(@prot.get_type_name_for_type_id(Thrift::Types::STRING)).to eq("str")
|
|
282
|
+
expect(@prot.get_type_name_for_type_id(Thrift::Types::STRUCT)).to eq("rec")
|
|
283
|
+
expect(@prot.get_type_name_for_type_id(Thrift::Types::MAP)).to eq("map")
|
|
284
|
+
expect(@prot.get_type_name_for_type_id(Thrift::Types::SET)).to eq("set")
|
|
285
|
+
expect(@prot.get_type_name_for_type_id(Thrift::Types::LIST)).to eq("lst")
|
|
281
286
|
end
|
|
282
287
|
|
|
283
288
|
it "should get type id for type name" do
|
|
284
289
|
expect {@prot.get_type_id_for_type_name("pp")}.to raise_error(NotImplementedError)
|
|
285
|
-
@prot.get_type_id_for_type_name("tf").
|
|
286
|
-
@prot.get_type_id_for_type_name("i8").
|
|
287
|
-
@prot.get_type_id_for_type_name("dbl").
|
|
288
|
-
@prot.get_type_id_for_type_name("i16").
|
|
289
|
-
@prot.get_type_id_for_type_name("i32").
|
|
290
|
-
@prot.get_type_id_for_type_name("i64").
|
|
291
|
-
@prot.get_type_id_for_type_name("str").
|
|
292
|
-
@prot.get_type_id_for_type_name("rec").
|
|
293
|
-
@prot.get_type_id_for_type_name("map").
|
|
294
|
-
@prot.get_type_id_for_type_name("set").
|
|
295
|
-
@prot.get_type_id_for_type_name("lst").
|
|
290
|
+
expect(@prot.get_type_id_for_type_name("tf")).to eq(Thrift::Types::BOOL)
|
|
291
|
+
expect(@prot.get_type_id_for_type_name("i8")).to eq(Thrift::Types::BYTE)
|
|
292
|
+
expect(@prot.get_type_id_for_type_name("dbl")).to eq(Thrift::Types::DOUBLE)
|
|
293
|
+
expect(@prot.get_type_id_for_type_name("i16")).to eq(Thrift::Types::I16)
|
|
294
|
+
expect(@prot.get_type_id_for_type_name("i32")).to eq(Thrift::Types::I32)
|
|
295
|
+
expect(@prot.get_type_id_for_type_name("i64")).to eq(Thrift::Types::I64)
|
|
296
|
+
expect(@prot.get_type_id_for_type_name("str")).to eq(Thrift::Types::STRING)
|
|
297
|
+
expect(@prot.get_type_id_for_type_name("rec")).to eq(Thrift::Types::STRUCT)
|
|
298
|
+
expect(@prot.get_type_id_for_type_name("map")).to eq(Thrift::Types::MAP)
|
|
299
|
+
expect(@prot.get_type_id_for_type_name("set")).to eq(Thrift::Types::SET)
|
|
300
|
+
expect(@prot.get_type_id_for_type_name("lst")).to eq(Thrift::Types::LIST)
|
|
296
301
|
end
|
|
297
302
|
|
|
298
303
|
it "should read json syntax char" do
|
|
@@ -304,47 +309,68 @@ describe 'JsonProtocol' do
|
|
|
304
309
|
|
|
305
310
|
it "should read json escape char" do
|
|
306
311
|
@trans.write('0054')
|
|
307
|
-
@prot.read_json_escape_char.
|
|
312
|
+
expect(@prot.read_json_escape_char).to eq('T')
|
|
313
|
+
|
|
314
|
+
@trans.write("\"\\\"\"")
|
|
315
|
+
expect(@prot.read_json_string(false)).to eq("\"")
|
|
316
|
+
|
|
317
|
+
@trans.write("\"\\\\\"")
|
|
318
|
+
expect(@prot.read_json_string(false)).to eq("\\")
|
|
319
|
+
|
|
320
|
+
@trans.write("\"\\/\"")
|
|
321
|
+
expect(@prot.read_json_string(false)).to eq("\/")
|
|
322
|
+
|
|
323
|
+
@trans.write("\"\\b\"")
|
|
324
|
+
expect(@prot.read_json_string(false)).to eq("\b")
|
|
325
|
+
|
|
326
|
+
@trans.write("\"\\f\"")
|
|
327
|
+
expect(@prot.read_json_string(false)).to eq("\f")
|
|
328
|
+
|
|
329
|
+
@trans.write("\"\\n\"")
|
|
330
|
+
expect(@prot.read_json_string(false)).to eq("\n")
|
|
331
|
+
|
|
332
|
+
@trans.write("\"\\r\"")
|
|
333
|
+
expect(@prot.read_json_string(false)).to eq("\r")
|
|
334
|
+
|
|
335
|
+
@trans.write("\"\\t\"")
|
|
336
|
+
expect(@prot.read_json_string(false)).to eq("\t")
|
|
308
337
|
end
|
|
309
338
|
|
|
310
339
|
it "should read json string" do
|
|
311
340
|
@trans.write("\"\\P")
|
|
312
341
|
expect {@prot.read_json_string(false)}.to raise_error(Thrift::ProtocolException)
|
|
313
342
|
|
|
314
|
-
@trans.write("\"\\n\"")
|
|
315
|
-
@prot.read_json_string(false).should == "\\n"
|
|
316
|
-
|
|
317
343
|
@trans.write("\"this is a test string\"")
|
|
318
|
-
@prot.read_json_string.
|
|
344
|
+
expect(@prot.read_json_string).to eq("this is a test string")
|
|
319
345
|
end
|
|
320
346
|
|
|
321
347
|
it "should read json base64" do
|
|
322
348
|
@trans.write("\"dGhpcyBpcyBhIHRlc3Qgc3RyaW5n\"")
|
|
323
|
-
@prot.read_json_base64.
|
|
349
|
+
expect(@prot.read_json_base64).to eq("this is a test string")
|
|
324
350
|
end
|
|
325
351
|
|
|
326
352
|
it "should is json numeric" do
|
|
327
|
-
@prot.is_json_numeric("A").
|
|
328
|
-
@prot.is_json_numeric("+").
|
|
329
|
-
@prot.is_json_numeric("-").
|
|
330
|
-
@prot.is_json_numeric(".").
|
|
331
|
-
@prot.is_json_numeric("0").
|
|
332
|
-
@prot.is_json_numeric("1").
|
|
333
|
-
@prot.is_json_numeric("2").
|
|
334
|
-
@prot.is_json_numeric("3").
|
|
335
|
-
@prot.is_json_numeric("4").
|
|
336
|
-
@prot.is_json_numeric("5").
|
|
337
|
-
@prot.is_json_numeric("6").
|
|
338
|
-
@prot.is_json_numeric("7").
|
|
339
|
-
@prot.is_json_numeric("8").
|
|
340
|
-
@prot.is_json_numeric("9").
|
|
341
|
-
@prot.is_json_numeric("E").
|
|
342
|
-
@prot.is_json_numeric("e").
|
|
353
|
+
expect(@prot.is_json_numeric("A")).to eq(false)
|
|
354
|
+
expect(@prot.is_json_numeric("+")).to eq(true)
|
|
355
|
+
expect(@prot.is_json_numeric("-")).to eq(true)
|
|
356
|
+
expect(@prot.is_json_numeric(".")).to eq(true)
|
|
357
|
+
expect(@prot.is_json_numeric("0")).to eq(true)
|
|
358
|
+
expect(@prot.is_json_numeric("1")).to eq(true)
|
|
359
|
+
expect(@prot.is_json_numeric("2")).to eq(true)
|
|
360
|
+
expect(@prot.is_json_numeric("3")).to eq(true)
|
|
361
|
+
expect(@prot.is_json_numeric("4")).to eq(true)
|
|
362
|
+
expect(@prot.is_json_numeric("5")).to eq(true)
|
|
363
|
+
expect(@prot.is_json_numeric("6")).to eq(true)
|
|
364
|
+
expect(@prot.is_json_numeric("7")).to eq(true)
|
|
365
|
+
expect(@prot.is_json_numeric("8")).to eq(true)
|
|
366
|
+
expect(@prot.is_json_numeric("9")).to eq(true)
|
|
367
|
+
expect(@prot.is_json_numeric("E")).to eq(true)
|
|
368
|
+
expect(@prot.is_json_numeric("e")).to eq(true)
|
|
343
369
|
end
|
|
344
370
|
|
|
345
371
|
it "should read json numeric chars" do
|
|
346
372
|
@trans.write("1.453E45T")
|
|
347
|
-
@prot.read_json_numeric_chars.
|
|
373
|
+
expect(@prot.read_json_numeric_chars).to eq("1.453E45")
|
|
348
374
|
end
|
|
349
375
|
|
|
350
376
|
it "should read json integer" do
|
|
@@ -353,7 +379,7 @@ describe 'JsonProtocol' do
|
|
|
353
379
|
@prot.read_string
|
|
354
380
|
|
|
355
381
|
@trans.write("1453T")
|
|
356
|
-
@prot.read_json_integer.
|
|
382
|
+
expect(@prot.read_json_integer).to eq(1453)
|
|
357
383
|
end
|
|
358
384
|
|
|
359
385
|
it "should read json double" do
|
|
@@ -365,37 +391,37 @@ describe 'JsonProtocol' do
|
|
|
365
391
|
expect {@prot.read_json_double}.to raise_error(Thrift::ProtocolException)
|
|
366
392
|
|
|
367
393
|
@trans.write("1.453e01\"\"")
|
|
368
|
-
@prot.read_json_double.
|
|
394
|
+
expect(@prot.read_json_double).to eq(14.53)
|
|
369
395
|
@prot.read_string
|
|
370
396
|
|
|
371
397
|
@trans.write("\"NaN\"")
|
|
372
|
-
@prot.read_json_double.nan
|
|
398
|
+
expect(@prot.read_json_double.nan?).to eq(true)
|
|
373
399
|
|
|
374
400
|
@trans.write("\"Infinity\"")
|
|
375
|
-
@prot.read_json_double.
|
|
401
|
+
expect(@prot.read_json_double).to eq(+1.0/0.0)
|
|
376
402
|
|
|
377
403
|
@trans.write("\"-Infinity\"")
|
|
378
|
-
@prot.read_json_double.
|
|
404
|
+
expect(@prot.read_json_double).to eq(-1.0/0.0)
|
|
379
405
|
end
|
|
380
406
|
|
|
381
407
|
it "should read json object start" do
|
|
382
408
|
@trans.write("{")
|
|
383
|
-
@prot.read_json_object_start.
|
|
409
|
+
expect(@prot.read_json_object_start).to eq(nil)
|
|
384
410
|
end
|
|
385
411
|
|
|
386
412
|
it "should read json object end" do
|
|
387
413
|
@trans.write("}")
|
|
388
|
-
@prot.read_json_object_end.
|
|
414
|
+
expect(@prot.read_json_object_end).to eq(nil)
|
|
389
415
|
end
|
|
390
416
|
|
|
391
417
|
it "should read json array start" do
|
|
392
418
|
@trans.write("[")
|
|
393
|
-
@prot.read_json_array_start.
|
|
419
|
+
expect(@prot.read_json_array_start).to eq(nil)
|
|
394
420
|
end
|
|
395
421
|
|
|
396
422
|
it "should read json array end" do
|
|
397
423
|
@trans.write("]")
|
|
398
|
-
@prot.read_json_array_end.
|
|
424
|
+
expect(@prot.read_json_array_end).to eq(nil)
|
|
399
425
|
end
|
|
400
426
|
|
|
401
427
|
it "should read_message_begin" do
|
|
@@ -403,128 +429,141 @@ describe 'JsonProtocol' do
|
|
|
403
429
|
expect {@prot.read_message_begin}.to raise_error(Thrift::ProtocolException)
|
|
404
430
|
|
|
405
431
|
@trans.write("[1,\"name\",12,32\"\"")
|
|
406
|
-
@prot.read_message_begin.
|
|
432
|
+
expect(@prot.read_message_begin).to eq(["name", 12, 32])
|
|
407
433
|
end
|
|
408
434
|
|
|
409
435
|
it "should read message end" do
|
|
410
436
|
@trans.write("]")
|
|
411
|
-
@prot.read_message_end.
|
|
437
|
+
expect(@prot.read_message_end).to eq(nil)
|
|
412
438
|
end
|
|
413
439
|
|
|
414
440
|
it "should read struct begin" do
|
|
415
441
|
@trans.write("{")
|
|
416
|
-
@prot.read_struct_begin.
|
|
442
|
+
expect(@prot.read_struct_begin).to eq(nil)
|
|
417
443
|
end
|
|
418
444
|
|
|
419
445
|
it "should read struct end" do
|
|
420
446
|
@trans.write("}")
|
|
421
|
-
@prot.read_struct_end.
|
|
447
|
+
expect(@prot.read_struct_end).to eq(nil)
|
|
422
448
|
end
|
|
423
449
|
|
|
424
450
|
it "should read field begin" do
|
|
425
451
|
@trans.write("1{\"rec\"")
|
|
426
|
-
@prot.read_field_begin.
|
|
452
|
+
expect(@prot.read_field_begin).to eq([nil, 12, 1])
|
|
427
453
|
end
|
|
428
454
|
|
|
429
455
|
it "should read field end" do
|
|
430
456
|
@trans.write("}")
|
|
431
|
-
@prot.read_field_end.
|
|
457
|
+
expect(@prot.read_field_end).to eq(nil)
|
|
432
458
|
end
|
|
433
459
|
|
|
434
460
|
it "should read map begin" do
|
|
435
461
|
@trans.write("[\"rec\",\"lst\",2,{")
|
|
436
|
-
@prot.read_map_begin.
|
|
462
|
+
expect(@prot.read_map_begin).to eq([12, 15, 2])
|
|
437
463
|
end
|
|
438
464
|
|
|
439
465
|
it "should read map end" do
|
|
440
466
|
@trans.write("}]")
|
|
441
|
-
@prot.read_map_end.
|
|
467
|
+
expect(@prot.read_map_end).to eq(nil)
|
|
442
468
|
end
|
|
443
469
|
|
|
444
470
|
it "should read list begin" do
|
|
445
471
|
@trans.write("[\"rec\",2\"\"")
|
|
446
|
-
@prot.read_list_begin.
|
|
472
|
+
expect(@prot.read_list_begin).to eq([12, 2])
|
|
447
473
|
end
|
|
448
474
|
|
|
449
475
|
it "should read list end" do
|
|
450
476
|
@trans.write("]")
|
|
451
|
-
@prot.read_list_end.
|
|
477
|
+
expect(@prot.read_list_end).to eq(nil)
|
|
452
478
|
end
|
|
453
479
|
|
|
454
480
|
it "should read set begin" do
|
|
455
481
|
@trans.write("[\"rec\",2\"\"")
|
|
456
|
-
@prot.read_set_begin.
|
|
482
|
+
expect(@prot.read_set_begin).to eq([12, 2])
|
|
457
483
|
end
|
|
458
484
|
|
|
459
485
|
it "should read set end" do
|
|
460
486
|
@trans.write("]")
|
|
461
|
-
@prot.read_set_end.
|
|
487
|
+
expect(@prot.read_set_end).to eq(nil)
|
|
462
488
|
end
|
|
463
489
|
|
|
464
490
|
it "should read bool" do
|
|
465
491
|
@trans.write("0\"\"")
|
|
466
|
-
@prot.read_bool.
|
|
492
|
+
expect(@prot.read_bool).to eq(false)
|
|
467
493
|
@prot.read_string
|
|
468
494
|
|
|
469
495
|
@trans.write("1\"\"")
|
|
470
|
-
@prot.read_bool.
|
|
496
|
+
expect(@prot.read_bool).to eq(true)
|
|
471
497
|
end
|
|
472
498
|
|
|
473
499
|
it "should read byte" do
|
|
474
500
|
@trans.write("60\"\"")
|
|
475
|
-
@prot.read_byte.
|
|
501
|
+
expect(@prot.read_byte).to eq(60)
|
|
476
502
|
end
|
|
477
503
|
|
|
478
504
|
it "should read i16" do
|
|
479
505
|
@trans.write("1000\"\"")
|
|
480
|
-
@prot.read_i16.
|
|
506
|
+
expect(@prot.read_i16).to eq(1000)
|
|
481
507
|
end
|
|
482
508
|
|
|
483
509
|
it "should read i32" do
|
|
484
510
|
@trans.write("3000000000\"\"")
|
|
485
|
-
@prot.read_i32.
|
|
511
|
+
expect(@prot.read_i32).to eq(3000000000)
|
|
486
512
|
end
|
|
487
513
|
|
|
488
514
|
it "should read i64" do
|
|
489
515
|
@trans.write("6000000000\"\"")
|
|
490
|
-
@prot.read_i64.
|
|
516
|
+
expect(@prot.read_i64).to eq(6000000000)
|
|
491
517
|
end
|
|
492
518
|
|
|
493
519
|
it "should read double" do
|
|
494
520
|
@trans.write("12.23\"\"")
|
|
495
|
-
@prot.read_double.
|
|
521
|
+
expect(@prot.read_double).to eq(12.23)
|
|
496
522
|
end
|
|
497
523
|
|
|
498
524
|
if RUBY_VERSION >= '1.9'
|
|
499
525
|
it 'should read string' do
|
|
500
526
|
@trans.write('"this is a test string"'.force_encoding(Encoding::BINARY))
|
|
501
527
|
a = @prot.read_string
|
|
502
|
-
a.
|
|
503
|
-
a.encoding.
|
|
528
|
+
expect(a).to eq('this is a test string')
|
|
529
|
+
expect(a.encoding).to eq(Encoding::UTF_8)
|
|
504
530
|
end
|
|
505
531
|
|
|
506
532
|
it 'should read string with unicode characters' do
|
|
507
533
|
@trans.write('"this is a test string with unicode characters: \u20AC \u20AD"'.force_encoding(Encoding::BINARY))
|
|
508
534
|
a = @prot.read_string
|
|
509
|
-
a.
|
|
510
|
-
a.encoding.
|
|
535
|
+
expect(a).to eq("this is a test string with unicode characters: \u20AC \u20AD")
|
|
536
|
+
expect(a.encoding).to eq(Encoding::UTF_8)
|
|
511
537
|
end
|
|
512
538
|
else
|
|
513
539
|
it 'should read string' do
|
|
514
540
|
@trans.write('"this is a test string"')
|
|
515
|
-
@prot.read_string.
|
|
541
|
+
expect(@prot.read_string).to eq('this is a test string')
|
|
516
542
|
end
|
|
517
543
|
end
|
|
518
544
|
|
|
519
545
|
it "should read binary" do
|
|
520
546
|
@trans.write("\"dGhpcyBpcyBhIHRlc3Qgc3RyaW5n\"")
|
|
521
|
-
@prot.read_binary.
|
|
547
|
+
expect(@prot.read_binary).to eq("this is a test string")
|
|
548
|
+
end
|
|
549
|
+
|
|
550
|
+
it "should read long binary" do
|
|
551
|
+
@trans.write("\"AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w==\"")
|
|
552
|
+
expect(@prot.read_binary.bytes.to_a).to eq((0...256).to_a)
|
|
553
|
+
end
|
|
554
|
+
|
|
555
|
+
it "should provide a reasonable to_s" do
|
|
556
|
+
expect(@prot.to_s).to eq("json(memory)")
|
|
522
557
|
end
|
|
523
558
|
end
|
|
524
559
|
|
|
525
560
|
describe Thrift::JsonProtocolFactory do
|
|
526
561
|
it "should create a JsonProtocol" do
|
|
527
|
-
Thrift::JsonProtocolFactory.new.get_protocol(
|
|
562
|
+
expect(Thrift::JsonProtocolFactory.new.get_protocol(double("MockTransport"))).to be_instance_of(Thrift::JsonProtocol)
|
|
563
|
+
end
|
|
564
|
+
|
|
565
|
+
it "should provide a reasonable to_s" do
|
|
566
|
+
expect(Thrift::JsonProtocolFactory.new.to_s).to eq("json")
|
|
528
567
|
end
|
|
529
568
|
end
|
|
530
569
|
end
|