upfluence-thrift 2.3.0 → 2.4.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 (34) hide show
  1. checksums.yaml +4 -4
  2. data/benchmark/gen-rb/benchmark_constants.rb +11 -0
  3. data/benchmark/gen-rb/benchmark_service.rb +106 -0
  4. data/benchmark/gen-rb/benchmark_types.rb +10 -0
  5. data/ext/extconf.rb +1 -4
  6. data/lib/thrift/protocol/json_protocol.rb +65 -1
  7. data/spec/gen-rb/base/base_service.rb +106 -0
  8. data/spec/gen-rb/base/base_service_constants.rb +11 -0
  9. data/spec/gen-rb/base/base_service_types.rb +33 -0
  10. data/spec/gen-rb/extended/extended_service.rb +103 -0
  11. data/spec/gen-rb/extended/extended_service_constants.rb +11 -0
  12. data/spec/gen-rb/extended/extended_service_types.rb +12 -0
  13. data/spec/gen-rb/flat/namespaced_nonblocking_service.rb +343 -0
  14. data/spec/gen-rb/flat/referenced_constants.rb +11 -0
  15. data/spec/gen-rb/flat/referenced_types.rb +17 -0
  16. data/spec/gen-rb/flat/thrift_namespaced_spec_constants.rb +11 -0
  17. data/spec/gen-rb/flat/thrift_namespaced_spec_types.rb +35 -0
  18. data/spec/gen-rb/namespaced_spec_namespace/namespaced_nonblocking_service.rb +343 -0
  19. data/spec/gen-rb/namespaced_spec_namespace/thrift_namespaced_spec_constants.rb +11 -0
  20. data/spec/gen-rb/namespaced_spec_namespace/thrift_namespaced_spec_types.rb +35 -0
  21. data/spec/gen-rb/nonblocking_service.rb +343 -0
  22. data/spec/gen-rb/other_namespace/referenced_constants.rb +11 -0
  23. data/spec/gen-rb/other_namespace/referenced_types.rb +17 -0
  24. data/spec/gen-rb/thrift_spec_constants.rb +11 -0
  25. data/spec/gen-rb/thrift_spec_types.rb +699 -0
  26. data/spec/json_protocol_spec.rb +17 -0
  27. data/test/debug_proto/gen-rb/debug_proto_test_constants.rb +274 -0
  28. data/test/debug_proto/gen-rb/debug_proto_test_types.rb +936 -0
  29. data/test/debug_proto/gen-rb/empty_service.rb +39 -0
  30. data/test/debug_proto/gen-rb/inherited.rb +105 -0
  31. data/test/debug_proto/gen-rb/reverse_order_service.rb +107 -0
  32. data/test/debug_proto/gen-rb/service_for_exception_with_a_map.rb +106 -0
  33. data/test/debug_proto/gen-rb/srv.rb +410 -0
  34. metadata +150 -92
@@ -0,0 +1,699 @@
1
+ #
2
+ # Autogenerated by Thrift Compiler (2.4.0-upfluence)
3
+ #
4
+ # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
+ #
6
+
7
+ require 'thrift'
8
+
9
+ module SpecNamespace
10
+ module SomeEnum
11
+ ONE = 0
12
+ TWO = 1
13
+ VALUE_MAP = {0 => "ONE", 1 => "TWO"}
14
+ VALID_VALUES = Set.new([ONE, TWO]).freeze
15
+ end
16
+
17
+ class Hello; end
18
+
19
+ class StructWithSomeEnum; end
20
+
21
+ class TestUnion < ::Thrift::Union; end
22
+
23
+ class Foo; end
24
+
25
+ class Foo2; end
26
+
27
+ class BoolStruct; end
28
+
29
+ class SimpleList; end
30
+
31
+ class Xception < ::Thrift::Exception; end
32
+
33
+ class My_union < ::Thrift::Union; end
34
+
35
+ class Struct_with_union; end
36
+
37
+ class StructWithEnumMap; end
38
+
39
+ class NestedListInList; end
40
+
41
+ class NestedListInSet; end
42
+
43
+ class NestedListInMapKey; end
44
+
45
+ class NestedListInMapValue; end
46
+
47
+ class NestedSetInList; end
48
+
49
+ class NestedSetInSet; end
50
+
51
+ class NestedSetInMapKey; end
52
+
53
+ class NestedSetInMapValue; end
54
+
55
+ class NestedMapInList; end
56
+
57
+ class NestedMapInSet; end
58
+
59
+ class NestedMapInMapKey; end
60
+
61
+ class NestedMapInMapValue; end
62
+
63
+ class Hello
64
+ include ::Thrift::Struct, ::Thrift::Struct_Union
65
+
66
+ NAME = 'Hello'.freeze
67
+ NAMESPACE = ''.freeze
68
+
69
+ THRIFT_FIELD_INDEX_GREETING = 1
70
+
71
+ FIELDS = {
72
+ THRIFT_FIELD_INDEX_GREETING => {type: ::Thrift::Types::STRING, name: 'greeting', default: %q"hello world"}
73
+ }
74
+
75
+ def struct_fields; FIELDS; end
76
+
77
+ def validate
78
+ end
79
+
80
+ ::Thrift::Struct.generate_accessors self
81
+ ::Thrift.register_struct_type self
82
+ end
83
+
84
+ class StructWithSomeEnum
85
+ include ::Thrift::Struct, ::Thrift::Struct_Union
86
+
87
+ NAME = 'StructWithSomeEnum'.freeze
88
+ NAMESPACE = ''.freeze
89
+
90
+ THRIFT_FIELD_INDEX_SOME_ENUM = 1
91
+
92
+ FIELDS = {
93
+ THRIFT_FIELD_INDEX_SOME_ENUM => {type: ::Thrift::Types::I32, name: 'some_enum', enum_class: ::SpecNamespace::SomeEnum}
94
+ }
95
+
96
+ def struct_fields; FIELDS; end
97
+
98
+ def validate
99
+ unless @some_enum.nil? || ::SpecNamespace::SomeEnum::VALID_VALUES.include?(@some_enum)
100
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field some_enum!')
101
+ end
102
+ end
103
+
104
+ ::Thrift::Struct.generate_accessors self
105
+ ::Thrift.register_struct_type self
106
+ end
107
+
108
+ class TestUnion < ::Thrift::Union
109
+ include ::Thrift::Struct_Union
110
+
111
+ NAME = 'TestUnion'.freeze
112
+ NAMESPACE = ''.freeze
113
+
114
+ class << self
115
+ def string_field(val)
116
+ TestUnion.new(:string_field, val)
117
+ end
118
+
119
+ def i32_field(val)
120
+ TestUnion.new(:i32_field, val)
121
+ end
122
+
123
+ def other_i32_field(val)
124
+ TestUnion.new(:other_i32_field, val)
125
+ end
126
+
127
+ def enum_field(val)
128
+ TestUnion.new(:enum_field, val)
129
+ end
130
+
131
+ def binary_field(val)
132
+ TestUnion.new(:binary_field, val)
133
+ end
134
+ end
135
+
136
+ THRIFT_FIELD_INDEX_STRING_FIELD = 1
137
+ THRIFT_FIELD_INDEX_I32_FIELD = 2
138
+ THRIFT_FIELD_INDEX_OTHER_I32_FIELD = 3
139
+ THRIFT_FIELD_INDEX_ENUM_FIELD = 4
140
+ THRIFT_FIELD_INDEX_BINARY_FIELD = 5
141
+
142
+ FIELDS = {
143
+ # A doc string
144
+ THRIFT_FIELD_INDEX_STRING_FIELD => {type: ::Thrift::Types::STRING, name: 'string_field'},
145
+ THRIFT_FIELD_INDEX_I32_FIELD => {type: ::Thrift::Types::I32, name: 'i32_field'},
146
+ THRIFT_FIELD_INDEX_OTHER_I32_FIELD => {type: ::Thrift::Types::I32, name: 'other_i32_field'},
147
+ THRIFT_FIELD_INDEX_ENUM_FIELD => {type: ::Thrift::Types::I32, name: 'enum_field', enum_class: ::SpecNamespace::SomeEnum},
148
+ THRIFT_FIELD_INDEX_BINARY_FIELD => {type: ::Thrift::Types::STRING, name: 'binary_field', binary: true}
149
+ }
150
+
151
+ def struct_fields; FIELDS; end
152
+
153
+ def validate
154
+ raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
155
+ if get_set_field == :enum_field
156
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field enum_field!') unless ::SpecNamespace::SomeEnum::VALID_VALUES.include?(get_value)
157
+ end
158
+ end
159
+
160
+ ::Thrift::Union.generate_accessors self
161
+ ::Thrift.register_struct_type self
162
+ end
163
+
164
+ class Foo
165
+ include ::Thrift::Struct, ::Thrift::Struct_Union
166
+
167
+ NAME = 'Foo'.freeze
168
+ NAMESPACE = ''.freeze
169
+
170
+ THRIFT_FIELD_INDEX_SIMPLE = 1
171
+ THRIFT_FIELD_INDEX_WORDS = 2
172
+ THRIFT_FIELD_INDEX_HELLO = 3
173
+ THRIFT_FIELD_INDEX_INTS = 4
174
+ THRIFT_FIELD_INDEX_COMPLEX = 5
175
+ THRIFT_FIELD_INDEX_SHORTS = 6
176
+ THRIFT_FIELD_INDEX_OPT_STRING = 7
177
+ THRIFT_FIELD_INDEX_MY_BOOL = 8
178
+
179
+ FIELDS = {
180
+ THRIFT_FIELD_INDEX_SIMPLE => {type: ::Thrift::Types::I32, name: 'simple', default: 53},
181
+ THRIFT_FIELD_INDEX_WORDS => {type: ::Thrift::Types::STRING, name: 'words', default: %q"words"},
182
+ THRIFT_FIELD_INDEX_HELLO => {type: ::Thrift::Types::STRUCT, name: 'hello', default: ::SpecNamespace::Hello.new({
183
+ %q"greeting" => %q"hello, world!",
184
+ }), class: ::SpecNamespace::Hello},
185
+ THRIFT_FIELD_INDEX_INTS => {type: ::Thrift::Types::LIST, name: 'ints', default: [
186
+ 1,
187
+ 2,
188
+ 2,
189
+ 3,
190
+ ], element: {type: ::Thrift::Types::I32}},
191
+ THRIFT_FIELD_INDEX_COMPLEX => {type: ::Thrift::Types::MAP, name: 'complex', key: {type: ::Thrift::Types::I32}, value: {type: ::Thrift::Types::MAP, key: {type: ::Thrift::Types::STRING}, value: {type: ::Thrift::Types::DOUBLE}}},
192
+ THRIFT_FIELD_INDEX_SHORTS => {type: ::Thrift::Types::SET, name: 'shorts', default: Set.new([
193
+ 5,
194
+ 17,
195
+ 239,
196
+ ]), element: {type: ::Thrift::Types::I16}},
197
+ THRIFT_FIELD_INDEX_OPT_STRING => {type: ::Thrift::Types::STRING, name: 'opt_string', optional: true},
198
+ THRIFT_FIELD_INDEX_MY_BOOL => {type: ::Thrift::Types::BOOL, name: 'my_bool'}
199
+ }
200
+
201
+ def struct_fields; FIELDS; end
202
+
203
+ def validate
204
+ end
205
+
206
+ ::Thrift::Struct.generate_accessors self
207
+ ::Thrift.register_struct_type self
208
+ end
209
+
210
+ class Foo2
211
+ include ::Thrift::Struct, ::Thrift::Struct_Union
212
+
213
+ NAME = 'Foo2'.freeze
214
+ NAMESPACE = ''.freeze
215
+
216
+ THRIFT_FIELD_INDEX_MY_BINARY = 1
217
+
218
+ FIELDS = {
219
+ THRIFT_FIELD_INDEX_MY_BINARY => {type: ::Thrift::Types::STRING, name: 'my_binary', binary: true}
220
+ }
221
+
222
+ def struct_fields; FIELDS; end
223
+
224
+ def validate
225
+ end
226
+
227
+ ::Thrift::Struct.generate_accessors self
228
+ ::Thrift.register_struct_type self
229
+ end
230
+
231
+ class BoolStruct
232
+ include ::Thrift::Struct, ::Thrift::Struct_Union
233
+
234
+ NAME = 'BoolStruct'.freeze
235
+ NAMESPACE = ''.freeze
236
+
237
+ THRIFT_FIELD_INDEX_YESNO = 1
238
+
239
+ FIELDS = {
240
+ THRIFT_FIELD_INDEX_YESNO => {type: ::Thrift::Types::BOOL, name: 'yesno', default: true}
241
+ }
242
+
243
+ def struct_fields; FIELDS; end
244
+
245
+ def validate
246
+ end
247
+
248
+ ::Thrift::Struct.generate_accessors self
249
+ ::Thrift.register_struct_type self
250
+ end
251
+
252
+ class SimpleList
253
+ include ::Thrift::Struct, ::Thrift::Struct_Union
254
+
255
+ NAME = 'SimpleList'.freeze
256
+ NAMESPACE = ''.freeze
257
+
258
+ THRIFT_FIELD_INDEX_BOOLS = 1
259
+ THRIFT_FIELD_INDEX_BYTES = 2
260
+ THRIFT_FIELD_INDEX_I16S = 3
261
+ THRIFT_FIELD_INDEX_I32S = 4
262
+ THRIFT_FIELD_INDEX_I64S = 5
263
+ THRIFT_FIELD_INDEX_DOUBLES = 6
264
+ THRIFT_FIELD_INDEX_STRINGS = 7
265
+ THRIFT_FIELD_INDEX_MAPS = 8
266
+ THRIFT_FIELD_INDEX_LISTS = 9
267
+ THRIFT_FIELD_INDEX_SETS = 10
268
+ THRIFT_FIELD_INDEX_HELLOS = 11
269
+
270
+ FIELDS = {
271
+ THRIFT_FIELD_INDEX_BOOLS => {type: ::Thrift::Types::LIST, name: 'bools', element: {type: ::Thrift::Types::BOOL}},
272
+ THRIFT_FIELD_INDEX_BYTES => {type: ::Thrift::Types::LIST, name: 'bytes', element: {type: ::Thrift::Types::BYTE}},
273
+ THRIFT_FIELD_INDEX_I16S => {type: ::Thrift::Types::LIST, name: 'i16s', element: {type: ::Thrift::Types::I16}},
274
+ THRIFT_FIELD_INDEX_I32S => {type: ::Thrift::Types::LIST, name: 'i32s', element: {type: ::Thrift::Types::I32}},
275
+ THRIFT_FIELD_INDEX_I64S => {type: ::Thrift::Types::LIST, name: 'i64s', element: {type: ::Thrift::Types::I64}},
276
+ THRIFT_FIELD_INDEX_DOUBLES => {type: ::Thrift::Types::LIST, name: 'doubles', element: {type: ::Thrift::Types::DOUBLE}},
277
+ THRIFT_FIELD_INDEX_STRINGS => {type: ::Thrift::Types::LIST, name: 'strings', element: {type: ::Thrift::Types::STRING}},
278
+ THRIFT_FIELD_INDEX_MAPS => {type: ::Thrift::Types::LIST, name: 'maps', element: {type: ::Thrift::Types::MAP, key: {type: ::Thrift::Types::I16}, value: {type: ::Thrift::Types::I16}}},
279
+ THRIFT_FIELD_INDEX_LISTS => {type: ::Thrift::Types::LIST, name: 'lists', element: {type: ::Thrift::Types::LIST, element: {type: ::Thrift::Types::I16}}},
280
+ THRIFT_FIELD_INDEX_SETS => {type: ::Thrift::Types::LIST, name: 'sets', element: {type: ::Thrift::Types::SET, element: {type: ::Thrift::Types::I16}}},
281
+ THRIFT_FIELD_INDEX_HELLOS => {type: ::Thrift::Types::LIST, name: 'hellos', element: {type: ::Thrift::Types::STRUCT, class: ::SpecNamespace::Hello}}
282
+ }
283
+
284
+ def struct_fields; FIELDS; end
285
+
286
+ def validate
287
+ end
288
+
289
+ ::Thrift::Struct.generate_accessors self
290
+ ::Thrift.register_struct_type self
291
+ end
292
+
293
+ class Xception < ::Thrift::Exception
294
+ include ::Thrift::Struct, ::Thrift::Struct_Union
295
+
296
+ NAME = 'Xception'.freeze
297
+ NAMESPACE = ''.freeze
298
+
299
+ THRIFT_FIELD_INDEX_MESSAGE = 1
300
+ THRIFT_FIELD_INDEX_CODE = 2
301
+
302
+ FIELDS = {
303
+ THRIFT_FIELD_INDEX_MESSAGE => {type: ::Thrift::Types::STRING, name: 'message'},
304
+ THRIFT_FIELD_INDEX_CODE => {type: ::Thrift::Types::I32, name: 'code', default: 1}
305
+ }
306
+
307
+ def struct_fields; FIELDS; end
308
+
309
+ def validate
310
+ end
311
+
312
+ ::Thrift::Struct.generate_accessors self
313
+ ::Thrift.register_struct_type self
314
+ end
315
+
316
+ class My_union < ::Thrift::Union
317
+ include ::Thrift::Struct_Union
318
+
319
+ NAME = 'My_union'.freeze
320
+ NAMESPACE = ''.freeze
321
+
322
+ class << self
323
+ def im_true(val)
324
+ My_union.new(:im_true, val)
325
+ end
326
+
327
+ def a_bite(val)
328
+ My_union.new(:a_bite, val)
329
+ end
330
+
331
+ def integer16(val)
332
+ My_union.new(:integer16, val)
333
+ end
334
+
335
+ def integer32(val)
336
+ My_union.new(:integer32, val)
337
+ end
338
+
339
+ def integer64(val)
340
+ My_union.new(:integer64, val)
341
+ end
342
+
343
+ def double_precision(val)
344
+ My_union.new(:double_precision, val)
345
+ end
346
+
347
+ def some_characters(val)
348
+ My_union.new(:some_characters, val)
349
+ end
350
+
351
+ def other_i32(val)
352
+ My_union.new(:other_i32, val)
353
+ end
354
+
355
+ def some_enum(val)
356
+ My_union.new(:some_enum, val)
357
+ end
358
+
359
+ def my_map(val)
360
+ My_union.new(:my_map, val)
361
+ end
362
+ end
363
+
364
+ THRIFT_FIELD_INDEX_IM_TRUE = 1
365
+ THRIFT_FIELD_INDEX_A_BITE = 2
366
+ THRIFT_FIELD_INDEX_INTEGER16 = 3
367
+ THRIFT_FIELD_INDEX_INTEGER32 = 4
368
+ THRIFT_FIELD_INDEX_INTEGER64 = 5
369
+ THRIFT_FIELD_INDEX_DOUBLE_PRECISION = 6
370
+ THRIFT_FIELD_INDEX_SOME_CHARACTERS = 7
371
+ THRIFT_FIELD_INDEX_OTHER_I32 = 8
372
+ THRIFT_FIELD_INDEX_SOME_ENUM = 9
373
+ THRIFT_FIELD_INDEX_MY_MAP = 10
374
+
375
+ FIELDS = {
376
+ THRIFT_FIELD_INDEX_IM_TRUE => {type: ::Thrift::Types::BOOL, name: 'im_true'},
377
+ THRIFT_FIELD_INDEX_A_BITE => {type: ::Thrift::Types::BYTE, name: 'a_bite'},
378
+ THRIFT_FIELD_INDEX_INTEGER16 => {type: ::Thrift::Types::I16, name: 'integer16'},
379
+ THRIFT_FIELD_INDEX_INTEGER32 => {type: ::Thrift::Types::I32, name: 'integer32'},
380
+ THRIFT_FIELD_INDEX_INTEGER64 => {type: ::Thrift::Types::I64, name: 'integer64'},
381
+ THRIFT_FIELD_INDEX_DOUBLE_PRECISION => {type: ::Thrift::Types::DOUBLE, name: 'double_precision'},
382
+ THRIFT_FIELD_INDEX_SOME_CHARACTERS => {type: ::Thrift::Types::STRING, name: 'some_characters'},
383
+ THRIFT_FIELD_INDEX_OTHER_I32 => {type: ::Thrift::Types::I32, name: 'other_i32'},
384
+ THRIFT_FIELD_INDEX_SOME_ENUM => {type: ::Thrift::Types::I32, name: 'some_enum', enum_class: ::SpecNamespace::SomeEnum},
385
+ 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}}}
386
+ }
387
+
388
+ def struct_fields; FIELDS; end
389
+
390
+ def validate
391
+ raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
392
+ if get_set_field == :some_enum
393
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field some_enum!') unless ::SpecNamespace::SomeEnum::VALID_VALUES.include?(get_value)
394
+ end
395
+ end
396
+
397
+ ::Thrift::Union.generate_accessors self
398
+ ::Thrift.register_struct_type self
399
+ end
400
+
401
+ class Struct_with_union
402
+ include ::Thrift::Struct, ::Thrift::Struct_Union
403
+
404
+ NAME = 'Struct_with_union'.freeze
405
+ NAMESPACE = ''.freeze
406
+
407
+ THRIFT_FIELD_INDEX_FUN_UNION = 1
408
+ THRIFT_FIELD_INDEX_INTEGER32 = 2
409
+ THRIFT_FIELD_INDEX_SOME_CHARACTERS = 3
410
+
411
+ FIELDS = {
412
+ THRIFT_FIELD_INDEX_FUN_UNION => {type: ::Thrift::Types::STRUCT, name: 'fun_union', class: ::SpecNamespace::My_union},
413
+ THRIFT_FIELD_INDEX_INTEGER32 => {type: ::Thrift::Types::I32, name: 'integer32'},
414
+ THRIFT_FIELD_INDEX_SOME_CHARACTERS => {type: ::Thrift::Types::STRING, name: 'some_characters'}
415
+ }
416
+
417
+ def struct_fields; FIELDS; end
418
+
419
+ def validate
420
+ end
421
+
422
+ ::Thrift::Struct.generate_accessors self
423
+ ::Thrift.register_struct_type self
424
+ end
425
+
426
+ class StructWithEnumMap
427
+ include ::Thrift::Struct, ::Thrift::Struct_Union
428
+
429
+ NAME = 'StructWithEnumMap'.freeze
430
+ NAMESPACE = ''.freeze
431
+
432
+ THRIFT_FIELD_INDEX_MY_MAP = 1
433
+
434
+ FIELDS = {
435
+ 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}}}
436
+ }
437
+
438
+ def struct_fields; FIELDS; end
439
+
440
+ def validate
441
+ end
442
+
443
+ ::Thrift::Struct.generate_accessors self
444
+ ::Thrift.register_struct_type self
445
+ end
446
+
447
+ class NestedListInList
448
+ include ::Thrift::Struct, ::Thrift::Struct_Union
449
+
450
+ NAME = 'NestedListInList'.freeze
451
+ NAMESPACE = ''.freeze
452
+
453
+ THRIFT_FIELD_INDEX_VALUE = 1
454
+
455
+ FIELDS = {
456
+ THRIFT_FIELD_INDEX_VALUE => {type: ::Thrift::Types::LIST, name: 'value', element: {type: ::Thrift::Types::LIST, element: {type: ::Thrift::Types::BYTE}}}
457
+ }
458
+
459
+ def struct_fields; FIELDS; end
460
+
461
+ def validate
462
+ end
463
+
464
+ ::Thrift::Struct.generate_accessors self
465
+ ::Thrift.register_struct_type self
466
+ end
467
+
468
+ class NestedListInSet
469
+ include ::Thrift::Struct, ::Thrift::Struct_Union
470
+
471
+ NAME = 'NestedListInSet'.freeze
472
+ NAMESPACE = ''.freeze
473
+
474
+ THRIFT_FIELD_INDEX_VALUE = 1
475
+
476
+ FIELDS = {
477
+ THRIFT_FIELD_INDEX_VALUE => {type: ::Thrift::Types::SET, name: 'value', element: {type: ::Thrift::Types::LIST, element: {type: ::Thrift::Types::BYTE}}}
478
+ }
479
+
480
+ def struct_fields; FIELDS; end
481
+
482
+ def validate
483
+ end
484
+
485
+ ::Thrift::Struct.generate_accessors self
486
+ ::Thrift.register_struct_type self
487
+ end
488
+
489
+ class NestedListInMapKey
490
+ include ::Thrift::Struct, ::Thrift::Struct_Union
491
+
492
+ NAME = 'NestedListInMapKey'.freeze
493
+ NAMESPACE = ''.freeze
494
+
495
+ THRIFT_FIELD_INDEX_VALUE = 1
496
+
497
+ FIELDS = {
498
+ THRIFT_FIELD_INDEX_VALUE => {type: ::Thrift::Types::MAP, name: 'value', key: {type: ::Thrift::Types::LIST, element: {type: ::Thrift::Types::BYTE}}, value: {type: ::Thrift::Types::BYTE}}
499
+ }
500
+
501
+ def struct_fields; FIELDS; end
502
+
503
+ def validate
504
+ end
505
+
506
+ ::Thrift::Struct.generate_accessors self
507
+ ::Thrift.register_struct_type self
508
+ end
509
+
510
+ class NestedListInMapValue
511
+ include ::Thrift::Struct, ::Thrift::Struct_Union
512
+
513
+ NAME = 'NestedListInMapValue'.freeze
514
+ NAMESPACE = ''.freeze
515
+
516
+ THRIFT_FIELD_INDEX_VALUE = 1
517
+
518
+ FIELDS = {
519
+ THRIFT_FIELD_INDEX_VALUE => {type: ::Thrift::Types::MAP, name: 'value', key: {type: ::Thrift::Types::BYTE}, value: {type: ::Thrift::Types::LIST, element: {type: ::Thrift::Types::BYTE}}}
520
+ }
521
+
522
+ def struct_fields; FIELDS; end
523
+
524
+ def validate
525
+ end
526
+
527
+ ::Thrift::Struct.generate_accessors self
528
+ ::Thrift.register_struct_type self
529
+ end
530
+
531
+ class NestedSetInList
532
+ include ::Thrift::Struct, ::Thrift::Struct_Union
533
+
534
+ NAME = 'NestedSetInList'.freeze
535
+ NAMESPACE = ''.freeze
536
+
537
+ THRIFT_FIELD_INDEX_VALUE = 1
538
+
539
+ FIELDS = {
540
+ THRIFT_FIELD_INDEX_VALUE => {type: ::Thrift::Types::LIST, name: 'value', element: {type: ::Thrift::Types::SET, element: {type: ::Thrift::Types::BYTE}}}
541
+ }
542
+
543
+ def struct_fields; FIELDS; end
544
+
545
+ def validate
546
+ end
547
+
548
+ ::Thrift::Struct.generate_accessors self
549
+ ::Thrift.register_struct_type self
550
+ end
551
+
552
+ class NestedSetInSet
553
+ include ::Thrift::Struct, ::Thrift::Struct_Union
554
+
555
+ NAME = 'NestedSetInSet'.freeze
556
+ NAMESPACE = ''.freeze
557
+
558
+ THRIFT_FIELD_INDEX_VALUE = 1
559
+
560
+ FIELDS = {
561
+ THRIFT_FIELD_INDEX_VALUE => {type: ::Thrift::Types::SET, name: 'value', element: {type: ::Thrift::Types::SET, element: {type: ::Thrift::Types::BYTE}}}
562
+ }
563
+
564
+ def struct_fields; FIELDS; end
565
+
566
+ def validate
567
+ end
568
+
569
+ ::Thrift::Struct.generate_accessors self
570
+ ::Thrift.register_struct_type self
571
+ end
572
+
573
+ class NestedSetInMapKey
574
+ include ::Thrift::Struct, ::Thrift::Struct_Union
575
+
576
+ NAME = 'NestedSetInMapKey'.freeze
577
+ NAMESPACE = ''.freeze
578
+
579
+ THRIFT_FIELD_INDEX_VALUE = 1
580
+
581
+ FIELDS = {
582
+ THRIFT_FIELD_INDEX_VALUE => {type: ::Thrift::Types::MAP, name: 'value', key: {type: ::Thrift::Types::SET, element: {type: ::Thrift::Types::BYTE}}, value: {type: ::Thrift::Types::BYTE}}
583
+ }
584
+
585
+ def struct_fields; FIELDS; end
586
+
587
+ def validate
588
+ end
589
+
590
+ ::Thrift::Struct.generate_accessors self
591
+ ::Thrift.register_struct_type self
592
+ end
593
+
594
+ class NestedSetInMapValue
595
+ include ::Thrift::Struct, ::Thrift::Struct_Union
596
+
597
+ NAME = 'NestedSetInMapValue'.freeze
598
+ NAMESPACE = ''.freeze
599
+
600
+ THRIFT_FIELD_INDEX_VALUE = 1
601
+
602
+ FIELDS = {
603
+ THRIFT_FIELD_INDEX_VALUE => {type: ::Thrift::Types::MAP, name: 'value', key: {type: ::Thrift::Types::BYTE}, value: {type: ::Thrift::Types::SET, element: {type: ::Thrift::Types::BYTE}}}
604
+ }
605
+
606
+ def struct_fields; FIELDS; end
607
+
608
+ def validate
609
+ end
610
+
611
+ ::Thrift::Struct.generate_accessors self
612
+ ::Thrift.register_struct_type self
613
+ end
614
+
615
+ class NestedMapInList
616
+ include ::Thrift::Struct, ::Thrift::Struct_Union
617
+
618
+ NAME = 'NestedMapInList'.freeze
619
+ NAMESPACE = ''.freeze
620
+
621
+ THRIFT_FIELD_INDEX_VALUE = 1
622
+
623
+ FIELDS = {
624
+ THRIFT_FIELD_INDEX_VALUE => {type: ::Thrift::Types::LIST, name: 'value', element: {type: ::Thrift::Types::MAP, key: {type: ::Thrift::Types::BYTE}, value: {type: ::Thrift::Types::BYTE}}}
625
+ }
626
+
627
+ def struct_fields; FIELDS; end
628
+
629
+ def validate
630
+ end
631
+
632
+ ::Thrift::Struct.generate_accessors self
633
+ ::Thrift.register_struct_type self
634
+ end
635
+
636
+ class NestedMapInSet
637
+ include ::Thrift::Struct, ::Thrift::Struct_Union
638
+
639
+ NAME = 'NestedMapInSet'.freeze
640
+ NAMESPACE = ''.freeze
641
+
642
+ THRIFT_FIELD_INDEX_VALUE = 1
643
+
644
+ FIELDS = {
645
+ THRIFT_FIELD_INDEX_VALUE => {type: ::Thrift::Types::SET, name: 'value', element: {type: ::Thrift::Types::MAP, key: {type: ::Thrift::Types::BYTE}, value: {type: ::Thrift::Types::BYTE}}}
646
+ }
647
+
648
+ def struct_fields; FIELDS; end
649
+
650
+ def validate
651
+ end
652
+
653
+ ::Thrift::Struct.generate_accessors self
654
+ ::Thrift.register_struct_type self
655
+ end
656
+
657
+ class NestedMapInMapKey
658
+ include ::Thrift::Struct, ::Thrift::Struct_Union
659
+
660
+ NAME = 'NestedMapInMapKey'.freeze
661
+ NAMESPACE = ''.freeze
662
+
663
+ THRIFT_FIELD_INDEX_VALUE = 2
664
+
665
+ FIELDS = {
666
+ THRIFT_FIELD_INDEX_VALUE => {type: ::Thrift::Types::MAP, name: 'value', key: {type: ::Thrift::Types::MAP, key: {type: ::Thrift::Types::BYTE}, value: {type: ::Thrift::Types::BYTE}}, value: {type: ::Thrift::Types::BYTE}}
667
+ }
668
+
669
+ def struct_fields; FIELDS; end
670
+
671
+ def validate
672
+ end
673
+
674
+ ::Thrift::Struct.generate_accessors self
675
+ ::Thrift.register_struct_type self
676
+ end
677
+
678
+ class NestedMapInMapValue
679
+ include ::Thrift::Struct, ::Thrift::Struct_Union
680
+
681
+ NAME = 'NestedMapInMapValue'.freeze
682
+ NAMESPACE = ''.freeze
683
+
684
+ THRIFT_FIELD_INDEX_VALUE = 2
685
+
686
+ FIELDS = {
687
+ THRIFT_FIELD_INDEX_VALUE => {type: ::Thrift::Types::MAP, name: 'value', key: {type: ::Thrift::Types::BYTE}, value: {type: ::Thrift::Types::MAP, key: {type: ::Thrift::Types::BYTE}, value: {type: ::Thrift::Types::BYTE}}}
688
+ }
689
+
690
+ def struct_fields; FIELDS; end
691
+
692
+ def validate
693
+ end
694
+
695
+ ::Thrift::Struct.generate_accessors self
696
+ ::Thrift.register_struct_type self
697
+ end
698
+
699
+ end
@@ -21,6 +21,23 @@
21
21
  require 'spec_helper'
22
22
 
23
23
  describe 'JsonProtocol' do
24
+ describe Thrift::SimpleJsonProtocol do
25
+ before(:each) do
26
+ @trans = Thrift::MemoryBufferTransport.new
27
+ @prot = Thrift::SimpleJsonProtocol.new(@trans)
28
+ end
29
+
30
+ it 'should pretty print object' do
31
+ SpecNamespace::Hello.new.write(@prot)
32
+
33
+ @trans.read(@trans.available).should == '{"greeting":"hello world"}'
34
+ end
35
+
36
+ it 'shound not be able to read message' do
37
+ @trans.write('{"greeting":"hello world"}')
38
+ expect {@prot.read_message_begin}.to raise_error(Thrift::ProtocolException)
39
+ end
40
+ end
24
41
 
25
42
  describe Thrift::JsonProtocol do
26
43
  before(:each) do