blob: d24e5d1453dfc8c3a9ee330d65e9c092ca255962 [file] [log] [blame]
David Reissea2cba82009-03-30 21:35:00 +00001#
2# Licensed to the Apache Software Foundation (ASF) under one
3# or more contributor license agreements. See the NOTICE file
4# distributed with this work for additional information
5# regarding copyright ownership. The ASF licenses this file
6# to you under the Apache License, Version 2.0 (the
7# "License"); you may not use this file except in compliance
8# with the License. You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing,
13# software distributed under the License is distributed on an
14# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15# KIND, either express or implied. See the License for the
16# specific language governing permissions and limitations
17# under the License.
18#
19
Kevin Clark4bd89162008-07-08 00:47:49 +000020require 'thrift'
21
22module Fixtures
23 module Structs
24 class OneBool
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -040025 include Thrift::Struct, Thrift::Struct_Union
26
Kevin Clark4bd89162008-07-08 00:47:49 +000027 FIELDS = {
28 1 => {:type => Thrift::Types::BOOL, :name => 'bool'}
29 }
Kevin Clarkc85fd502009-01-14 23:55:10 +000030
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -040031 def struct_fields; FIELDS; end
32
Kevin Clarkc85fd502009-01-14 23:55:10 +000033 def validate
34 end
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -040035
36 Thrift::Struct.generate_accessors self
Kevin Clark4bd89162008-07-08 00:47:49 +000037 end
Dmytro Shteflyukf5c80a42026-03-08 19:09:43 -040038
Kevin Clark4bd89162008-07-08 00:47:49 +000039 class OneByte
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -040040 include Thrift::Struct, Thrift::Struct_Union
41
Kevin Clark4bd89162008-07-08 00:47:49 +000042 FIELDS = {
43 1 => {:type => Thrift::Types::BYTE, :name => 'byte'}
44 }
Kevin Clarkc85fd502009-01-14 23:55:10 +000045
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -040046 def struct_fields; FIELDS; end
47
Kevin Clarkc85fd502009-01-14 23:55:10 +000048 def validate
49 end
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -040050
51 Thrift::Struct.generate_accessors self
Kevin Clark4bd89162008-07-08 00:47:49 +000052 end
Dmytro Shteflyukf5c80a42026-03-08 19:09:43 -040053
Kevin Clark4bd89162008-07-08 00:47:49 +000054 class OneI16
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -040055 include Thrift::Struct, Thrift::Struct_Union
56
Kevin Clark4bd89162008-07-08 00:47:49 +000057 FIELDS = {
58 1 => {:type => Thrift::Types::I16, :name => 'i16'}
59 }
Kevin Clarkc85fd502009-01-14 23:55:10 +000060
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -040061 def struct_fields; FIELDS; end
62
Kevin Clarkc85fd502009-01-14 23:55:10 +000063 def validate
64 end
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -040065
66 Thrift::Struct.generate_accessors self
Kevin Clark4bd89162008-07-08 00:47:49 +000067 end
Dmytro Shteflyukf5c80a42026-03-08 19:09:43 -040068
Kevin Clark4bd89162008-07-08 00:47:49 +000069 class OneI32
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -040070 include Thrift::Struct, Thrift::Struct_Union
71
Kevin Clark4bd89162008-07-08 00:47:49 +000072 FIELDS = {
73 1 => {:type => Thrift::Types::I32, :name => 'i32'}
74 }
Kevin Clarkc85fd502009-01-14 23:55:10 +000075
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -040076 def struct_fields; FIELDS; end
77
Kevin Clarkc85fd502009-01-14 23:55:10 +000078 def validate
79 end
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -040080
81 Thrift::Struct.generate_accessors self
Kevin Clark4bd89162008-07-08 00:47:49 +000082 end
Dmytro Shteflyukf5c80a42026-03-08 19:09:43 -040083
Kevin Clark4bd89162008-07-08 00:47:49 +000084 class OneI64
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -040085 include Thrift::Struct, Thrift::Struct_Union
86
Kevin Clark4bd89162008-07-08 00:47:49 +000087 FIELDS = {
88 1 => {:type => Thrift::Types::I64, :name => 'i64'}
89 }
Kevin Clarkc85fd502009-01-14 23:55:10 +000090
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -040091 def struct_fields; FIELDS; end
92
Kevin Clarkc85fd502009-01-14 23:55:10 +000093 def validate
94 end
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -040095
96 Thrift::Struct.generate_accessors self
Kevin Clark4bd89162008-07-08 00:47:49 +000097 end
Dmytro Shteflyukf5c80a42026-03-08 19:09:43 -040098
Kevin Clark4bd89162008-07-08 00:47:49 +000099 class OneDouble
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400100 include Thrift::Struct, Thrift::Struct_Union
101
Kevin Clark4bd89162008-07-08 00:47:49 +0000102 FIELDS = {
103 1 => {:type => Thrift::Types::DOUBLE, :name => 'double'}
104 }
Kevin Clarkc85fd502009-01-14 23:55:10 +0000105
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400106 def struct_fields; FIELDS; end
107
Kevin Clarkc85fd502009-01-14 23:55:10 +0000108 def validate
109 end
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400110
111 Thrift::Struct.generate_accessors self
Kevin Clark4bd89162008-07-08 00:47:49 +0000112 end
Dmytro Shteflyukf5c80a42026-03-08 19:09:43 -0400113
Kevin Clark4bd89162008-07-08 00:47:49 +0000114 class OneString
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400115 include Thrift::Struct, Thrift::Struct_Union
116
Kevin Clark4bd89162008-07-08 00:47:49 +0000117 FIELDS = {
118 1 => {:type => Thrift::Types::STRING, :name => 'string'}
119 }
Kevin Clarkc85fd502009-01-14 23:55:10 +0000120
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400121 def struct_fields; FIELDS; end
122
Kevin Clarkc85fd502009-01-14 23:55:10 +0000123 def validate
124 end
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400125
126 Thrift::Struct.generate_accessors self
Kevin Clark4bd89162008-07-08 00:47:49 +0000127 end
Dmytro Shteflyukf5c80a42026-03-08 19:09:43 -0400128
Kevin Clark4bd89162008-07-08 00:47:49 +0000129 class OneMap
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400130 include Thrift::Struct, Thrift::Struct_Union
131
Kevin Clark4bd89162008-07-08 00:47:49 +0000132 FIELDS = {
133 1 => {:type => Thrift::Types::MAP, :name => 'map', :key => {:type => Thrift::Types::STRING}, :value => {:type => Thrift::Types::STRING}}
134 }
Kevin Clarkc85fd502009-01-14 23:55:10 +0000135
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400136 def struct_fields; FIELDS; end
137
Kevin Clarkc85fd502009-01-14 23:55:10 +0000138 def validate
139 end
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400140
141 Thrift::Struct.generate_accessors self
Kevin Clark4bd89162008-07-08 00:47:49 +0000142 end
Dmytro Shteflyukf5c80a42026-03-08 19:09:43 -0400143
Kevin Clark4bd89162008-07-08 00:47:49 +0000144 class NestedMap
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400145 include Thrift::Struct, Thrift::Struct_Union
146
Kevin Clark4bd89162008-07-08 00:47:49 +0000147 FIELDS = {
148 0 => {:type => Thrift::Types::MAP, :name => 'map', :key => {:type => Thrift::Types::I32}, :value => {:type => Thrift::Types::MAP, :key => {:type => Thrift::Types::I32}, :value => {:type => Thrift::Types::I32}}}
149 }
Kevin Clarkc85fd502009-01-14 23:55:10 +0000150
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400151 def struct_fields; FIELDS; end
152
Kevin Clarkc85fd502009-01-14 23:55:10 +0000153 def validate
154 end
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400155
156 Thrift::Struct.generate_accessors self
Kevin Clark4bd89162008-07-08 00:47:49 +0000157 end
Dmytro Shteflyukf5c80a42026-03-08 19:09:43 -0400158
Kevin Clark4bd89162008-07-08 00:47:49 +0000159 class OneList
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400160 include Thrift::Struct, Thrift::Struct_Union
161
Kevin Clark4bd89162008-07-08 00:47:49 +0000162 FIELDS = {
163 1 => {:type => Thrift::Types::LIST, :name => 'list', :element => {:type => Thrift::Types::STRING}}
164 }
Kevin Clarkc85fd502009-01-14 23:55:10 +0000165
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400166 def struct_fields; FIELDS; end
167
Kevin Clarkc85fd502009-01-14 23:55:10 +0000168 def validate
169 end
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400170
171 Thrift::Struct.generate_accessors self
Kevin Clark4bd89162008-07-08 00:47:49 +0000172 end
Dmytro Shteflyukf5c80a42026-03-08 19:09:43 -0400173
Kevin Clark4bd89162008-07-08 00:47:49 +0000174 class NestedList
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400175 include Thrift::Struct, Thrift::Struct_Union
176
Kevin Clark4bd89162008-07-08 00:47:49 +0000177 FIELDS = {
178 0 => {:type => Thrift::Types::LIST, :name => 'list', :element => {:type => Thrift::Types::LIST, :element => { :type => Thrift::Types::I32 } } }
179 }
Kevin Clarkc85fd502009-01-14 23:55:10 +0000180
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400181 def struct_fields; FIELDS; end
182
Kevin Clarkc85fd502009-01-14 23:55:10 +0000183 def validate
184 end
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400185
186 Thrift::Struct.generate_accessors self
Kevin Clark4bd89162008-07-08 00:47:49 +0000187 end
Dmytro Shteflyukf5c80a42026-03-08 19:09:43 -0400188
Kevin Clark4bd89162008-07-08 00:47:49 +0000189 class OneSet
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400190 include Thrift::Struct, Thrift::Struct_Union
191
Kevin Clark4bd89162008-07-08 00:47:49 +0000192 FIELDS = {
193 1 => {:type => Thrift::Types::SET, :name => 'set', :element => {:type => Thrift::Types::STRING}}
194 }
Kevin Clarkc85fd502009-01-14 23:55:10 +0000195
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400196 def struct_fields; FIELDS; end
197
Kevin Clarkc85fd502009-01-14 23:55:10 +0000198 def validate
199 end
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400200
201 Thrift::Struct.generate_accessors self
Kevin Clark4bd89162008-07-08 00:47:49 +0000202 end
Dmytro Shteflyukf5c80a42026-03-08 19:09:43 -0400203
Kevin Clark4bd89162008-07-08 00:47:49 +0000204 class NestedSet
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400205 include Thrift::Struct, Thrift::Struct_Union
206
Kevin Clark4bd89162008-07-08 00:47:49 +0000207 FIELDS = {
208 1 => {:type => Thrift::Types::SET, :name => 'set', :element => {:type => Thrift::Types::SET, :element => { :type => Thrift::Types::STRING } }}
209 }
Kevin Clarkc85fd502009-01-14 23:55:10 +0000210
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400211 def struct_fields; FIELDS; end
212
Kevin Clarkc85fd502009-01-14 23:55:10 +0000213 def validate
214 end
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400215
216 Thrift::Struct.generate_accessors self
Kevin Clark4bd89162008-07-08 00:47:49 +0000217 end
Dmytro Shteflyukf5c80a42026-03-08 19:09:43 -0400218
Kevin Clark4bd89162008-07-08 00:47:49 +0000219 # struct OneOfEach {
220 # 1: bool im_true,
221 # 2: bool im_false,
222 # 3: byte a_bite,
223 # 4: i16 integer16,
224 # 5: i32 integer32,
225 # 6: i64 integer64,
226 # 7: double double_precision,
227 # 8: string some_characters,
228 # 9: string zomg_unicode,
229 # 10: bool what_who,
230 # 11: binary base64,
231 # }
232 class OneOfEach
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400233 include Thrift::Struct, Thrift::Struct_Union
234
Kevin Clark4bd89162008-07-08 00:47:49 +0000235 FIELDS = {
236 1 => {:type => Thrift::Types::BOOL, :name => 'im_true'},
237 2 => {:type => Thrift::Types::BOOL, :name => 'im_false'},
238 3 => {:type => Thrift::Types::BYTE, :name => 'a_bite'},
239 4 => {:type => Thrift::Types::I16, :name => 'integer16'},
240 5 => {:type => Thrift::Types::I32, :name => 'integer32'},
241 6 => {:type => Thrift::Types::I64, :name => 'integer64'},
242 7 => {:type => Thrift::Types::DOUBLE, :name => 'double_precision'},
243 8 => {:type => Thrift::Types::STRING, :name => 'some_characters'},
244 9 => {:type => Thrift::Types::STRING, :name => 'zomg_unicode'},
245 10 => {:type => Thrift::Types::BOOL, :name => 'what_who'},
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400246 11 => {:type => Thrift::Types::STRING, :name => 'base64', :binary => true}
Kevin Clark4bd89162008-07-08 00:47:49 +0000247 }
248
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400249 def struct_fields; FIELDS; end
Kevin Clarkc85fd502009-01-14 23:55:10 +0000250
251 def validate
252 end
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400253
254 Thrift::Struct.generate_accessors self
Kevin Clark4bd89162008-07-08 00:47:49 +0000255 end
256
257 # struct Nested1 {
258 # 1: list<OneOfEach> a_list
259 # 2: map<i32, OneOfEach> i32_map
260 # 3: map<i64, OneOfEach> i64_map
261 # 4: map<double, OneOfEach> dbl_map
262 # 5: map<string, OneOfEach> str_map
263 # }
264 class Nested1
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400265 include Thrift::Struct, Thrift::Struct_Union
266
Kevin Clark4bd89162008-07-08 00:47:49 +0000267 FIELDS = {
268 1 => {:type => Thrift::Types::LIST, :name => 'a_list', :element => {:type => Thrift::Types::STRUCT, :class => OneOfEach}},
269 2 => {:type => Thrift::Types::MAP, :name => 'i32_map', :key => {:type => Thrift::Types::I32}, :value => {:type => Thrift::Types::STRUCT, :class => OneOfEach}},
270 3 => {:type => Thrift::Types::MAP, :name => 'i64_map', :key => {:type => Thrift::Types::I64}, :value => {:type => Thrift::Types::STRUCT, :class => OneOfEach}},
271 4 => {:type => Thrift::Types::MAP, :name => 'dbl_map', :key => {:type => Thrift::Types::DOUBLE}, :value => {:type => Thrift::Types::STRUCT, :class => OneOfEach}},
272 5 => {:type => Thrift::Types::MAP, :name => 'str_map', :key => {:type => Thrift::Types::STRING}, :value => {:type => Thrift::Types::STRUCT, :class => OneOfEach}}
273 }
Kevin Clarkc85fd502009-01-14 23:55:10 +0000274
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400275 def struct_fields; FIELDS; end
276
Kevin Clarkc85fd502009-01-14 23:55:10 +0000277 def validate
278 end
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400279
280 Thrift::Struct.generate_accessors self
Kevin Clark4bd89162008-07-08 00:47:49 +0000281 end
282
283 # struct Nested2 {
284 # 1: list<Nested1> a_list
285 # 2: map<i32, Nested1> i32_map
286 # 3: map<i64, Nested1> i64_map
287 # 4: map<double, Nested1> dbl_map
288 # 5: map<string, Nested1> str_map
289 # }
290 class Nested2
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400291 include Thrift::Struct, Thrift::Struct_Union
292
Kevin Clark4bd89162008-07-08 00:47:49 +0000293 FIELDS = {
294 1 => {:type => Thrift::Types::LIST, :name => 'a_list', :element => {:type => Thrift::Types::STRUCT, :class => Nested1}},
295 2 => {:type => Thrift::Types::MAP, :name => 'i32_map', :key => {:type => Thrift::Types::I32}, :value => {:type => Thrift::Types::STRUCT, :class => Nested1}},
296 3 => {:type => Thrift::Types::MAP, :name => 'i64_map', :key => {:type => Thrift::Types::I64}, :value => {:type => Thrift::Types::STRUCT, :class => Nested1}},
297 4 => {:type => Thrift::Types::MAP, :name => 'dbl_map', :key => {:type => Thrift::Types::DOUBLE}, :value => {:type => Thrift::Types::STRUCT, :class => Nested1}},
298 5 => {:type => Thrift::Types::MAP, :name => 'str_map', :key => {:type => Thrift::Types::STRING}, :value => {:type => Thrift::Types::STRUCT, :class => Nested1}}
299 }
Kevin Clarkc85fd502009-01-14 23:55:10 +0000300
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400301 def struct_fields; FIELDS; end
302
Kevin Clarkc85fd502009-01-14 23:55:10 +0000303 def validate
304 end
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400305
306 Thrift::Struct.generate_accessors self
Kevin Clark4bd89162008-07-08 00:47:49 +0000307 end
308
309 # struct Nested3 {
310 # 1: list<Nested2> a_list
311 # 2: map<i32, Nested2> i32_map
312 # 3: map<i64, Nested2> i64_map
313 # 4: map<double, Nested2> dbl_map
314 # 5: map<string, Nested2> str_map
315 # }
316 class Nested3
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400317 include Thrift::Struct, Thrift::Struct_Union
318
Kevin Clark4bd89162008-07-08 00:47:49 +0000319 FIELDS = {
320 1 => {:type => Thrift::Types::LIST, :name => 'a_list', :element => {:type => Thrift::Types::STRUCT, :class => Nested2}},
321 2 => {:type => Thrift::Types::MAP, :name => 'i32_map', :key => {:type => Thrift::Types::I32}, :value => {:type => Thrift::Types::STRUCT, :class => Nested2}},
322 3 => {:type => Thrift::Types::MAP, :name => 'i64_map', :key => {:type => Thrift::Types::I64}, :value => {:type => Thrift::Types::STRUCT, :class => Nested2}},
323 4 => {:type => Thrift::Types::MAP, :name => 'dbl_map', :key => {:type => Thrift::Types::DOUBLE}, :value => {:type => Thrift::Types::STRUCT, :class => Nested2}},
324 5 => {:type => Thrift::Types::MAP, :name => 'str_map', :key => {:type => Thrift::Types::STRING}, :value => {:type => Thrift::Types::STRUCT, :class => Nested2}}
325 }
Kevin Clarkc85fd502009-01-14 23:55:10 +0000326
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400327 def struct_fields; FIELDS; end
328
Kevin Clarkc85fd502009-01-14 23:55:10 +0000329 def validate
330 end
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400331
332 Thrift::Struct.generate_accessors self
Kevin Clark4bd89162008-07-08 00:47:49 +0000333 end
334
335 # struct Nested4 {
336 # 1: list<Nested3> a_list
337 # 2: map<i32, Nested3> i32_map
338 # 3: map<i64, Nested3> i64_map
339 # 4: map<double, Nested3> dbl_map
340 # 5: map<string, Nested3> str_map
341 # }
342 class Nested4
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400343 include Thrift::Struct, Thrift::Struct_Union
344
Kevin Clark4bd89162008-07-08 00:47:49 +0000345 FIELDS = {
346 1 => {:type => Thrift::Types::LIST, :name => 'a_list', :element => {:type => Thrift::Types::STRUCT, :class => Nested3}},
347 2 => {:type => Thrift::Types::MAP, :name => 'i32_map', :key => {:type => Thrift::Types::I32}, :value => {:type => Thrift::Types::STRUCT, :class => Nested3}},
348 3 => {:type => Thrift::Types::MAP, :name => 'i64_map', :key => {:type => Thrift::Types::I64}, :value => {:type => Thrift::Types::STRUCT, :class => Nested3}},
349 4 => {:type => Thrift::Types::MAP, :name => 'dbl_map', :key => {:type => Thrift::Types::DOUBLE}, :value => {:type => Thrift::Types::STRUCT, :class => Nested3}},
350 5 => {:type => Thrift::Types::MAP, :name => 'str_map', :key => {:type => Thrift::Types::STRING}, :value => {:type => Thrift::Types::STRUCT, :class => Nested3}}
351 }
Kevin Clarkc85fd502009-01-14 23:55:10 +0000352
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400353 def struct_fields; FIELDS; end
354
Kevin Clarkc85fd502009-01-14 23:55:10 +0000355 def validate
356 end
Dmytro Shteflyuk82754d22026-03-27 12:39:51 -0400357
358 Thrift::Struct.generate_accessors self
Kevin Clark4bd89162008-07-08 00:47:49 +0000359 end
360 end
361end