use of com.google.firebase.firestore.remote.ExistenceFilter in project firebase-android-sdk by firebase.
the class SpecTestCase method doWatchFilter.
private void doWatchFilter(JSONArray watchFilter) throws Exception {
List<Integer> targets = parseIntList(watchFilter.getJSONArray(0));
Assert.hardAssert(targets.size() == 1, "ExistenceFilters currently support exactly one target only.");
int keyCount = watchFilter.length() == 0 ? 0 : watchFilter.length() - 1;
// TODO: extend this with different existence filters over time.
ExistenceFilter filter = new ExistenceFilter(keyCount);
ExistenceFilterWatchChange change = new ExistenceFilterWatchChange(targets.get(0), filter);
writeWatchChange(change, SnapshotVersion.NONE);
}
use of com.google.firebase.firestore.remote.ExistenceFilter in project firebase-android-sdk by firebase.
the class TestUtil method existenceFilterEvent.
public static RemoteEvent existenceFilterEvent(int targetId, ImmutableSortedSet<DocumentKey> syncedKeys, int remoteCount, int version) {
TargetData targetData = TestUtil.targetData(targetId, QueryPurpose.LISTEN, "foo");
TestTargetMetadataProvider testTargetMetadataProvider = new TestTargetMetadataProvider();
testTargetMetadataProvider.setSyncedKeys(targetData, syncedKeys);
ExistenceFilter existenceFilter = new ExistenceFilter(remoteCount);
WatchChangeAggregator aggregator = new WatchChangeAggregator(testTargetMetadataProvider);
WatchChange.ExistenceFilterWatchChange existenceFilterWatchChange = new WatchChange.ExistenceFilterWatchChange(targetId, existenceFilter);
aggregator.handleExistenceFilter(existenceFilterWatchChange);
return aggregator.createRemoteEvent(version(version));
}
Aggregations