OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library raw_datastore_test_utils; | 5 library raw_datastore_test_utils; |
6 | 6 |
7 import 'package:gcloud/datastore.dart'; | 7 import 'package:gcloud/datastore.dart'; |
8 | 8 |
9 const TEST_KIND = 'TestKind'; | 9 const TEST_KIND = 'TestKind'; |
10 const TEST_PROPERTY_KEY_PREFIX = 'test_property'; | 10 const TEST_PROPERTY_KEY_PREFIX = 'test_property'; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 return entities; | 63 return entities; |
64 } | 64 } |
65 | 65 |
66 List<Entity> buildEntityWithAllProperties( | 66 List<Entity> buildEntityWithAllProperties( |
67 int from, int to, {String kind : TEST_KIND, Partition partition}) { | 67 int from, int to, {String kind : TEST_KIND, Partition partition}) { |
68 var us42 = const Duration(microseconds: 42); | 68 var us42 = const Duration(microseconds: 42); |
69 var unIndexed = new Set<String>.from(['blobProperty']); | 69 var unIndexed = new Set<String>.from(['blobProperty']); |
70 | 70 |
71 Map<String, String> buildProperties(int i) { | 71 Map<String, String> buildProperties(int i) { |
72 return { | 72 return { |
| 73 'nullValue' : null, |
73 'boolProperty' : true, | 74 'boolProperty' : true, |
74 'intProperty' : 42, | 75 'intProperty' : 42, |
75 'doubleProperty' : 4.2, | 76 'doubleProperty' : 4.2, |
76 'stringProperty' : 'foobar', | 77 'stringProperty' : 'foobar', |
77 'blobProperty' : new BlobValue([0xff, 0xff, 0xaa, 0xaa]), | 78 'blobProperty' : new BlobValue([0xff, 0xff, 0xaa, 0xaa]), |
78 'blobPropertyIndexed' : new BlobValue([0xaa, 0xaa, 0xff, 0xff]), | 79 'blobPropertyIndexed' : new BlobValue([0xaa, 0xaa, 0xff, 0xff]), |
79 'dateProperty' : | 80 'dateProperty' : |
80 new DateTime.fromMillisecondsSinceEpoch(1, isUtc: true).add(us42), | 81 new DateTime.fromMillisecondsSinceEpoch(1, isUtc: true).add(us42), |
81 'keyProperty' : buildKey(1, idFunction: (i) => 's$i', kind: kind), | 82 'keyProperty' : buildKey(1, idFunction: (i) => 's$i', kind: kind), |
82 'listProperty' : [ | 83 'listProperty' : [ |
83 42, | 84 42, |
84 4.2, | 85 4.2, |
85 'foobar', | 86 'foobar', |
86 buildKey(1, idFunction: (i) => 's$i', kind: 'TestKind'), | 87 buildKey(1, idFunction: (i) => 's$i', kind: 'TestKind'), |
87 ], | 88 ], |
88 }; | 89 }; |
89 } | 90 } |
90 | 91 |
91 var entities = []; | 92 var entities = []; |
92 for (var i = from; i < to; i++) { | 93 for (var i = from; i < to; i++) { |
93 var key = buildKey( | 94 var key = buildKey( |
94 i, idFunction: (i) => 'allprop$i', kind: kind, p: partition); | 95 i, idFunction: (i) => 'allprop$i', kind: kind, p: partition); |
95 var properties = buildProperties(i); | 96 var properties = buildProperties(i); |
96 entities.add(new Entity(key, properties, unIndexedProperties: unIndexed)); | 97 entities.add(new Entity(key, properties, unIndexedProperties: unIndexed)); |
97 } | 98 } |
98 return entities; | 99 return entities; |
99 } | 100 } |
OLD | NEW |