Skip to content

Commit

Permalink
Fix broken GraphQL client tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jmartisk committed Apr 3, 2024
1 parent 067643b commit bf31a24
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.smallrye.graphql.client.deployment.model.Person;
import io.quarkus.smallrye.graphql.client.deployment.model.PersonDto;
import io.quarkus.smallrye.graphql.client.deployment.model.TestingGraphQLApi;
import io.quarkus.test.QuarkusUnitTest;
import io.smallrye.graphql.client.GraphQLClient;
Expand All @@ -32,7 +33,7 @@ public class DynamicGraphQLClientInjectionTest {
@RegisterExtension
static QuarkusUnitTest test = new QuarkusUnitTest()
.withApplicationRoot((jar) -> jar
.addClasses(TestingGraphQLApi.class, Person.class)
.addClasses(TestingGraphQLApi.class, Person.class, PersonDto.class)
.addAsResource(new StringAsset("people-client/mp-graphql/url=" + url + "\n" +
"people-client/mp-graphql/header/My-Header=My-Value"),
"application.properties")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.smallrye.graphql.client.deployment.model.Person;
import io.quarkus.smallrye.graphql.client.deployment.model.PersonDto;
import io.quarkus.smallrye.graphql.client.deployment.model.TestingGraphQLApi;
import io.quarkus.test.QuarkusUnitTest;
import io.smallrye.graphql.client.GraphQLClient;
Expand All @@ -32,7 +33,7 @@ public class DynamicGraphQLClientInjectionWithQuarkusConfigTest {
@RegisterExtension
static QuarkusUnitTest test = new QuarkusUnitTest()
.withApplicationRoot((jar) -> jar
.addClasses(TestingGraphQLApi.class, Person.class)
.addClasses(TestingGraphQLApi.class, Person.class, PersonDto.class)
.addAsResource(new StringAsset("quarkus.smallrye-graphql-client.people.url=" + url + "\n" +
"quarkus.smallrye-graphql-client.people.header.My-Header=My-Value"),
"application.properties")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.smallrye.graphql.client.deployment.model.Person;
import io.quarkus.smallrye.graphql.client.deployment.model.PersonDto;
import io.quarkus.smallrye.graphql.client.deployment.model.TestingGraphQLApi;
import io.quarkus.test.QuarkusUnitTest;
import io.quarkus.test.common.http.TestHTTPResource;
Expand All @@ -26,7 +27,7 @@ public class DynamicGraphQLClientProgrammaticUsageTest {
@RegisterExtension
static QuarkusUnitTest test = new QuarkusUnitTest()
.withApplicationRoot((jar) -> jar
.addClasses(TestingGraphQLApi.class, Person.class)
.addClasses(TestingGraphQLApi.class, Person.class, PersonDto.class)
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"));

@TestHTTPResource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.smallrye.graphql.client.deployment.model.Person;
import io.quarkus.smallrye.graphql.client.deployment.model.PersonDto;
import io.quarkus.smallrye.graphql.client.deployment.model.TestingGraphQLApi;
import io.quarkus.smallrye.graphql.client.deployment.model.TestingGraphQLClientApi;
import io.quarkus.test.QuarkusUnitTest;
Expand All @@ -21,7 +22,7 @@ public class StorkAndGraphQLClientTest {
@RegisterExtension
static QuarkusUnitTest test = new QuarkusUnitTest()
.withApplicationRoot((jar) -> jar
.addClasses(TestingGraphQLApi.class, TestingGraphQLClientApi.class, Person.class)
.addClasses(TestingGraphQLApi.class, TestingGraphQLClientApi.class, Person.class, PersonDto.class)
.addAsResource(new StringAsset(
"quarkus.smallrye-graphql-client.typesafeclient.url=stork://foo-service/graphql\n" +
"quarkus.stork.foo-service.service-discovery.type=static\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.smallrye.graphql.client.deployment.model.Person;
import io.quarkus.smallrye.graphql.client.deployment.model.PersonDto;
import io.quarkus.smallrye.graphql.client.deployment.model.TestingGraphQLApi;
import io.quarkus.smallrye.graphql.client.deployment.model.TestingGraphQLClientApiWithNoConfigKey;
import io.quarkus.test.QuarkusUnitTest;
Expand All @@ -27,7 +28,8 @@ public class TypesafeGraphQLClientFQNameTest {
@RegisterExtension
static QuarkusUnitTest test = new QuarkusUnitTest()
.withApplicationRoot((jar) -> jar
.addClasses(TestingGraphQLApi.class, TestingGraphQLClientApiWithNoConfigKey.class, Person.class)
.addClasses(TestingGraphQLApi.class, TestingGraphQLClientApiWithNoConfigKey.class, Person.class,
PersonDto.class)
.addAsResource(
new StringAsset(
"quarkus.smallrye-graphql-client.\"io.quarkus.smallrye.graphql." +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.smallrye.graphql.client.deployment.model.Person;
import io.quarkus.smallrye.graphql.client.deployment.model.PersonDto;
import io.quarkus.smallrye.graphql.client.deployment.model.TestingGraphQLApi;
import io.quarkus.smallrye.graphql.client.deployment.model.TestingGraphQLClientApi;
import io.quarkus.test.QuarkusUnitTest;
Expand All @@ -24,7 +25,7 @@ public class TypesafeGraphQLClientInjectionTest {
@RegisterExtension
static QuarkusUnitTest test = new QuarkusUnitTest()
.withApplicationRoot((jar) -> jar
.addClasses(TestingGraphQLApi.class, TestingGraphQLClientApi.class, Person.class)
.addClasses(TestingGraphQLApi.class, TestingGraphQLClientApi.class, Person.class, PersonDto.class)
.addAsResource(new StringAsset("typesafeclient/mp-graphql/url=" + url + "\n" +
"typesafeclient/mp-graphql/header/My-Header=My-Value"),
"application.properties")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.smallrye.graphql.client.deployment.model.Person;
import io.quarkus.smallrye.graphql.client.deployment.model.PersonDto;
import io.quarkus.smallrye.graphql.client.deployment.model.TestingGraphQLApi;
import io.quarkus.smallrye.graphql.client.deployment.model.TestingGraphQLClientApi;
import io.quarkus.test.QuarkusUnitTest;
Expand All @@ -24,7 +25,7 @@ public class TypesafeGraphQLClientInjectionWithQuarkusConfigTest {
@RegisterExtension
static QuarkusUnitTest test = new QuarkusUnitTest()
.withApplicationRoot((jar) -> jar
.addClasses(TestingGraphQLApi.class, TestingGraphQLClientApi.class, Person.class)
.addClasses(TestingGraphQLApi.class, TestingGraphQLClientApi.class, Person.class, PersonDto.class)
.addAsResource(new StringAsset("quarkus.smallrye-graphql-client.typesafeclient.url=" + url + "\n" +
"quarkus.smallrye-graphql-client.typesafeclient.header.My-Header=My-Value"),
"application.properties")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.smallrye.graphql.client.deployment.model.Person;
import io.quarkus.smallrye.graphql.client.deployment.model.PersonDto;
import io.quarkus.smallrye.graphql.client.deployment.model.TestingGraphQLApi;
import io.quarkus.smallrye.graphql.client.deployment.model.TestingGraphQLClientApi;
import io.quarkus.test.QuarkusUnitTest;
Expand All @@ -21,7 +22,7 @@ public class TypesafeGraphQLClientProgrammaticUsageTest {
@RegisterExtension
static QuarkusUnitTest test = new QuarkusUnitTest()
.withApplicationRoot((jar) -> jar
.addClasses(TestingGraphQLApi.class, TestingGraphQLClientApi.class, Person.class)
.addClasses(TestingGraphQLApi.class, TestingGraphQLClientApi.class, Person.class, PersonDto.class)
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"));

@TestHTTPResource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
import java.net.URL;
import java.util.List;

import org.eclipse.microprofile.graphql.Input;
import org.jboss.jandex.Index;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.smallrye.graphql.client.deployment.model.Person;
import io.quarkus.smallrye.graphql.client.deployment.model.PersonDto;
import io.quarkus.smallrye.graphql.client.deployment.model.TestingGraphQLApi;
import io.quarkus.smallrye.graphql.client.deployment.model.TestingGraphQLClientApi;
import io.quarkus.test.QuarkusUnitTest;
Expand All @@ -26,15 +28,16 @@ public class TypesafeGraphQLClientProgrammaticUsageWithClientModelTest {
@RegisterExtension
static QuarkusUnitTest test = new QuarkusUnitTest()
.withApplicationRoot((jar) -> jar
.addClasses(TestingGraphQLApi.class, TestingGraphQLClientApi.class, Person.class)
.addClasses(TestingGraphQLApi.class, TestingGraphQLClientApi.class, Person.class, PersonDto.class)
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"));

@TestHTTPResource
URL url;

@Test
public void performQuery() throws IOException {
Index index = Index.of(GraphQLClientApi.class, TestingGraphQLClientApi.class, Person.class);
Index index = Index.of(GraphQLClientApi.class, TestingGraphQLClientApi.class, Person.class, PersonDto.class,
Input.class);
TestingGraphQLClientApi client = ((VertxTypesafeGraphQLClientBuilder) TypesafeGraphQLClientBuilder.newBuilder())
.clientModels(ClientModelBuilder.build(index))
.endpoint(url.toString() + "/graphql")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.smallrye.graphql.client.deployment.model.Person;
import io.quarkus.smallrye.graphql.client.deployment.model.PersonDto;
import io.quarkus.smallrye.graphql.client.deployment.model.TestingGraphQLApi;
import io.quarkus.smallrye.graphql.client.deployment.model.TestingGraphQLClientApiWithNoConfigKey;
import io.quarkus.test.QuarkusUnitTest;
Expand All @@ -28,7 +29,8 @@ public class TypesafeGraphQLClientShortcutTest {
@RegisterExtension
static QuarkusUnitTest test = new QuarkusUnitTest()
.withApplicationRoot((jar) -> jar
.addClasses(TestingGraphQLApi.class, TestingGraphQLClientApiWithNoConfigKey.class, Person.class)
.addClasses(TestingGraphQLApi.class, TestingGraphQLClientApiWithNoConfigKey.class, Person.class,
PersonDto.class)
.addAsResource(
new StringAsset(
"quarkus.smallrye-graphql-client.TestingGraphQLClientApiWithNoConfigKey.url=" + url),
Expand Down

0 comments on commit bf31a24

Please sign in to comment.