Search in sources :

Example 1 with SubscriptionCallbackListInteger

use of org.allGraphQLCases.subscription.SubscriptionCallbackListInteger in project graphql-maven-plugin-project by graphql-java-generator.

the class FullRequestSubscriptionIT method test_SubscribeToAList.

@Execution(ExecutionMode.CONCURRENT)
@Test
void test_SubscribeToAList() throws GraphQLRequestExecutionException, InterruptedException {
    // Preparation
    SubscriptionCallbackListInteger callback = new SubscriptionCallbackListInteger("FullRequestSubscriptionIT.test_SubscribeToAList");
    // Go, go, go
    SubscriptionClient sub = graphQLRepo.subscribeToAList(callback);
    // Verification
    // Let's wait a max of 20 second, until we receive some notifications
    callback.latchForMessageReception.await(20, TimeUnit.SECONDS);
    // Let's disconnect from the subscription
    sub.unsubscribe();
    // We should have received a notification from the subscription
    assertNotNull(callback.lastReceivedMessage);
}
Also used : SubscriptionCallbackListInteger(org.allGraphQLCases.subscription.SubscriptionCallbackListInteger) SubscriptionClient(com.graphql_java_generator.client.SubscriptionClient) Execution(org.junit.jupiter.api.parallel.Execution) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 2 with SubscriptionCallbackListInteger

use of org.allGraphQLCases.subscription.SubscriptionCallbackListInteger in project graphql-maven-plugin-project by graphql-java-generator.

the class RequestsAgainstTwoGraphQLServersIT method test_GraphQLRepository_allGraphQLCases.

@Test
@Execution(ExecutionMode.CONCURRENT)
void test_GraphQLRepository_allGraphQLCases() throws GraphQLRequestExecutionException, InterruptedException {
    // Preparation
    SubscriptionCallbackListInteger callback = new SubscriptionCallbackListInteger("FullRequestSubscriptionIT.test_SubscribeToAList");
    // Go, go, go
    SubscriptionClient sub = graphQLRepoAllGraphQLCases.subscribeToAList(callback);
    // Verification
    // Let's wait a max of 80 second, until we receive some notifications (this allows some debugging check in the
    // server)
    callback.latchForMessageReception.await(80, TimeUnit.SECONDS);
    // Let's disconnect from the subscription
    sub.unsubscribe();
    // We should have received a notification from the subscription
    assertNotNull(callback.lastReceivedMessage);
}
Also used : SubscriptionCallbackListInteger(org.allGraphQLCases.subscription.SubscriptionCallbackListInteger) SubscriptionClient(com.graphql_java_generator.client.SubscriptionClient) Execution(org.junit.jupiter.api.parallel.Execution) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

SubscriptionClient (com.graphql_java_generator.client.SubscriptionClient)2 SubscriptionCallbackListInteger (org.allGraphQLCases.subscription.SubscriptionCallbackListInteger)2 Test (org.junit.jupiter.api.Test)2 Execution (org.junit.jupiter.api.parallel.Execution)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2