Search in sources :

Example 11 with LruNormalizedCacheFactory

use of com.apollographql.apollo.cache.normalized.lru.LruNormalizedCacheFactory in project apollo-android by apollographql.

the class ResponseNormalizationTest method setUp.

@Before
public void setUp() {
    OkHttpClient okHttpClient = new OkHttpClient.Builder().dispatcher(new Dispatcher(Utils.immediateExecutorService())).build();
    apolloClient = ApolloClient.builder().serverUrl(server.url("/")).okHttpClient(okHttpClient).normalizedCache(new LruNormalizedCacheFactory(EvictionPolicy.NO_EVICTION), new IdFieldCacheKeyResolver()).dispatcher(Utils.immediateExecutor()).build();
    normalizedCache = apolloClient.apolloStore().normalizedCache();
}
Also used : OkHttpClient(okhttp3.OkHttpClient) LruNormalizedCacheFactory(com.apollographql.apollo.cache.normalized.lru.LruNormalizedCacheFactory) Dispatcher(okhttp3.Dispatcher) Before(org.junit.Before)

Example 12 with LruNormalizedCacheFactory

use of com.apollographql.apollo.cache.normalized.lru.LruNormalizedCacheFactory in project apollo-android by apollographql.

the class QueryRefetchTest method setUp.

@Before
public void setUp() throws IOException {
    server = new MockWebServer();
    server.start();
    OkHttpClient okHttpClient = new OkHttpClient.Builder().dispatcher(new Dispatcher(Utils.immediateExecutorService())).build();
    apolloClient = ApolloClient.builder().serverUrl(server.url("/")).dispatcher(Utils.immediateExecutor()).okHttpClient(okHttpClient).normalizedCache(new LruNormalizedCacheFactory(EvictionPolicy.NO_EVICTION), new IdFieldCacheKeyResolver()).build();
}
Also used : OkHttpClient(okhttp3.OkHttpClient) LruNormalizedCacheFactory(com.apollographql.apollo.cache.normalized.lru.LruNormalizedCacheFactory) MockWebServer(okhttp3.mockwebserver.MockWebServer) Dispatcher(okhttp3.Dispatcher) IdFieldCacheKeyResolver(com.apollographql.apollo.IdFieldCacheKeyResolver) Before(org.junit.Before)

Aggregations

LruNormalizedCacheFactory (com.apollographql.apollo.cache.normalized.lru.LruNormalizedCacheFactory)12 OkHttpClient (okhttp3.OkHttpClient)12 Before (org.junit.Before)11 Dispatcher (okhttp3.Dispatcher)10 IdFieldCacheKeyResolver (com.apollographql.apollo.IdFieldCacheKeyResolver)2 CustomTypeValue (com.apollographql.apollo.response.CustomTypeValue)2 ParseException (java.text.ParseException)2 Date (java.util.Date)2 Nonnull (javax.annotation.Nonnull)2 MockWebServer (okhttp3.mockwebserver.MockWebServer)2 ResponseField (com.apollographql.apollo.api.ResponseField)1 Optional (com.apollographql.apollo.api.internal.Optional)1 CacheKeyResolver (com.apollographql.apollo.cache.normalized.CacheKeyResolver)1 NormalizedCacheFactory (com.apollographql.apollo.cache.normalized.NormalizedCacheFactory)1 ApolloSqlHelper (com.apollographql.apollo.cache.normalized.sql.ApolloSqlHelper)1 SqlNormalizedCacheFactory (com.apollographql.apollo.cache.normalized.sql.SqlNormalizedCacheFactory)1 WebSocketSubscriptionTransport (com.apollographql.apollo.subscription.WebSocketSubscriptionTransport)1 Map (java.util.Map)1