-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30143 from jmartisk/main-issue-30129
Make sure Federation annotations are in the index, add a test
- Loading branch information
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...eployment/src/test/java/io/quarkus/smallrye/graphql/deployment/GraphQLFederationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package io.quarkus.smallrye.graphql.deployment; | ||
|
||
import static org.hamcrest.Matchers.containsString; | ||
|
||
import org.eclipse.microprofile.graphql.GraphQLApi; | ||
import org.eclipse.microprofile.graphql.Query; | ||
import org.jboss.shrinkwrap.api.asset.EmptyAsset; | ||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.restassured.RestAssured; | ||
import io.smallrye.graphql.api.federation.Extends; | ||
|
||
public class GraphQLFederationTest extends AbstractGraphQLTest { | ||
|
||
@RegisterExtension | ||
static QuarkusUnitTest test = new QuarkusUnitTest() | ||
.withApplicationRoot((jar) -> jar | ||
.addClasses(FooApi.class, Foo.class) | ||
.addAsResource(new StringAsset("quarkus.smallrye-graphql.schema-include-directives=true"), | ||
"application.properties") | ||
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")); | ||
|
||
@Test | ||
public void checkServiceDeclarationInSchema() { | ||
RestAssured.given() | ||
.get("/graphql/schema.graphql") | ||
.then() | ||
.body(containsString("type _Service {")); | ||
} | ||
|
||
@Test | ||
public void checkFederationDirectivesInSchema() { | ||
RestAssured.given() | ||
.get("/graphql/schema.graphql") | ||
.then() | ||
.body(containsString("name: String @extends")); | ||
} | ||
|
||
@GraphQLApi | ||
static class FooApi { | ||
|
||
@Query | ||
public Foo foo() { | ||
return new Foo(); | ||
} | ||
|
||
} | ||
|
||
static class Foo { | ||
|
||
@Extends | ||
public String name; | ||
|
||
} | ||
|
||
} |