Search in sources :

Example 1 with Variables

use of com.apollographql.apollo.api.Operation.Variables in project aws-mobile-appsync-sdk-android by awslabs.

the class MultiClientInstrumentationTest method testSyncOnlyBaseQuery.

@Test
public void testSyncOnlyBaseQuery() {
    List<AWSAppSyncClient> clients = Arrays.asList(AWSAppSyncClients.withAPIKEYFromAWSConfiguration(), AWSAppSyncClients.withIAMFromAWSConfiguration(), AWSAppSyncClients.withUserPoolsFromAWSConfiguration());
    for (AWSAppSyncClient client : clients) {
        Query<AllPostsQuery.Data, AllPostsQuery.Data, Variables> baseQuery = AllPostsQuery.builder().build();
        LatchedGraphQLCallback<Query.Data> baseQueryCallback = LatchedGraphQLCallback.instance();
        Cancelable handle = client.sync(baseQuery, baseQueryCallback, 0);
        assertFalse(handle.isCanceled());
        baseQueryCallback.awaitSuccessfulResponse();
        handle.cancel();
        assertTrue(handle.isCanceled());
        // This should be a No-op. Test to make sure.
        handle.cancel();
        assertTrue(handle.isCanceled());
    }
}
Also used : Variables(com.apollographql.apollo.api.Operation.Variables) AWSAppSyncClient(com.amazonaws.mobileconnectors.appsync.AWSAppSyncClient) Cancelable(com.apollographql.apollo.internal.util.Cancelable) Test(org.junit.Test)

Aggregations

AWSAppSyncClient (com.amazonaws.mobileconnectors.appsync.AWSAppSyncClient)1 Variables (com.apollographql.apollo.api.Operation.Variables)1 Cancelable (com.apollographql.apollo.internal.util.Cancelable)1 Test (org.junit.Test)1