Skip to content

Commit

Permalink
Tests for Map<String, Map<String, Xxx>> where Xxx is a leaf or config…
Browse files Browse the repository at this point in the history
… group
  • Loading branch information
machi1990 authored and dmlloyd committed Nov 13, 2019
1 parent 53d9533 commit 595bc00
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, Map<String, String>> 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<String, Map<String, NestedConfig>> 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);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@ public class TestRunTimeConfig {
@ConfigItem
public AllValuesConfig allValues;

/** A map of properties */
@ConfigItem
public Map<String, Map<String, String>> leafMap;
/** A map of property lists */
@ConfigItem
public Map<String, Map<String, NestedConfig>> configGroupMap;

/**
* Enum object
*/
Expand Down

0 comments on commit 595bc00

Please sign in to comment.