use of com.google.firebase.firestore.local.TargetData in project firebase-android-sdk by firebase.
the class TestUtil method updateRemoteEvent.
public static RemoteEvent updateRemoteEvent(MutableDocument doc, List<Integer> updatedInTargets, List<Integer> removedFromTargets, List<Integer> activeTargets) {
DocumentChange change = new DocumentChange(updatedInTargets, removedFromTargets, doc.getKey(), doc);
WatchChangeAggregator aggregator = new WatchChangeAggregator(new WatchChangeAggregator.TargetMetadataProvider() {
@Override
public ImmutableSortedSet<DocumentKey> getRemoteKeysForTarget(int targetId) {
return DocumentKey.emptyKeySet().insert(doc.getKey());
}
@Override
public TargetData getTargetDataForTarget(int targetId) {
return activeTargets.contains(targetId) ? targetData(targetId, QueryPurpose.LISTEN, doc.getKey().toString()) : null;
}
});
aggregator.handleDocumentChange(change);
return aggregator.createRemoteEvent(doc.getVersion());
}
use of com.google.firebase.firestore.local.TargetData in project firebase-android-sdk by firebase.
the class TestUtil method activeLimboQueries.
public static Map<Integer, TargetData> activeLimboQueries(String docKey, Iterable<Integer> targets) {
Query query = query(docKey);
Map<Integer, TargetData> listenMap = new HashMap<>();
for (Integer targetId : targets) {
TargetData targetData = new TargetData(query.toTarget(), targetId, ARBITRARY_SEQUENCE_NUMBER, QueryPurpose.LIMBO_RESOLUTION);
listenMap.put(targetId, targetData);
}
return listenMap;
}
use of com.google.firebase.firestore.local.TargetData in project firebase-android-sdk by firebase.
the class TestUtil method activeQueries.
public static Map<Integer, TargetData> activeQueries(Iterable<Integer> targets) {
Query query = query("foo");
Map<Integer, TargetData> listenMap = new HashMap<>();
for (Integer targetId : targets) {
TargetData targetData = new TargetData(query.toTarget(), targetId, ARBITRARY_SEQUENCE_NUMBER, QueryPurpose.LISTEN);
listenMap.put(targetId, targetData);
}
return listenMap;
}
Aggregations