Skip to content

Commit

Permalink
Tests for autowiring of GraphQL clients
Browse files Browse the repository at this point in the history
  • Loading branch information
jmartisk committed Jul 28, 2022
1 parent 010af60 commit 7c61f9e
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 86 deletions.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;

import javax.inject.Inject;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;

import io.smallrye.graphql.client.GraphQLClient;
import io.smallrye.graphql.client.Response;
import io.smallrye.graphql.client.core.Document;
import io.smallrye.graphql.client.core.OperationType;
Expand Down Expand Up @@ -148,4 +150,22 @@ public void dynamicSubscription(@PathParam("url") String url) throws Exception {
}
}

@GraphQLClient("some-key")
DynamicGraphQLClient autowiredDynamicClient;

@GET
@Path("/autowired-dynamic")
public void autowiredDynamicClient() throws ExecutionException, InterruptedException {
testSingleResultOperationsWithDynamicClient(autowiredDynamicClient);
}

@Inject
LuckyNumbersClientApi autowiredTypesafeClient;

@GET
@Path("/autowired-typesafe")
public void autowiredTypesafeClient() throws Exception {
testSingleResultOperationsWithTypesafeClient(autowiredTypesafeClient);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,13 @@ public void testDynamicClientSubscription() throws Exception {
.statusCode(204);
}

@Test
public void testDynamicClientAutowiredUrl() throws Exception {
when()
.get("/autowired-dynamic/")
.then()
.log().everything()
.statusCode(204);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,13 @@ public void testHeader() {
.statusCode(204);
}

@Test
public void testAutowiredUrl() throws Exception {
when()
.get("/autowired-typesafe/")
.then()
.log().everything()
.statusCode(204);
}

}

0 comments on commit 7c61f9e

Please sign in to comment.