OLD | NEW |
| (Empty) |
1 library googleapis_beta.datastore.v1beta2.test; | |
2 | |
3 import "dart:core" as core; | |
4 import "dart:collection" as collection; | |
5 import "dart:async" as async; | |
6 import "dart:convert" as convert; | |
7 | |
8 import 'package:http/http.dart' as http; | |
9 import 'package:http/testing.dart' as http_testing; | |
10 import 'package:unittest/unittest.dart' as unittest; | |
11 | |
12 import 'package:googleapis_beta/datastore/v1beta2.dart' as api; | |
13 | |
14 class HttpServerMock extends http.BaseClient { | |
15 core.Function _callback; | |
16 core.bool _expectJson; | |
17 | |
18 void register(core.Function callback, core.bool expectJson) { | |
19 _callback = callback; | |
20 _expectJson = expectJson; | |
21 } | |
22 | |
23 async.Future<http.StreamedResponse> send(http.BaseRequest request) { | |
24 if (_expectJson) { | |
25 return request.finalize() | |
26 .transform(convert.UTF8.decoder) | |
27 .join('') | |
28 .then((core.String jsonString) { | |
29 if (jsonString.isEmpty) { | |
30 return _callback(request, null); | |
31 } else { | |
32 return _callback(request, convert.JSON.decode(jsonString)); | |
33 } | |
34 }); | |
35 } else { | |
36 var stream = request.finalize(); | |
37 if (stream == null) { | |
38 return _callback(request, []); | |
39 } else { | |
40 return stream.toBytes().then((data) { | |
41 return _callback(request, data); | |
42 }); | |
43 } | |
44 } | |
45 } | |
46 } | |
47 | |
48 http.StreamedResponse stringResponse( | |
49 core.int status, core.Map headers, core.String body) { | |
50 var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]); | |
51 return new http.StreamedResponse(stream, status, headers: headers); | |
52 } | |
53 | |
54 buildUnnamed3593() { | |
55 var o = new core.List<api.Key>(); | |
56 o.add(buildKey()); | |
57 o.add(buildKey()); | |
58 return o; | |
59 } | |
60 | |
61 checkUnnamed3593(core.List<api.Key> o) { | |
62 unittest.expect(o, unittest.hasLength(2)); | |
63 checkKey(o[0]); | |
64 checkKey(o[1]); | |
65 } | |
66 | |
67 core.int buildCounterAllocateIdsRequest = 0; | |
68 buildAllocateIdsRequest() { | |
69 var o = new api.AllocateIdsRequest(); | |
70 buildCounterAllocateIdsRequest++; | |
71 if (buildCounterAllocateIdsRequest < 3) { | |
72 o.keys = buildUnnamed3593(); | |
73 } | |
74 buildCounterAllocateIdsRequest--; | |
75 return o; | |
76 } | |
77 | |
78 checkAllocateIdsRequest(api.AllocateIdsRequest o) { | |
79 buildCounterAllocateIdsRequest++; | |
80 if (buildCounterAllocateIdsRequest < 3) { | |
81 checkUnnamed3593(o.keys); | |
82 } | |
83 buildCounterAllocateIdsRequest--; | |
84 } | |
85 | |
86 buildUnnamed3594() { | |
87 var o = new core.List<api.Key>(); | |
88 o.add(buildKey()); | |
89 o.add(buildKey()); | |
90 return o; | |
91 } | |
92 | |
93 checkUnnamed3594(core.List<api.Key> o) { | |
94 unittest.expect(o, unittest.hasLength(2)); | |
95 checkKey(o[0]); | |
96 checkKey(o[1]); | |
97 } | |
98 | |
99 core.int buildCounterAllocateIdsResponse = 0; | |
100 buildAllocateIdsResponse() { | |
101 var o = new api.AllocateIdsResponse(); | |
102 buildCounterAllocateIdsResponse++; | |
103 if (buildCounterAllocateIdsResponse < 3) { | |
104 o.header = buildResponseHeader(); | |
105 o.keys = buildUnnamed3594(); | |
106 } | |
107 buildCounterAllocateIdsResponse--; | |
108 return o; | |
109 } | |
110 | |
111 checkAllocateIdsResponse(api.AllocateIdsResponse o) { | |
112 buildCounterAllocateIdsResponse++; | |
113 if (buildCounterAllocateIdsResponse < 3) { | |
114 checkResponseHeader(o.header); | |
115 checkUnnamed3594(o.keys); | |
116 } | |
117 buildCounterAllocateIdsResponse--; | |
118 } | |
119 | |
120 core.int buildCounterBeginTransactionRequest = 0; | |
121 buildBeginTransactionRequest() { | |
122 var o = new api.BeginTransactionRequest(); | |
123 buildCounterBeginTransactionRequest++; | |
124 if (buildCounterBeginTransactionRequest < 3) { | |
125 o.isolationLevel = "foo"; | |
126 } | |
127 buildCounterBeginTransactionRequest--; | |
128 return o; | |
129 } | |
130 | |
131 checkBeginTransactionRequest(api.BeginTransactionRequest o) { | |
132 buildCounterBeginTransactionRequest++; | |
133 if (buildCounterBeginTransactionRequest < 3) { | |
134 unittest.expect(o.isolationLevel, unittest.equals('foo')); | |
135 } | |
136 buildCounterBeginTransactionRequest--; | |
137 } | |
138 | |
139 core.int buildCounterBeginTransactionResponse = 0; | |
140 buildBeginTransactionResponse() { | |
141 var o = new api.BeginTransactionResponse(); | |
142 buildCounterBeginTransactionResponse++; | |
143 if (buildCounterBeginTransactionResponse < 3) { | |
144 o.header = buildResponseHeader(); | |
145 o.transaction = "foo"; | |
146 } | |
147 buildCounterBeginTransactionResponse--; | |
148 return o; | |
149 } | |
150 | |
151 checkBeginTransactionResponse(api.BeginTransactionResponse o) { | |
152 buildCounterBeginTransactionResponse++; | |
153 if (buildCounterBeginTransactionResponse < 3) { | |
154 checkResponseHeader(o.header); | |
155 unittest.expect(o.transaction, unittest.equals('foo')); | |
156 } | |
157 buildCounterBeginTransactionResponse--; | |
158 } | |
159 | |
160 core.int buildCounterCommitRequest = 0; | |
161 buildCommitRequest() { | |
162 var o = new api.CommitRequest(); | |
163 buildCounterCommitRequest++; | |
164 if (buildCounterCommitRequest < 3) { | |
165 o.ignoreReadOnly = true; | |
166 o.mode = "foo"; | |
167 o.mutation = buildMutation(); | |
168 o.transaction = "foo"; | |
169 } | |
170 buildCounterCommitRequest--; | |
171 return o; | |
172 } | |
173 | |
174 checkCommitRequest(api.CommitRequest o) { | |
175 buildCounterCommitRequest++; | |
176 if (buildCounterCommitRequest < 3) { | |
177 unittest.expect(o.ignoreReadOnly, unittest.isTrue); | |
178 unittest.expect(o.mode, unittest.equals('foo')); | |
179 checkMutation(o.mutation); | |
180 unittest.expect(o.transaction, unittest.equals('foo')); | |
181 } | |
182 buildCounterCommitRequest--; | |
183 } | |
184 | |
185 core.int buildCounterCommitResponse = 0; | |
186 buildCommitResponse() { | |
187 var o = new api.CommitResponse(); | |
188 buildCounterCommitResponse++; | |
189 if (buildCounterCommitResponse < 3) { | |
190 o.header = buildResponseHeader(); | |
191 o.mutationResult = buildMutationResult(); | |
192 } | |
193 buildCounterCommitResponse--; | |
194 return o; | |
195 } | |
196 | |
197 checkCommitResponse(api.CommitResponse o) { | |
198 buildCounterCommitResponse++; | |
199 if (buildCounterCommitResponse < 3) { | |
200 checkResponseHeader(o.header); | |
201 checkMutationResult(o.mutationResult); | |
202 } | |
203 buildCounterCommitResponse--; | |
204 } | |
205 | |
206 buildUnnamed3595() { | |
207 var o = new core.List<api.Filter>(); | |
208 o.add(buildFilter()); | |
209 o.add(buildFilter()); | |
210 return o; | |
211 } | |
212 | |
213 checkUnnamed3595(core.List<api.Filter> o) { | |
214 unittest.expect(o, unittest.hasLength(2)); | |
215 checkFilter(o[0]); | |
216 checkFilter(o[1]); | |
217 } | |
218 | |
219 core.int buildCounterCompositeFilter = 0; | |
220 buildCompositeFilter() { | |
221 var o = new api.CompositeFilter(); | |
222 buildCounterCompositeFilter++; | |
223 if (buildCounterCompositeFilter < 3) { | |
224 o.filters = buildUnnamed3595(); | |
225 o.operator = "foo"; | |
226 } | |
227 buildCounterCompositeFilter--; | |
228 return o; | |
229 } | |
230 | |
231 checkCompositeFilter(api.CompositeFilter o) { | |
232 buildCounterCompositeFilter++; | |
233 if (buildCounterCompositeFilter < 3) { | |
234 checkUnnamed3595(o.filters); | |
235 unittest.expect(o.operator, unittest.equals('foo')); | |
236 } | |
237 buildCounterCompositeFilter--; | |
238 } | |
239 | |
240 buildUnnamed3596() { | |
241 var o = new core.Map<core.String, api.Property>(); | |
242 o["x"] = buildProperty(); | |
243 o["y"] = buildProperty(); | |
244 return o; | |
245 } | |
246 | |
247 checkUnnamed3596(core.Map<core.String, api.Property> o) { | |
248 unittest.expect(o, unittest.hasLength(2)); | |
249 checkProperty(o["x"]); | |
250 checkProperty(o["y"]); | |
251 } | |
252 | |
253 core.int buildCounterEntity = 0; | |
254 buildEntity() { | |
255 var o = new api.Entity(); | |
256 buildCounterEntity++; | |
257 if (buildCounterEntity < 3) { | |
258 o.key = buildKey(); | |
259 o.properties = buildUnnamed3596(); | |
260 } | |
261 buildCounterEntity--; | |
262 return o; | |
263 } | |
264 | |
265 checkEntity(api.Entity o) { | |
266 buildCounterEntity++; | |
267 if (buildCounterEntity < 3) { | |
268 checkKey(o.key); | |
269 checkUnnamed3596(o.properties); | |
270 } | |
271 buildCounterEntity--; | |
272 } | |
273 | |
274 core.int buildCounterEntityResult = 0; | |
275 buildEntityResult() { | |
276 var o = new api.EntityResult(); | |
277 buildCounterEntityResult++; | |
278 if (buildCounterEntityResult < 3) { | |
279 o.entity = buildEntity(); | |
280 } | |
281 buildCounterEntityResult--; | |
282 return o; | |
283 } | |
284 | |
285 checkEntityResult(api.EntityResult o) { | |
286 buildCounterEntityResult++; | |
287 if (buildCounterEntityResult < 3) { | |
288 checkEntity(o.entity); | |
289 } | |
290 buildCounterEntityResult--; | |
291 } | |
292 | |
293 core.int buildCounterFilter = 0; | |
294 buildFilter() { | |
295 var o = new api.Filter(); | |
296 buildCounterFilter++; | |
297 if (buildCounterFilter < 3) { | |
298 o.compositeFilter = buildCompositeFilter(); | |
299 o.propertyFilter = buildPropertyFilter(); | |
300 } | |
301 buildCounterFilter--; | |
302 return o; | |
303 } | |
304 | |
305 checkFilter(api.Filter o) { | |
306 buildCounterFilter++; | |
307 if (buildCounterFilter < 3) { | |
308 checkCompositeFilter(o.compositeFilter); | |
309 checkPropertyFilter(o.propertyFilter); | |
310 } | |
311 buildCounterFilter--; | |
312 } | |
313 | |
314 buildUnnamed3597() { | |
315 var o = new core.List<api.GqlQueryArg>(); | |
316 o.add(buildGqlQueryArg()); | |
317 o.add(buildGqlQueryArg()); | |
318 return o; | |
319 } | |
320 | |
321 checkUnnamed3597(core.List<api.GqlQueryArg> o) { | |
322 unittest.expect(o, unittest.hasLength(2)); | |
323 checkGqlQueryArg(o[0]); | |
324 checkGqlQueryArg(o[1]); | |
325 } | |
326 | |
327 buildUnnamed3598() { | |
328 var o = new core.List<api.GqlQueryArg>(); | |
329 o.add(buildGqlQueryArg()); | |
330 o.add(buildGqlQueryArg()); | |
331 return o; | |
332 } | |
333 | |
334 checkUnnamed3598(core.List<api.GqlQueryArg> o) { | |
335 unittest.expect(o, unittest.hasLength(2)); | |
336 checkGqlQueryArg(o[0]); | |
337 checkGqlQueryArg(o[1]); | |
338 } | |
339 | |
340 core.int buildCounterGqlQuery = 0; | |
341 buildGqlQuery() { | |
342 var o = new api.GqlQuery(); | |
343 buildCounterGqlQuery++; | |
344 if (buildCounterGqlQuery < 3) { | |
345 o.allowLiteral = true; | |
346 o.nameArgs = buildUnnamed3597(); | |
347 o.numberArgs = buildUnnamed3598(); | |
348 o.queryString = "foo"; | |
349 } | |
350 buildCounterGqlQuery--; | |
351 return o; | |
352 } | |
353 | |
354 checkGqlQuery(api.GqlQuery o) { | |
355 buildCounterGqlQuery++; | |
356 if (buildCounterGqlQuery < 3) { | |
357 unittest.expect(o.allowLiteral, unittest.isTrue); | |
358 checkUnnamed3597(o.nameArgs); | |
359 checkUnnamed3598(o.numberArgs); | |
360 unittest.expect(o.queryString, unittest.equals('foo')); | |
361 } | |
362 buildCounterGqlQuery--; | |
363 } | |
364 | |
365 core.int buildCounterGqlQueryArg = 0; | |
366 buildGqlQueryArg() { | |
367 var o = new api.GqlQueryArg(); | |
368 buildCounterGqlQueryArg++; | |
369 if (buildCounterGqlQueryArg < 3) { | |
370 o.cursor = "foo"; | |
371 o.name = "foo"; | |
372 o.value = buildValue(); | |
373 } | |
374 buildCounterGqlQueryArg--; | |
375 return o; | |
376 } | |
377 | |
378 checkGqlQueryArg(api.GqlQueryArg o) { | |
379 buildCounterGqlQueryArg++; | |
380 if (buildCounterGqlQueryArg < 3) { | |
381 unittest.expect(o.cursor, unittest.equals('foo')); | |
382 unittest.expect(o.name, unittest.equals('foo')); | |
383 checkValue(o.value); | |
384 } | |
385 buildCounterGqlQueryArg--; | |
386 } | |
387 | |
388 buildUnnamed3599() { | |
389 var o = new core.List<api.KeyPathElement>(); | |
390 o.add(buildKeyPathElement()); | |
391 o.add(buildKeyPathElement()); | |
392 return o; | |
393 } | |
394 | |
395 checkUnnamed3599(core.List<api.KeyPathElement> o) { | |
396 unittest.expect(o, unittest.hasLength(2)); | |
397 checkKeyPathElement(o[0]); | |
398 checkKeyPathElement(o[1]); | |
399 } | |
400 | |
401 core.int buildCounterKey = 0; | |
402 buildKey() { | |
403 var o = new api.Key(); | |
404 buildCounterKey++; | |
405 if (buildCounterKey < 3) { | |
406 o.partitionId = buildPartitionId(); | |
407 o.path = buildUnnamed3599(); | |
408 } | |
409 buildCounterKey--; | |
410 return o; | |
411 } | |
412 | |
413 checkKey(api.Key o) { | |
414 buildCounterKey++; | |
415 if (buildCounterKey < 3) { | |
416 checkPartitionId(o.partitionId); | |
417 checkUnnamed3599(o.path); | |
418 } | |
419 buildCounterKey--; | |
420 } | |
421 | |
422 core.int buildCounterKeyPathElement = 0; | |
423 buildKeyPathElement() { | |
424 var o = new api.KeyPathElement(); | |
425 buildCounterKeyPathElement++; | |
426 if (buildCounterKeyPathElement < 3) { | |
427 o.id = "foo"; | |
428 o.kind = "foo"; | |
429 o.name = "foo"; | |
430 } | |
431 buildCounterKeyPathElement--; | |
432 return o; | |
433 } | |
434 | |
435 checkKeyPathElement(api.KeyPathElement o) { | |
436 buildCounterKeyPathElement++; | |
437 if (buildCounterKeyPathElement < 3) { | |
438 unittest.expect(o.id, unittest.equals('foo')); | |
439 unittest.expect(o.kind, unittest.equals('foo')); | |
440 unittest.expect(o.name, unittest.equals('foo')); | |
441 } | |
442 buildCounterKeyPathElement--; | |
443 } | |
444 | |
445 core.int buildCounterKindExpression = 0; | |
446 buildKindExpression() { | |
447 var o = new api.KindExpression(); | |
448 buildCounterKindExpression++; | |
449 if (buildCounterKindExpression < 3) { | |
450 o.name = "foo"; | |
451 } | |
452 buildCounterKindExpression--; | |
453 return o; | |
454 } | |
455 | |
456 checkKindExpression(api.KindExpression o) { | |
457 buildCounterKindExpression++; | |
458 if (buildCounterKindExpression < 3) { | |
459 unittest.expect(o.name, unittest.equals('foo')); | |
460 } | |
461 buildCounterKindExpression--; | |
462 } | |
463 | |
464 buildUnnamed3600() { | |
465 var o = new core.List<api.Key>(); | |
466 o.add(buildKey()); | |
467 o.add(buildKey()); | |
468 return o; | |
469 } | |
470 | |
471 checkUnnamed3600(core.List<api.Key> o) { | |
472 unittest.expect(o, unittest.hasLength(2)); | |
473 checkKey(o[0]); | |
474 checkKey(o[1]); | |
475 } | |
476 | |
477 core.int buildCounterLookupRequest = 0; | |
478 buildLookupRequest() { | |
479 var o = new api.LookupRequest(); | |
480 buildCounterLookupRequest++; | |
481 if (buildCounterLookupRequest < 3) { | |
482 o.keys = buildUnnamed3600(); | |
483 o.readOptions = buildReadOptions(); | |
484 } | |
485 buildCounterLookupRequest--; | |
486 return o; | |
487 } | |
488 | |
489 checkLookupRequest(api.LookupRequest o) { | |
490 buildCounterLookupRequest++; | |
491 if (buildCounterLookupRequest < 3) { | |
492 checkUnnamed3600(o.keys); | |
493 checkReadOptions(o.readOptions); | |
494 } | |
495 buildCounterLookupRequest--; | |
496 } | |
497 | |
498 buildUnnamed3601() { | |
499 var o = new core.List<api.Key>(); | |
500 o.add(buildKey()); | |
501 o.add(buildKey()); | |
502 return o; | |
503 } | |
504 | |
505 checkUnnamed3601(core.List<api.Key> o) { | |
506 unittest.expect(o, unittest.hasLength(2)); | |
507 checkKey(o[0]); | |
508 checkKey(o[1]); | |
509 } | |
510 | |
511 buildUnnamed3602() { | |
512 var o = new core.List<api.EntityResult>(); | |
513 o.add(buildEntityResult()); | |
514 o.add(buildEntityResult()); | |
515 return o; | |
516 } | |
517 | |
518 checkUnnamed3602(core.List<api.EntityResult> o) { | |
519 unittest.expect(o, unittest.hasLength(2)); | |
520 checkEntityResult(o[0]); | |
521 checkEntityResult(o[1]); | |
522 } | |
523 | |
524 buildUnnamed3603() { | |
525 var o = new core.List<api.EntityResult>(); | |
526 o.add(buildEntityResult()); | |
527 o.add(buildEntityResult()); | |
528 return o; | |
529 } | |
530 | |
531 checkUnnamed3603(core.List<api.EntityResult> o) { | |
532 unittest.expect(o, unittest.hasLength(2)); | |
533 checkEntityResult(o[0]); | |
534 checkEntityResult(o[1]); | |
535 } | |
536 | |
537 core.int buildCounterLookupResponse = 0; | |
538 buildLookupResponse() { | |
539 var o = new api.LookupResponse(); | |
540 buildCounterLookupResponse++; | |
541 if (buildCounterLookupResponse < 3) { | |
542 o.deferred = buildUnnamed3601(); | |
543 o.found = buildUnnamed3602(); | |
544 o.header = buildResponseHeader(); | |
545 o.missing = buildUnnamed3603(); | |
546 } | |
547 buildCounterLookupResponse--; | |
548 return o; | |
549 } | |
550 | |
551 checkLookupResponse(api.LookupResponse o) { | |
552 buildCounterLookupResponse++; | |
553 if (buildCounterLookupResponse < 3) { | |
554 checkUnnamed3601(o.deferred); | |
555 checkUnnamed3602(o.found); | |
556 checkResponseHeader(o.header); | |
557 checkUnnamed3603(o.missing); | |
558 } | |
559 buildCounterLookupResponse--; | |
560 } | |
561 | |
562 buildUnnamed3604() { | |
563 var o = new core.List<api.Key>(); | |
564 o.add(buildKey()); | |
565 o.add(buildKey()); | |
566 return o; | |
567 } | |
568 | |
569 checkUnnamed3604(core.List<api.Key> o) { | |
570 unittest.expect(o, unittest.hasLength(2)); | |
571 checkKey(o[0]); | |
572 checkKey(o[1]); | |
573 } | |
574 | |
575 buildUnnamed3605() { | |
576 var o = new core.List<api.Entity>(); | |
577 o.add(buildEntity()); | |
578 o.add(buildEntity()); | |
579 return o; | |
580 } | |
581 | |
582 checkUnnamed3605(core.List<api.Entity> o) { | |
583 unittest.expect(o, unittest.hasLength(2)); | |
584 checkEntity(o[0]); | |
585 checkEntity(o[1]); | |
586 } | |
587 | |
588 buildUnnamed3606() { | |
589 var o = new core.List<api.Entity>(); | |
590 o.add(buildEntity()); | |
591 o.add(buildEntity()); | |
592 return o; | |
593 } | |
594 | |
595 checkUnnamed3606(core.List<api.Entity> o) { | |
596 unittest.expect(o, unittest.hasLength(2)); | |
597 checkEntity(o[0]); | |
598 checkEntity(o[1]); | |
599 } | |
600 | |
601 buildUnnamed3607() { | |
602 var o = new core.List<api.Entity>(); | |
603 o.add(buildEntity()); | |
604 o.add(buildEntity()); | |
605 return o; | |
606 } | |
607 | |
608 checkUnnamed3607(core.List<api.Entity> o) { | |
609 unittest.expect(o, unittest.hasLength(2)); | |
610 checkEntity(o[0]); | |
611 checkEntity(o[1]); | |
612 } | |
613 | |
614 buildUnnamed3608() { | |
615 var o = new core.List<api.Entity>(); | |
616 o.add(buildEntity()); | |
617 o.add(buildEntity()); | |
618 return o; | |
619 } | |
620 | |
621 checkUnnamed3608(core.List<api.Entity> o) { | |
622 unittest.expect(o, unittest.hasLength(2)); | |
623 checkEntity(o[0]); | |
624 checkEntity(o[1]); | |
625 } | |
626 | |
627 core.int buildCounterMutation = 0; | |
628 buildMutation() { | |
629 var o = new api.Mutation(); | |
630 buildCounterMutation++; | |
631 if (buildCounterMutation < 3) { | |
632 o.delete = buildUnnamed3604(); | |
633 o.force = true; | |
634 o.insert = buildUnnamed3605(); | |
635 o.insertAutoId = buildUnnamed3606(); | |
636 o.update = buildUnnamed3607(); | |
637 o.upsert = buildUnnamed3608(); | |
638 } | |
639 buildCounterMutation--; | |
640 return o; | |
641 } | |
642 | |
643 checkMutation(api.Mutation o) { | |
644 buildCounterMutation++; | |
645 if (buildCounterMutation < 3) { | |
646 checkUnnamed3604(o.delete); | |
647 unittest.expect(o.force, unittest.isTrue); | |
648 checkUnnamed3605(o.insert); | |
649 checkUnnamed3606(o.insertAutoId); | |
650 checkUnnamed3607(o.update); | |
651 checkUnnamed3608(o.upsert); | |
652 } | |
653 buildCounterMutation--; | |
654 } | |
655 | |
656 buildUnnamed3609() { | |
657 var o = new core.List<api.Key>(); | |
658 o.add(buildKey()); | |
659 o.add(buildKey()); | |
660 return o; | |
661 } | |
662 | |
663 checkUnnamed3609(core.List<api.Key> o) { | |
664 unittest.expect(o, unittest.hasLength(2)); | |
665 checkKey(o[0]); | |
666 checkKey(o[1]); | |
667 } | |
668 | |
669 core.int buildCounterMutationResult = 0; | |
670 buildMutationResult() { | |
671 var o = new api.MutationResult(); | |
672 buildCounterMutationResult++; | |
673 if (buildCounterMutationResult < 3) { | |
674 o.indexUpdates = 42; | |
675 o.insertAutoIdKeys = buildUnnamed3609(); | |
676 } | |
677 buildCounterMutationResult--; | |
678 return o; | |
679 } | |
680 | |
681 checkMutationResult(api.MutationResult o) { | |
682 buildCounterMutationResult++; | |
683 if (buildCounterMutationResult < 3) { | |
684 unittest.expect(o.indexUpdates, unittest.equals(42)); | |
685 checkUnnamed3609(o.insertAutoIdKeys); | |
686 } | |
687 buildCounterMutationResult--; | |
688 } | |
689 | |
690 core.int buildCounterPartitionId = 0; | |
691 buildPartitionId() { | |
692 var o = new api.PartitionId(); | |
693 buildCounterPartitionId++; | |
694 if (buildCounterPartitionId < 3) { | |
695 o.datasetId = "foo"; | |
696 o.namespace = "foo"; | |
697 } | |
698 buildCounterPartitionId--; | |
699 return o; | |
700 } | |
701 | |
702 checkPartitionId(api.PartitionId o) { | |
703 buildCounterPartitionId++; | |
704 if (buildCounterPartitionId < 3) { | |
705 unittest.expect(o.datasetId, unittest.equals('foo')); | |
706 unittest.expect(o.namespace, unittest.equals('foo')); | |
707 } | |
708 buildCounterPartitionId--; | |
709 } | |
710 | |
711 buildUnnamed3610() { | |
712 var o = new core.List<api.Value>(); | |
713 o.add(buildValue()); | |
714 o.add(buildValue()); | |
715 return o; | |
716 } | |
717 | |
718 checkUnnamed3610(core.List<api.Value> o) { | |
719 unittest.expect(o, unittest.hasLength(2)); | |
720 checkValue(o[0]); | |
721 checkValue(o[1]); | |
722 } | |
723 | |
724 core.int buildCounterProperty = 0; | |
725 buildProperty() { | |
726 var o = new api.Property(); | |
727 buildCounterProperty++; | |
728 if (buildCounterProperty < 3) { | |
729 o.blobKeyValue = "foo"; | |
730 o.blobValue = "foo"; | |
731 o.booleanValue = true; | |
732 o.dateTimeValue = core.DateTime.parse("2002-02-27T14:01:02"); | |
733 o.doubleValue = 42.0; | |
734 o.entityValue = buildEntity(); | |
735 o.indexed = true; | |
736 o.integerValue = "foo"; | |
737 o.keyValue = buildKey(); | |
738 o.listValue = buildUnnamed3610(); | |
739 o.meaning = 42; | |
740 o.stringValue = "foo"; | |
741 } | |
742 buildCounterProperty--; | |
743 return o; | |
744 } | |
745 | |
746 checkProperty(api.Property o) { | |
747 buildCounterProperty++; | |
748 if (buildCounterProperty < 3) { | |
749 unittest.expect(o.blobKeyValue, unittest.equals('foo')); | |
750 unittest.expect(o.blobValue, unittest.equals('foo')); | |
751 unittest.expect(o.booleanValue, unittest.isTrue); | |
752 unittest.expect(o.dateTimeValue, unittest.equals(core.DateTime.parse("2002-0
2-27T14:01:02"))); | |
753 unittest.expect(o.doubleValue, unittest.equals(42.0)); | |
754 checkEntity(o.entityValue); | |
755 unittest.expect(o.indexed, unittest.isTrue); | |
756 unittest.expect(o.integerValue, unittest.equals('foo')); | |
757 checkKey(o.keyValue); | |
758 checkUnnamed3610(o.listValue); | |
759 unittest.expect(o.meaning, unittest.equals(42)); | |
760 unittest.expect(o.stringValue, unittest.equals('foo')); | |
761 } | |
762 buildCounterProperty--; | |
763 } | |
764 | |
765 core.int buildCounterPropertyExpression = 0; | |
766 buildPropertyExpression() { | |
767 var o = new api.PropertyExpression(); | |
768 buildCounterPropertyExpression++; | |
769 if (buildCounterPropertyExpression < 3) { | |
770 o.aggregationFunction = "foo"; | |
771 o.property = buildPropertyReference(); | |
772 } | |
773 buildCounterPropertyExpression--; | |
774 return o; | |
775 } | |
776 | |
777 checkPropertyExpression(api.PropertyExpression o) { | |
778 buildCounterPropertyExpression++; | |
779 if (buildCounterPropertyExpression < 3) { | |
780 unittest.expect(o.aggregationFunction, unittest.equals('foo')); | |
781 checkPropertyReference(o.property); | |
782 } | |
783 buildCounterPropertyExpression--; | |
784 } | |
785 | |
786 core.int buildCounterPropertyFilter = 0; | |
787 buildPropertyFilter() { | |
788 var o = new api.PropertyFilter(); | |
789 buildCounterPropertyFilter++; | |
790 if (buildCounterPropertyFilter < 3) { | |
791 o.operator = "foo"; | |
792 o.property = buildPropertyReference(); | |
793 o.value = buildValue(); | |
794 } | |
795 buildCounterPropertyFilter--; | |
796 return o; | |
797 } | |
798 | |
799 checkPropertyFilter(api.PropertyFilter o) { | |
800 buildCounterPropertyFilter++; | |
801 if (buildCounterPropertyFilter < 3) { | |
802 unittest.expect(o.operator, unittest.equals('foo')); | |
803 checkPropertyReference(o.property); | |
804 checkValue(o.value); | |
805 } | |
806 buildCounterPropertyFilter--; | |
807 } | |
808 | |
809 core.int buildCounterPropertyOrder = 0; | |
810 buildPropertyOrder() { | |
811 var o = new api.PropertyOrder(); | |
812 buildCounterPropertyOrder++; | |
813 if (buildCounterPropertyOrder < 3) { | |
814 o.direction = "foo"; | |
815 o.property = buildPropertyReference(); | |
816 } | |
817 buildCounterPropertyOrder--; | |
818 return o; | |
819 } | |
820 | |
821 checkPropertyOrder(api.PropertyOrder o) { | |
822 buildCounterPropertyOrder++; | |
823 if (buildCounterPropertyOrder < 3) { | |
824 unittest.expect(o.direction, unittest.equals('foo')); | |
825 checkPropertyReference(o.property); | |
826 } | |
827 buildCounterPropertyOrder--; | |
828 } | |
829 | |
830 core.int buildCounterPropertyReference = 0; | |
831 buildPropertyReference() { | |
832 var o = new api.PropertyReference(); | |
833 buildCounterPropertyReference++; | |
834 if (buildCounterPropertyReference < 3) { | |
835 o.name = "foo"; | |
836 } | |
837 buildCounterPropertyReference--; | |
838 return o; | |
839 } | |
840 | |
841 checkPropertyReference(api.PropertyReference o) { | |
842 buildCounterPropertyReference++; | |
843 if (buildCounterPropertyReference < 3) { | |
844 unittest.expect(o.name, unittest.equals('foo')); | |
845 } | |
846 buildCounterPropertyReference--; | |
847 } | |
848 | |
849 buildUnnamed3611() { | |
850 var o = new core.List<api.PropertyReference>(); | |
851 o.add(buildPropertyReference()); | |
852 o.add(buildPropertyReference()); | |
853 return o; | |
854 } | |
855 | |
856 checkUnnamed3611(core.List<api.PropertyReference> o) { | |
857 unittest.expect(o, unittest.hasLength(2)); | |
858 checkPropertyReference(o[0]); | |
859 checkPropertyReference(o[1]); | |
860 } | |
861 | |
862 buildUnnamed3612() { | |
863 var o = new core.List<api.KindExpression>(); | |
864 o.add(buildKindExpression()); | |
865 o.add(buildKindExpression()); | |
866 return o; | |
867 } | |
868 | |
869 checkUnnamed3612(core.List<api.KindExpression> o) { | |
870 unittest.expect(o, unittest.hasLength(2)); | |
871 checkKindExpression(o[0]); | |
872 checkKindExpression(o[1]); | |
873 } | |
874 | |
875 buildUnnamed3613() { | |
876 var o = new core.List<api.PropertyOrder>(); | |
877 o.add(buildPropertyOrder()); | |
878 o.add(buildPropertyOrder()); | |
879 return o; | |
880 } | |
881 | |
882 checkUnnamed3613(core.List<api.PropertyOrder> o) { | |
883 unittest.expect(o, unittest.hasLength(2)); | |
884 checkPropertyOrder(o[0]); | |
885 checkPropertyOrder(o[1]); | |
886 } | |
887 | |
888 buildUnnamed3614() { | |
889 var o = new core.List<api.PropertyExpression>(); | |
890 o.add(buildPropertyExpression()); | |
891 o.add(buildPropertyExpression()); | |
892 return o; | |
893 } | |
894 | |
895 checkUnnamed3614(core.List<api.PropertyExpression> o) { | |
896 unittest.expect(o, unittest.hasLength(2)); | |
897 checkPropertyExpression(o[0]); | |
898 checkPropertyExpression(o[1]); | |
899 } | |
900 | |
901 core.int buildCounterQuery = 0; | |
902 buildQuery() { | |
903 var o = new api.Query(); | |
904 buildCounterQuery++; | |
905 if (buildCounterQuery < 3) { | |
906 o.endCursor = "foo"; | |
907 o.filter = buildFilter(); | |
908 o.groupBy = buildUnnamed3611(); | |
909 o.kinds = buildUnnamed3612(); | |
910 o.limit = 42; | |
911 o.offset = 42; | |
912 o.order = buildUnnamed3613(); | |
913 o.projection = buildUnnamed3614(); | |
914 o.startCursor = "foo"; | |
915 } | |
916 buildCounterQuery--; | |
917 return o; | |
918 } | |
919 | |
920 checkQuery(api.Query o) { | |
921 buildCounterQuery++; | |
922 if (buildCounterQuery < 3) { | |
923 unittest.expect(o.endCursor, unittest.equals('foo')); | |
924 checkFilter(o.filter); | |
925 checkUnnamed3611(o.groupBy); | |
926 checkUnnamed3612(o.kinds); | |
927 unittest.expect(o.limit, unittest.equals(42)); | |
928 unittest.expect(o.offset, unittest.equals(42)); | |
929 checkUnnamed3613(o.order); | |
930 checkUnnamed3614(o.projection); | |
931 unittest.expect(o.startCursor, unittest.equals('foo')); | |
932 } | |
933 buildCounterQuery--; | |
934 } | |
935 | |
936 buildUnnamed3615() { | |
937 var o = new core.List<api.EntityResult>(); | |
938 o.add(buildEntityResult()); | |
939 o.add(buildEntityResult()); | |
940 return o; | |
941 } | |
942 | |
943 checkUnnamed3615(core.List<api.EntityResult> o) { | |
944 unittest.expect(o, unittest.hasLength(2)); | |
945 checkEntityResult(o[0]); | |
946 checkEntityResult(o[1]); | |
947 } | |
948 | |
949 core.int buildCounterQueryResultBatch = 0; | |
950 buildQueryResultBatch() { | |
951 var o = new api.QueryResultBatch(); | |
952 buildCounterQueryResultBatch++; | |
953 if (buildCounterQueryResultBatch < 3) { | |
954 o.endCursor = "foo"; | |
955 o.entityResultType = "foo"; | |
956 o.entityResults = buildUnnamed3615(); | |
957 o.moreResults = "foo"; | |
958 o.skippedResults = 42; | |
959 } | |
960 buildCounterQueryResultBatch--; | |
961 return o; | |
962 } | |
963 | |
964 checkQueryResultBatch(api.QueryResultBatch o) { | |
965 buildCounterQueryResultBatch++; | |
966 if (buildCounterQueryResultBatch < 3) { | |
967 unittest.expect(o.endCursor, unittest.equals('foo')); | |
968 unittest.expect(o.entityResultType, unittest.equals('foo')); | |
969 checkUnnamed3615(o.entityResults); | |
970 unittest.expect(o.moreResults, unittest.equals('foo')); | |
971 unittest.expect(o.skippedResults, unittest.equals(42)); | |
972 } | |
973 buildCounterQueryResultBatch--; | |
974 } | |
975 | |
976 core.int buildCounterReadOptions = 0; | |
977 buildReadOptions() { | |
978 var o = new api.ReadOptions(); | |
979 buildCounterReadOptions++; | |
980 if (buildCounterReadOptions < 3) { | |
981 o.readConsistency = "foo"; | |
982 o.transaction = "foo"; | |
983 } | |
984 buildCounterReadOptions--; | |
985 return o; | |
986 } | |
987 | |
988 checkReadOptions(api.ReadOptions o) { | |
989 buildCounterReadOptions++; | |
990 if (buildCounterReadOptions < 3) { | |
991 unittest.expect(o.readConsistency, unittest.equals('foo')); | |
992 unittest.expect(o.transaction, unittest.equals('foo')); | |
993 } | |
994 buildCounterReadOptions--; | |
995 } | |
996 | |
997 core.int buildCounterResponseHeader = 0; | |
998 buildResponseHeader() { | |
999 var o = new api.ResponseHeader(); | |
1000 buildCounterResponseHeader++; | |
1001 if (buildCounterResponseHeader < 3) { | |
1002 o.kind = "foo"; | |
1003 } | |
1004 buildCounterResponseHeader--; | |
1005 return o; | |
1006 } | |
1007 | |
1008 checkResponseHeader(api.ResponseHeader o) { | |
1009 buildCounterResponseHeader++; | |
1010 if (buildCounterResponseHeader < 3) { | |
1011 unittest.expect(o.kind, unittest.equals('foo')); | |
1012 } | |
1013 buildCounterResponseHeader--; | |
1014 } | |
1015 | |
1016 core.int buildCounterRollbackRequest = 0; | |
1017 buildRollbackRequest() { | |
1018 var o = new api.RollbackRequest(); | |
1019 buildCounterRollbackRequest++; | |
1020 if (buildCounterRollbackRequest < 3) { | |
1021 o.transaction = "foo"; | |
1022 } | |
1023 buildCounterRollbackRequest--; | |
1024 return o; | |
1025 } | |
1026 | |
1027 checkRollbackRequest(api.RollbackRequest o) { | |
1028 buildCounterRollbackRequest++; | |
1029 if (buildCounterRollbackRequest < 3) { | |
1030 unittest.expect(o.transaction, unittest.equals('foo')); | |
1031 } | |
1032 buildCounterRollbackRequest--; | |
1033 } | |
1034 | |
1035 core.int buildCounterRollbackResponse = 0; | |
1036 buildRollbackResponse() { | |
1037 var o = new api.RollbackResponse(); | |
1038 buildCounterRollbackResponse++; | |
1039 if (buildCounterRollbackResponse < 3) { | |
1040 o.header = buildResponseHeader(); | |
1041 } | |
1042 buildCounterRollbackResponse--; | |
1043 return o; | |
1044 } | |
1045 | |
1046 checkRollbackResponse(api.RollbackResponse o) { | |
1047 buildCounterRollbackResponse++; | |
1048 if (buildCounterRollbackResponse < 3) { | |
1049 checkResponseHeader(o.header); | |
1050 } | |
1051 buildCounterRollbackResponse--; | |
1052 } | |
1053 | |
1054 core.int buildCounterRunQueryRequest = 0; | |
1055 buildRunQueryRequest() { | |
1056 var o = new api.RunQueryRequest(); | |
1057 buildCounterRunQueryRequest++; | |
1058 if (buildCounterRunQueryRequest < 3) { | |
1059 o.gqlQuery = buildGqlQuery(); | |
1060 o.partitionId = buildPartitionId(); | |
1061 o.query = buildQuery(); | |
1062 o.readOptions = buildReadOptions(); | |
1063 } | |
1064 buildCounterRunQueryRequest--; | |
1065 return o; | |
1066 } | |
1067 | |
1068 checkRunQueryRequest(api.RunQueryRequest o) { | |
1069 buildCounterRunQueryRequest++; | |
1070 if (buildCounterRunQueryRequest < 3) { | |
1071 checkGqlQuery(o.gqlQuery); | |
1072 checkPartitionId(o.partitionId); | |
1073 checkQuery(o.query); | |
1074 checkReadOptions(o.readOptions); | |
1075 } | |
1076 buildCounterRunQueryRequest--; | |
1077 } | |
1078 | |
1079 core.int buildCounterRunQueryResponse = 0; | |
1080 buildRunQueryResponse() { | |
1081 var o = new api.RunQueryResponse(); | |
1082 buildCounterRunQueryResponse++; | |
1083 if (buildCounterRunQueryResponse < 3) { | |
1084 o.batch = buildQueryResultBatch(); | |
1085 o.header = buildResponseHeader(); | |
1086 } | |
1087 buildCounterRunQueryResponse--; | |
1088 return o; | |
1089 } | |
1090 | |
1091 checkRunQueryResponse(api.RunQueryResponse o) { | |
1092 buildCounterRunQueryResponse++; | |
1093 if (buildCounterRunQueryResponse < 3) { | |
1094 checkQueryResultBatch(o.batch); | |
1095 checkResponseHeader(o.header); | |
1096 } | |
1097 buildCounterRunQueryResponse--; | |
1098 } | |
1099 | |
1100 buildUnnamed3616() { | |
1101 var o = new core.List<api.Value>(); | |
1102 o.add(buildValue()); | |
1103 o.add(buildValue()); | |
1104 return o; | |
1105 } | |
1106 | |
1107 checkUnnamed3616(core.List<api.Value> o) { | |
1108 unittest.expect(o, unittest.hasLength(2)); | |
1109 checkValue(o[0]); | |
1110 checkValue(o[1]); | |
1111 } | |
1112 | |
1113 core.int buildCounterValue = 0; | |
1114 buildValue() { | |
1115 var o = new api.Value(); | |
1116 buildCounterValue++; | |
1117 if (buildCounterValue < 3) { | |
1118 o.blobKeyValue = "foo"; | |
1119 o.blobValue = "foo"; | |
1120 o.booleanValue = true; | |
1121 o.dateTimeValue = core.DateTime.parse("2002-02-27T14:01:02"); | |
1122 o.doubleValue = 42.0; | |
1123 o.entityValue = buildEntity(); | |
1124 o.indexed = true; | |
1125 o.integerValue = "foo"; | |
1126 o.keyValue = buildKey(); | |
1127 o.listValue = buildUnnamed3616(); | |
1128 o.meaning = 42; | |
1129 o.stringValue = "foo"; | |
1130 } | |
1131 buildCounterValue--; | |
1132 return o; | |
1133 } | |
1134 | |
1135 checkValue(api.Value o) { | |
1136 buildCounterValue++; | |
1137 if (buildCounterValue < 3) { | |
1138 unittest.expect(o.blobKeyValue, unittest.equals('foo')); | |
1139 unittest.expect(o.blobValue, unittest.equals('foo')); | |
1140 unittest.expect(o.booleanValue, unittest.isTrue); | |
1141 unittest.expect(o.dateTimeValue, unittest.equals(core.DateTime.parse("2002-0
2-27T14:01:02"))); | |
1142 unittest.expect(o.doubleValue, unittest.equals(42.0)); | |
1143 checkEntity(o.entityValue); | |
1144 unittest.expect(o.indexed, unittest.isTrue); | |
1145 unittest.expect(o.integerValue, unittest.equals('foo')); | |
1146 checkKey(o.keyValue); | |
1147 checkUnnamed3616(o.listValue); | |
1148 unittest.expect(o.meaning, unittest.equals(42)); | |
1149 unittest.expect(o.stringValue, unittest.equals('foo')); | |
1150 } | |
1151 buildCounterValue--; | |
1152 } | |
1153 | |
1154 | |
1155 main() { | |
1156 unittest.group("obj-schema-AllocateIdsRequest", () { | |
1157 unittest.test("to-json--from-json", () { | |
1158 var o = buildAllocateIdsRequest(); | |
1159 var od = new api.AllocateIdsRequest.fromJson(o.toJson()); | |
1160 checkAllocateIdsRequest(od); | |
1161 }); | |
1162 }); | |
1163 | |
1164 | |
1165 unittest.group("obj-schema-AllocateIdsResponse", () { | |
1166 unittest.test("to-json--from-json", () { | |
1167 var o = buildAllocateIdsResponse(); | |
1168 var od = new api.AllocateIdsResponse.fromJson(o.toJson()); | |
1169 checkAllocateIdsResponse(od); | |
1170 }); | |
1171 }); | |
1172 | |
1173 | |
1174 unittest.group("obj-schema-BeginTransactionRequest", () { | |
1175 unittest.test("to-json--from-json", () { | |
1176 var o = buildBeginTransactionRequest(); | |
1177 var od = new api.BeginTransactionRequest.fromJson(o.toJson()); | |
1178 checkBeginTransactionRequest(od); | |
1179 }); | |
1180 }); | |
1181 | |
1182 | |
1183 unittest.group("obj-schema-BeginTransactionResponse", () { | |
1184 unittest.test("to-json--from-json", () { | |
1185 var o = buildBeginTransactionResponse(); | |
1186 var od = new api.BeginTransactionResponse.fromJson(o.toJson()); | |
1187 checkBeginTransactionResponse(od); | |
1188 }); | |
1189 }); | |
1190 | |
1191 | |
1192 unittest.group("obj-schema-CommitRequest", () { | |
1193 unittest.test("to-json--from-json", () { | |
1194 var o = buildCommitRequest(); | |
1195 var od = new api.CommitRequest.fromJson(o.toJson()); | |
1196 checkCommitRequest(od); | |
1197 }); | |
1198 }); | |
1199 | |
1200 | |
1201 unittest.group("obj-schema-CommitResponse", () { | |
1202 unittest.test("to-json--from-json", () { | |
1203 var o = buildCommitResponse(); | |
1204 var od = new api.CommitResponse.fromJson(o.toJson()); | |
1205 checkCommitResponse(od); | |
1206 }); | |
1207 }); | |
1208 | |
1209 | |
1210 unittest.group("obj-schema-CompositeFilter", () { | |
1211 unittest.test("to-json--from-json", () { | |
1212 var o = buildCompositeFilter(); | |
1213 var od = new api.CompositeFilter.fromJson(o.toJson()); | |
1214 checkCompositeFilter(od); | |
1215 }); | |
1216 }); | |
1217 | |
1218 | |
1219 unittest.group("obj-schema-Entity", () { | |
1220 unittest.test("to-json--from-json", () { | |
1221 var o = buildEntity(); | |
1222 var od = new api.Entity.fromJson(o.toJson()); | |
1223 checkEntity(od); | |
1224 }); | |
1225 }); | |
1226 | |
1227 | |
1228 unittest.group("obj-schema-EntityResult", () { | |
1229 unittest.test("to-json--from-json", () { | |
1230 var o = buildEntityResult(); | |
1231 var od = new api.EntityResult.fromJson(o.toJson()); | |
1232 checkEntityResult(od); | |
1233 }); | |
1234 }); | |
1235 | |
1236 | |
1237 unittest.group("obj-schema-Filter", () { | |
1238 unittest.test("to-json--from-json", () { | |
1239 var o = buildFilter(); | |
1240 var od = new api.Filter.fromJson(o.toJson()); | |
1241 checkFilter(od); | |
1242 }); | |
1243 }); | |
1244 | |
1245 | |
1246 unittest.group("obj-schema-GqlQuery", () { | |
1247 unittest.test("to-json--from-json", () { | |
1248 var o = buildGqlQuery(); | |
1249 var od = new api.GqlQuery.fromJson(o.toJson()); | |
1250 checkGqlQuery(od); | |
1251 }); | |
1252 }); | |
1253 | |
1254 | |
1255 unittest.group("obj-schema-GqlQueryArg", () { | |
1256 unittest.test("to-json--from-json", () { | |
1257 var o = buildGqlQueryArg(); | |
1258 var od = new api.GqlQueryArg.fromJson(o.toJson()); | |
1259 checkGqlQueryArg(od); | |
1260 }); | |
1261 }); | |
1262 | |
1263 | |
1264 unittest.group("obj-schema-Key", () { | |
1265 unittest.test("to-json--from-json", () { | |
1266 var o = buildKey(); | |
1267 var od = new api.Key.fromJson(o.toJson()); | |
1268 checkKey(od); | |
1269 }); | |
1270 }); | |
1271 | |
1272 | |
1273 unittest.group("obj-schema-KeyPathElement", () { | |
1274 unittest.test("to-json--from-json", () { | |
1275 var o = buildKeyPathElement(); | |
1276 var od = new api.KeyPathElement.fromJson(o.toJson()); | |
1277 checkKeyPathElement(od); | |
1278 }); | |
1279 }); | |
1280 | |
1281 | |
1282 unittest.group("obj-schema-KindExpression", () { | |
1283 unittest.test("to-json--from-json", () { | |
1284 var o = buildKindExpression(); | |
1285 var od = new api.KindExpression.fromJson(o.toJson()); | |
1286 checkKindExpression(od); | |
1287 }); | |
1288 }); | |
1289 | |
1290 | |
1291 unittest.group("obj-schema-LookupRequest", () { | |
1292 unittest.test("to-json--from-json", () { | |
1293 var o = buildLookupRequest(); | |
1294 var od = new api.LookupRequest.fromJson(o.toJson()); | |
1295 checkLookupRequest(od); | |
1296 }); | |
1297 }); | |
1298 | |
1299 | |
1300 unittest.group("obj-schema-LookupResponse", () { | |
1301 unittest.test("to-json--from-json", () { | |
1302 var o = buildLookupResponse(); | |
1303 var od = new api.LookupResponse.fromJson(o.toJson()); | |
1304 checkLookupResponse(od); | |
1305 }); | |
1306 }); | |
1307 | |
1308 | |
1309 unittest.group("obj-schema-Mutation", () { | |
1310 unittest.test("to-json--from-json", () { | |
1311 var o = buildMutation(); | |
1312 var od = new api.Mutation.fromJson(o.toJson()); | |
1313 checkMutation(od); | |
1314 }); | |
1315 }); | |
1316 | |
1317 | |
1318 unittest.group("obj-schema-MutationResult", () { | |
1319 unittest.test("to-json--from-json", () { | |
1320 var o = buildMutationResult(); | |
1321 var od = new api.MutationResult.fromJson(o.toJson()); | |
1322 checkMutationResult(od); | |
1323 }); | |
1324 }); | |
1325 | |
1326 | |
1327 unittest.group("obj-schema-PartitionId", () { | |
1328 unittest.test("to-json--from-json", () { | |
1329 var o = buildPartitionId(); | |
1330 var od = new api.PartitionId.fromJson(o.toJson()); | |
1331 checkPartitionId(od); | |
1332 }); | |
1333 }); | |
1334 | |
1335 | |
1336 unittest.group("obj-schema-Property", () { | |
1337 unittest.test("to-json--from-json", () { | |
1338 var o = buildProperty(); | |
1339 var od = new api.Property.fromJson(o.toJson()); | |
1340 checkProperty(od); | |
1341 }); | |
1342 }); | |
1343 | |
1344 | |
1345 unittest.group("obj-schema-PropertyExpression", () { | |
1346 unittest.test("to-json--from-json", () { | |
1347 var o = buildPropertyExpression(); | |
1348 var od = new api.PropertyExpression.fromJson(o.toJson()); | |
1349 checkPropertyExpression(od); | |
1350 }); | |
1351 }); | |
1352 | |
1353 | |
1354 unittest.group("obj-schema-PropertyFilter", () { | |
1355 unittest.test("to-json--from-json", () { | |
1356 var o = buildPropertyFilter(); | |
1357 var od = new api.PropertyFilter.fromJson(o.toJson()); | |
1358 checkPropertyFilter(od); | |
1359 }); | |
1360 }); | |
1361 | |
1362 | |
1363 unittest.group("obj-schema-PropertyOrder", () { | |
1364 unittest.test("to-json--from-json", () { | |
1365 var o = buildPropertyOrder(); | |
1366 var od = new api.PropertyOrder.fromJson(o.toJson()); | |
1367 checkPropertyOrder(od); | |
1368 }); | |
1369 }); | |
1370 | |
1371 | |
1372 unittest.group("obj-schema-PropertyReference", () { | |
1373 unittest.test("to-json--from-json", () { | |
1374 var o = buildPropertyReference(); | |
1375 var od = new api.PropertyReference.fromJson(o.toJson()); | |
1376 checkPropertyReference(od); | |
1377 }); | |
1378 }); | |
1379 | |
1380 | |
1381 unittest.group("obj-schema-Query", () { | |
1382 unittest.test("to-json--from-json", () { | |
1383 var o = buildQuery(); | |
1384 var od = new api.Query.fromJson(o.toJson()); | |
1385 checkQuery(od); | |
1386 }); | |
1387 }); | |
1388 | |
1389 | |
1390 unittest.group("obj-schema-QueryResultBatch", () { | |
1391 unittest.test("to-json--from-json", () { | |
1392 var o = buildQueryResultBatch(); | |
1393 var od = new api.QueryResultBatch.fromJson(o.toJson()); | |
1394 checkQueryResultBatch(od); | |
1395 }); | |
1396 }); | |
1397 | |
1398 | |
1399 unittest.group("obj-schema-ReadOptions", () { | |
1400 unittest.test("to-json--from-json", () { | |
1401 var o = buildReadOptions(); | |
1402 var od = new api.ReadOptions.fromJson(o.toJson()); | |
1403 checkReadOptions(od); | |
1404 }); | |
1405 }); | |
1406 | |
1407 | |
1408 unittest.group("obj-schema-ResponseHeader", () { | |
1409 unittest.test("to-json--from-json", () { | |
1410 var o = buildResponseHeader(); | |
1411 var od = new api.ResponseHeader.fromJson(o.toJson()); | |
1412 checkResponseHeader(od); | |
1413 }); | |
1414 }); | |
1415 | |
1416 | |
1417 unittest.group("obj-schema-RollbackRequest", () { | |
1418 unittest.test("to-json--from-json", () { | |
1419 var o = buildRollbackRequest(); | |
1420 var od = new api.RollbackRequest.fromJson(o.toJson()); | |
1421 checkRollbackRequest(od); | |
1422 }); | |
1423 }); | |
1424 | |
1425 | |
1426 unittest.group("obj-schema-RollbackResponse", () { | |
1427 unittest.test("to-json--from-json", () { | |
1428 var o = buildRollbackResponse(); | |
1429 var od = new api.RollbackResponse.fromJson(o.toJson()); | |
1430 checkRollbackResponse(od); | |
1431 }); | |
1432 }); | |
1433 | |
1434 | |
1435 unittest.group("obj-schema-RunQueryRequest", () { | |
1436 unittest.test("to-json--from-json", () { | |
1437 var o = buildRunQueryRequest(); | |
1438 var od = new api.RunQueryRequest.fromJson(o.toJson()); | |
1439 checkRunQueryRequest(od); | |
1440 }); | |
1441 }); | |
1442 | |
1443 | |
1444 unittest.group("obj-schema-RunQueryResponse", () { | |
1445 unittest.test("to-json--from-json", () { | |
1446 var o = buildRunQueryResponse(); | |
1447 var od = new api.RunQueryResponse.fromJson(o.toJson()); | |
1448 checkRunQueryResponse(od); | |
1449 }); | |
1450 }); | |
1451 | |
1452 | |
1453 unittest.group("obj-schema-Value", () { | |
1454 unittest.test("to-json--from-json", () { | |
1455 var o = buildValue(); | |
1456 var od = new api.Value.fromJson(o.toJson()); | |
1457 checkValue(od); | |
1458 }); | |
1459 }); | |
1460 | |
1461 | |
1462 unittest.group("resource-DatasetsResourceApi", () { | |
1463 unittest.test("method--allocateIds", () { | |
1464 | |
1465 var mock = new HttpServerMock(); | |
1466 api.DatasetsResourceApi res = new api.DatastoreApi(mock).datasets; | |
1467 var arg_request = buildAllocateIdsRequest(); | |
1468 var arg_datasetId = "foo"; | |
1469 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1470 var obj = new api.AllocateIdsRequest.fromJson(json); | |
1471 checkAllocateIdsRequest(obj); | |
1472 | |
1473 var path = (req.url).path; | |
1474 var pathOffset = 0; | |
1475 var index; | |
1476 var subPart; | |
1477 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1478 pathOffset += 1; | |
1479 | |
1480 var query = (req.url).query; | |
1481 var queryOffset = 0; | |
1482 var queryMap = {}; | |
1483 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1484 parseBool(n) { | |
1485 if (n == "true") return true; | |
1486 if (n == "false") return false; | |
1487 if (n == null) return null; | |
1488 throw new core.ArgumentError("Invalid boolean: $n"); | |
1489 } | |
1490 if (query.length > 0) { | |
1491 for (var part in query.split("&")) { | |
1492 var keyvalue = part.split("="); | |
1493 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1494 } | |
1495 } | |
1496 | |
1497 | |
1498 var h = { | |
1499 "content-type" : "application/json; charset=utf-8", | |
1500 }; | |
1501 var resp = convert.JSON.encode(buildAllocateIdsResponse()); | |
1502 return new async.Future.value(stringResponse(200, h, resp)); | |
1503 }), true); | |
1504 res.allocateIds(arg_request, arg_datasetId).then(unittest.expectAsync(((ap
i.AllocateIdsResponse response) { | |
1505 checkAllocateIdsResponse(response); | |
1506 }))); | |
1507 }); | |
1508 | |
1509 unittest.test("method--beginTransaction", () { | |
1510 | |
1511 var mock = new HttpServerMock(); | |
1512 api.DatasetsResourceApi res = new api.DatastoreApi(mock).datasets; | |
1513 var arg_request = buildBeginTransactionRequest(); | |
1514 var arg_datasetId = "foo"; | |
1515 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1516 var obj = new api.BeginTransactionRequest.fromJson(json); | |
1517 checkBeginTransactionRequest(obj); | |
1518 | |
1519 var path = (req.url).path; | |
1520 var pathOffset = 0; | |
1521 var index; | |
1522 var subPart; | |
1523 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1524 pathOffset += 1; | |
1525 | |
1526 var query = (req.url).query; | |
1527 var queryOffset = 0; | |
1528 var queryMap = {}; | |
1529 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1530 parseBool(n) { | |
1531 if (n == "true") return true; | |
1532 if (n == "false") return false; | |
1533 if (n == null) return null; | |
1534 throw new core.ArgumentError("Invalid boolean: $n"); | |
1535 } | |
1536 if (query.length > 0) { | |
1537 for (var part in query.split("&")) { | |
1538 var keyvalue = part.split("="); | |
1539 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1540 } | |
1541 } | |
1542 | |
1543 | |
1544 var h = { | |
1545 "content-type" : "application/json; charset=utf-8", | |
1546 }; | |
1547 var resp = convert.JSON.encode(buildBeginTransactionResponse()); | |
1548 return new async.Future.value(stringResponse(200, h, resp)); | |
1549 }), true); | |
1550 res.beginTransaction(arg_request, arg_datasetId).then(unittest.expectAsync
(((api.BeginTransactionResponse response) { | |
1551 checkBeginTransactionResponse(response); | |
1552 }))); | |
1553 }); | |
1554 | |
1555 unittest.test("method--commit", () { | |
1556 | |
1557 var mock = new HttpServerMock(); | |
1558 api.DatasetsResourceApi res = new api.DatastoreApi(mock).datasets; | |
1559 var arg_request = buildCommitRequest(); | |
1560 var arg_datasetId = "foo"; | |
1561 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1562 var obj = new api.CommitRequest.fromJson(json); | |
1563 checkCommitRequest(obj); | |
1564 | |
1565 var path = (req.url).path; | |
1566 var pathOffset = 0; | |
1567 var index; | |
1568 var subPart; | |
1569 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1570 pathOffset += 1; | |
1571 | |
1572 var query = (req.url).query; | |
1573 var queryOffset = 0; | |
1574 var queryMap = {}; | |
1575 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1576 parseBool(n) { | |
1577 if (n == "true") return true; | |
1578 if (n == "false") return false; | |
1579 if (n == null) return null; | |
1580 throw new core.ArgumentError("Invalid boolean: $n"); | |
1581 } | |
1582 if (query.length > 0) { | |
1583 for (var part in query.split("&")) { | |
1584 var keyvalue = part.split("="); | |
1585 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1586 } | |
1587 } | |
1588 | |
1589 | |
1590 var h = { | |
1591 "content-type" : "application/json; charset=utf-8", | |
1592 }; | |
1593 var resp = convert.JSON.encode(buildCommitResponse()); | |
1594 return new async.Future.value(stringResponse(200, h, resp)); | |
1595 }), true); | |
1596 res.commit(arg_request, arg_datasetId).then(unittest.expectAsync(((api.Com
mitResponse response) { | |
1597 checkCommitResponse(response); | |
1598 }))); | |
1599 }); | |
1600 | |
1601 unittest.test("method--lookup", () { | |
1602 | |
1603 var mock = new HttpServerMock(); | |
1604 api.DatasetsResourceApi res = new api.DatastoreApi(mock).datasets; | |
1605 var arg_request = buildLookupRequest(); | |
1606 var arg_datasetId = "foo"; | |
1607 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1608 var obj = new api.LookupRequest.fromJson(json); | |
1609 checkLookupRequest(obj); | |
1610 | |
1611 var path = (req.url).path; | |
1612 var pathOffset = 0; | |
1613 var index; | |
1614 var subPart; | |
1615 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1616 pathOffset += 1; | |
1617 | |
1618 var query = (req.url).query; | |
1619 var queryOffset = 0; | |
1620 var queryMap = {}; | |
1621 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1622 parseBool(n) { | |
1623 if (n == "true") return true; | |
1624 if (n == "false") return false; | |
1625 if (n == null) return null; | |
1626 throw new core.ArgumentError("Invalid boolean: $n"); | |
1627 } | |
1628 if (query.length > 0) { | |
1629 for (var part in query.split("&")) { | |
1630 var keyvalue = part.split("="); | |
1631 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1632 } | |
1633 } | |
1634 | |
1635 | |
1636 var h = { | |
1637 "content-type" : "application/json; charset=utf-8", | |
1638 }; | |
1639 var resp = convert.JSON.encode(buildLookupResponse()); | |
1640 return new async.Future.value(stringResponse(200, h, resp)); | |
1641 }), true); | |
1642 res.lookup(arg_request, arg_datasetId).then(unittest.expectAsync(((api.Loo
kupResponse response) { | |
1643 checkLookupResponse(response); | |
1644 }))); | |
1645 }); | |
1646 | |
1647 unittest.test("method--rollback", () { | |
1648 | |
1649 var mock = new HttpServerMock(); | |
1650 api.DatasetsResourceApi res = new api.DatastoreApi(mock).datasets; | |
1651 var arg_request = buildRollbackRequest(); | |
1652 var arg_datasetId = "foo"; | |
1653 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1654 var obj = new api.RollbackRequest.fromJson(json); | |
1655 checkRollbackRequest(obj); | |
1656 | |
1657 var path = (req.url).path; | |
1658 var pathOffset = 0; | |
1659 var index; | |
1660 var subPart; | |
1661 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1662 pathOffset += 1; | |
1663 | |
1664 var query = (req.url).query; | |
1665 var queryOffset = 0; | |
1666 var queryMap = {}; | |
1667 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1668 parseBool(n) { | |
1669 if (n == "true") return true; | |
1670 if (n == "false") return false; | |
1671 if (n == null) return null; | |
1672 throw new core.ArgumentError("Invalid boolean: $n"); | |
1673 } | |
1674 if (query.length > 0) { | |
1675 for (var part in query.split("&")) { | |
1676 var keyvalue = part.split("="); | |
1677 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1678 } | |
1679 } | |
1680 | |
1681 | |
1682 var h = { | |
1683 "content-type" : "application/json; charset=utf-8", | |
1684 }; | |
1685 var resp = convert.JSON.encode(buildRollbackResponse()); | |
1686 return new async.Future.value(stringResponse(200, h, resp)); | |
1687 }), true); | |
1688 res.rollback(arg_request, arg_datasetId).then(unittest.expectAsync(((api.R
ollbackResponse response) { | |
1689 checkRollbackResponse(response); | |
1690 }))); | |
1691 }); | |
1692 | |
1693 unittest.test("method--runQuery", () { | |
1694 | |
1695 var mock = new HttpServerMock(); | |
1696 api.DatasetsResourceApi res = new api.DatastoreApi(mock).datasets; | |
1697 var arg_request = buildRunQueryRequest(); | |
1698 var arg_datasetId = "foo"; | |
1699 mock.register(unittest.expectAsync((http.BaseRequest req, json) { | |
1700 var obj = new api.RunQueryRequest.fromJson(json); | |
1701 checkRunQueryRequest(obj); | |
1702 | |
1703 var path = (req.url).path; | |
1704 var pathOffset = 0; | |
1705 var index; | |
1706 var subPart; | |
1707 unittest.expect(path.substring(pathOffset, pathOffset + 1), unittest.equ
als("/")); | |
1708 pathOffset += 1; | |
1709 | |
1710 var query = (req.url).query; | |
1711 var queryOffset = 0; | |
1712 var queryMap = {}; | |
1713 addQueryParam(n, v) => queryMap.putIfAbsent(n, () => []).add(v); | |
1714 parseBool(n) { | |
1715 if (n == "true") return true; | |
1716 if (n == "false") return false; | |
1717 if (n == null) return null; | |
1718 throw new core.ArgumentError("Invalid boolean: $n"); | |
1719 } | |
1720 if (query.length > 0) { | |
1721 for (var part in query.split("&")) { | |
1722 var keyvalue = part.split("="); | |
1723 addQueryParam(core.Uri.decodeQueryComponent(keyvalue[0]), core.Uri.d
ecodeQueryComponent(keyvalue[1])); | |
1724 } | |
1725 } | |
1726 | |
1727 | |
1728 var h = { | |
1729 "content-type" : "application/json; charset=utf-8", | |
1730 }; | |
1731 var resp = convert.JSON.encode(buildRunQueryResponse()); | |
1732 return new async.Future.value(stringResponse(200, h, resp)); | |
1733 }), true); | |
1734 res.runQuery(arg_request, arg_datasetId).then(unittest.expectAsync(((api.R
unQueryResponse response) { | |
1735 checkRunQueryResponse(response); | |
1736 }))); | |
1737 }); | |
1738 | |
1739 }); | |
1740 | |
1741 | |
1742 } | |
1743 | |
OLD | NEW |