-
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.
Fix Bootstrap Config to use default Config Sources (System and Env)
- Loading branch information
Showing
14 changed files
with
162 additions
and
112 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
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
33 changes: 33 additions & 0 deletions
33
...strap-config/application/src/main/java/io/quarkus/it/bootstrap/config/ConfigResource.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,33 @@ | ||
package io.quarkus.it.bootstrap.config; | ||
|
||
import javax.inject.Inject; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.PathParam; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
import javax.ws.rs.core.Response; | ||
|
||
import io.quarkus.runtime.annotations.RegisterForReflection; | ||
import io.smallrye.config.SmallRyeConfig; | ||
|
||
@Path("/config") | ||
@Produces(MediaType.APPLICATION_JSON) | ||
public class ConfigResource { | ||
@Inject | ||
SmallRyeConfig config; | ||
|
||
@GET | ||
@Path("/{name}") | ||
public Response configValue(@PathParam("name") final String name) { | ||
return Response.ok(config.getConfigValue(name)).build(); | ||
} | ||
|
||
@RegisterForReflection(targets = { | ||
org.eclipse.microprofile.config.ConfigValue.class, | ||
io.smallrye.config.ConfigValue.class | ||
}) | ||
public static class ConfigValueReflection { | ||
|
||
} | ||
} |
18 changes: 0 additions & 18 deletions
18
...rap-config/application/src/main/java/io/quarkus/it/bootstrap/config/GreetingResource.java
This file was deleted.
Oops, something went wrong.
3 changes: 2 additions & 1 deletion
3
integration-tests/bootstrap-config/application/src/main/resources/application.properties
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
quarkus.dummy.name=foo | ||
quarkus.application.name=dummy | ||
quarkus.dummy.times=9 | ||
quarkus.dummy.map.key=value |
1 change: 1 addition & 0 deletions
1
integration-tests/bootstrap-config/application/src/main/resources/config.properties
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 @@ | ||
quarkus.dummy.map.locations=locations |
53 changes: 53 additions & 0 deletions
53
...p-config/application/src/test/java/io/quarkus/it/bootstrap/config/ConfigResourceTest.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,53 @@ | ||
package io.quarkus.it.bootstrap.config; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static javax.ws.rs.core.Response.Status.OK; | ||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import io.quarkus.test.junit.QuarkusTest; | ||
|
||
@QuarkusTest | ||
class ConfigResourceTest { | ||
@Test | ||
void bootstrap() { | ||
given() | ||
.get("/config/{name}", "quarkus.dummy.name") | ||
.then() | ||
.statusCode(OK.getStatusCode()) | ||
.body("value", equalTo("foo")) | ||
.body("configSourceName", equalTo("bootstrap")); | ||
|
||
given() | ||
.get("/config/{name}", "quarkus.dummy.times") | ||
.then() | ||
.statusCode(OK.getStatusCode()) | ||
.body("value", equalTo("9")) | ||
.body("configSourceName", equalTo("bootstrap")); | ||
|
||
given() | ||
.get("/config/{name}", "quarkus.dummy.map.key") | ||
.then() | ||
.statusCode(OK.getStatusCode()) | ||
.body("value", equalTo("value")) | ||
.body("configSourceName", equalTo("bootstrap")); | ||
|
||
given() | ||
.get("/config/{name}", "quarkus.dummy.map.system") | ||
.then() | ||
.statusCode(OK.getStatusCode()) | ||
.body("value", equalTo("system")) | ||
.body("configSourceName", equalTo("bootstrap")); | ||
} | ||
|
||
@Test | ||
void locations() { | ||
given() | ||
.get("/config/{name}", "quarkus.dummy.map.locations") | ||
.then() | ||
.statusCode(OK.getStatusCode()) | ||
.body("value", equalTo("locations")) | ||
.body("configSourceName", equalTo("bootstrap")); | ||
} | ||
} |
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
23 changes: 0 additions & 23 deletions
23
...config/application/src/test/java/io/quarkus/it/bootstrap/config/GreetingResourceTest.java
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.