TAMAYA-345 Applied patch, using colons as map entry separator.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/9f38f770 Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/9f38f770 Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/9f38f770 Branch: refs/heads/master Commit: 9f38f77020a057145aa246f2ff6f121adf7a6727 Parents: bf0cd8b Author: Anatole Tresch <[email protected]> Authored: Fri Nov 16 22:45:34 2018 +0100 Committer: Anatole Tresch <[email protected]> Committed: Fri Nov 16 22:45:34 2018 +0100 ---------------------------------------------------------------------- .../org/apache/tamaya/collections/ItemTokenizer.java | 12 +++++++----- .../apache/tamaya/collections/CollectionsBaseTests.java | 2 +- .../collections/CollectionsTypedReadOnlyTests.java | 2 +- .../tamaya/collections/CollectionsTypedTests.java | 2 +- .../resources/META-INF/javaconfiguration.properties | 10 +++++----- 5 files changed, 15 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/9f38f770/modules/collections/src/main/java/org/apache/tamaya/collections/ItemTokenizer.java ---------------------------------------------------------------------- diff --git a/modules/collections/src/main/java/org/apache/tamaya/collections/ItemTokenizer.java b/modules/collections/src/main/java/org/apache/tamaya/collections/ItemTokenizer.java index 98f5473..176241e 100644 --- a/modules/collections/src/main/java/org/apache/tamaya/collections/ItemTokenizer.java +++ b/modules/collections/src/main/java/org/apache/tamaya/collections/ItemTokenizer.java @@ -34,9 +34,11 @@ final class ItemTokenizer { private static final Logger LOG = Logger.getLogger(ItemTokenizer.class.getName()); - public static final String ITEM_SEPARATOR = "item-separator"; - public static final String MAP_ENTRY_SEPARATOR = "map-entry-separator"; - public static final String ITEM_CONVERTER = "item-converter"; + private static final String ITEM_SEPARATOR = "item-separator"; + private static final String MAP_ENTRY_SEPARATOR = "map-entry-separator"; + private static final String ITEM_CONVERTER = "item-converter"; + private static final String DEFAULT_MAP_ENTRY_SEPARATOR = ":"; + private static final String DEFAULT_LIST_ITEM_SEPARATOR = ","; /** * Private singleton. @@ -51,7 +53,7 @@ final class ItemTokenizer { * @return the tokenized createValue as createList, in order of occurrence. */ public static List<String> split(String value, ConversionContext ctx){ - String itemSeparator = (String)ctx.getMeta().getOrDefault(ITEM_SEPARATOR, ","); + String itemSeparator = (String)ctx.getMeta().getOrDefault(ITEM_SEPARATOR, DEFAULT_LIST_ITEM_SEPARATOR); return split(value, itemSeparator); } @@ -88,7 +90,7 @@ final class ItemTokenizer { * @return an array of length 2, with the trimmed and parsed key/createValue pair. */ public static String[] splitMapEntry(String mapEntry, ConversionContext ctx){ - String entrySeparator = (String)ctx.getMeta().getOrDefault(MAP_ENTRY_SEPARATOR, "="); + String entrySeparator = (String)ctx.getMeta().getOrDefault(MAP_ENTRY_SEPARATOR, DEFAULT_MAP_ENTRY_SEPARATOR); return splitMapEntry(mapEntry, entrySeparator); } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/9f38f770/modules/collections/src/test/java/org/apache/tamaya/collections/CollectionsBaseTests.java ---------------------------------------------------------------------- diff --git a/modules/collections/src/test/java/org/apache/tamaya/collections/CollectionsBaseTests.java b/modules/collections/src/test/java/org/apache/tamaya/collections/CollectionsBaseTests.java index 8a531e3..9cee76d 100644 --- a/modules/collections/src/test/java/org/apache/tamaya/collections/CollectionsBaseTests.java +++ b/modules/collections/src/test/java/org/apache/tamaya/collections/CollectionsBaseTests.java @@ -31,7 +31,7 @@ import static org.junit.Assert.assertNotNull; /** * Basic tests for Tamaya collection support. Relevant configs for this tests: * <pre>base.items=1,2,3,4,5,6,7,8,9,0 - * base.map=1::a, 2::b, 3::c, [4:: ] + * base.map=1:a, 2:b, 3:c, [4: ] * </pre> */ public class CollectionsBaseTests { http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/9f38f770/modules/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedReadOnlyTests.java ---------------------------------------------------------------------- diff --git a/modules/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedReadOnlyTests.java b/modules/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedReadOnlyTests.java index 848d1b3..ba63dfc 100644 --- a/modules/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedReadOnlyTests.java +++ b/modules/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedReadOnlyTests.java @@ -31,7 +31,7 @@ import static org.junit.Assert.*; /** * Basic tests for Tamaya collection support. Relevant configs for this tests: * <pre>base.items=1,2,3,4,5,6,7,8,9,0 - * base.map=1::a, 2::b, 3::c, [4:: ] + * base.map=1:a, 2:b, 3:c, [4: ] * </pre> */ //@Ignore("Readonly support has been deactivated as of now.") http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/9f38f770/modules/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedTests.java ---------------------------------------------------------------------- diff --git a/modules/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedTests.java b/modules/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedTests.java index 92c592e..6860a2f 100644 --- a/modules/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedTests.java +++ b/modules/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedTests.java @@ -32,7 +32,7 @@ import static org.junit.Assert.assertTrue; /** * Basic tests for Tamaya collection support. Relevant configs for this tests: * <pre>base.items=1,2,3,4,5,6,7,8,9,0 - * base.map=1::a, 2::b, 3::c, [4:: ] + * base.map=1:a, 2:b, 3:c, [4: ] * </pre> */ public class CollectionsTypedTests { http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/9f38f770/modules/collections/src/test/resources/META-INF/javaconfiguration.properties ---------------------------------------------------------------------- diff --git a/modules/collections/src/test/resources/META-INF/javaconfiguration.properties b/modules/collections/src/test/resources/META-INF/javaconfiguration.properties index 3764840..6e6b436 100644 --- a/modules/collections/src/test/resources/META-INF/javaconfiguration.properties +++ b/modules/collections/src/test/resources/META-INF/javaconfiguration.properties @@ -20,7 +20,7 @@ # Config for base tests (no combination policy) base.items=1,2,3,4,5,6,7,8,9,0 -base.map=1=a, 2=b, 3=c, [4= ] +base.map=1:a, 2:b, 3:c, [4: ] # Config for tests with explcit implementation types typed2.arraylist=1,2,3,4,5,6,7,8,9,0 @@ -31,9 +31,9 @@ typed2.hashset=1,2,3,4,5,6,7,8,9,0 [META]typed2.hashset.collection-type=HashSet typed2.treeset=1,2,3,4,5,6,7,8,9,0 [META]typed2.treeset.collection-type=TreeSet -typed2.hashmap=1=a, 2=b, 3=c, [4= ] +typed2.hashmap=1:a, 2:b, 3:c, [4: ] [META]typed2.hashmap.collection-type=java.util.HashMap -typed2.treemap=1=a, 2=b, 3=c, [4= ] +typed2.treemap=1:a, 2:b, 3:c, [4: ] [META]typed2.treemap.collection-type=TreeMap # Config for tests with combination policy, writable @@ -46,10 +46,10 @@ typed.hashset=1,2,3,4,5,6,7,8,9,0 [META]typed.hashset.collection-type=HashSet typed.treeset=1,2,3,4,5,6,7,8,9,0 [META]typed.treeset.collection-type=TreeSet -typed.hashmap=1=a, 2=b, 3=c, [4= ] +typed.hashmap=1:a, 2:b, 3:c, [4: ] [META]typed.hashmap.collection-type=java.util.HashMap [META]typed.hashmap.read-only=true -typed.treemap=1=a, 2=b, 3=c, [4= ] +typed.treemap=1:a, 2:b, 3:c, [4: ] [META]typed.treemap.collection-type=TreeMap # Config for advanced tests
