use of com.google.firebase.firestore.model.MutableDocument in project firebase-android-sdk by firebase.
the class RemoteDocumentCacheTestCase method testSetDocumentToNewValue.
@Test
public void testSetDocumentToNewValue() {
String path = "a/b";
MutableDocument written = addTestDocumentAtPath(path);
MutableDocument newDoc = doc(path, 57, map("data", 5));
add(newDoc, version(57));
assertNotEquals(written, newDoc);
assertEquals(newDoc, get(path));
}
use of com.google.firebase.firestore.model.MutableDocument in project firebase-android-sdk by firebase.
the class RemoteDocumentCacheTestCase method testGetAllFromExcludesSubcollections.
@Test
public void testGetAllFromExcludesSubcollections() {
addTestDocumentAtPath("a/1");
addTestDocumentAtPath("a/1/b/1");
addTestDocumentAtPath("a/2");
ResourcePath collection = path("a");
Map<DocumentKey, MutableDocument> results = remoteDocumentCache.getAll(collection, IndexOffset.NONE);
assertThat(results.values()).containsExactly(doc("a/1", 42, DOC_DATA), doc("a/2", 42, DOC_DATA));
}
use of com.google.firebase.firestore.model.MutableDocument in project firebase-android-sdk by firebase.
the class RemoteDocumentCacheTestCase method testGetAllFromSinceReadTimeAndDocumentKey.
@Test
public void testGetAllFromSinceReadTimeAndDocumentKey() {
addTestDocumentAtPath("b/a", /* updateTime= */
1, /* readTime= */
11);
addTestDocumentAtPath("b/b", /* updateTime= */
2, /* readTime= = */
11);
addTestDocumentAtPath("b/c", /* updateTime= */
3, /* readTime= = */
11);
addTestDocumentAtPath("b/d", /* updateTime= */
4, /* readTime= = */
12);
ResourcePath collection = path("b");
Map<DocumentKey, MutableDocument> results = remoteDocumentCache.getAll(collection, IndexOffset.create(version(11), key("b/b"), -1));
assertThat(results.values()).containsExactly(doc("b/c", 3, DOC_DATA), doc("b/d", 4, DOC_DATA));
}
use of com.google.firebase.firestore.model.MutableDocument in project firebase-android-sdk by firebase.
the class RemoteDocumentCacheTestCase method testGetAllFromCollection.
@Test
public void testGetAllFromCollection() {
addTestDocumentAtPath("a/1");
addTestDocumentAtPath("b/1");
addTestDocumentAtPath("b/2");
addTestDocumentAtPath("c/1");
ResourcePath collection = path("b");
Map<DocumentKey, MutableDocument> results = remoteDocumentCache.getAll(collection, IndexOffset.NONE);
assertThat(results.values()).containsExactly(doc("b/1", 42, DOC_DATA), doc("b/2", 42, DOC_DATA));
}
use of com.google.firebase.firestore.model.MutableDocument in project firebase-android-sdk by firebase.
the class RemoteDocumentCacheTestCase method testGetAllFromUsesReadTimeNotUpdateTime.
@Test
public void testGetAllFromUsesReadTimeNotUpdateTime() {
addTestDocumentAtPath("b/old", /* updateTime= */
1, /* readTime= */
2);
addTestDocumentAtPath("b/new", /* updateTime= */
2, /* readTime= */
1);
ResourcePath collection = path("b");
Map<DocumentKey, MutableDocument> results = remoteDocumentCache.getAll(collection, IndexOffset.createSuccessor(version(1), -1));
assertThat(results.values()).containsExactly(doc("b/old", 1, DOC_DATA));
}
Aggregations