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