tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ple...@apache.org
Subject [24/50] [abbrv] incubator-tamaya-sandbox git commit: TAMAYA-114: Tested and implemented base functionality.
Date Tue, 06 Sep 2016 17:18:20 GMT
TAMAYA-114: Tested and implemented base functionality.


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/dda281b2
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/dda281b2
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/dda281b2

Branch: refs/heads/master
Commit: dda281b2e2c76c061e7c183f52d7565617f14566
Parents: e37c2e0
Author: anatole <anatole@apache.org>
Authored: Mon Feb 15 17:25:02 2016 +0100
Committer: anatole <anatole@apache.org>
Committed: Mon Feb 15 17:25:02 2016 +0100

----------------------------------------------------------------------
 .../internal/AdaptiveCombinationPolicy.java     |  12 +-
 .../internal/ArrayListConverter.java            |  10 +-
 .../internal/CollectionConverter.java           |  30 ++-
 .../internal/ConcurrentHashMapConverter.java    |  14 +-
 .../collections/internal/HashMapConverter.java  |   4 +-
 .../collections/internal/HashSetConverter.java  |   4 +-
 .../internal/LinkedListConverter.java           |  13 +-
 .../collections/internal/ListConverter.java     |  21 +-
 .../collections/internal/MapConverter.java      |  25 ++-
 .../collections/internal/SetConverter.java      |  21 +-
 .../collections/internal/TreeSetConverter.java  |   2 +-
 .../org.apache.tamaya.spi.PropertyConverter     |   1 +
 .../collections/CollectionsBaseTests.java       | 202 ++++++++++++++++++-
 .../CollectionsTypedReadOnlyTests.java          | 199 +++++++-----------
 .../collections/CollectionsTypedTests.java      | 165 ++++++++-------
 .../META-INF/javaconfiguration.properties       |  34 ++++
 16 files changed, 525 insertions(+), 232 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/dda281b2/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 161e874..63fea76 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
@@ -24,6 +24,7 @@ import org.apache.tamaya.spi.PropertyValue;
 import org.apache.tamaya.spi.PropertyValueCombinationPolicy;
 
 import javax.annotation.Priority;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
@@ -88,14 +89,21 @@ public class AdaptiveCombinationPolicy implements PropertyValueCombinationPolicy
                 case "SortedMap":
                     PropertyValue newValue = propertySource.get(key);
                     if(newValue!=null){
-                        Map<String,String> newMapValue = new HashMap<>(currentValue);
+                        Map<String,String> newMapValue = new HashMap<>();
+                        if(currentValue!=null){
+                            newMapValue.putAll(currentValue);
+                        }
                         String oldVal = newMapValue.get(key);
+                        newMapValue.putAll(newValue.getConfigEntries());
                         if(oldVal!=null){
                             newMapValue.put(key,oldVal + ',' + newValue.getValue());
                         }
                         return newMapValue;
                     }else{
-                        return newValue.getConfigEntries();
+                        if(currentValue!=null){
+                            return currentValue;
+                        }
+                        return Collections.emptyMap();
                     }
                 default:
                     LOG.log(Level.SEVERE, "Unsupported collection-type for key: " + key + ": " + collectionType);

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/dda281b2/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 4c6b06d..e55b44a 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
@@ -47,8 +47,8 @@ public class ArrayListConverter implements PropertyConverter<ArrayList> {
 
     @Override
     public ArrayList convert(String value, ConversionContext context) {
-        List<String> rawList = split(value);
-        String converterClass = context.getConfiguration().get('_' + context.getKey()+".collection-valueParser");
+        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();
@@ -68,11 +68,11 @@ public class ArrayListConverter implements PropertyConverter<ArrayList> {
                 LOG.log(Level.SEVERE, "Error convertion config to ArrayList type.", e);
             }
         }
-        return null;
+        return rawList;
     }
 
-    static List<String>  split(String value) {
-        List<String> result = new ArrayList<>();
+    static ArrayList<String>  split(String value) {
+        ArrayList<String> result = new ArrayList<>();
         int start = 0;
         int end = value.indexOf(',',start);
         while(end>0) {

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/dda281b2/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 80d65cd..ecd2878 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,6 +23,7 @@ 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.
@@ -31,6 +32,33 @@ public class CollectionConverter implements PropertyConverter<Collection> {
 
     @Override
     public Collection convert(String value, ConversionContext context) {
-        return Collections.unmodifiableCollection(ArrayListConverter.getInstance().convert(value, context));
+        String collectionType = context.getConfiguration().getOrDefault('_' + context.getKey()+".collection-type", "List");
+        if(collectionType.startsWith("java.util.")){
+            collectionType = collectionType.substring("java.util.".length());
+        }
+        Collection result = null;
+        switch(collectionType){
+            case "List":
+            case "ArrayList":
+            default:
+                result = ArrayListConverter.getInstance().convert(value, context);
+                break;
+            case "LinkedList":
+                result = LinkedListConverter.getInstance().convert(value, context);
+                break;
+            case "Set":
+            case "HashSet":
+                result = HashSetConverter.getInstance().convert(value, context);
+                break;
+            case "SortedSet":
+            case "TreeSet":
+                result = TreeSetConverter.getInstance().convert(value, context);
+                break;
+        }
+        if(context.getConfiguration().getOrDefault('_' + context.getKey()+".read-only",
+                Boolean.class, Boolean.TRUE)){
+            return Collections.unmodifiableCollection(result);
+        }
+        return result;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/dda281b2/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 e425a27..f472c4c 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
@@ -22,16 +22,16 @@ import org.apache.tamaya.TypeLiteral;
 import org.apache.tamaya.spi.ConversionContext;
 import org.apache.tamaya.spi.PropertyConverter;
 
-import java.util.HashMap;
 import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
 /**
- *  PropertyConverter for gnerating HashMap representation of a values.
+ *  PropertyConverter for gnerating ConcurrentHashMap representation of a values.
  */
-public class ConcurrentHashMapConverter implements PropertyConverter<HashMap> {
-    private static final Logger LOG = Logger.getLogger(ArrayListConverter.class.getName());
+public class ConcurrentHashMapConverter implements PropertyConverter<ConcurrentHashMap> {
+    private static final Logger LOG = Logger.getLogger(ConcurrentHashMapConverter.class.getName());
 
     /** The shared instance, used by other collection converters in this package.*/
     private static ConcurrentHashMapConverter INSTANCE = new ConcurrentHashMapConverter();
@@ -45,13 +45,13 @@ public class ConcurrentHashMapConverter implements PropertyConverter<HashMap> {
     }
 
     @Override
-    public HashMap convert(String value, ConversionContext context) {
+    public ConcurrentHashMap convert(String value, ConversionContext context) {
         List<String> rawList = ArrayListConverter.split(value);
         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<>();
+                ConcurrentHashMap<String,Object> mlist = new ConcurrentHashMap<>();
                 ConversionContext ctx = new ConversionContext.Builder(context.getConfiguration(), context.getKey(),
                         TypeLiteral.of(context.getTargetType().getType())).build();
                 for(String raw:rawList){
@@ -68,7 +68,7 @@ public class ConcurrentHashMapConverter implements PropertyConverter<HashMap> {
                 LOG.log(Level.SEVERE, "Error convertion config to HashMap type.", e);
             }
         }
-        HashMap<String,String> result = new HashMap<>();
+        ConcurrentHashMap<String,String> result = new ConcurrentHashMap<>();
         for(String raw:rawList){
             String[] items = splitItems(raw);
             if(items!=null){

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/dda281b2/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 8091dc6..49defaa 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
@@ -32,7 +32,7 @@ import java.util.logging.Logger;
  *  PropertyConverter for gnerating HashMap representation of a values.
  */
 public class HashMapConverter implements PropertyConverter<HashMap> {
-    private static final Logger LOG = Logger.getLogger(ArrayListConverter.class.getName());
+    private static final Logger LOG = Logger.getLogger(HashMapConverter.class.getName());
 
     /** The shared instance, used by other collection converters in this package.*/
     private static HashMapConverter INSTANCE = new HashMapConverter();
@@ -48,7 +48,7 @@ public class HashMapConverter implements PropertyConverter<HashMap> {
     @Override
     public HashMap convert(String value, ConversionContext context) {
         List<String> rawList = ArrayListConverter.split(value);
-        String converterClass = context.getConfiguration().get('_' + context.getKey()+".collection-valueParser");
+        String converterClass = context.getConfiguration().get('_' + context.getKey()+".collection-parser");
         if(converterClass!=null){
             try {
                 PropertyConverter<?> valueConverter = (PropertyConverter<?>) Class.forName(converterClass).newInstance();

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/dda281b2/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 2c402fb..0551549 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
@@ -50,7 +50,7 @@ public class HashSetConverter implements PropertyConverter<HashSet> {
     @Override
     public HashSet convert(String value, ConversionContext context) {
         List<String> rawList = ArrayListConverter.split(value);
-        String converterClass = context.getConfiguration().get('_' + context.getKey()+".collection-valueParser");
+        String converterClass = context.getConfiguration().get('_' + context.getKey()+".collection-parser");
         if(converterClass!=null){
             try {
                 PropertyConverter<?> valueConverter = (PropertyConverter<?>) Class.forName(converterClass).newInstance();
@@ -70,6 +70,6 @@ public class HashSetConverter implements PropertyConverter<HashSet> {
                 LOG.log(Level.SEVERE, "Error convertion config to HashSet type.", e);
             }
         }
-        return null;
+        return new HashSet(rawList);
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/dda281b2/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 f1c2514..f882c78 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
@@ -33,10 +33,21 @@ import java.util.logging.Logger;
 public class LinkedListConverter implements PropertyConverter<LinkedList> {
     private static final Logger LOG = Logger.getLogger(LinkedListConverter.class.getName());
 
+    /** The shared instance, used by other collection converters in this package.*/
+    private static LinkedListConverter INSTANCE = new LinkedListConverter();
+
+    /**
+     * Provide a shared instance, used by other collection converters in this package.
+     * @return the shared instance, never null.
+     */
+    static LinkedListConverter getInstance(){
+        return INSTANCE;
+    }
+
     @Override
     public LinkedList convert(String value, ConversionContext context) {
         List<String> rawList = ArrayListConverter.split(value);
-        String converterClass = context.getConfiguration().get('_' + context.getKey()+".collection-valueParser");
+        String converterClass = context.getConfiguration().get('_' + context.getKey()+".collection-parser");
         if(converterClass!=null){
             try {
                 PropertyConverter<?> valueConverter = (PropertyConverter<?>) Class.forName(converterClass).newInstance();

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/dda281b2/collections/src/main/java/org/apache/tamaya/collections/internal/ListConverter.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/internal/ListConverter.java b/collections/src/main/java/org/apache/tamaya/collections/internal/ListConverter.java
index 2299bac..65fc54e 100644
--- a/collections/src/main/java/org/apache/tamaya/collections/internal/ListConverter.java
+++ b/collections/src/main/java/org/apache/tamaya/collections/internal/ListConverter.java
@@ -31,6 +31,25 @@ public class ListConverter implements PropertyConverter<List> {
 
     @Override
     public List convert(String value, ConversionContext context) {
-        return Collections.unmodifiableList(ArrayListConverter.getInstance().convert(value, context));
+        String collectionType = context.getConfiguration().getOrDefault('_' + context.getKey()+".collection-type", "List");
+        if(collectionType.startsWith("java.util.")){
+            collectionType = collectionType.substring("java.util.".length());
+        }
+        List result = null;
+        switch(collectionType){
+            case "List":
+            case "ArrayList":
+            default:
+                result = ArrayListConverter.getInstance().convert(value, context);
+                break;
+            case "LinkedList":
+                result = LinkedListConverter.getInstance().convert(value, context);
+                break;
+        }
+        if(context.getConfiguration().getOrDefault('_' + context.getKey()+".read-only",
+                Boolean.class, Boolean.TRUE)){
+            return Collections.unmodifiableList(result);
+        }
+        return result;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/dda281b2/collections/src/main/java/org/apache/tamaya/collections/internal/MapConverter.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/internal/MapConverter.java b/collections/src/main/java/org/apache/tamaya/collections/internal/MapConverter.java
index dcd2919..606e14f 100644
--- a/collections/src/main/java/org/apache/tamaya/collections/internal/MapConverter.java
+++ b/collections/src/main/java/org/apache/tamaya/collections/internal/MapConverter.java
@@ -23,6 +23,7 @@ import org.apache.tamaya.spi.PropertyConverter;
 
 import java.util.Collections;
 import java.util.Map;
+import java.util.Set;
 
 /**
  *  PropertyConverter for gnerating HashMap representation of a values.
@@ -31,6 +32,28 @@ public class MapConverter implements PropertyConverter<Map> {
 
     @Override
     public Map convert(String value, ConversionContext context) {
-        return Collections.unmodifiableMap(HashMapConverter.getInstance().convert(value, context));
+        String collectionType = context.getConfiguration().getOrDefault('_' + context.getKey()+".collection-type", "Map");
+        if(collectionType.startsWith("java.util.")){
+            collectionType = collectionType.substring("java.util.".length());
+        }
+        Map result = null;
+        switch(collectionType){
+            case "Map":
+            case "HashMap":
+            default:
+                result = HashMapConverter.getInstance().convert(value, context);
+                break;
+            case "TreeMap":
+                result = TreeMapConverter.getInstance().convert(value, context);
+                break;
+            case "ConcurrentHashMap":
+                result = ConcurrentHashMapConverter.getInstance().convert(value, context);
+                break;
+        }
+        if(context.getConfiguration().getOrDefault('_' + context.getKey()+".read-only",
+                Boolean.class, Boolean.TRUE)){
+            return Collections.unmodifiableMap(result);
+        }
+        return result;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/dda281b2/collections/src/main/java/org/apache/tamaya/collections/internal/SetConverter.java
----------------------------------------------------------------------
diff --git a/collections/src/main/java/org/apache/tamaya/collections/internal/SetConverter.java b/collections/src/main/java/org/apache/tamaya/collections/internal/SetConverter.java
index 27fdee9..75301bc 100644
--- a/collections/src/main/java/org/apache/tamaya/collections/internal/SetConverter.java
+++ b/collections/src/main/java/org/apache/tamaya/collections/internal/SetConverter.java
@@ -31,6 +31,25 @@ public class SetConverter implements PropertyConverter<Set> {
 
     @Override
     public Set convert(String value, ConversionContext context) {
-        return Collections.unmodifiableSet(HashSetConverter.getInstance().convert(value, context));
+        String collectionType = context.getConfiguration().getOrDefault('_' + context.getKey()+".collection-type", "Set");
+        if(collectionType.startsWith("java.util.")){
+            collectionType = collectionType.substring("java.util.".length());
+        }
+        Set result = null;
+        switch(collectionType){
+            case "Set":
+            case "HashSet":
+            default:
+                result = HashSetConverter.getInstance().convert(value, context);
+                break;
+            case "TreeSet":
+                result = TreeSetConverter.getInstance().convert(value, context);
+                break;
+        }
+        if(context.getConfiguration().getOrDefault('_' + context.getKey()+".read-only",
+                Boolean.class, Boolean.TRUE)){
+            return Collections.unmodifiableSet(result);
+        }
+        return result;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/dda281b2/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 32fee83..e9e2282 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
@@ -48,7 +48,7 @@ public class TreeSetConverter implements PropertyConverter<TreeSet> {
     @Override
     public TreeSet convert(String value, ConversionContext context) {
         List<String> rawList = ArrayListConverter.split(value);
-        String converterClass = context.getConfiguration().get('_' + context.getKey()+".collection-valueParser");
+        String converterClass = context.getConfiguration().get('_' + context.getKey()+".collection-parser");
         if(converterClass!=null){
             try {
                 PropertyConverter<?> valueConverter = (PropertyConverter<?>) Class.forName(converterClass).newInstance();

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/dda281b2/collections/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
----------------------------------------------------------------------
diff --git a/collections/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter b/collections/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
index c4cf2ae..9a93a69 100644
--- a/collections/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
+++ b/collections/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
@@ -19,6 +19,7 @@
 org.apache.tamaya.collections.internal.ArrayListConverter
 org.apache.tamaya.collections.internal.CollectionConverter
 org.apache.tamaya.collections.internal.HashMapConverter
+org.apache.tamaya.collections.internal.ConcurrentHashMapConverter
 org.apache.tamaya.collections.internal.HashSetConverter
 org.apache.tamaya.collections.internal.LinkedListConverter
 org.apache.tamaya.collections.internal.ListConverter

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/dda281b2/collections/src/test/java/org/apache/tamaya/collections/CollectionsBaseTests.java
----------------------------------------------------------------------
diff --git a/collections/src/test/java/org/apache/tamaya/collections/CollectionsBaseTests.java b/collections/src/test/java/org/apache/tamaya/collections/CollectionsBaseTests.java
index ca100ea..34c82cb 100644
--- a/collections/src/test/java/org/apache/tamaya/collections/CollectionsBaseTests.java
+++ b/collections/src/test/java/org/apache/tamaya/collections/CollectionsBaseTests.java
@@ -1,29 +1,227 @@
+/*
+ * 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.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.TypeLiteral;
 import org.junit.Test;
 
+import java.util.*;
+
+import static junit.framework.TestCase.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
 /**
- * Created by atsticks on 14.02.16.
+ * 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:: ]
+ * </pre>
  */
 public class CollectionsBaseTests {
 
     @Test
     public void testList_String(){
+        Configuration config = ConfigurationProvider.getConfiguration();
+        List<String> items = config.get("base.items", new TypeLiteral<List<String>>(){});
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(10, items.size());
+        items = (List<String>) config.get("base.items", List.class);
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(10, items.size());
+    }
 
+    @Test
+    public void testArrayList_String(){
+        Configuration config = ConfigurationProvider.getConfiguration();
+        ArrayList<String> items = config.get("base.items", new TypeLiteral<ArrayList<String>>(){});
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(10, items.size());
+        items = (ArrayList<String>) config.get("base.items", ArrayList.class);
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(10, items.size());
+    }
+
+    @Test
+    public void testLinkedList_String(){
+        Configuration config = ConfigurationProvider.getConfiguration();
+        LinkedList<String> items = config.get("base.items", new TypeLiteral<LinkedList<String>>(){});
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(10, items.size());
+        items = (LinkedList<String>) config.get("base.items", LinkedList.class);
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(10, items.size());
     }
 
     @Test
     public void testSet_String(){
+        Configuration config = ConfigurationProvider.getConfiguration();
+        Set<String> items = config.get("base.items", new TypeLiteral<Set<String>>(){});
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(10, items.size());
+        items = (Set<String>) config.get("base.items", Set.class);
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(10, items.size());
+    }
+
+    @Test
+    public void testSortedSet_String(){
+        Configuration config = ConfigurationProvider.getConfiguration();
+        Set<String> items = config.get("base.items", new TypeLiteral<SortedSet<String>>(){});
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(10, items.size());
+        items = (SortedSet<String>) config.get("base.items", SortedSet.class);
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(10, items.size());
+    }
 
+    @Test
+    public void testHashSet_String(){
+        Configuration config = ConfigurationProvider.getConfiguration();
+        Set<String> items = config.get("base.items", new TypeLiteral<HashSet<String>>(){});
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(10, items.size());
+        items = (HashSet<String>) config.get("base.items", HashSet.class);
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(10, items.size());
+    }
+
+    @Test
+    public void testTreeSet_String(){
+        Configuration config = ConfigurationProvider.getConfiguration();
+        TreeSet<String> items = config.get("base.items", new TypeLiteral<TreeSet<String>>(){});
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(10, items.size());
+        items = (TreeSet<String>) config.get("base.items", TreeSet.class);
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(10, items.size());
     }
 
     @Test
     public void testMap_String(){
+        Configuration config = ConfigurationProvider.getConfiguration();
+        Map<String,String> items = config.get("base.map", new TypeLiteral<Map<String,String>>(){});
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(4, items.size());
+        assertEquals("a", items.get("1"));
+        assertEquals("b", items.get("2"));
+        assertEquals("c", items.get("3"));
+        assertEquals(" ", items.get("4"));
+        items = (Map<String,String>) config.get("base.map", Map.class);
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(4, items.size());
+        assertEquals("a", items.get("1"));
+        assertEquals("b", items.get("2"));
+        assertEquals("c", items.get("3"));
+        assertEquals(" ", items.get("4"));
+    }
 
+    @Test
+    public void testHashMap_String(){
+        Configuration config = ConfigurationProvider.getConfiguration();
+        Map<String,String> items = config.get("base.map", new TypeLiteral<HashMap<String,String>>(){});
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(4, items.size());
+        assertEquals("a", items.get("1"));
+        assertEquals("b", items.get("2"));
+        assertEquals("c", items.get("3"));
+        assertEquals(" ", items.get("4"));
+        items = (HashMap<String,String>) config.get("base.map", HashMap.class);
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(4, items.size());
+        assertEquals("a", items.get("1"));
+        assertEquals("b", items.get("2"));
+        assertEquals("c", items.get("3"));
+        assertEquals(" ", items.get("4"));
     }
 
     @Test
-    public void testCollection_String(){
+    public void testSortedMap_String(){
+        Configuration config = ConfigurationProvider.getConfiguration();
+        Map<String,String> items = config.get("base.map", new TypeLiteral<SortedMap<String,String>>(){});
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(4, items.size());
+        assertEquals("a", items.get("1"));
+        assertEquals("b", items.get("2"));
+        assertEquals("c", items.get("3"));
+        assertEquals(" ", items.get("4"));
+        items = (Map<String,String>) config.get("base.map", SortedMap.class);
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(4, items.size());
+        assertEquals("a", items.get("1"));
+        assertEquals("b", items.get("2"));
+        assertEquals("c", items.get("3"));
+        assertEquals(" ", items.get("4"));
+    }
+
+    @Test
+    public void testTreeMap_String(){
+        Configuration config = ConfigurationProvider.getConfiguration();
+        TreeMap<String,String> items = config.get("base.map", new TypeLiteral<TreeMap<String,String>>(){});
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(4, items.size());
+        assertEquals("a", items.get("1"));
+        assertEquals("b", items.get("2"));
+        assertEquals("c", items.get("3"));
+        assertEquals(" ", items.get("4"));
+        items =  config.get("base.map", TreeMap.class);
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(4, items.size());
+        assertEquals("a", items.get("1"));
+        assertEquals("b", items.get("2"));
+        assertEquals("c", items.get("3"));
+        assertEquals(" ", items.get("4"));
+    }
 
+    @Test
+    public void testCollection_String(){
+        Configuration config = ConfigurationProvider.getConfiguration();
+        Collection<String> items = config.get("base.items", new TypeLiteral<Collection<String>>(){});
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(10, items.size());
+        items = (Collection<String>) config.get("base.items", Collection.class);
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(10, items.size());
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/dda281b2/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedReadOnlyTests.java
----------------------------------------------------------------------
diff --git a/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedReadOnlyTests.java b/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedReadOnlyTests.java
index 04b0564..7882512 100644
--- a/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedReadOnlyTests.java
+++ b/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedReadOnlyTests.java
@@ -1,3 +1,21 @@
+/*
+ * 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.Configuration;
@@ -8,9 +26,7 @@ import org.junit.Test;
 import java.util.*;
 
 import static junit.framework.TestCase.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
 
 /**
  * Basic tests for Tamaya collection support. Relevant configs for this tests:
@@ -20,69 +36,87 @@ import static org.junit.Assert.assertTrue;
  */
 public class CollectionsTypedReadOnlyTests {
 
-    @Test
-    public void testArrayListList_String(){
+    @Test(expected=UnsupportedOperationException.class)
+    public void testArrayListList_1(){
         Configuration config = ConfigurationProvider.getConfiguration();
         List<String> items = config.get("typed.arraylist", new TypeLiteral<List<String>>(){});
         assertNotNull(items);
         assertFalse(items.isEmpty());
         assertEquals(10, items.size());
-        assertTrue(items instanceof ArrayList);
-        items = (List<String>) config.get("typed.arraylist", List.class);
+        items.add("test");
+    }
+
+    @Test(expected=UnsupportedOperationException.class)
+    public void testArrayListList_2(){
+        Configuration config = ConfigurationProvider.getConfiguration();
+        List<String> items = (List<String>) config.get("typed.arraylist", List.class);
         assertNotNull(items);
         assertFalse(items.isEmpty());
         assertEquals(10, items.size());
-        assertTrue(items instanceof ArrayList);
+        items.add("test");
     }
 
-    @Test
-    public void testLinkedListList_String(){
+    @Test(expected=UnsupportedOperationException.class)
+    public void testLinkedListList_1(){
         Configuration config = ConfigurationProvider.getConfiguration();
         List<String> items = config.get("typed.linkedlist", new TypeLiteral<List<String>>(){});
         assertNotNull(items);
         assertFalse(items.isEmpty());
         assertEquals(10, items.size());
-        assertTrue(items instanceof LinkedList);
-        items = (List<String>) config.get("typed.linkedlist", List.class);
+        items.add("test");
+    }
+
+    @Test(expected=UnsupportedOperationException.class)
+    public void testLinkedListList_2(){
+        Configuration config = ConfigurationProvider.getConfiguration();
+        List<String> items = (List<String>) config.get("typed.linkedlist", List.class);
         assertNotNull(items);
         assertFalse(items.isEmpty());
         assertEquals(10, items.size());
-        assertTrue(items instanceof LinkedList);
+        items.add("test");
     }
 
 
-    @Test
-    public void testHashSet_String(){
+    @Test(expected=UnsupportedOperationException.class)
+    public void testHashSet_1(){
         Configuration config = ConfigurationProvider.getConfiguration();
         Set<String> items = config.get("typed.hashset", new TypeLiteral<Set<String>>(){});
         assertNotNull(items);
         assertFalse(items.isEmpty());
         assertEquals(10, items.size());
-        assertTrue(items instanceof HashSet);
-        items = (Set<String>) config.get("typed.hashset", Set.class);
+        items.add("test");
+    }
+    @Test(expected=UnsupportedOperationException.class)
+    public void testHashSet_2(){
+        Configuration config = ConfigurationProvider.getConfiguration();
+        Set<String> items = (Set<String>) config.get("typed.hashset", Set.class);
         assertNotNull(items);
         assertFalse(items.isEmpty());
         assertEquals(10, items.size());
-        assertTrue(items instanceof HashSet);
+        items.add("test");
     }
 
-    @Test
-    public void testTreeSet_String(){
+    @Test(expected=UnsupportedOperationException.class)
+    public void testTreeSet_1(){
         Configuration config = ConfigurationProvider.getConfiguration();
         Set<String> items = config.get("typed.treeset", new TypeLiteral<Set<String>>(){});
         assertNotNull(items);
         assertFalse(items.isEmpty());
         assertEquals(10, items.size());
-        assertTrue(items instanceof TreeSet);
-        items = (Set<String>) config.get("typed.treeset", Set.class);
+        items.add("test");
+    }
+    @Test(expected=UnsupportedOperationException.class)
+    public void testTreeSet_2(){
+        Configuration config = ConfigurationProvider.getConfiguration();
+        Set<String> items = items = (Set<String>) config.get("typed.treeset", Set.class);
         assertNotNull(items);
         assertFalse(items.isEmpty());
         assertEquals(10, items.size());
-        assertTrue(items instanceof TreeSet);
+        items.add("test");
     }
 
-    @Test
-    public void testHashMap_String(){
+    @Test(expected=UnsupportedOperationException.class)
+    public void testHashMap_1(){
         Configuration config = ConfigurationProvider.getConfiguration();
         Map<String,String> items = config.get("typed.hashmap", new TypeLiteral<Map<String,String>>(){});
         assertNotNull(items);
@@ -92,8 +126,12 @@ public class CollectionsTypedReadOnlyTests {
         assertEquals("b", items.get("2"));
         assertEquals("c", items.get("3"));
         assertEquals(" ", items.get("4"));
-        assertTrue(items instanceof HashMap);
-        items = (Map<String,String>) config.get("typed.hashmap", Map.class);
+        items.put("g","hjhhj");
+    }
+    @Test(expected=UnsupportedOperationException.class)
+    public void testHashMap_2(){
+        Configuration config = ConfigurationProvider.getConfiguration();
+        Map<String,String> items = (Map<String,String>) config.get("typed.hashmap", Map.class);
         assertNotNull(items);
         assertFalse(items.isEmpty());
         assertEquals(4, items.size());
@@ -101,11 +139,12 @@ public class CollectionsTypedReadOnlyTests {
         assertEquals("b", items.get("2"));
         assertEquals("c", items.get("3"));
         assertEquals(" ", items.get("4"));
-        assertTrue(items instanceof HashMap);
+        items.put("g","hjhhj");
     }
 
-    @Test
-    public void testTreeMap_String(){
+
+    @Test(expected=UnsupportedOperationException.class)
+    public void testTreeMap_1(){
         Configuration config = ConfigurationProvider.getConfiguration();
         Map<String,String> items = config.get("typed.treemap", new TypeLiteral<Map<String,String>>(){});
         assertNotNull(items);
@@ -115,8 +154,12 @@ public class CollectionsTypedReadOnlyTests {
         assertEquals("b", items.get("2"));
         assertEquals("c", items.get("3"));
         assertEquals(" ", items.get("4"));
-        assertTrue(items instanceof TreeMap);
-        items = (Map<String,String>) config.get("typed.treemap", Map.class);
+        items.put("g","hjhhj");
+    }
+    @Test(expected=UnsupportedOperationException.class)
+    public void testTreeMap_2(){
+        Configuration config = ConfigurationProvider.getConfiguration();
+        Map<String,String> items = (Map<String,String>) config.get("typed.treemap", Map.class);
         assertNotNull(items);
         assertFalse(items.isEmpty());
         assertEquals(4, items.size());
@@ -124,97 +167,7 @@ public class CollectionsTypedReadOnlyTests {
         assertEquals("b", items.get("2"));
         assertEquals("c", items.get("3"));
         assertEquals(" ", items.get("4"));
-        assertTrue(items instanceof TreeMap);
-    }
-
-
-    @Test
-    public void testCollection_TreeMap(){
-        Configuration config = ConfigurationProvider.getConfiguration();
-        Collection<String> items = config.get("typed.treemap", new TypeLiteral<Collection<String>>(){});
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof TreeMap);
-        items = (Collection<String>) config.get("typed.treemap", Collection.class);
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof TreeMap);
-    }
-
-    @Test
-    public void testCollection_HashMap(){
-        Configuration config = ConfigurationProvider.getConfiguration();
-        Collection<String> items = config.get("typed.hashmap", new TypeLiteral<Collection<String>>(){});
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof HashMap);
-        items = (Collection<String>) config.get("typed.hashmap", Collection.class);
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof HashMap);
+        items.put("g","hjhhj");
     }
 
-    @Test
-    public void testCollection_HashSet(){
-        Configuration config = ConfigurationProvider.getConfiguration();
-        Collection<String> items = config.get("typed.hashset", new TypeLiteral<Collection<String>>(){});
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof HashSet);
-        items = (Collection<String>) config.get("typed.hashset", Collection.class);
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof HashSet);
-    }
-
-    @Test
-    public void testCollection_TreeSet(){
-        Configuration config = ConfigurationProvider.getConfiguration();
-        Collection<String> items = config.get("typed.treeset", new TypeLiteral<Collection<String>>(){});
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof TreeSet);
-        items = (Collection<String>) config.get("typed.treeset", Collection.class);
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof TreeSet);
-    }
-
-    @Test
-    public void testCollection_ArrayList(){
-        Configuration config = ConfigurationProvider.getConfiguration();
-        Collection<String> items = config.get("typed.arraylist", new TypeLiteral<Collection<String>>(){});
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof ArrayList);
-        items = (Collection<String>) config.get("typed.arraylist", Collection.class);
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof ArrayList);
-    }
-
-    @Test
-    public void testCollection_LinkedList(){
-        Configuration config = ConfigurationProvider.getConfiguration();
-        Collection<String> items = config.get("typed.linkedlist", new TypeLiteral<Collection<String>>(){});
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof LinkedList);
-        items = (Collection<String>) config.get("typed.linkedlist", Collection.class);
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        assertTrue(items instanceof LinkedList);
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/dda281b2/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedTests.java
----------------------------------------------------------------------
diff --git a/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedTests.java b/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedTests.java
index 71a86fb..b4e4d52 100644
--- a/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedTests.java
+++ b/collections/src/test/java/org/apache/tamaya/collections/CollectionsTypedTests.java
@@ -1,3 +1,21 @@
+/*
+ * 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.Configuration;
@@ -10,6 +28,7 @@ import java.util.*;
 import static junit.framework.TestCase.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 /**
  * Basic tests for Tamaya collection support. Relevant configs for this tests:
@@ -20,100 +39,70 @@ import static org.junit.Assert.assertNotNull;
 public class CollectionsTypedTests {
 
     @Test
-    public void testList_String(){
+    public void testArrayListList_String(){
         Configuration config = ConfigurationProvider.getConfiguration();
-        List<String> items = config.get("base.items", new TypeLiteral<List<String>>(){});
+        List<String> items = config.get("typed2.arraylist", new TypeLiteral<List<String>>(){});
         assertNotNull(items);
         assertFalse(items.isEmpty());
         assertEquals(10, items.size());
-        items = (List<String>) config.get("base.items", List.class);
+        assertTrue(items instanceof ArrayList);
+        items = (List<String>) config.get("typed2.arraylist", List.class);
         assertNotNull(items);
         assertFalse(items.isEmpty());
         assertEquals(10, items.size());
+        assertTrue(items instanceof ArrayList);
     }
 
     @Test
-    public void testArrayList_String(){
+    public void testLinkedListList_String(){
         Configuration config = ConfigurationProvider.getConfiguration();
-        ArrayList<String> items = config.get("base.items", new TypeLiteral<ArrayList<String>>(){});
+        List<String> items = config.get("typed2.linkedlist", new TypeLiteral<List<String>>(){});
         assertNotNull(items);
         assertFalse(items.isEmpty());
         assertEquals(10, items.size());
-        items = (ArrayList<String>) config.get("base.items", ArrayList.class);
+        assertTrue(items instanceof LinkedList);
+        items = (List<String>) config.get("typed2.linkedlist", List.class);
         assertNotNull(items);
         assertFalse(items.isEmpty());
         assertEquals(10, items.size());
+        assertTrue(items instanceof LinkedList);
     }
 
-    @Test
-    public void testLinkedList_String(){
-        Configuration config = ConfigurationProvider.getConfiguration();
-        LinkedList<String> items = config.get("base.items", new TypeLiteral<LinkedList<String>>(){});
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        items = (LinkedList<String>) config.get("base.items", LinkedList.class);
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-    }
-
-    @Test
-    public void testSet_String(){
-        Configuration config = ConfigurationProvider.getConfiguration();
-        Set<String> items = config.get("base.items", new TypeLiteral<Set<String>>(){});
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        items = (Set<String>) config.get("base.items", Set.class);
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-    }
-
-    @Test
-    public void testSortedSet_String(){
-        Configuration config = ConfigurationProvider.getConfiguration();
-        Set<String> items = config.get("base.items", new TypeLiteral<SortedSet<String>>(){});
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-        items = (SortedSet<String>) config.get("base.items", SortedSet.class);
-        assertNotNull(items);
-        assertFalse(items.isEmpty());
-        assertEquals(10, items.size());
-    }
 
     @Test
     public void testHashSet_String(){
         Configuration config = ConfigurationProvider.getConfiguration();
-        Set<String> items = config.get("base.items", new TypeLiteral<HashSet<String>>(){});
+        Set<String> items = config.get("typed2.hashset", new TypeLiteral<Set<String>>(){});
         assertNotNull(items);
         assertFalse(items.isEmpty());
         assertEquals(10, items.size());
-        items = (HashSet<String>) config.get("base.items", HashSet.class);
+        assertTrue(items instanceof HashSet);
+        items = (Set<String>) config.get("typed2.hashset", Set.class);
         assertNotNull(items);
         assertFalse(items.isEmpty());
         assertEquals(10, items.size());
+        assertTrue(items instanceof HashSet);
     }
 
     @Test
     public void testTreeSet_String(){
         Configuration config = ConfigurationProvider.getConfiguration();
-        TreeSet<String> items = config.get("base.items", new TypeLiteral<TreeSet<String>>(){});
+        Set<String> items = config.get("typed2.treeset", new TypeLiteral<Set<String>>(){});
         assertNotNull(items);
         assertFalse(items.isEmpty());
         assertEquals(10, items.size());
-        items = (TreeSet<String>) config.get("base.items", TreeSet.class);
+        assertTrue(items instanceof TreeSet);
+        items = (Set<String>) config.get("typed2.treeset", Set.class);
         assertNotNull(items);
         assertFalse(items.isEmpty());
         assertEquals(10, items.size());
+        assertTrue(items instanceof TreeSet);
     }
 
     @Test
-    public void testMap_String(){
+    public void testHashMap_String(){
         Configuration config = ConfigurationProvider.getConfiguration();
-        Map<String,String> items = config.get("base.map", new TypeLiteral<Map<String,String>>(){});
+        Map<String,String> items = config.get("typed2.hashmap", new TypeLiteral<Map<String,String>>(){});
         assertNotNull(items);
         assertFalse(items.isEmpty());
         assertEquals(4, items.size());
@@ -121,7 +110,8 @@ public class CollectionsTypedTests {
         assertEquals("b", items.get("2"));
         assertEquals("c", items.get("3"));
         assertEquals(" ", items.get("4"));
-        items = (Map<String,String>) config.get("base.map", Map.class);
+        assertTrue(items instanceof HashMap);
+        items = (Map<String,String>) config.get("typed2.hashmap", Map.class);
         assertNotNull(items);
         assertFalse(items.isEmpty());
         assertEquals(4, items.size());
@@ -129,12 +119,13 @@ public class CollectionsTypedTests {
         assertEquals("b", items.get("2"));
         assertEquals("c", items.get("3"));
         assertEquals(" ", items.get("4"));
+        assertTrue(items instanceof HashMap);
     }
 
     @Test
-    public void testHashMap_String(){
+    public void testTreeMap_String(){
         Configuration config = ConfigurationProvider.getConfiguration();
-        Map<String,String> items = config.get("base.map", new TypeLiteral<HashMap<String,String>>(){});
+        Map<String,String> items = config.get("typed2.treemap", new TypeLiteral<Map<String,String>>(){});
         assertNotNull(items);
         assertFalse(items.isEmpty());
         assertEquals(4, items.size());
@@ -142,7 +133,8 @@ public class CollectionsTypedTests {
         assertEquals("b", items.get("2"));
         assertEquals("c", items.get("3"));
         assertEquals(" ", items.get("4"));
-        items = (HashMap<String,String>) config.get("base.map", HashMap.class);
+        assertTrue(items instanceof TreeMap);
+        items = (Map<String,String>) config.get("typed2.treemap", Map.class);
         assertNotNull(items);
         assertFalse(items.isEmpty());
         assertEquals(4, items.size());
@@ -150,60 +142,67 @@ public class CollectionsTypedTests {
         assertEquals("b", items.get("2"));
         assertEquals("c", items.get("3"));
         assertEquals(" ", items.get("4"));
+        assertTrue(items instanceof TreeMap);
     }
 
     @Test
-    public void testSortedMap_String(){
+    public void testCollection_HashSet(){
         Configuration config = ConfigurationProvider.getConfiguration();
-        Map<String,String> items = config.get("base.map", new TypeLiteral<SortedMap<String,String>>(){});
+        Collection<String> items = config.get("typed2.hashset", new TypeLiteral<Collection<String>>(){});
         assertNotNull(items);
         assertFalse(items.isEmpty());
-        assertEquals(4, items.size());
-        assertEquals("a", items.get("1"));
-        assertEquals("b", items.get("2"));
-        assertEquals("c", items.get("3"));
-        assertEquals(" ", items.get("4"));
-        items = (Map<String,String>) config.get("base.map", SortedMap.class);
+        assertEquals(10, items.size());
+        assertTrue(items instanceof HashSet);
+        items = (Collection<String>) config.get("typed2.hashset", Collection.class);
         assertNotNull(items);
         assertFalse(items.isEmpty());
-        assertEquals(4, items.size());
-        assertEquals("a", items.get("1"));
-        assertEquals("b", items.get("2"));
-        assertEquals("c", items.get("3"));
-        assertEquals(" ", items.get("4"));
+        assertEquals(10, items.size());
+        assertTrue(items instanceof HashSet);
     }
 
     @Test
-    public void testTreeMap_String(){
+    public void testCollection_TreeSet(){
         Configuration config = ConfigurationProvider.getConfiguration();
-        TreeMap<String,String> items = config.get("base.map", new TypeLiteral<TreeMap<String,String>>(){});
+        Collection<String> items = config.get("typed2.treeset", new TypeLiteral<Collection<String>>(){});
         assertNotNull(items);
         assertFalse(items.isEmpty());
-        assertEquals(4, items.size());
-        assertEquals("a", items.get("1"));
-        assertEquals("b", items.get("2"));
-        assertEquals("c", items.get("3"));
-        assertEquals(" ", items.get("4"));
-        items =  config.get("base.map", TreeMap.class);
+        assertEquals(10, items.size());
+        assertTrue(items instanceof TreeSet);
+        items = (Collection<String>) config.get("typed2.treeset", Collection.class);
         assertNotNull(items);
         assertFalse(items.isEmpty());
-        assertEquals(4, items.size());
-        assertEquals("a", items.get("1"));
-        assertEquals("b", items.get("2"));
-        assertEquals("c", items.get("3"));
-        assertEquals(" ", items.get("4"));
+        assertEquals(10, items.size());
+        assertTrue(items instanceof TreeSet);
     }
 
     @Test
-    public void testCollection_String(){
+    public void testCollection_ArrayList(){
         Configuration config = ConfigurationProvider.getConfiguration();
-        Collection<String> items = config.get("base.items", new TypeLiteral<Collection<String>>(){});
+        Collection<String> items = config.get("typed2.arraylist", new TypeLiteral<Collection<String>>(){});
         assertNotNull(items);
         assertFalse(items.isEmpty());
         assertEquals(10, items.size());
-        items = (Collection<String>) config.get("base.items", Collection.class);
+        assertTrue(items instanceof ArrayList);
+        items = (Collection<String>) config.get("typed2.arraylist", Collection.class);
         assertNotNull(items);
         assertFalse(items.isEmpty());
         assertEquals(10, items.size());
+        assertTrue(items instanceof ArrayList);
     }
+
+    @Test
+    public void testCollection_LinkedList(){
+        Configuration config = ConfigurationProvider.getConfiguration();
+        Collection<String> items = config.get("typed2.linkedlist", new TypeLiteral<Collection<String>>(){});
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(10, items.size());
+        assertTrue(items instanceof LinkedList);
+        items = (Collection<String>) config.get("typed2.linkedlist", Collection.class);
+        assertNotNull(items);
+        assertFalse(items.isEmpty());
+        assertEquals(10, items.size());
+        assertTrue(items instanceof LinkedList);
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/dda281b2/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 ca3c66e..76e5e84 100644
--- a/collections/src/test/resources/META-INF/javaconfiguration.properties
+++ b/collections/src/test/resources/META-INF/javaconfiguration.properties
@@ -22,6 +22,40 @@
 base.items=1,2,3,4,5,6,7,8,9,0
 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
+_typed2.arraylist.collection-type=ArrayList
+_typed2.arraylist.read-only=false
+typed2.linkedlist=1,2,3,4,5,6,7,8,9,0
+_typed2.linkedlist.collection-type=java.util.LinkedList
+_typed2.linkedlist.read-only=false
+typed2.hashset=1,2,3,4,5,6,7,8,9,0
+_typed2.hashset.collection-type=HashSet
+_typed2.hashset.read-only=false
+typed2.treeset=1,2,3,4,5,6,7,8,9,0
+_typed2.treeset.collection-type=TreeSet
+_typed2.treeset.read-only=false
+typed2.hashmap=1::a, 2::b, 3::c, [4:: ]
+_typed2.hashmap.collection-type=java.util.HashMap
+_typed2.hashmap.read-only=false
+typed2.treemap=1::a, 2::b, 3::c, [4:: ]
+_typed2.treemap.collection-type=TreeMap
+_typed2.treemap.read-only=false
+
+# Config for tests with combination policy, writable
+typed.arraylist=1,2,3,4,5,6,7,8,9,0
+_typed.arraylist.collection-type=ArrayList
+typed.linkedlist=1,2,3,4,5,6,7,8,9,0
+_typed.linkedlist.collection-type=java.util.LinkedList
+typed.hashset=1,2,3,4,5,6,7,8,9,0
+_typed.hashset.collection-type=HashSet
+typed.treeset=1,2,3,4,5,6,7,8,9,0
+_typed.treeset.collection-type=TreeSet
+typed.hashmap=1::a, 2::b, 3::c, [4:: ]
+_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


Mime
View raw message