-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GraphQL: New config option to make the schema unavailable
Signed-off-by:Phillip Kruger <[email protected]>
- Loading branch information
1 parent
ae2ec6f
commit 468a463
Showing
4 changed files
with
60 additions
and
3 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
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
50 changes: 50 additions & 0 deletions
50
...nt/src/test/java/io/quarkus/smallrye/graphql/deployment/GraphQLSchemaUnavailableTest.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,50 @@ | ||
package io.quarkus.smallrye.graphql.deployment; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.jboss.logging.Logger; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.EmptyAsset; | ||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.restassured.RestAssured; | ||
import io.restassured.response.Response; | ||
import io.restassured.specification.RequestSpecification; | ||
|
||
/** | ||
* Test when schema is not available | ||
*/ | ||
public class GraphQLSchemaUnavailableTest extends AbstractGraphQLTest { | ||
|
||
private static final Logger LOG = Logger.getLogger(GraphQLSchemaUnavailableTest.class); | ||
|
||
@RegisterExtension | ||
static QuarkusUnitTest test = new QuarkusUnitTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClasses(TestResource.class, TestPojo.class, TestRandom.class, TestGenericsPojo.class, | ||
BusinessException.class) | ||
.addAsResource(new StringAsset(getPropertyAsString(configuration())), "application.properties") | ||
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")); | ||
|
||
@Test | ||
public void testSchema() { | ||
RequestSpecification request = RestAssured.given(); | ||
request.accept(MEDIATYPE_TEXT); | ||
request.contentType(MEDIATYPE_TEXT); | ||
Response response = request.get("/graphql/schema.graphql"); | ||
|
||
Assertions.assertEquals(404, response.statusCode()); | ||
} | ||
|
||
private static Map<String, String> configuration() { | ||
Map<String, String> m = new HashMap<>(); | ||
m.put("quarkus.smallrye-graphql.schema-available", "false"); | ||
return m; | ||
} | ||
} |
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