-
Notifications
You must be signed in to change notification settings - Fork 3k
Make the vertx-graphql extension work in native mode #5253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
machi1990
merged 4 commits into
quarkusio:master
from
machi1990:fix/vertx-graphql-native
Nov 29, 2019
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
0b93756
feat: add a build item to register packages resources for native image
machi1990 c5d04d8
fix(vertx-graphql): make the extension work in native mode
machi1990 7fab924
feat(vertx-graphql): adds the possibility to control graphql-ui path …
machi1990 3db09bd
test: properly close vertx instances
machi1990 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
19 changes: 19 additions & 0 deletions
19
...va/io/quarkus/deployment/builditem/nativeimage/NativeImageResourceDirectoryBuildItem.java
This file contains hidden or 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,19 @@ | ||
package io.quarkus.deployment.builditem.nativeimage; | ||
|
||
import io.quarkus.builder.item.MultiBuildItem; | ||
|
||
/** | ||
* A build item that indicates that directory resources should be included in the native image | ||
*/ | ||
public final class NativeImageResourceDirectoryBuildItem extends MultiBuildItem { | ||
|
||
private final String path; | ||
|
||
public NativeImageResourceDirectoryBuildItem(String path) { | ||
this.path = path; | ||
} | ||
|
||
public String getPath() { | ||
return path; | ||
} | ||
} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
32 changes: 32 additions & 0 deletions
32
...phql/deployment/src/main/java/io/quarkus/vertx/graphql/deployment/VertxGraphqlConfig.java
This file contains hidden or 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,32 @@ | ||
package io.quarkus.vertx.graphql.deployment; | ||
|
||
import io.quarkus.runtime.annotations.ConfigGroup; | ||
import io.quarkus.runtime.annotations.ConfigItem; | ||
import io.quarkus.runtime.annotations.ConfigRoot; | ||
|
||
@ConfigRoot | ||
public final class VertxGraphqlConfig { | ||
/** | ||
* GraphQL UI configuration | ||
*/ | ||
@ConfigItem | ||
VertxGraphqlUiConfig ui; | ||
|
||
@ConfigGroup | ||
public static class VertxGraphqlUiConfig { | ||
/** | ||
* If GraphQL UI should be included every time. By default this is only included when the application is running | ||
* in dev mode. | ||
*/ | ||
@ConfigItem(defaultValue = "false") | ||
boolean alwaysInclude; | ||
|
||
/** | ||
* The path where GraphQL UI is available. | ||
* <p> | ||
* The value `/` is not allowed as it blocks the application from serving anything else. | ||
*/ | ||
@ConfigItem(defaultValue = "/graphql-ui") | ||
String path; | ||
} | ||
} |
This file contains hidden or 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
25 changes: 25 additions & 0 deletions
25
...hql/deployment/src/test/java/io/quarkus/vertx/graphql/deployment/ErroneousConfigTest.java
This file contains hidden or 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,25 @@ | ||
package io.quarkus.vertx.graphql.deployment; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
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.runtime.configuration.ConfigurationException; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class ErroneousConfigTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.setExpectedException(ConfigurationException.class) | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addAsResource(new StringAsset("quarkus.vertx-graphql.ui.path=/\n"), "application.properties")); | ||
|
||
@Test | ||
public void shouldNotStartApplicationIfPathIsASlash() { | ||
Assertions.fail(); | ||
machi1990 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...oyment/src/test/java/io/quarkus/vertx/graphql/deployment/ServingUIFromCustomPathTest.java
This file contains hidden or 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,23 @@ | ||
package io.quarkus.vertx.graphql.deployment; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.asset.StringAsset; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.restassured.RestAssured; | ||
|
||
public class ServingUIFromCustomPathTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addAsResource(new StringAsset("quarkus.vertx-graphql.ui.path=/custom\n"), "application.properties")); | ||
|
||
@Test | ||
public void shouldServeVertxGraphqlUiFromCustomPath() { | ||
RestAssured.when().get("/custom").then().statusCode(200); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.