use of com.apollographql.apollo.NamedCountDownLatch in project apollo-android by apollographql.
the class ApolloStoreTest method storeClearAllCallsNormalizedCacheClearAll.
@Test
public void storeClearAllCallsNormalizedCacheClearAll() throws Exception {
final NamedCountDownLatch latch = new NamedCountDownLatch("storeClearAllCallsNormalizedCacheClearAll", 1);
final RealApolloStore realApolloStore = new RealApolloStore(new NormalizedCache() {
@Nullable
@Override
public Record loadRecord(@Nonnull String key, @Nonnull CacheHeaders cacheHeaders) {
return null;
}
@Nonnull
@Override
public Set<String> merge(@Nonnull Record record, @Nonnull CacheHeaders cacheHeaders) {
return emptySet();
}
@Override
public void clearAll() {
latch.countDown();
}
@Override
public boolean remove(@Nonnull CacheKey cacheKey) {
return false;
}
@Nonnull
@Override
protected Set<String> performMerge(@Nonnull Record apolloRecord, @Nonnull CacheHeaders cacheHeaders) {
return emptySet();
}
}, CacheKeyResolver.DEFAULT, new ScalarTypeAdapters(Collections.EMPTY_MAP), Executors.newSingleThreadExecutor(), new ApolloLogger(Optional.<Logger>absent()));
realApolloStore.clearAll().execute();
latch.awaitOrThrowWithTimeout(3, TimeUnit.SECONDS);
}
Aggregations