You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by pl...@apache.org on 2016/09/06 17:18:21 UTC

[25/50] [abbrv] incubator-tamaya-sandbox git commit: Added more complex scenarios and features for configuring of collections. Refactored parsing logic into separate utility class.

Added more complex scenarios and features for configuring of collections. Refactored parsing logic into separate utility class.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/e94ac73d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/e94ac73d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/e94ac73d

Branch: refs/heads/master
Commit: e94ac73dfa88b9b974ec7b6eddb52a39fcbcdaeb
Parents: dda281b
Author: anatole <an...@apache.org>
Authored: Wed Feb 17 00:31:16 2016 +0100
Committer: anatole <an...@apache.org>
Committed: Wed Feb 17 00:31:16 2016 +0100

----------------------------------------------------------------------
 .../internal/AdaptiveCombinationPolicy.java     |   3 +-
 .../internal/ArrayListConverter.java            |  50 ++----
 .../internal/CollectionConverter.java           |   1 -
 .../internal/ConcurrentHashMapConverter.java    |  25 +--
 .../collections/internal/HashMapConverter.java  |   6 +-
 .../collections/internal/HashSetConverter.java  |   5 +-
 .../collections/internal/ItemTokenizer.java     | 170 +++++++++++++++++++
 .../internal/LinkedListConverter.java           |   5 +-
 .../collections/internal/TreeSetConverter.java  |   5 +-
 .../collections/CollectionAdvancedTests.java    |  78 +++++++++
 .../collections/MyUpperCaseConverter.java       |  33 ++++
 .../META-INF/javaconfiguration.properties       |  30 ++--
 12 files changed, 324 insertions(+), 87 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/e94ac73d/collections/src/main/java/org/apache/tamaya/collections/internal/AdaptiveCombinationPolicy.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/internal/AdaptiveCombinationPolicy.java b/collections/src/main/java/org/apache/tamaya/collections/internal/AdaptiveCombinationPolicy.java
index 63fea76..ac5af36 100644
--- a/collections/src/main/java/org/apache/tamaya/collections/internal/AdaptiveCombinationPolicy.java
+++ b/collections/src/main/java/org/apache/tamaya/collections/internal/AdaptiveCombinationPolicy.java
@@ -68,6 +68,7 @@ public class AdaptiveCombinationPolicy implements PropertyValueCombinationPolicy
             }
         }
         // check for default collection combination policies for lists, sets, maps etc.
+        final String SEPARATOR = ConfigurationProvider.getConfiguration().getOrDefault('_' + key+".collection-separator", ",");
         String collectionType = ConfigurationProvider.getConfiguration().get('_' + key+".collection-type");
         if(collectionType!=null) {
             if (collectionType.startsWith("java.util.")) {
@@ -96,7 +97,7 @@ public class AdaptiveCombinationPolicy implements PropertyValueCombinationPolicy
                         String oldVal = newMapValue.get(key);
                         newMapValue.putAll(newValue.getConfigEntries());
                         if(oldVal!=null){
-                            newMapValue.put(key,oldVal + ',' + newValue.getValue());
+                            newMapValue.put(key,oldVal + SEPARATOR + newValue.getValue());
                         }
                         return newMapValue;
                     }else{

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/e94ac73d/collections/src/main/java/org/apache/tamaya/collections/internal/ArrayListConverter.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/internal/ArrayListConverter.java b/collections/src/main/java/org/apache/tamaya/collections/internal/ArrayListConverter.java
index e55b44a..3e95438 100644
--- a/collections/src/main/java/org/apache/tamaya/collections/internal/ArrayListConverter.java
+++ b/collections/src/main/java/org/apache/tamaya/collections/internal/ArrayListConverter.java
@@ -18,6 +18,7 @@
  */
 package org.apache.tamaya.collections.internal;
 
+import org.apache.tamaya.ConfigurationProvider;
 import org.apache.tamaya.TypeLiteral;
 import org.apache.tamaya.spi.ConversionContext;
 import org.apache.tamaya.spi.PropertyConverter;
@@ -47,47 +48,20 @@ public class ArrayListConverter implements PropertyConverter<ArrayList> {
 
     @Override
     public ArrayList convert(String value, ConversionContext context) {
-        ArrayList<String> rawList = split(value);
-        String converterClass = context.getConfiguration().get('_' + context.getKey()+".collection-parser");
-        if(converterClass!=null){
-            try {
-                PropertyConverter<?> valueConverter = (PropertyConverter<?>) Class.forName(converterClass).newInstance();
-                ArrayList<Object> mlist = new ArrayList<>();
-                ConversionContext ctx = new ConversionContext.Builder(context.getConfiguration(), context.getKey(),
-                        TypeLiteral.of(context.getTargetType().getType())).build();
-                for(String raw:rawList){
-                    Object convValue = valueConverter.convert(raw, ctx);
-                    if(convValue!=null){
-                        mlist.add(convValue);
-                        continue;
-                    }
-                }
-                return mlist;
+        final String SEPARATOR = ConfigurationProvider.getConfiguration().getOrDefault(
+                '_' + context.getKey()+".collection-separator", ",");
+        List<String> rawList = ItemTokenizer.split(value, SEPARATOR);
 
-            } catch (Exception e) {
-                LOG.log(Level.SEVERE, "Error convertion config to ArrayList type.", e);
-            }
-        }
-        return rawList;
-    }
-
-    static ArrayList<String>  split(String value) {
-        ArrayList<String> result = new ArrayList<>();
-        int start = 0;
-        int end = value.indexOf(',',start);
-        while(end>0) {
-            if (end>0 && (value.charAt(end - 1) != '\\')) {
-                result.add(value.substring(start, end));
-                start = end + 1;
-                end = value.indexOf(',',start);
+        ArrayList<Object> mlist = new ArrayList<>();
+        for(String raw:rawList){
+            Object convValue = ItemTokenizer.convertValue(raw, context);
+            if (convValue != null) {
+                mlist.add(convValue);
             }else{
-                end = value.indexOf(',',end + 1);
+                LOG.log(Level.SEVERE, "Failed to convert collection value type for '"+raw+"'.");
             }
-            end = value.indexOf(',',start);
-        }
-        if(start < value.length()){
-            result.add(value.substring(start));
         }
-        return result;
+        return mlist;
     }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/e94ac73d/collections/src/main/java/org/apache/tamaya/collections/internal/CollectionConverter.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/internal/CollectionConverter.java b/collections/src/main/java/org/apache/tamaya/collections/internal/CollectionConverter.java
index ecd2878..0d9a799 100644
--- a/collections/src/main/java/org/apache/tamaya/collections/internal/CollectionConverter.java
+++ b/collections/src/main/java/org/apache/tamaya/collections/internal/CollectionConverter.java
@@ -23,7 +23,6 @@ import org.apache.tamaya.spi.PropertyConverter;
 
 import java.util.Collection;
 import java.util.Collections;
-import java.util.List;
 
 /**
  *  PropertyConverter for gnerating a LIST representation of values.

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/e94ac73d/collections/src/main/java/org/apache/tamaya/collections/internal/ConcurrentHashMapConverter.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/internal/ConcurrentHashMapConverter.java b/collections/src/main/java/org/apache/tamaya/collections/internal/ConcurrentHashMapConverter.java
index f472c4c..07aecc8 100644
--- a/collections/src/main/java/org/apache/tamaya/collections/internal/ConcurrentHashMapConverter.java
+++ b/collections/src/main/java/org/apache/tamaya/collections/internal/ConcurrentHashMapConverter.java
@@ -46,16 +46,17 @@ public class ConcurrentHashMapConverter implements PropertyConverter<ConcurrentH
 
     @Override
     public ConcurrentHashMap convert(String value, ConversionContext context) {
-        List<String> rawList = ArrayListConverter.split(value);
+        List<String> rawList = ItemTokenizer.split(value, context);
         String converterClass = context.getConfiguration().get('_' + context.getKey()+".collection-parser");
         if(converterClass!=null){
             try {
                 PropertyConverter<?> valueConverter = (PropertyConverter<?>) Class.forName(converterClass).newInstance();
                 ConcurrentHashMap<String,Object> mlist = new ConcurrentHashMap<>();
-                ConversionContext ctx = new ConversionContext.Builder(context.getConfiguration(), context.getKey(),
+                ConversionContext ctx = new ConversionContext.Builder(context.getConfiguration(),
+                        context.getConfigurationContext(), context.getKey(),
                         TypeLiteral.of(context.getTargetType().getType())).build();
                 for(String raw:rawList){
-                    String[] items = splitItems(raw);
+                    String[] items = ItemTokenizer.splitMapEntry(raw, context);
                     Object convValue = valueConverter.convert(items[1], ctx);
                     if(convValue!=null){
                         mlist.put(items[0], convValue);
@@ -70,7 +71,7 @@ public class ConcurrentHashMapConverter implements PropertyConverter<ConcurrentH
         }
         ConcurrentHashMap<String,String> result = new ConcurrentHashMap<>();
         for(String raw:rawList){
-            String[] items = splitItems(raw);
+            String[] items = ItemTokenizer.splitMapEntry(raw, context);
             if(items!=null){
                 result.put(items[0], items[1]);
             }
@@ -78,19 +79,5 @@ public class ConcurrentHashMapConverter implements PropertyConverter<ConcurrentH
         return result;
     }
 
-    static String[] splitItems(String raw) {
-        String[] items = raw.split("::");
-        if(items[0].trim().startsWith("[")){
-            items[0]= items[0].trim();
-            items[0] = items[0].substring(1);
-        }else{
-            items[0]= items[0].trim();
-        }
-        if(items[1].trim().endsWith("]")){
-            items[1] = items[1].substring(0,items[1].length()-1);
-        }else{
-            items[1]= items[1].trim();
-        }
-        return items;
-    }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/e94ac73d/collections/src/main/java/org/apache/tamaya/collections/internal/HashMapConverter.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/internal/HashMapConverter.java b/collections/src/main/java/org/apache/tamaya/collections/internal/HashMapConverter.java
index 49defaa..29d7ad7 100644
--- a/collections/src/main/java/org/apache/tamaya/collections/internal/HashMapConverter.java
+++ b/collections/src/main/java/org/apache/tamaya/collections/internal/HashMapConverter.java
@@ -24,7 +24,6 @@ import org.apache.tamaya.spi.PropertyConverter;
 
 import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -47,13 +46,14 @@ public class HashMapConverter implements PropertyConverter<HashMap> {
 
     @Override
     public HashMap convert(String value, ConversionContext context) {
-        List<String> rawList = ArrayListConverter.split(value);
+        List<String> rawList = ItemTokenizer.split(value, context);
         String converterClass = context.getConfiguration().get('_' + context.getKey()+".collection-parser");
         if(converterClass!=null){
             try {
                 PropertyConverter<?> valueConverter = (PropertyConverter<?>) Class.forName(converterClass).newInstance();
                 HashMap<String,Object> mlist = new HashMap<>();
-                ConversionContext ctx = new ConversionContext.Builder(context.getConfiguration(), context.getKey(),
+                ConversionContext ctx = new ConversionContext.Builder(context.getConfiguration(),
+                        context.getConfigurationContext(), context.getKey(),
                         TypeLiteral.of(context.getTargetType().getType())).build();
                 for(String raw:rawList){
                     String[] items = splitItems(raw);

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/e94ac73d/collections/src/main/java/org/apache/tamaya/collections/internal/HashSetConverter.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/internal/HashSetConverter.java b/collections/src/main/java/org/apache/tamaya/collections/internal/HashSetConverter.java
index 0551549..47c32f6 100644
--- a/collections/src/main/java/org/apache/tamaya/collections/internal/HashSetConverter.java
+++ b/collections/src/main/java/org/apache/tamaya/collections/internal/HashSetConverter.java
@@ -49,13 +49,14 @@ public class HashSetConverter implements PropertyConverter<HashSet> {
 
     @Override
     public HashSet convert(String value, ConversionContext context) {
-        List<String> rawList = ArrayListConverter.split(value);
+        List<String> rawList = ItemTokenizer.split(value, context);
         String converterClass = context.getConfiguration().get('_' + context.getKey()+".collection-parser");
         if(converterClass!=null){
             try {
                 PropertyConverter<?> valueConverter = (PropertyConverter<?>) Class.forName(converterClass).newInstance();
                 HashSet<Object> mlist = new HashSet<>();
-                ConversionContext ctx = new ConversionContext.Builder(context.getConfiguration(), context.getKey(),
+                ConversionContext ctx = new ConversionContext.Builder(context.getConfiguration(),
+                        context.getConfigurationContext(), context.getKey(),
                         TypeLiteral.of(context.getTargetType().getType())).build();
                 for(String raw:rawList){
                     Object convValue = valueConverter.convert(raw, ctx);

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/e94ac73d/collections/src/main/java/org/apache/tamaya/collections/internal/ItemTokenizer.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/internal/ItemTokenizer.java b/collections/src/main/java/org/apache/tamaya/collections/internal/ItemTokenizer.java
new file mode 100644
index 0000000..37f7cf1
--- /dev/null
+++ b/collections/src/main/java/org/apache/tamaya/collections/internal/ItemTokenizer.java
@@ -0,0 +1,170 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.collections.internal;
+
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.TypeLiteral;
+import org.apache.tamaya.spi.ConversionContext;
+import org.apache.tamaya.spi.PropertyConverter;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Helper class that implements the tokenizing of the entries of a configuration value.
+ */
+final class ItemTokenizer {
+
+    private static final Logger LOG = Logger.getLogger(ItemTokenizer.class.getName());
+
+    /**
+     * Private singleton.
+     */
+    private ItemTokenizer(){}
+
+    /**
+     * Splits the given value using the given separator. Matcjhing is done by traversing the String value using
+     * {@code indexOf} calls, one by one. The last unresolvable item (without any next separator token)
+     * is added at the end of the list.
+     * @param value the value, not null.
+     * @param context the conversion context.
+     * @return the tokenized value as list, in order of occurrence.
+     */
+    public static List<String> split(String value, ConversionContext context){
+        return split(value, ConfigurationProvider.getConfiguration().getOrDefault(
+                '_' + context.getKey()+".collection-separator", ","));
+    }
+
+    /**
+     * Splits the given value using the given separator. Matcjhing is done by traversing the String value using
+     * {@code indexOf} calls, one by one. The last unresolvable item (without any next separator token)
+     * is added at the end of the list.
+     * @param value the value, not null.
+     * @param separator the separator to be used.
+     * @return the tokenized value as list, in order of occurrence.
+     */
+    public static List<String> split(String value, final String separator) {
+        ArrayList<String> result = new ArrayList<>();
+        int start = 0;
+        int end = value.indexOf(separator,start);
+        while(end>0) {
+            if (end>0 && (value.charAt(end - 1) != '\\')) {
+                result.add(value.substring(start, end));
+                start = end + separator.length();
+                end = value.indexOf(separator,start);
+            }else{
+                end = value.indexOf(separator,end + separator.length());
+            }
+            end = value.indexOf(separator,start);
+        }
+        if(start < value.length()){
+            result.add(value.substring(start));
+        }
+        return result;
+    }
+
+    /**
+     * plits the given String value as a map entry, splitting it into key and value part with the given separator.
+     * If the value cannot be split then {@code key = value = mapEntry} is used for further processing. key or value
+     * parts are normally trimmed, unless they are enmcosed with brackets {@code []}.
+     * @param mapEntry the entry, not null.
+     * @param context the conversion context.
+     * @return an array of length 2, with the trimmed and parsed key/value pair.
+     */
+    public static String[] splitMapEntry(String mapEntry, ConversionContext context){
+        return splitMapEntry(mapEntry, ConfigurationProvider.getConfiguration().getOrDefault(
+                '_' + context.getKey()+".collection-map-separator", ","));
+    }
+
+    /**
+     * Splits the given String value as a map entry, splitting it into key and value part with the given separator.
+     * If the value cannot be split then {@code key = value = mapEntry} is used for further processing. key or value
+     * parts are normally trimmed, unless they are enmcosed with brackets {@code []}.
+     * @param mapEntry the entry, not null.
+     * @param separator the separator, not null.
+     * @return an array of length 2, with the trimmed and parsed key/value pair.
+     */
+    public static String[] splitMapEntry(final String mapEntry, final String separator) {
+        int index = mapEntry.indexOf(separator);
+        String[] items;
+        if(index<0) {
+            items = new String[]{mapEntry, mapEntry};
+        }else {
+            items = new String[]{mapEntry.substring(0,index),
+                                 mapEntry.substring(index+separator.length())};
+        }
+        if(items[0].trim().startsWith("[")){
+            items[0]= items[0].trim();
+            items[0] = items[0].substring(1);
+        }else{
+            items[0]= items[0].trim();
+        }
+        if(items[1].trim().endsWith("]")){
+            items[1] = items[1].substring(0,items[1].length()-1);
+        }else{
+            items[1]= items[1].trim();
+        }
+        return items;
+    }
+
+    /**
+     * Parses the given value into the required collection target type, defined by the context.
+     * @param value the raw String value.
+     * @param context the context
+     * @return the parsed value, or null.
+     */
+    public static Object convertValue(String value, ConversionContext context) {
+        String converterClass = context.getConfiguration().get('_' + context.getKey() + ".item-converter");
+        List<PropertyConverter<Object>> valueConverters = new ArrayList<>(1);
+        if (converterClass != null) {
+            try {
+                valueConverters.add((PropertyConverter<Object>) Class.forName(converterClass).newInstance());
+            } catch (Exception e) {
+                LOG.log(Level.SEVERE, "Error convertion config to ArrayList type.", e);
+            }
+        }
+        if (TypeLiteral.getTypeParameters(context.getTargetType().getType()).length>0) {
+            valueConverters.addAll(context.getConfigurationContext().getPropertyConverters(
+                    TypeLiteral.of(TypeLiteral.getTypeParameters(context.getTargetType().getType())[0])));
+        }
+        ConversionContext ctx = new ConversionContext.Builder(context.getConfiguration(),
+                context.getConfigurationContext(), context.getKey(),
+                TypeLiteral.of(context.getTargetType().getType())).build();
+        Object result = null;
+        if (valueConverters.isEmpty()) {
+            return value;
+        } else {
+            for (PropertyConverter<Object> conv : valueConverters) {
+                try {
+                    result = conv.convert(value, ctx);
+                    if (result != null) {
+                        return result;
+                    }
+                } catch (Exception e) {
+                    LOG.log(Level.SEVERE, "Error convertion config to ArrayList type.", e);
+                }
+            }
+        }
+        LOG.log(Level.SEVERE, "Failed to convert collection value type for '" + value + "'.");
+        return null;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/e94ac73d/collections/src/main/java/org/apache/tamaya/collections/internal/LinkedListConverter.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/internal/LinkedListConverter.java b/collections/src/main/java/org/apache/tamaya/collections/internal/LinkedListConverter.java
index f882c78..986a303 100644
--- a/collections/src/main/java/org/apache/tamaya/collections/internal/LinkedListConverter.java
+++ b/collections/src/main/java/org/apache/tamaya/collections/internal/LinkedListConverter.java
@@ -46,13 +46,14 @@ public class LinkedListConverter implements PropertyConverter<LinkedList> {
 
     @Override
     public LinkedList convert(String value, ConversionContext context) {
-        List<String> rawList = ArrayListConverter.split(value);
+        List<String> rawList = ItemTokenizer.split(value, context);
         String converterClass = context.getConfiguration().get('_' + context.getKey()+".collection-parser");
         if(converterClass!=null){
             try {
                 PropertyConverter<?> valueConverter = (PropertyConverter<?>) Class.forName(converterClass).newInstance();
                 LinkedList<Object> mlist = new LinkedList<>();
-                ConversionContext ctx = new ConversionContext.Builder(context.getConfiguration(), context.getKey(),
+                ConversionContext ctx = new ConversionContext.Builder(context.getConfiguration(),
+                        context.getConfigurationContext(), context.getKey(),
                         TypeLiteral.of(context.getTargetType().getType())).build();
                 for(String raw:rawList){
                     Object convValue = valueConverter.convert(raw, ctx);

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/e94ac73d/collections/src/main/java/org/apache/tamaya/collections/internal/TreeSetConverter.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/internal/TreeSetConverter.java b/collections/src/main/java/org/apache/tamaya/collections/internal/TreeSetConverter.java
index e9e2282..f9cba02 100644
--- a/collections/src/main/java/org/apache/tamaya/collections/internal/TreeSetConverter.java
+++ b/collections/src/main/java/org/apache/tamaya/collections/internal/TreeSetConverter.java
@@ -47,13 +47,14 @@ public class TreeSetConverter implements PropertyConverter<TreeSet> {
 
     @Override
     public TreeSet convert(String value, ConversionContext context) {
-        List<String> rawList = ArrayListConverter.split(value);
+        List<String> rawList = ItemTokenizer.split(value, context);
         String converterClass = context.getConfiguration().get('_' + context.getKey()+".collection-parser");
         if(converterClass!=null){
             try {
                 PropertyConverter<?> valueConverter = (PropertyConverter<?>) Class.forName(converterClass).newInstance();
                 TreeSet<Object> mlist = new TreeSet<>();
-                ConversionContext ctx = new ConversionContext.Builder(context.getConfiguration(), context.getKey(),
+                ConversionContext ctx = new ConversionContext.Builder(context.getConfiguration(),
+                        context.getConfigurationContext(), context.getKey(),
                         TypeLiteral.of(context.getTargetType().getType())).build();
                 for(String raw:rawList){
                     Object convValue = valueConverter.convert(raw, ctx);

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/e94ac73d/collections/src/test/java/org/apache/tamaya/collections/CollectionAdvancedTests.java
----------------------------------------------------------------------
diff --git a/collections/src/test/java/org/apache/tamaya/collections/CollectionAdvancedTests.java b/collections/src/test/java/org/apache/tamaya/collections/CollectionAdvancedTests.java
new file mode 100644
index 0000000..435ed5d
--- /dev/null
+++ b/collections/src/test/java/org/apache/tamaya/collections/CollectionAdvancedTests.java
@@ -0,0 +1,78 @@
+package org.apache.tamaya.collections;
+
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.TypeLiteral;
+import org.junit.Test;
+
+import java.util.Currency;
+import java.util.List;
+
+import static junit.framework.TestCase.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+/**
+ * Created by atsticks on 16.02.16.
+ */
+public class CollectionAdvancedTests {
+
+    /**
+     * Tests if a custom separator works, Config is
+     * <pre>
+     *  sep-list=a,b,c|d,e,f|g,h,i
+     *  _sep-list.collection-type=List
+     *  _sep-list.collection-separator=|
+     * </pre>
+     */
+    @Test
+    public void testCustomSeparator(){
+        Configuration config = ConfigurationProvider.getConfiguration();
+        List<String> items = config.get("sep-list", new TypeLiteral<List<String>>(){});
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(3, items.size());
+        assertEquals("a,b,c", items.get(0));
+        assertEquals("d,e,f", items.get(1));
+        assertEquals("g,h,i", items.get(2));
+    }
+
+    /**
+     * Test typed content.
+     * <pre>
+     *  currency-list=CHF,USD,YEN
+     *  _currency-list.collection-type=List
+     * </pre>
+     */
+    @Test
+    public void testTypedContent(){
+        Configuration config = ConfigurationProvider.getConfiguration();
+        List<Currency> items = config.get("currency-list", new TypeLiteral<List<Currency>>(){});
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(3, items.size());
+        assertEquals("CHF", items.get(0).getCurrencyCode());
+        assertEquals("USD", items.get(1).getCurrencyCode());
+        assertEquals("USS", items.get(2).getCurrencyCode());
+    }
+
+    /**
+     * Tests if a custom parser works, Config is
+     * <pre>
+     *  parser-list=a,b,c
+     *  _parser-list.collection-type=List
+     *  _parser-list.item-converter=org.apache.tamaya.collections.MyUpperCaseConverter
+     * </pre>
+     */
+    @Test
+    public void testCustomParser(){
+        Configuration config = ConfigurationProvider.getConfiguration();
+        List<String> items = config.get("parser-list", new TypeLiteral<List<String>>(){});
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(3, items.size());
+        assertEquals("(A)", items.get(0));
+        assertEquals("(B)", items.get(1));
+        assertEquals("(C)", items.get(2));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/e94ac73d/collections/src/test/java/org/apache/tamaya/collections/MyUpperCaseConverter.java
----------------------------------------------------------------------
diff --git a/collections/src/test/java/org/apache/tamaya/collections/MyUpperCaseConverter.java b/collections/src/test/java/org/apache/tamaya/collections/MyUpperCaseConverter.java
new file mode 100644
index 0000000..1c95261
--- /dev/null
+++ b/collections/src/test/java/org/apache/tamaya/collections/MyUpperCaseConverter.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tamaya.collections;
+
+import org.apache.tamaya.spi.ConversionContext;
+import org.apache.tamaya.spi.PropertyConverter;
+
+/**
+ * Example converter that is used for testing the custom parsing functionality. It sorrounds values with () and
+ * converts them to uppercase.
+ */
+public class MyUpperCaseConverter implements PropertyConverter<String>{
+    @Override
+    public String convert(String value, ConversionContext context) {
+        return "("+value.toUpperCase()+")";
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/e94ac73d/collections/src/test/resources/META-INF/javaconfiguration.properties
----------------------------------------------------------------------
diff --git a/collections/src/test/resources/META-INF/javaconfiguration.properties b/collections/src/test/resources/META-INF/javaconfiguration.properties
index 76e5e84..2bb8414 100644
--- a/collections/src/test/resources/META-INF/javaconfiguration.properties
+++ b/collections/src/test/resources/META-INF/javaconfiguration.properties
@@ -56,22 +56,14 @@ _typed.hashmap.collection-type=java.util.HashMap
 typed.treemap=1::a, 2::b, 3::c, [4:: ]
 _typed.treemap.collection-type=TreeMap
 
-# Config for tests with combination policy
-list=a,b,c
-_list.collection-type=List
-arrayList=d,e,f
-_arrayList.collection-type=java.util.ArrayList
-linkedList=g,h,i
-_linkedList.collection-type=java.util.LinkedList
-set=a,b,b
-_set.collection-type=java.util.Set
-sortedSet=a,c,b
-_sortedSet.collection-type=java.util.TreeSet
-map=1::a, 2::b, 3::c
-_map.collection-type=Map
-sortedmap=[3 :: c], 1 :: a, 2 :: b
-_sortedmap.collection-type=SorteedMap
-treemap=[3 :: c], 1 :: a, 2 :: b
-_treemap.collection-type=java.util.TreeMap
-concurrentMap=[3::c], 1::a, key::value
-_concurrentMap.collection-type=java.util.ConcurrentHashMap
\ No newline at end of file
+# Config for advanced tests
+sep-list=a,b,c|d,e,f|g,h,i
+_sep-list.collection-type=List
+_sep-list.collection-separator=|
+currency-list=CHF,USD,USS
+_currency-list.collection-type=List
+
+parser-list=a,b,c
+_parser-list.collection-type=List
+_parser-list.item-converter=org.apache.tamaya.collections.MyUpperCaseConverter
+