From 595bc0049dcd192cf183d38edad448d2f2efe30d Mon Sep 17 00:00:00 2001 From: Manyanda Chitimbo Date: Tue, 12 Nov 2019 21:00:04 +0100 Subject: [PATCH] Tests for Map> where Xxx is a leaf or config group --- .../src/main/resources/application.properties | 5 +++++ .../java/io/quarkus/extest/ConfiguredBeanTest.java | 14 ++++++++++++++ .../extest/runtime/config/TestRunTimeConfig.java | 7 +++++++ 3 files changed, 26 insertions(+) diff --git a/core/test-extension/deployment/src/main/resources/application.properties b/core/test-extension/deployment/src/main/resources/application.properties index 9c904afc68904..dba86f4b3a5a1 100644 --- a/core/test-extension/deployment/src/main/resources/application.properties +++ b/core/test-extension/deployment/src/main/resources/application.properties @@ -99,6 +99,11 @@ quarkus.rt.one-to-nine=one,two,three,four,five,six,seven,eight,nine quarkus.rt.map-of-numbers.key1=one quarkus.rt.map-of-numbers.key2=two +### map configurations +quarkus.rt.leaf-map.key.first=first-key-value +quarkus.rt.leaf-map.key.second=second-key-value +quarkus.rt.config-group-map.key.group.nested-value=value +quarkus.rt.config-group-map.key.group.oov=value2.1+value2.2 ### build time and run time configuration using enhanced converters quarkus.btrt.map-of-numbers.key1=one diff --git a/core/test-extension/deployment/src/test/java/io/quarkus/extest/ConfiguredBeanTest.java b/core/test-extension/deployment/src/test/java/io/quarkus/extest/ConfiguredBeanTest.java index 64cbf269e3e60..bcf9d1092a31e 100644 --- a/core/test-extension/deployment/src/test/java/io/quarkus/extest/ConfiguredBeanTest.java +++ b/core/test-extension/deployment/src/test/java/io/quarkus/extest/ConfiguredBeanTest.java @@ -204,6 +204,20 @@ public void validateRuntimeConfigMap() { Assertions.assertEquals(Arrays.asList("value1", "value2", "value3"), stringListMap.get("key1")); Assertions.assertEquals(Arrays.asList("value4", "value5"), stringListMap.get("key2")); Assertions.assertEquals(Collections.singletonList("value6"), stringListMap.get("key3")); + + //quarkus.rt.leaf-map.key.first=first-key-value + //quarkus.rt.leaf-map.key.second=second-key-value + + final Map> leafMap = runTimeConfig.leafMap; + Assertions.assertEquals("first-key-value", leafMap.get("key").get("first")); + Assertions.assertEquals("second-key-value", leafMap.get("key").get("second")); + + //quarkus.rt.config-group-map.key.group.nested-value=value + //quarkus.rt.config-group-map.key.group.oov=value2.1+value2.2 + final Map> configGroupMap = runTimeConfig.configGroupMap; + NestedConfig nestedConfigFromMap = configGroupMap.get("key").get("group"); + Assertions.assertEquals("value", nestedConfigFromMap.nestedValue); + Assertions.assertEquals(new ObjectOfValue("value2.1", "value2.2"), nestedConfigFromMap.oov); } /** diff --git a/core/test-extension/runtime/src/main/java/io/quarkus/extest/runtime/config/TestRunTimeConfig.java b/core/test-extension/runtime/src/main/java/io/quarkus/extest/runtime/config/TestRunTimeConfig.java index fe9ab9c45384a..66d9c335790ce 100644 --- a/core/test-extension/runtime/src/main/java/io/quarkus/extest/runtime/config/TestRunTimeConfig.java +++ b/core/test-extension/runtime/src/main/java/io/quarkus/extest/runtime/config/TestRunTimeConfig.java @@ -28,6 +28,13 @@ public class TestRunTimeConfig { @ConfigItem public AllValuesConfig allValues; + /** A map of properties */ + @ConfigItem + public Map> leafMap; + /** A map of property lists */ + @ConfigItem + public Map> configGroupMap; + /** * Enum object */