use of com.google.firebase.firestore.bundle.BundledQuery in project firebase-android-sdk by firebase.
the class BundleCacheTestCase method testReturnsSavedLimitToFirstQueries.
@Test
public void testReturnsSavedLimitToFirstQueries() {
Target target = new Target(path("room"), /* collectionGroup= */
null, Collections.emptyList(), Collections.emptyList(), /* limit= */
1, /* startAt= */
null, /* endAt= */
null);
BundledQuery bundledQuery = new BundledQuery(target, Query.LimitType.LIMIT_TO_FIRST);
NamedQuery expectedQuery = new NamedQuery("query-1", bundledQuery, new SnapshotVersion(Timestamp.now()));
bundleCache.saveNamedQuery(expectedQuery);
NamedQuery actualQuery = bundleCache.getNamedQuery("query-1");
assertEquals(expectedQuery, actualQuery);
}
use of com.google.firebase.firestore.bundle.BundledQuery in project firebase-android-sdk by firebase.
the class BundleCacheTestCase method testReturnsSavedLimitToLastQueries.
@Test
public void testReturnsSavedLimitToLastQueries() {
Target target = new Target(path("room"), /* collectionGroup= */
null, Collections.emptyList(), Collections.emptyList(), /* limit= */
1, /* startAt= */
null, /* endAt= */
null);
BundledQuery bundledQuery = new BundledQuery(target, Query.LimitType.LIMIT_TO_LAST);
NamedQuery expectedQuery = new NamedQuery("query-1", bundledQuery, new SnapshotVersion(Timestamp.now()));
bundleCache.saveNamedQuery(expectedQuery);
NamedQuery actualQuery = bundleCache.getNamedQuery("query-1");
assertEquals(expectedQuery, actualQuery);
}
use of com.google.firebase.firestore.bundle.BundledQuery in project firebase-android-sdk by firebase.
the class LocalSerializerTest method testEncodesLimitToLastQuery.
@Test
public void testEncodesLimitToLastQuery() {
Target target = new Target(path("room"), /* collectionGroup= */
null, Collections.emptyList(), Collections.emptyList(), /* limit=*/
42, /* startAt= */
null, /* endAt= */
null);
BundledQuery bundledQuery = new BundledQuery(target, Query.LimitType.LIMIT_TO_LAST);
com.google.firestore.bundle.BundledQuery encodedBundledQuery = serializer.encodeBundledQuery(bundledQuery);
BundledQuery decodedBundledQuery = serializer.decodeBundledQuery(encodedBundledQuery);
assertEquals(bundledQuery, decodedBundledQuery);
}
use of com.google.firebase.firestore.bundle.BundledQuery in project firebase-android-sdk by firebase.
the class LocalSerializer method decodeBundledQuery.
public BundledQuery decodeBundledQuery(com.google.firestore.bundle.BundledQuery bundledQuery) {
LimitType limitType = bundledQuery.getLimitType().equals(com.google.firestore.bundle.BundledQuery.LimitType.FIRST) ? LimitType.LIMIT_TO_FIRST : LimitType.LIMIT_TO_LAST;
Target target = rpcSerializer.decodeQueryTarget(bundledQuery.getParent(), bundledQuery.getStructuredQuery());
return new BundledQuery(target, limitType);
}
use of com.google.firebase.firestore.bundle.BundledQuery in project firebase-android-sdk by firebase.
the class LocalStoreTestCase method testHandlesSavingAndLoadingNamedQueries.
@Test
public void testHandlesSavingAndLoadingNamedQueries() {
Target target = query("foo").toTarget();
NamedQuery namedQuery = new NamedQuery("testQuery", new BundledQuery(target, Query.LimitType.LIMIT_TO_FIRST), SnapshotVersion.NONE);
saveNamedQuery(namedQuery);
assertHasNamedQuery(namedQuery);
}
Aggregations