use of com.amazonaws.mobileconnectors.appsync.demo.AllPostsQuery in project aws-mobile-appsync-sdk-android by awslabs.
the class QueryInstrumentationTest method testBaseAndDeltaSyncQuery.
@Test
public void testBaseAndDeltaSyncQuery() {
AWSAppSyncClient awsAppSyncClient = AWSAppSyncClients.withIAMFromAWSConfiguration();
AllPostsQuery baseQuery = AllPostsQuery.builder().build();
LatchedGraphQLCallback<Operation.Data> baseQueryCallback = LatchedGraphQLCallback.instance();
AllPostsQuery deltaQuery = AllPostsQuery.builder().build();
LatchedGraphQLCallback<Operation.Data> deltaQueryCallback = LatchedGraphQLCallback.instance();
// First, a base sync happens
Cancelable cancelable = awsAppSyncClient.sync(baseQuery, baseQueryCallback, deltaQuery, deltaQueryCallback, TimeUnit.HOURS.toSeconds(1));
assertFalse(cancelable.isCanceled());
baseQueryCallback.awaitSuccessfulResponse();
// Next, a delta sync, since the refresh interval isn't over.
// deltaQueryCallback.awaitResponse(); This does not appear to be working.
cancelable.cancel();
assertTrue(cancelable.isCanceled());
// This should be a No op. Test to make sure that there are no unintended side effects
cancelable.cancel();
assertTrue(cancelable.isCanceled());
}
Aggregations