Search in sources :

Example 1 with Optional

use of com.apollographql.apollo.api.internal.Optional in project apollo-android by apollographql.

the class ApolloWatcherTest method setUp.

@Before
public void setUp() throws IOException {
    OkHttpClient okHttpClient = new OkHttpClient.Builder().dispatcher(new Dispatcher(Utils.immediateExecutorService())).build();
    apolloClient = ApolloClient.builder().serverUrl(server.url("/")).dispatcher(immediateExecutor()).okHttpClient(okHttpClient).logger(new Logger() {

        @Override
        public void log(int priority, @Nonnull String message, @Nonnull Optional<Throwable> t, @Nonnull Object... args) {
            String throwableTrace = "";
            if (t.isPresent()) {
                throwableTrace = t.get().getMessage();
            }
            System.out.println(String.format(message, args) + " " + throwableTrace);
        }
    }).normalizedCache(new LruNormalizedCacheFactory(EvictionPolicy.NO_EVICTION), new IdFieldCacheKeyResolver()).build();
}
Also used : OkHttpClient(okhttp3.OkHttpClient) Optional(com.apollographql.apollo.api.internal.Optional) LruNormalizedCacheFactory(com.apollographql.apollo.cache.normalized.lru.LruNormalizedCacheFactory) Nonnull(javax.annotation.Nonnull) Dispatcher(okhttp3.Dispatcher) Before(org.junit.Before)

Aggregations

Optional (com.apollographql.apollo.api.internal.Optional)1 LruNormalizedCacheFactory (com.apollographql.apollo.cache.normalized.lru.LruNormalizedCacheFactory)1 Nonnull (javax.annotation.Nonnull)1 Dispatcher (okhttp3.Dispatcher)1 OkHttpClient (okhttp3.OkHttpClient)1 Before (org.junit.Before)1