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 db_test; | 5 library db_test; |
6 | 6 |
7 /// NOTE: In order to run these tests, the following datastore indices must | 7 /// NOTE: In order to run these tests, the following datastore indices must |
8 /// exist: | 8 /// exist: |
9 /// $ cat index.yaml | 9 /// $ cat index.yaml |
10 /// indexes: | 10 /// indexes: |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 var usersSortedAndFilteredNameDescNicknameDesc = | 436 var usersSortedAndFilteredNameDescNicknameDesc = |
437 usersSortedNameDescNicknameDesc.where((User u) { | 437 usersSortedNameDescNicknameDesc.where((User u) { |
438 return LOWER_BOUND.compareTo(u.name) <= 0; | 438 return LOWER_BOUND.compareTo(u.name) <= 0; |
439 }).toList(); | 439 }).toList(); |
440 | 440 |
441 var fooUsers = users.where( | 441 var fooUsers = users.where( |
442 (User u) => u.languages.contains('foo')).toList(); | 442 (User u) => u.languages.contains('foo')).toList(); |
443 var barUsers = users.where( | 443 var barUsers = users.where( |
444 (User u) => u.languages.contains('bar')).toList(); | 444 (User u) => u.languages.contains('bar')).toList(); |
445 var usersWithWife = users.where( | 445 var usersWithWife = users.where( |
446 (User u) => u.wife == root.append(User, id: 42 + 3)); | 446 (User u) => u.wife == root.append(User, id: 42 + 3)).toList(); |
447 | 447 |
448 var allInserts = [] | 448 var allInserts = [] |
449 ..addAll(users) | 449 ..addAll(users) |
450 ..addAll(expandoPersons); | 450 ..addAll(expandoPersons); |
451 var allKeys = allInserts.map((db.Model model) => model.key).toList(); | 451 var allKeys = allInserts.map((db.Model model) => model.key).toList(); |
452 return store.commit(inserts: allInserts).then((_) { | 452 return store.commit(inserts: allInserts).then((_) { |
453 return waitUntilEntitiesReady(store, allKeys, partition).then((_) { | 453 return waitUntilEntitiesReady(store, allKeys, partition).then((_) { |
454 var tests = [ | 454 var tests = [ |
455 // Queries for [Person] return no results, we only have [User] | 455 // Queries for [Person] return no results, we only have [User] |
456 // objects. | 456 // objects. |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 var scopes = datastore_impl.DatastoreImpl.SCOPES; | 683 var scopes = datastore_impl.DatastoreImpl.SCOPES; |
684 | 684 |
685 withAuthClient(scopes, (String project, httpClient) { | 685 withAuthClient(scopes, (String project, httpClient) { |
686 var datastore = new datastore_impl.DatastoreImpl(httpClient, 's~$project'); | 686 var datastore = new datastore_impl.DatastoreImpl(httpClient, 's~$project'); |
687 return datastore_test.cleanupDB(datastore, null).then((_) { | 687 return datastore_test.cleanupDB(datastore, null).then((_) { |
688 return runE2EUnittest( | 688 return runE2EUnittest( |
689 () => runTests(new db.DatastoreDB(datastore), null)); | 689 () => runTests(new db.DatastoreDB(datastore), null)); |
690 }); | 690 }); |
691 }); | 691 }); |
692 } | 692 } |
OLD | NEW |