diff --git a/bom/application/pom.xml b/bom/application/pom.xml index eb7a06c56b356..a913a78bc2ec6 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -40,7 +40,7 @@ 1.2 1.0 1.13.0 - 2.10.1 + 2.11.0 3.2.1 3.0.5 2.1.22 diff --git a/integration-tests/smallrye-config/src/main/java/io/quarkus/it/smallrye/config/AppConfig.java b/integration-tests/smallrye-config/src/main/java/io/quarkus/it/smallrye/config/AppConfig.java index 31370d9cfb7d5..f5c8797d8f61a 100644 --- a/integration-tests/smallrye-config/src/main/java/io/quarkus/it/smallrye/config/AppConfig.java +++ b/integration-tests/smallrye-config/src/main/java/io/quarkus/it/smallrye/config/AppConfig.java @@ -10,11 +10,15 @@ public interface AppConfig { Info info(); + String toString(); + interface Info { @WithDefault("alias") String alias(); @WithDefault("10") Integer count(); + + String toString(); } } diff --git a/integration-tests/smallrye-config/src/main/java/io/quarkus/it/smallrye/config/AppConfigResouce.java b/integration-tests/smallrye-config/src/main/java/io/quarkus/it/smallrye/config/AppConfigResouce.java index db07669cebc05..1a7773ca062a9 100644 --- a/integration-tests/smallrye-config/src/main/java/io/quarkus/it/smallrye/config/AppConfigResouce.java +++ b/integration-tests/smallrye-config/src/main/java/io/quarkus/it/smallrye/config/AppConfigResouce.java @@ -20,4 +20,10 @@ public String getName() { public String getAlias() { return appConfig.info().alias(); } + + @GET + @Path("/toString") + public String getToString() { + return appConfig.toString(); + } } diff --git a/integration-tests/smallrye-config/src/main/java/io/quarkus/it/smallrye/config/ConfigResource.java b/integration-tests/smallrye-config/src/main/java/io/quarkus/it/smallrye/config/ConfigResource.java index 3f6c3499ab58d..b8f2e3003ff64 100644 --- a/integration-tests/smallrye-config/src/main/java/io/quarkus/it/smallrye/config/ConfigResource.java +++ b/integration-tests/smallrye-config/src/main/java/io/quarkus/it/smallrye/config/ConfigResource.java @@ -23,6 +23,12 @@ public Response configValue(@PathParam("name") final String name) { return Response.ok(config.getConfigValue(name)).build(); } + @GET + @Path("/profiles") + public Response profiles() { + return Response.ok(config.getProfiles()).build(); + } + @RegisterForReflection(targets = { org.eclipse.microprofile.config.ConfigValue.class, io.smallrye.config.ConfigValue.class diff --git a/integration-tests/smallrye-config/src/main/java/io/quarkus/it/smallrye/config/Server.java b/integration-tests/smallrye-config/src/main/java/io/quarkus/it/smallrye/config/Server.java index 9a51067ac01cb..c98ee3d649714 100644 --- a/integration-tests/smallrye-config/src/main/java/io/quarkus/it/smallrye/config/Server.java +++ b/integration-tests/smallrye-config/src/main/java/io/quarkus/it/smallrye/config/Server.java @@ -153,11 +153,14 @@ interface Info { Optional> alias(); @JsonProperty - Map admins(); + Map> admins(); + + @JsonProperty + Map> firewall(); interface Admin { @JsonProperty - @Size(max = 3) + @Size(max = 4) String username(); } } diff --git a/integration-tests/smallrye-config/src/main/resources/application.properties b/integration-tests/smallrye-config/src/main/resources/application.properties index f3e4324535fcc..d44dc7bbd9af3 100644 --- a/integration-tests/smallrye-config/src/main/resources/application.properties +++ b/integration-tests/smallrye-config/src/main/resources/application.properties @@ -6,9 +6,11 @@ smallrye.config.locations=config.properties smallrye.config.source.file.locations=src/main/smallrye-config-source-file-system # parent profile -%prod.quarkus.config.profile.parent=common -%test.quarkus.config.profile.parent=common -%dev.quarkus.config.profile.parent=common +%prod.quarkus.config.profile.parent=parent-common,common +%test.quarkus.config.profile.parent=parent-common,common +%dev.quarkus.config.profile.parent=parent-common,common + +%parent-common.parent.common.prop=parent-common %common.profile.property.shared=common %test.profile.property.shared=main diff --git a/integration-tests/smallrye-config/src/main/resources/application.yaml b/integration-tests/smallrye-config/src/main/resources/application.yaml index 74e587ea59748..1387ba1876750 100644 --- a/integration-tests/smallrye-config/src/main/resources/application.yaml +++ b/integration-tests/smallrye-config/src/main/resources/application.yaml @@ -74,7 +74,14 @@ cloud: - James admins: root: - username: root + - + username: root + - + username: super + firewall: + accepted: + - 127.0.0.1 + - 8.8.8 profile: main: diff --git a/integration-tests/smallrye-config/src/test/java/io/quarkus/it/smallrye/config/AppConfigIT.java b/integration-tests/smallrye-config/src/test/java/io/quarkus/it/smallrye/config/AppConfigIT.java new file mode 100644 index 0000000000000..6aac74f3cdf7b --- /dev/null +++ b/integration-tests/smallrye-config/src/test/java/io/quarkus/it/smallrye/config/AppConfigIT.java @@ -0,0 +1,7 @@ +package io.quarkus.it.smallrye.config; + +import io.quarkus.test.junit.QuarkusIntegrationTest; + +@QuarkusIntegrationTest +public class AppConfigIT extends AppConfigTest { +} diff --git a/integration-tests/smallrye-config/src/test/java/io/quarkus/it/smallrye/config/AppConfigTest.java b/integration-tests/smallrye-config/src/test/java/io/quarkus/it/smallrye/config/AppConfigTest.java new file mode 100644 index 0000000000000..123cf614e8aa2 --- /dev/null +++ b/integration-tests/smallrye-config/src/test/java/io/quarkus/it/smallrye/config/AppConfigTest.java @@ -0,0 +1,21 @@ +package io.quarkus.it.smallrye.config; + +import static io.restassured.RestAssured.given; +import static javax.ws.rs.core.Response.Status.OK; +import static org.hamcrest.Matchers.is; + +import org.junit.jupiter.api.Test; + +import io.quarkus.test.junit.QuarkusTest; + +@QuarkusTest +public class AppConfigTest { + @Test + void getToString() { + given() + .get("/app-config/toString") + .then() + .statusCode(OK.getStatusCode()) + .body(is("AppConfig{name=app, info=Info{count=10, alias=alias}}")); + } +} diff --git a/integration-tests/smallrye-config/src/test/java/io/quarkus/it/smallrye/config/ServerResourceTest.java b/integration-tests/smallrye-config/src/test/java/io/quarkus/it/smallrye/config/ServerResourceTest.java index 21b2cda6b6d49..5d96721359ff5 100644 --- a/integration-tests/smallrye-config/src/test/java/io/quarkus/it/smallrye/config/ServerResourceTest.java +++ b/integration-tests/smallrye-config/src/test/java/io/quarkus/it/smallrye/config/ServerResourceTest.java @@ -102,13 +102,14 @@ void invalid() { given().get("/server/validator/{prefix}", "cloud") .then() .statusCode(OK.getStatusCode()) - .body("errors", hasSize(7)) + .body("errors", hasSize(8)) .body("errors", hasItem("cloud.log.days must be less than or equal to 15")) .body("errors", hasItem("cloud.cors.origins[1].port must be greater than or equal to 8000")) .body("errors", hasItem("cloud.info.name size must be between 0 and 3")) .body("errors", hasItem("cloud.info.code must be less than or equal to 3")) .body("errors", hasItem("cloud.info.alias[0] size must be between 0 and 3")) - .body("errors", hasItem("cloud.info.admins.root.username size must be between 0 and 3")) + .body("errors", hasItem("cloud.info.admins.root[1].username size must be between 0 and 4")) + .body("errors", hasItem("cloud.info.firewall.accepted[1] size must be between 8 and 15")) .body("errors", hasItem("cloud.proxy.timeout must be less than or equal to 10")); } } diff --git a/integration-tests/smallrye-config/src/test/java/io/quarkus/it/smallrye/config/SmallRyeConfigTest.java b/integration-tests/smallrye-config/src/test/java/io/quarkus/it/smallrye/config/SmallRyeConfigTest.java index ccdb2d4cbf3a0..999b7c5d84ba7 100644 --- a/integration-tests/smallrye-config/src/test/java/io/quarkus/it/smallrye/config/SmallRyeConfigTest.java +++ b/integration-tests/smallrye-config/src/test/java/io/quarkus/it/smallrye/config/SmallRyeConfigTest.java @@ -2,6 +2,7 @@ import static io.restassured.RestAssured.given; import static javax.ws.rs.core.Response.Status.OK; +import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import org.junit.jupiter.api.Test; @@ -98,4 +99,19 @@ void userConfig() { .body("value", equalTo("1234")) .body("sourceName", equalTo("UserConfigSource")); } + + @Test + void profiles() { + given() + .get("/config/profiles") + .then() + .statusCode(OK.getStatusCode()) + .body(containsString("parent-common")); + + given() + .get("/config/{name}", "parent.common.prop") + .then() + .statusCode(OK.getStatusCode()) + .body("value", equalTo("parent-common")); + } }