tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anat...@apache.org
Subject [02/15] incubator-tamaya git commit: Fixed bugs in TypeLiteral with code from OpenWebBeans. Unified test file location in RIs. Added tests for uncoveraged areas.
Date Thu, 21 May 2015 07:40:20 GMT
Fixed bugs in TypeLiteral with code from OpenWebBeans.
Unified test file location in RIs.
Added tests for uncoveraged areas.


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

Branch: refs/heads/master
Commit: 58bda32ab247e71e8b3cd791486f06283d1cfb53
Parents: 0bf0eec
Author: anatole <anatole@apache.org>
Authored: Fri May 15 14:09:23 2015 +0200
Committer: anatole <anatole@apache.org>
Committed: Fri May 15 14:09:23 2015 +0200

----------------------------------------------------------------------
 .../java/org/apache/tamaya/TypeLiteral.java     | 167 +++++++++-------
 .../org/apache/tamaya/ConfigExceptionTest.java  |  45 +++++
 .../java/org/apache/tamaya/TypeLiteralTest.java |  61 ++++++
 .../core/internal/PropertyConverterManager.java |   2 +-
 .../propertysource/BasePropertySourceTest.java  | 104 ++++++++++
 .../EnvironmentPropertySourceTest.java          |  41 ++++
 .../PropertiesFilePropertySourceTest.java       |  58 ++++++
 .../SystemPropertySourceTest.java               |  99 ++++++++++
 .../provider/JavaConfigurationProviderTest.java |  60 ++++++
 .../propertysource/BasePropertySourceTest.java  | 104 ----------
 .../PropertiesFilePropertySourceTest.java       |  58 ------
 .../SystemPropertySourceTest.java               |  99 ----------
 .../provider/JavaConfigurationProviderTest.java |  60 ------
 .../java/org/apache/tamaya/TypeLiteral.java     | 191 +++++++++++--------
 .../java/org/apache/tamaya/TypeLiteralTest.java |  62 ++++++
 .../core/internal/PropertyConverterManager.java |   2 +-
 .../propertysource/BasePropertySourceTest.java  | 104 ++++++++++
 .../EnvironmentPropertySourceTest.java          |  41 ++++
 .../PropertiesFilePropertySourceTest.java       |  64 +++++++
 .../SystemPropertySourceTest.java               | 101 ++++++++++
 .../provider/JavaConfigurationProviderTest.java |  60 ++++++
 .../propertysource/BasePropertySourceTest.java  | 104 ----------
 .../PropertiesFilePropertySourceTest.java       |  64 -------
 .../SystemPropertySourceTest.java               | 101 ----------
 .../provider/JavaConfigurationProviderTest.java |  60 ------
 25 files changed, 1114 insertions(+), 798 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/58bda32a/java7/api/src/main/java/org/apache/tamaya/TypeLiteral.java
----------------------------------------------------------------------
diff --git a/java7/api/src/main/java/org/apache/tamaya/TypeLiteral.java b/java7/api/src/main/java/org/apache/tamaya/TypeLiteral.java
index a3abdf5..b29a699 100644
--- a/java7/api/src/main/java/org/apache/tamaya/TypeLiteral.java
+++ b/java7/api/src/main/java/org/apache/tamaya/TypeLiteral.java
@@ -38,29 +38,39 @@ import java.lang.reflect.Type;
 public class TypeLiteral<T> implements Serializable {
 
     private static final long serialVersionUID = 1L;
-    private Type type;
+    private static final Type[] EMPTY_TYPE_ARRAY = new Type[0];
+    /** The current defined type. */
+    private Type definedType;
 
-    protected TypeLiteral(Type type) {
-        this.type = type;
+    /**
+     * Constructor.
+     * @param definedType the defined type.
+     */
+    protected TypeLiteral(Type definedType) {
+        this.definedType = definedType;
     }
 
     /**
      * Constructor only for directly implemeting a TypeLiteral hereby dynamically implementing a generic interface.
      */
-    protected TypeLiteral() { }
+    protected TypeLiteral() {
+        this.definedType = getDefinedType(this.getClass());
+    }
 
     /**
      * Creates a new TypeLiteral based on a given type.
+     *
      * @param type the type , not null.
-     * @param <R> the literal generic type.
+     * @param <R>  the literal generic type.
      * @return the corresponding TypeLiteral, never null.
      */
-    public static <R> TypeLiteral<R> of(Type type){
+    public static <R> TypeLiteral<R> of(Type type) {
         return new TypeLiteral<>(type);
     }
 
     /**
      * Evaluates the subclass of a TypeLiteral instance.
+     *
      * @param clazz the typeliteral class (could be an anonymous class).
      * @return the subclass implemented by the TypeLiteral.
      */
@@ -77,107 +87,130 @@ public class TypeLiteral<T> implements Serializable {
 
     /**
      * Checks the current implemented generic interfaces and evaluates the given single type parameter.
-     * @param clazz the class to check, not null.
+     *
+     * @param clazz         the class to check, not null.
      * @param interfaceType the interface type to be checked, not null.
      * @return the generic type parameter, or null, if it cannot be evaluated.
      */
-    public static Type getGenericInterfaceTypeParameter(Class<?> clazz, Class<?> interfaceType) {
-        for(Type type: clazz.getGenericInterfaces()){
-            if(interfaceType!=null && !interfaceType.equals(type)){
-                continue;
-            }
+    public static Type[] getGenericInterfaceTypeParameters(Class<?> clazz, Class<?> interfaceType) {
+        for (Type type : clazz.getGenericInterfaces()) {
             if (type instanceof ParameterizedType) {
                 ParameterizedType parameterizedType = (ParameterizedType) type;
-                if (parameterizedType.getActualTypeArguments().length == 1) {
-                    return parameterizedType.getActualTypeArguments()[0];
+                if(parameterizedType.getRawType().equals(interfaceType)){
+                    return parameterizedType.getActualTypeArguments();
                 }
             }
         }
-        return null;
+        return EMPTY_TYPE_ARRAY;
     }
 
     /**
      * Method that checks the class's type for a generic interface implementation type.
-     * @param clazz the type class, not null.
-     * @param interfaceType the generic interface to check (there could be multiple ones implemented by a class).
+     *
+     * @param type         the type, not null.
      * @return the generic type parameter of the given single type generic interfaceType, or null.
      */
-    public static Type getTypeParameter(Class<?> clazz, Class<?> interfaceType) {
-        Type[] types = clazz.getGenericInterfaces();
-        for(Type type:types) {
-            if (type instanceof ParameterizedType) {
-                ParameterizedType parameterizedType = (ParameterizedType) type;
-                if(interfaceType==null || parameterizedType.getRawType().equals(interfaceType)){
-                    if (parameterizedType.getActualTypeArguments().length == 1) {
-                        return parameterizedType.getActualTypeArguments()[0];
-                    }
-                }
-            }
+    public static Type[] getTypeParameters(Type type) {
+        if (type instanceof ParameterizedType) {
+            ParameterizedType parameterizedType = (ParameterizedType) type;
+            return parameterizedType.getActualTypeArguments();
         }
-        return null;
+        return EMPTY_TYPE_ARRAY;
     }
 
-    /**
-     * Returns basic Java type.
-     * @return the actual type represented by this object
-     */
     public final Type getType() {
-        if (type == null) {
-            Class<?> typeLiteralSubclass = getTypeLiteralSubclass(this.getClass());
-            if (typeLiteralSubclass == null) {
-                throw new RuntimeException(getClass() + " is not a subclass of TypeLiteral");
-            }
-            type = getTypeParameter(typeLiteralSubclass, null);
-            if (type == null) {
-                throw new RuntimeException(getClass() + " does not specify the type parameter T of TypeLiteral<T>");
-            }
-        }
-        return type;
+        return definedType;
     }
 
     /**
-     * Get the raw type of the current type.
-     * @return the raw type represented by this object
-     */
-    @SuppressWarnings("unchecked")
+      * Returns basic raw Java type.
+      *
+      * @return the actual type represented by this object
+      */
     public final Class<T> getRawType() {
-        Type type = getType();
-        if (type instanceof Class) {
-            return (Class<T>) type;
-        } else if (type instanceof ParameterizedType) {
-            return (Class<T>) ((ParameterizedType) type).getRawType();
-        } else if (type instanceof GenericArrayType) {
-            return (Class<T>) Object[].class;
+        Class<T> rawType = null;
+
+        if (this.definedType instanceof Class) {
+            rawType = (Class<T>) this.definedType;
+        } else if (this.definedType instanceof ParameterizedType) {
+            ParameterizedType pt = (ParameterizedType) this.definedType;
+            rawType = (Class<T>) pt.getRawType();
+
+        } else if (this.definedType instanceof GenericArrayType) {
+            rawType = (Class<T>) Object[].class;
+        } else {
+            throw new RuntimeException("Illegal type for the Type Literal Class");
+        }
+
+        return rawType;
+    }
+
+
+    protected Type getDefinedType(Class<?> clazz) {
+        Type type = null;
+
+        if (clazz == null) {
+            throw new RuntimeException("Class parameter clazz can not be null");
+        }
+
+        Type superClazz = clazz.getGenericSuperclass();
+
+        if (superClazz.equals(Object.class)) {
+            throw new RuntimeException("Super class must be parametrized type");
+        } else if (superClazz instanceof ParameterizedType) {
+            ParameterizedType pt = (ParameterizedType) superClazz;
+            Type[] actualArgs = pt.getActualTypeArguments();
+
+            if (actualArgs.length == 1) {
+                type = actualArgs[0];
+
+            } else {
+                throw new RuntimeException("More than one parametric type");
+            }
+
         } else {
-            throw new RuntimeException("Illegal type");
+            type = getDefinedType((Class<?>) superClazz);
         }
+
+        return type;
     }
 
+
     @Override
-    public boolean equals(Object o) {
-        if (this == o){
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((definedType == null) ? 0 : definedType.hashCode());
+        return result;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
             return true;
         }
-        if (!(o instanceof TypeLiteral)){
+        if (obj == null) {
             return false;
         }
-        TypeLiteral that = (TypeLiteral) o;
-        if (type != null ? !type.equals(that.type) : that.type != null){
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        TypeLiteral other = (TypeLiteral) obj;
+        if (definedType == null) {
+            if (other.definedType != null) {
+                return false;
+            }
+        } else if (!definedType.equals(other.definedType)) {
             return false;
         }
         return true;
     }
 
-    @Override
-    public int hashCode() {
-        int result = type != null ? type.hashCode() : 0;
-        return result;
-    }
 
     @Override
     public String toString() {
         return "TypeLiteral{" +
-                "type=" + type +
+                "type=" + definedType +
                 '}';
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/58bda32a/java7/api/src/test/java/org/apache/tamaya/ConfigExceptionTest.java
----------------------------------------------------------------------
diff --git a/java7/api/src/test/java/org/apache/tamaya/ConfigExceptionTest.java b/java7/api/src/test/java/org/apache/tamaya/ConfigExceptionTest.java
new file mode 100644
index 0000000..fa7da0a
--- /dev/null
+++ b/java7/api/src/test/java/org/apache/tamaya/ConfigExceptionTest.java
@@ -0,0 +1,45 @@
+/*
+ * 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;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Tests instantiating {@link ConfigException}.
+ */
+public class ConfigExceptionTest {
+
+    @Test
+    public void testCreationMessage(){
+        ConfigException ex = new ConfigException("test");
+        assertNull(ex.getCause());
+        assertEquals(ex.getMessage(), "test");
+    }
+
+    @Test
+    public void testCreationMessageThrowable(){
+        Exception e = new IllegalStateException("blabla");
+        ConfigException ex = new ConfigException("test", e);
+        assertTrue(ex.getCause() == e);
+        assertEquals("test", ex.getMessage());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/58bda32a/java7/api/src/test/java/org/apache/tamaya/TypeLiteralTest.java
----------------------------------------------------------------------
diff --git a/java7/api/src/test/java/org/apache/tamaya/TypeLiteralTest.java b/java7/api/src/test/java/org/apache/tamaya/TypeLiteralTest.java
new file mode 100644
index 0000000..51edae9
--- /dev/null
+++ b/java7/api/src/test/java/org/apache/tamaya/TypeLiteralTest.java
@@ -0,0 +1,61 @@
+/*
+ * 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;
+
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests for the {@link TypeLiteral} class.
+ */
+public class TypeLiteralTest {
+
+    @Test
+    public void test_constrcutor(){
+        TypeLiteral<List<String>> listTypeLiteral = new TypeLiteral<List<String>>(){};
+        assertEquals(List.class, listTypeLiteral.getRawType());
+        assertEquals(String.class, TypeLiteral.getTypeParameters(listTypeLiteral.getType())[0]);
+    }
+
+    @Test
+    public void test_of(){
+        class MyListClass extends ArrayList<String>{};
+        TypeLiteral<MyListClass> listTypeLiteral = TypeLiteral.of(MyListClass.class);
+        assertEquals(MyListClass.class, listTypeLiteral.getRawType());
+        assertEquals(MyListClass.class, listTypeLiteral.getType());
+    }
+
+    @Test
+    public void test_getTypeParameter(){
+        TypeLiteral<List<String>> listTypeLiteral = new TypeLiteral<List<String>>(){};
+        assertEquals(List.class, listTypeLiteral.getRawType());
+        assertEquals(String.class, TypeLiteral.getTypeParameters(listTypeLiteral.getType())[0]);
+    }
+
+    @Test
+    public void test_getGenericInterfaceTypeParameter(){
+        class MyListClass extends ArrayList<String> implements List<String>{};
+        assertEquals(String.class, TypeLiteral.getGenericInterfaceTypeParameters(MyListClass.class, List.class)[0]);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/58bda32a/java7/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java
----------------------------------------------------------------------
diff --git a/java7/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java b/java7/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java
index 7da86f9..31a05b2 100644
--- a/java7/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java
+++ b/java7/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java
@@ -69,7 +69,7 @@ public class PropertyConverterManager {
      */
     protected void initConverters() {
         for(PropertyConverter conv: ServiceContextManager.getServiceContext().getServices(PropertyConverter.class)){
-            Type type = TypeLiteral.getTypeParameter(conv.getClass(), PropertyConverter.class);
+            Type type = TypeLiteral.getGenericInterfaceTypeParameters(conv.getClass(), PropertyConverter.class)[0];
             register(TypeLiteral.of(type), conv);
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/58bda32a/java7/core/src/test/java/org/apache/tamaya/core/propertysource/BasePropertySourceTest.java
----------------------------------------------------------------------
diff --git a/java7/core/src/test/java/org/apache/tamaya/core/propertysource/BasePropertySourceTest.java b/java7/core/src/test/java/org/apache/tamaya/core/propertysource/BasePropertySourceTest.java
new file mode 100644
index 0000000..8d3f086
--- /dev/null
+++ b/java7/core/src/test/java/org/apache/tamaya/core/propertysource/BasePropertySourceTest.java
@@ -0,0 +1,104 @@
+/*
+ * 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.core.propertysource;
+
+import org.apache.tamaya.core.propertysource.BasePropertySource;
+import org.apache.tamaya.spi.PropertySource;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+public class BasePropertySourceTest {
+
+    @Test
+    public void testGetOrdinal() {
+
+        PropertySource defaultPropertySource = new BasePropertySource(56) {
+
+            @Override
+            public String getName() {
+                return "testWithDefault";
+            }
+
+            @Override
+            public String get(String key) {
+                return null;
+            }
+
+            @Override
+            public Map<String, String> getProperties() {
+                return Collections.emptyMap();
+            }
+        };
+
+        Assert.assertEquals(56, defaultPropertySource.getOrdinal());
+        Assert.assertEquals(1000, new OverriddenOrdinalPropertySource().getOrdinal());
+
+        // propertySource with invalid ordinal
+        Assert.assertEquals(1, new OverriddenInvalidOrdinalPropertySource().getOrdinal());
+    }
+
+    @Test
+    public void testGet() {
+        Assert.assertEquals("1000", new OverriddenOrdinalPropertySource().get(PropertySource.TAMAYA_ORDINAL));
+    }
+
+    private static class OverriddenOrdinalPropertySource extends BasePropertySource {
+
+        private OverriddenOrdinalPropertySource() {
+            super(250);
+        }
+
+        @Override
+        public String getName() {
+            return "overriddenOrdinal";
+        }
+
+        @Override
+        public Map<String, String> getProperties() {
+            Map<String, String> map = new HashMap<>(1);
+            map.put(PropertySource.TAMAYA_ORDINAL, "1000");
+            return map;
+        }
+    }
+
+    private static class OverriddenInvalidOrdinalPropertySource extends BasePropertySource {
+
+        private OverriddenInvalidOrdinalPropertySource() {
+            super(1);
+        }
+
+        @Override
+        public String getName() {
+            return "overriddenInvalidOrdinal";
+        }
+
+        @Override
+        public Map<String, String> getProperties() {
+            Map<String, String> map = new HashMap<>(1);
+            map.put(PropertySource.TAMAYA_ORDINAL, "invalid");
+            return map;
+        }
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/58bda32a/java7/core/src/test/java/org/apache/tamaya/core/propertysource/EnvironmentPropertySourceTest.java
----------------------------------------------------------------------
diff --git a/java7/core/src/test/java/org/apache/tamaya/core/propertysource/EnvironmentPropertySourceTest.java b/java7/core/src/test/java/org/apache/tamaya/core/propertysource/EnvironmentPropertySourceTest.java
new file mode 100644
index 0000000..995c7ad
--- /dev/null
+++ b/java7/core/src/test/java/org/apache/tamaya/core/propertysource/EnvironmentPropertySourceTest.java
@@ -0,0 +1,41 @@
+package org.apache.tamaya.core.propertysource;
+
+import org.junit.Test;
+
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class EnvironmentPropertySourceTest {
+
+    private EnvironmentPropertySource envPropertySource = new EnvironmentPropertySource();
+
+    @Test
+    public void testGetOrdinal() throws Exception {
+        assertEquals(EnvironmentPropertySource.DEFAULT_ORDINAL, envPropertySource.getOrdinal());
+    }
+
+    @Test
+    public void testGetName() throws Exception {
+        assertEquals("environment-properties", envPropertySource.getName());
+    }
+
+    @Test
+    public void testGet() throws Exception {
+        for (Map.Entry<String, String> envEntry : System.getenv().entrySet()) {
+            assertEquals(envPropertySource.get(envEntry.getKey()), envEntry.getValue());
+        }
+    }
+
+    @Test
+    public void testGetProperties() throws Exception {
+        Map<String, String> props = envPropertySource.getProperties();
+        assertEquals(System.getenv(), props);
+    }
+
+    @Test
+    public void testIsScannable() throws Exception {
+        assertTrue(envPropertySource.isScannable());
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/58bda32a/java7/core/src/test/java/org/apache/tamaya/core/propertysource/PropertiesFilePropertySourceTest.java
----------------------------------------------------------------------
diff --git a/java7/core/src/test/java/org/apache/tamaya/core/propertysource/PropertiesFilePropertySourceTest.java b/java7/core/src/test/java/org/apache/tamaya/core/propertysource/PropertiesFilePropertySourceTest.java
new file mode 100644
index 0000000..36b0f5d
--- /dev/null
+++ b/java7/core/src/test/java/org/apache/tamaya/core/propertysource/PropertiesFilePropertySourceTest.java
@@ -0,0 +1,58 @@
+/*
+ * 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.core.propertysource;
+
+import org.apache.tamaya.core.propertysource.SimplePropertySource;
+import org.apache.tamaya.spi.PropertySource;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class PropertiesFilePropertySourceTest {
+
+    private SimplePropertySource testfilePropertySource = new SimplePropertySource(Thread.currentThread()
+            .getContextClassLoader().getResource("testfile.properties"));
+    private SimplePropertySource overrideOrdinalPropertySource = new SimplePropertySource(
+            Thread.currentThread().getContextClassLoader().getResource("overrideOrdinal.properties"));
+
+
+    @Test
+    public void testGetOrdinal() {
+        Assert.assertEquals(0, testfilePropertySource.getOrdinal());
+        Assert.assertEquals(Integer.parseInt(overrideOrdinalPropertySource.get(PropertySource.TAMAYA_ORDINAL)), overrideOrdinalPropertySource.getOrdinal());
+    }
+
+
+    @Test
+    public void testGet() {
+        Assert.assertEquals("val3", testfilePropertySource.get("key3"));
+        Assert.assertEquals("myval5", overrideOrdinalPropertySource.get("mykey5"));
+        Assert.assertNull(testfilePropertySource.get("nonpresentkey"));
+    }
+
+
+    @Test
+    public void testGetProperties() throws Exception {
+        Assert.assertEquals(5, testfilePropertySource.getProperties().size());
+        Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key1"));
+        Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key2"));
+        Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key3"));
+        Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key4"));
+        Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key5"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/58bda32a/java7/core/src/test/java/org/apache/tamaya/core/propertysource/SystemPropertySourceTest.java
----------------------------------------------------------------------
diff --git a/java7/core/src/test/java/org/apache/tamaya/core/propertysource/SystemPropertySourceTest.java b/java7/core/src/test/java/org/apache/tamaya/core/propertysource/SystemPropertySourceTest.java
new file mode 100644
index 0000000..c627972
--- /dev/null
+++ b/java7/core/src/test/java/org/apache/tamaya/core/propertysource/SystemPropertySourceTest.java
@@ -0,0 +1,99 @@
+/*
+ * 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.core.propertysource;
+
+import org.apache.tamaya.core.propertysource.SystemPropertySource;
+import org.apache.tamaya.spi.PropertySource;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Map;
+import java.util.Properties;
+
+public class SystemPropertySourceTest {
+
+    private SystemPropertySource testPropertySource = new SystemPropertySource();
+
+
+    @Test
+    public void testGetOrdinal() throws Exception {
+
+        // test the default ordinal
+        Assert.assertEquals(SystemPropertySource.DEFAULT_ORDINAL, testPropertySource.getOrdinal());
+
+        // set the ordinal to 1000
+        System.setProperty(PropertySource.TAMAYA_ORDINAL, "1000");
+        Assert.assertEquals(1000, new SystemPropertySource().getOrdinal());
+        // currently its not possible to change ordinal at runtime
+
+        // reset it to not destroy other tests!!
+        System.clearProperty(PropertySource.TAMAYA_ORDINAL);
+    }
+
+    @Test
+    public void testGetName() throws Exception {
+        Assert.assertEquals("system-properties", testPropertySource.getName());
+    }
+
+    @Test
+    public void testGet() throws Exception {
+        String propertyKeyToCheck = System.getProperties().stringPropertyNames().iterator().next();
+
+        String property = testPropertySource.get(propertyKeyToCheck);
+        Assert.assertNotNull("Property '" + propertyKeyToCheck + "' is not present in " +
+                SystemPropertySource.class.getSimpleName(), property);
+        Assert.assertEquals(System.getProperty(propertyKeyToCheck), property);
+    }
+
+    @Test
+    public void testGetProperties() throws Exception {
+        checkWithSystemProperties(testPropertySource.getProperties());
+
+        // modify system properties
+        System.setProperty("test", "myTestVal");
+
+        checkWithSystemProperties(testPropertySource.getProperties());
+
+        // cleanup
+        System.clearProperty("test");
+
+        // no modifaction
+        try {
+            testPropertySource.getProperties().put("add.new.keys", "must throw exception");
+            Assert.fail(UnsupportedOperationException.class.getName() + " expected");
+        }
+        catch (UnsupportedOperationException e) {
+            // expected -> all is fine
+        }
+    }
+
+    private void checkWithSystemProperties(Map<String, String> toCheck) {
+        Properties systemEntries = System.getProperties();
+
+        Assert.assertEquals("size of System.getProperties().entrySet() must be the same as SystemPropertySrouce.getProperties().entrySet()",
+                            systemEntries.entrySet().size(), toCheck.size());
+
+        for (Map.Entry<String, String> propertySourceEntry : toCheck.entrySet()) {
+
+            Assert.assertEquals("Entry values for key '" + propertySourceEntry.getKey() + "' do not match",
+                                systemEntries.getProperty(propertySourceEntry.getKey()), propertySourceEntry.getValue());
+        }
+
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/58bda32a/java7/core/src/test/java/org/apache/tamaya/core/provider/JavaConfigurationProviderTest.java
----------------------------------------------------------------------
diff --git a/java7/core/src/test/java/org/apache/tamaya/core/provider/JavaConfigurationProviderTest.java b/java7/core/src/test/java/org/apache/tamaya/core/provider/JavaConfigurationProviderTest.java
new file mode 100644
index 0000000..f099da4
--- /dev/null
+++ b/java7/core/src/test/java/org/apache/tamaya/core/provider/JavaConfigurationProviderTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.core.provider;
+
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.core.provider.JavaConfigurationProvider;
+import org.apache.tamaya.spi.PropertySource;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Collection;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.hasSize;
+import static org.hamcrest.Matchers.notNullValue;
+
+public class JavaConfigurationProviderTest {
+
+    @Test
+    public void testJavaConfigurationProvider() {
+
+        Collection<PropertySource> propertySources = new JavaConfigurationProvider().getPropertySources();
+
+        assertThat(propertySources, notNullValue());
+        assertThat(propertySources, hasSize(1));
+
+        PropertySource propertySource = propertySources.iterator().next();
+
+        assertThat(propertySource.getProperties().keySet(), hasSize(5));
+
+        for (int i = 1; i < 6; i++) {
+            String key = "confkey" + i;
+            String value = "javaconf-value" + i;
+
+            Assert.assertEquals(value, propertySource.get(key));
+
+            // check if we had our key in configuration.current
+            Assert.assertTrue(ConfigurationProvider.getConfiguration().getProperties().containsKey(key));
+            Assert.assertEquals(value, ConfigurationProvider.getConfiguration().get(key));
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/58bda32a/java7/core/src/test/java/org/apache/tamaya/core/test/propertysource/BasePropertySourceTest.java
----------------------------------------------------------------------
diff --git a/java7/core/src/test/java/org/apache/tamaya/core/test/propertysource/BasePropertySourceTest.java b/java7/core/src/test/java/org/apache/tamaya/core/test/propertysource/BasePropertySourceTest.java
deleted file mode 100644
index a8325c6..0000000
--- a/java7/core/src/test/java/org/apache/tamaya/core/test/propertysource/BasePropertySourceTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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.core.test.propertysource;
-
-import org.apache.tamaya.core.propertysource.BasePropertySource;
-import org.apache.tamaya.spi.PropertySource;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-public class BasePropertySourceTest {
-
-    @Test
-    public void testGetOrdinal() {
-
-        PropertySource defaultPropertySource = new BasePropertySource(56) {
-
-            @Override
-            public String getName() {
-                return "testWithDefault";
-            }
-
-            @Override
-            public String get(String key) {
-                return null;
-            }
-
-            @Override
-            public Map<String, String> getProperties() {
-                return Collections.emptyMap();
-            }
-        };
-
-        Assert.assertEquals(56, defaultPropertySource.getOrdinal());
-        Assert.assertEquals(1000, new OverriddenOrdinalPropertySource().getOrdinal());
-
-        // propertySource with invalid ordinal
-        Assert.assertEquals(1, new OverriddenInvalidOrdinalPropertySource().getOrdinal());
-    }
-
-    @Test
-    public void testGet() {
-        Assert.assertEquals("1000", new OverriddenOrdinalPropertySource().get(PropertySource.TAMAYA_ORDINAL));
-    }
-
-    private static class OverriddenOrdinalPropertySource extends BasePropertySource {
-
-        private OverriddenOrdinalPropertySource() {
-            super(250);
-        }
-
-        @Override
-        public String getName() {
-            return "overriddenOrdinal";
-        }
-
-        @Override
-        public Map<String, String> getProperties() {
-            Map<String, String> map = new HashMap<>(1);
-            map.put(PropertySource.TAMAYA_ORDINAL, "1000");
-            return map;
-        }
-    }
-
-    private static class OverriddenInvalidOrdinalPropertySource extends BasePropertySource {
-
-        private OverriddenInvalidOrdinalPropertySource() {
-            super(1);
-        }
-
-        @Override
-        public String getName() {
-            return "overriddenInvalidOrdinal";
-        }
-
-        @Override
-        public Map<String, String> getProperties() {
-            Map<String, String> map = new HashMap<>(1);
-            map.put(PropertySource.TAMAYA_ORDINAL, "invalid");
-            return map;
-        }
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/58bda32a/java7/core/src/test/java/org/apache/tamaya/core/test/propertysource/PropertiesFilePropertySourceTest.java
----------------------------------------------------------------------
diff --git a/java7/core/src/test/java/org/apache/tamaya/core/test/propertysource/PropertiesFilePropertySourceTest.java b/java7/core/src/test/java/org/apache/tamaya/core/test/propertysource/PropertiesFilePropertySourceTest.java
deleted file mode 100644
index 8527881..0000000
--- a/java7/core/src/test/java/org/apache/tamaya/core/test/propertysource/PropertiesFilePropertySourceTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.core.test.propertysource;
-
-import org.apache.tamaya.core.propertysource.SimplePropertySource;
-import org.apache.tamaya.spi.PropertySource;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class PropertiesFilePropertySourceTest {
-
-    private SimplePropertySource testfilePropertySource = new SimplePropertySource(Thread.currentThread()
-            .getContextClassLoader().getResource("testfile.properties"));
-    private SimplePropertySource overrideOrdinalPropertySource = new SimplePropertySource(
-            Thread.currentThread().getContextClassLoader().getResource("overrideOrdinal.properties"));
-
-
-    @Test
-    public void testGetOrdinal() {
-        Assert.assertEquals(0, testfilePropertySource.getOrdinal());
-        Assert.assertEquals(Integer.parseInt(overrideOrdinalPropertySource.get(PropertySource.TAMAYA_ORDINAL)), overrideOrdinalPropertySource.getOrdinal());
-    }
-
-
-    @Test
-    public void testGet() {
-        Assert.assertEquals("val3", testfilePropertySource.get("key3"));
-        Assert.assertEquals("myval5", overrideOrdinalPropertySource.get("mykey5"));
-        Assert.assertNull(testfilePropertySource.get("nonpresentkey"));
-    }
-
-
-    @Test
-    public void testGetProperties() throws Exception {
-        Assert.assertEquals(5, testfilePropertySource.getProperties().size());
-        Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key1"));
-        Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key2"));
-        Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key3"));
-        Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key4"));
-        Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key5"));
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/58bda32a/java7/core/src/test/java/org/apache/tamaya/core/test/propertysource/SystemPropertySourceTest.java
----------------------------------------------------------------------
diff --git a/java7/core/src/test/java/org/apache/tamaya/core/test/propertysource/SystemPropertySourceTest.java b/java7/core/src/test/java/org/apache/tamaya/core/test/propertysource/SystemPropertySourceTest.java
deleted file mode 100644
index 0b26ff4..0000000
--- a/java7/core/src/test/java/org/apache/tamaya/core/test/propertysource/SystemPropertySourceTest.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.core.test.propertysource;
-
-import org.apache.tamaya.core.propertysource.SystemPropertySource;
-import org.apache.tamaya.spi.PropertySource;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.Map;
-import java.util.Properties;
-
-public class SystemPropertySourceTest {
-
-    private SystemPropertySource testPropertySource = new SystemPropertySource();
-
-
-    @Test
-    public void testGetOrdinal() throws Exception {
-
-        // test the default ordinal
-        Assert.assertEquals(SystemPropertySource.DEFAULT_ORDINAL, testPropertySource.getOrdinal());
-
-        // set the ordinal to 1000
-        System.setProperty(PropertySource.TAMAYA_ORDINAL, "1000");
-        Assert.assertEquals(1000, new SystemPropertySource().getOrdinal());
-        // currently its not possible to change ordinal at runtime
-
-        // reset it to not destroy other tests!!
-        System.clearProperty(PropertySource.TAMAYA_ORDINAL);
-    }
-
-    @Test
-    public void testGetName() throws Exception {
-        Assert.assertEquals("system-properties", testPropertySource.getName());
-    }
-
-    @Test
-    public void testGet() throws Exception {
-        String propertyKeyToCheck = System.getProperties().stringPropertyNames().iterator().next();
-
-        String property = testPropertySource.get(propertyKeyToCheck);
-        Assert.assertNotNull("Property '" + propertyKeyToCheck + "' is not present in " +
-                SystemPropertySource.class.getSimpleName(), property);
-        Assert.assertEquals(System.getProperty(propertyKeyToCheck), property);
-    }
-
-    @Test
-    public void testGetProperties() throws Exception {
-        checkWithSystemProperties(testPropertySource.getProperties());
-
-        // modify system properties
-        System.setProperty("test", "myTestVal");
-
-        checkWithSystemProperties(testPropertySource.getProperties());
-
-        // cleanup
-        System.clearProperty("test");
-
-        // no modifaction
-        try {
-            testPropertySource.getProperties().put("add.new.keys", "must throw exception");
-            Assert.fail(UnsupportedOperationException.class.getName() + " expected");
-        }
-        catch (UnsupportedOperationException e) {
-            // expected -> all is fine
-        }
-    }
-
-    private void checkWithSystemProperties(Map<String, String> toCheck) {
-        Properties systemEntries = System.getProperties();
-
-        Assert.assertEquals("size of System.getProperties().entrySet() must be the same as SystemPropertySrouce.getProperties().entrySet()",
-                            systemEntries.entrySet().size(), toCheck.size());
-
-        for (Map.Entry<String, String> propertySourceEntry : toCheck.entrySet()) {
-
-            Assert.assertEquals("Entry values for key '" + propertySourceEntry.getKey() + "' do not match",
-                                systemEntries.getProperty(propertySourceEntry.getKey()), propertySourceEntry.getValue());
-        }
-
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/58bda32a/java7/core/src/test/java/org/apache/tamaya/core/test/provider/JavaConfigurationProviderTest.java
----------------------------------------------------------------------
diff --git a/java7/core/src/test/java/org/apache/tamaya/core/test/provider/JavaConfigurationProviderTest.java b/java7/core/src/test/java/org/apache/tamaya/core/test/provider/JavaConfigurationProviderTest.java
deleted file mode 100644
index 6e558d7..0000000
--- a/java7/core/src/test/java/org/apache/tamaya/core/test/provider/JavaConfigurationProviderTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.core.test.provider;
-
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.core.provider.JavaConfigurationProvider;
-import org.apache.tamaya.spi.PropertySource;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.Collection;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.hasSize;
-import static org.hamcrest.Matchers.notNullValue;
-
-public class JavaConfigurationProviderTest {
-
-    @Test
-    public void testJavaConfigurationProvider() {
-
-        Collection<PropertySource> propertySources = new JavaConfigurationProvider().getPropertySources();
-
-        assertThat(propertySources, notNullValue());
-        assertThat(propertySources, hasSize(1));
-
-        PropertySource propertySource = propertySources.iterator().next();
-
-        assertThat(propertySource.getProperties().keySet(), hasSize(5));
-
-        for (int i = 1; i < 6; i++) {
-            String key = "confkey" + i;
-            String value = "javaconf-value" + i;
-
-            Assert.assertEquals(value, propertySource.get(key));
-
-            // check if we had our key in configuration.current
-            Assert.assertTrue(ConfigurationProvider.getConfiguration().getProperties().containsKey(key));
-            Assert.assertEquals(value, ConfigurationProvider.getConfiguration().get(key));
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/58bda32a/java8/api/src/main/java/org/apache/tamaya/TypeLiteral.java
----------------------------------------------------------------------
diff --git a/java8/api/src/main/java/org/apache/tamaya/TypeLiteral.java b/java8/api/src/main/java/org/apache/tamaya/TypeLiteral.java
index c77cadb..b29a699 100644
--- a/java8/api/src/main/java/org/apache/tamaya/TypeLiteral.java
+++ b/java8/api/src/main/java/org/apache/tamaya/TypeLiteral.java
@@ -23,44 +23,54 @@ import java.lang.reflect.Type;
 
 
 /**
-* <p>Class for instantiation of objects that represent parameterized types
-* with current parameters.</p>
-* <p>
-* <p>An object that represents a parameterized type may be obtained by
-* subclassing <tt>TypeLiteral</tt>.</p>
-* <p>
-* <pre>
-* TypeLiteral&lt;List&lt;Integer&gt;&gt; stringListType = new TypeLiteral&lt;List&lt;Integer&gt;&gt;() {};
-* </pre>
-*
-* @param <T> the type, including all type parameters
-*/
+ * <p>Class for instantiation of objects that represent parameterized types
+ * with current parameters.</p>
+ * <p>
+ * <p>An object that represents a parameterized type may be obtained by
+ * subclassing <tt>TypeLiteral</tt>.</p>
+ * <p>
+ * <pre>
+ * TypeLiteral&lt;List&lt;Integer&gt;&gt; stringListType = new TypeLiteral&lt;List&lt;Integer&gt;&gt;() {};
+ * </pre>
+ *
+ * @param <T> the type, including all type parameters
+ */
 public class TypeLiteral<T> implements Serializable {
 
     private static final long serialVersionUID = 1L;
-    private Type type;
+    private static final Type[] EMPTY_TYPE_ARRAY = new Type[0];
+    /** The current defined type. */
+    private Type definedType;
 
-    protected TypeLiteral(Type type) {
-        this.type = type;
+    /**
+     * Constructor.
+     * @param definedType the defined type.
+     */
+    protected TypeLiteral(Type definedType) {
+        this.definedType = definedType;
     }
 
     /**
      * Constructor only for directly implemeting a TypeLiteral hereby dynamically implementing a generic interface.
      */
-    protected TypeLiteral() { }
+    protected TypeLiteral() {
+        this.definedType = getDefinedType(this.getClass());
+    }
 
     /**
      * Creates a new TypeLiteral based on a given type.
+     *
      * @param type the type , not null.
-     * @param <R> the literal generic type.
+     * @param <R>  the literal generic type.
      * @return the corresponding TypeLiteral, never null.
      */
-    public static <R> TypeLiteral<R> of(Type type){
+    public static <R> TypeLiteral<R> of(Type type) {
         return new TypeLiteral<>(type);
     }
 
     /**
      * Evaluates the subclass of a TypeLiteral instance.
+     *
      * @param clazz the typeliteral class (could be an anonymous class).
      * @return the subclass implemented by the TypeLiteral.
      */
@@ -77,107 +87,130 @@ public class TypeLiteral<T> implements Serializable {
 
     /**
      * Checks the current implemented generic interfaces and evaluates the given single type parameter.
-     * @param clazz the class to check, not null.
+     *
+     * @param clazz         the class to check, not null.
      * @param interfaceType the interface type to be checked, not null.
      * @return the generic type parameter, or null, if it cannot be evaluated.
      */
-    public static Type getGenericInterfaceTypeParameter(Class<?> clazz, Class<?> interfaceType) {
-        for(Type type: clazz.getGenericInterfaces()){
-            if(interfaceType!=null && !interfaceType.equals(type)){
-                continue;
-            }
+    public static Type[] getGenericInterfaceTypeParameters(Class<?> clazz, Class<?> interfaceType) {
+        for (Type type : clazz.getGenericInterfaces()) {
             if (type instanceof ParameterizedType) {
                 ParameterizedType parameterizedType = (ParameterizedType) type;
-                if (parameterizedType.getActualTypeArguments().length == 1) {
-                    return parameterizedType.getActualTypeArguments()[0];
+                if(parameterizedType.getRawType().equals(interfaceType)){
+                    return parameterizedType.getActualTypeArguments();
                 }
             }
         }
-        return null;
+        return EMPTY_TYPE_ARRAY;
     }
 
     /**
      * Method that checks the class's type for a generic interface implementation type.
-     * @param clazz the type class, not null.
-     * @param interfaceType the generic interface to check (there could be multiple ones implemented by a class).
+     *
+     * @param type         the type, not null.
      * @return the generic type parameter of the given single type generic interfaceType, or null.
      */
-    public static Type getTypeParameter(Class<?> clazz, Class<?> interfaceType) {
-        Type[] types = clazz.getGenericInterfaces();
-        for(Type type:types) {
-            if (type instanceof ParameterizedType) {
-                ParameterizedType parameterizedType = (ParameterizedType) type;
-                if(interfaceType==null || parameterizedType.getRawType().equals(interfaceType)){
-                    if (parameterizedType.getActualTypeArguments().length == 1) {
-                        return parameterizedType.getActualTypeArguments()[0];
-                    }
-                }
-            }
+    public static Type[] getTypeParameters(Type type) {
+        if (type instanceof ParameterizedType) {
+            ParameterizedType parameterizedType = (ParameterizedType) type;
+            return parameterizedType.getActualTypeArguments();
         }
-        return null;
+        return EMPTY_TYPE_ARRAY;
     }
 
-    /**
-     * Returns basic Java type.
-     * @return the actual type represented by this object
-     */
     public final Type getType() {
-        if (type == null) {
-            Class<?> typeLiteralSubclass = getTypeLiteralSubclass(this.getClass());
-            if (typeLiteralSubclass == null) {
-                throw new RuntimeException(getClass() + " is not a subclass of TypeLiteral");
-            }
-            type = getTypeParameter(typeLiteralSubclass, null);
-            if (type == null) {
-                throw new RuntimeException(getClass() + " does not specify the type parameter T of TypeLiteral<T>");
-            }
-        }
-        return type;
+        return definedType;
     }
 
     /**
-     * Get the raw type of the current type.
-     * @return the raw type represented by this object
-     */
-    @SuppressWarnings("unchecked")
+      * Returns basic raw Java type.
+      *
+      * @return the actual type represented by this object
+      */
     public final Class<T> getRawType() {
-        Type type = getType();
-        if (type instanceof Class) {
-            return (Class<T>) type;
-        } else if (type instanceof ParameterizedType) {
-            return (Class<T>) ((ParameterizedType) type).getRawType();
-        } else if (type instanceof GenericArrayType) {
-            return (Class<T>) Object[].class;
+        Class<T> rawType = null;
+
+        if (this.definedType instanceof Class) {
+            rawType = (Class<T>) this.definedType;
+        } else if (this.definedType instanceof ParameterizedType) {
+            ParameterizedType pt = (ParameterizedType) this.definedType;
+            rawType = (Class<T>) pt.getRawType();
+
+        } else if (this.definedType instanceof GenericArrayType) {
+            rawType = (Class<T>) Object[].class;
+        } else {
+            throw new RuntimeException("Illegal type for the Type Literal Class");
+        }
+
+        return rawType;
+    }
+
+
+    protected Type getDefinedType(Class<?> clazz) {
+        Type type = null;
+
+        if (clazz == null) {
+            throw new RuntimeException("Class parameter clazz can not be null");
+        }
+
+        Type superClazz = clazz.getGenericSuperclass();
+
+        if (superClazz.equals(Object.class)) {
+            throw new RuntimeException("Super class must be parametrized type");
+        } else if (superClazz instanceof ParameterizedType) {
+            ParameterizedType pt = (ParameterizedType) superClazz;
+            Type[] actualArgs = pt.getActualTypeArguments();
+
+            if (actualArgs.length == 1) {
+                type = actualArgs[0];
+
+            } else {
+                throw new RuntimeException("More than one parametric type");
+            }
+
         } else {
-            throw new RuntimeException("Illegal type");
+            type = getDefinedType((Class<?>) superClazz);
         }
+
+        return type;
+    }
+
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((definedType == null) ? 0 : definedType.hashCode());
+        return result;
     }
 
     @Override
-    public boolean equals(Object o) {
-        if (this == o){
+    public boolean equals(Object obj) {
+        if (this == obj) {
             return true;
         }
-        if (!(o instanceof TypeLiteral)){
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
             return false;
         }
-        TypeLiteral that = (TypeLiteral) o;
-        if (type != null ? !type.equals(that.type) : that.type != null){
+        TypeLiteral other = (TypeLiteral) obj;
+        if (definedType == null) {
+            if (other.definedType != null) {
+                return false;
+            }
+        } else if (!definedType.equals(other.definedType)) {
             return false;
         }
         return true;
     }
 
-    @Override
-    public int hashCode() {
-        int result = type != null ? type.hashCode() : 0;
-        return result;
-    }
 
     @Override
     public String toString() {
         return "TypeLiteral{" +
-                "type=" + type +
+                "type=" + definedType +
                 '}';
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/58bda32a/java8/api/src/test/java/org/apache/tamaya/TypeLiteralTest.java
----------------------------------------------------------------------
diff --git a/java8/api/src/test/java/org/apache/tamaya/TypeLiteralTest.java b/java8/api/src/test/java/org/apache/tamaya/TypeLiteralTest.java
new file mode 100644
index 0000000..783d6bf
--- /dev/null
+++ b/java8/api/src/test/java/org/apache/tamaya/TypeLiteralTest.java
@@ -0,0 +1,62 @@
+/*
+ * 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;
+
+import org.junit.Test;
+
+import javax.annotation.Priority;
+import java.util.ArrayList;
+import java.util.List;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Tests for the {@link org.apache.tamaya.TypeLiteral} class.
+ */
+public class TypeLiteralTest {
+
+    @Test
+    public void test_constrcutor(){
+        TypeLiteral<List<String>> listTypeLiteral = new TypeLiteral<List<String>>(){};
+        assertEquals(List.class, listTypeLiteral.getRawType());
+        assertEquals(String.class, TypeLiteral.getTypeParameters(listTypeLiteral.getType())[0]);
+    }
+
+    @Test
+    public void test_of(){
+        class MyListClass extends ArrayList<String>{};
+        TypeLiteral<MyListClass> listTypeLiteral = TypeLiteral.of(MyListClass.class);
+        assertEquals(MyListClass.class, listTypeLiteral.getRawType());
+        assertEquals(MyListClass.class, listTypeLiteral.getType());
+    }
+
+    @Test
+    public void test_getTypeParameter(){
+        TypeLiteral<List<String>> listTypeLiteral = new TypeLiteral<List<String>>(){};
+        assertEquals(List.class, listTypeLiteral.getRawType());
+        assertEquals(String.class, TypeLiteral.getTypeParameters(listTypeLiteral.getType())[0]);
+    }
+
+    @Test
+    public void test_getGenericInterfaceTypeParameter(){
+        class MyListClass extends ArrayList<String> implements List<String>{};
+        assertEquals(String.class, TypeLiteral.getGenericInterfaceTypeParameters(MyListClass.class, List.class)[0]);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/58bda32a/java8/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java
----------------------------------------------------------------------
diff --git a/java8/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java b/java8/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java
index b4d1e75..333572e 100644
--- a/java8/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java
+++ b/java8/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java
@@ -68,7 +68,7 @@ public class PropertyConverterManager {
      */
     protected void initConverters() {
         for(PropertyConverter conv: ServiceContextManager.getServiceContext().getServices(PropertyConverter.class)){
-            Type type = TypeLiteral.getTypeParameter(conv.getClass(), PropertyConverter.class);
+            Type type = TypeLiteral.getGenericInterfaceTypeParameters(conv.getClass(), PropertyConverter.class)[0];
             register(TypeLiteral.of(type), conv);
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/58bda32a/java8/core/src/test/java/org/apache/tamaya/core/propertysource/BasePropertySourceTest.java
----------------------------------------------------------------------
diff --git a/java8/core/src/test/java/org/apache/tamaya/core/propertysource/BasePropertySourceTest.java b/java8/core/src/test/java/org/apache/tamaya/core/propertysource/BasePropertySourceTest.java
new file mode 100644
index 0000000..8d3f086
--- /dev/null
+++ b/java8/core/src/test/java/org/apache/tamaya/core/propertysource/BasePropertySourceTest.java
@@ -0,0 +1,104 @@
+/*
+ * 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.core.propertysource;
+
+import org.apache.tamaya.core.propertysource.BasePropertySource;
+import org.apache.tamaya.spi.PropertySource;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+public class BasePropertySourceTest {
+
+    @Test
+    public void testGetOrdinal() {
+
+        PropertySource defaultPropertySource = new BasePropertySource(56) {
+
+            @Override
+            public String getName() {
+                return "testWithDefault";
+            }
+
+            @Override
+            public String get(String key) {
+                return null;
+            }
+
+            @Override
+            public Map<String, String> getProperties() {
+                return Collections.emptyMap();
+            }
+        };
+
+        Assert.assertEquals(56, defaultPropertySource.getOrdinal());
+        Assert.assertEquals(1000, new OverriddenOrdinalPropertySource().getOrdinal());
+
+        // propertySource with invalid ordinal
+        Assert.assertEquals(1, new OverriddenInvalidOrdinalPropertySource().getOrdinal());
+    }
+
+    @Test
+    public void testGet() {
+        Assert.assertEquals("1000", new OverriddenOrdinalPropertySource().get(PropertySource.TAMAYA_ORDINAL));
+    }
+
+    private static class OverriddenOrdinalPropertySource extends BasePropertySource {
+
+        private OverriddenOrdinalPropertySource() {
+            super(250);
+        }
+
+        @Override
+        public String getName() {
+            return "overriddenOrdinal";
+        }
+
+        @Override
+        public Map<String, String> getProperties() {
+            Map<String, String> map = new HashMap<>(1);
+            map.put(PropertySource.TAMAYA_ORDINAL, "1000");
+            return map;
+        }
+    }
+
+    private static class OverriddenInvalidOrdinalPropertySource extends BasePropertySource {
+
+        private OverriddenInvalidOrdinalPropertySource() {
+            super(1);
+        }
+
+        @Override
+        public String getName() {
+            return "overriddenInvalidOrdinal";
+        }
+
+        @Override
+        public Map<String, String> getProperties() {
+            Map<String, String> map = new HashMap<>(1);
+            map.put(PropertySource.TAMAYA_ORDINAL, "invalid");
+            return map;
+        }
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/58bda32a/java8/core/src/test/java/org/apache/tamaya/core/propertysource/EnvironmentPropertySourceTest.java
----------------------------------------------------------------------
diff --git a/java8/core/src/test/java/org/apache/tamaya/core/propertysource/EnvironmentPropertySourceTest.java b/java8/core/src/test/java/org/apache/tamaya/core/propertysource/EnvironmentPropertySourceTest.java
new file mode 100644
index 0000000..995c7ad
--- /dev/null
+++ b/java8/core/src/test/java/org/apache/tamaya/core/propertysource/EnvironmentPropertySourceTest.java
@@ -0,0 +1,41 @@
+package org.apache.tamaya.core.propertysource;
+
+import org.junit.Test;
+
+import java.util.Map;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class EnvironmentPropertySourceTest {
+
+    private EnvironmentPropertySource envPropertySource = new EnvironmentPropertySource();
+
+    @Test
+    public void testGetOrdinal() throws Exception {
+        assertEquals(EnvironmentPropertySource.DEFAULT_ORDINAL, envPropertySource.getOrdinal());
+    }
+
+    @Test
+    public void testGetName() throws Exception {
+        assertEquals("environment-properties", envPropertySource.getName());
+    }
+
+    @Test
+    public void testGet() throws Exception {
+        for (Map.Entry<String, String> envEntry : System.getenv().entrySet()) {
+            assertEquals(envPropertySource.get(envEntry.getKey()), envEntry.getValue());
+        }
+    }
+
+    @Test
+    public void testGetProperties() throws Exception {
+        Map<String, String> props = envPropertySource.getProperties();
+        assertEquals(System.getenv(), props);
+    }
+
+    @Test
+    public void testIsScannable() throws Exception {
+        assertTrue(envPropertySource.isScannable());
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/58bda32a/java8/core/src/test/java/org/apache/tamaya/core/propertysource/PropertiesFilePropertySourceTest.java
----------------------------------------------------------------------
diff --git a/java8/core/src/test/java/org/apache/tamaya/core/propertysource/PropertiesFilePropertySourceTest.java b/java8/core/src/test/java/org/apache/tamaya/core/propertysource/PropertiesFilePropertySourceTest.java
new file mode 100644
index 0000000..d4ef659
--- /dev/null
+++ b/java8/core/src/test/java/org/apache/tamaya/core/propertysource/PropertiesFilePropertySourceTest.java
@@ -0,0 +1,64 @@
+/*
+ * 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.core.propertysource;
+
+import org.apache.tamaya.core.propertysource.SimplePropertySource;
+import org.apache.tamaya.spi.PropertySource;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class PropertiesFilePropertySourceTest {
+
+    private SimplePropertySource testfilePropertySource;
+    private SimplePropertySource overrideOrdinalPropertySource;
+
+
+    @Before
+    public void initTest() {
+        testfilePropertySource = new SimplePropertySource(Thread.currentThread().getContextClassLoader().getResource("testfile.properties"));
+        overrideOrdinalPropertySource = new SimplePropertySource(Thread.currentThread().getContextClassLoader().getResource("overrideOrdinal.properties"));
+    }
+
+
+    @Test
+    public void testGetOrdinal() {
+        Assert.assertEquals(0, testfilePropertySource.getOrdinal());
+        Assert.assertEquals(Integer.parseInt(overrideOrdinalPropertySource.get(PropertySource.TAMAYA_ORDINAL)), overrideOrdinalPropertySource.getOrdinal());
+    }
+
+
+    @Test
+    public void testGet() {
+        Assert.assertEquals("val3", testfilePropertySource.get("key3"));
+        Assert.assertEquals("myval5", overrideOrdinalPropertySource.get("mykey5"));
+        Assert.assertNull(testfilePropertySource.get("nonpresentkey"));
+    }
+
+
+    @Test
+    public void testGetProperties() throws Exception {
+        Assert.assertEquals(5, testfilePropertySource.getProperties().size());
+        Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key1"));
+        Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key2"));
+        Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key3"));
+        Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key4"));
+        Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key5"));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/58bda32a/java8/core/src/test/java/org/apache/tamaya/core/propertysource/SystemPropertySourceTest.java
----------------------------------------------------------------------
diff --git a/java8/core/src/test/java/org/apache/tamaya/core/propertysource/SystemPropertySourceTest.java b/java8/core/src/test/java/org/apache/tamaya/core/propertysource/SystemPropertySourceTest.java
new file mode 100644
index 0000000..14b136b
--- /dev/null
+++ b/java8/core/src/test/java/org/apache/tamaya/core/propertysource/SystemPropertySourceTest.java
@@ -0,0 +1,101 @@
+/*
+ * 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.core.propertysource;
+
+import org.apache.tamaya.core.propertysource.SystemPropertySource;
+import org.apache.tamaya.spi.PropertySource;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Map;
+import java.util.Properties;
+
+public class SystemPropertySourceTest {
+
+    private SystemPropertySource testPropertySource = new SystemPropertySource();
+
+
+    @Test
+    public void testGetOrdinal() throws Exception {
+
+        // test the default ordinal
+        Assert.assertEquals(SystemPropertySource.DEFAULT_ORDINAL, testPropertySource.getOrdinal());
+
+        // set the ordinal to 1000
+        System.setProperty(PropertySource.TAMAYA_ORDINAL, "1000");
+        Assert.assertEquals(1000, new SystemPropertySource().getOrdinal());
+        // currently its not possible to change ordinal at runtime
+
+        // reset it to not destroy other tests!!
+        System.clearProperty(PropertySource.TAMAYA_ORDINAL);
+    }
+
+    @Test
+    public void testGetName() throws Exception {
+        Assert.assertEquals("system-properties", new SystemPropertySource().getName());
+    }
+
+    @Test
+    public void testGet() throws Exception {
+        String propertyKeyToCheck = System.getProperties().stringPropertyNames().iterator().next();
+
+        String property = testPropertySource.get(propertyKeyToCheck);
+        Assert.assertTrue("Property '" + propertyKeyToCheck + "' is not present in " + SystemPropertySource.class.getSimpleName(),
+                          property != null);
+        Assert.assertEquals(System.getProperty(propertyKeyToCheck), property);
+
+
+    }
+
+    @Test
+    public void testGetProperties() throws Exception {
+        checkWithSystemProperties(testPropertySource.getProperties());
+
+        // modify system properties
+        System.setProperty("test", "myTestVal");
+
+        checkWithSystemProperties(testPropertySource.getProperties());
+
+        // cleanup
+        System.clearProperty("test");
+
+        // no modifaction
+        try {
+            testPropertySource.getProperties().put("add.new.keys", "must throw exception");
+            Assert.fail(UnsupportedOperationException.class.getName() + " expected");
+        }
+        catch (UnsupportedOperationException e) {
+            // expected -> all is fine
+        }
+    }
+
+    private void checkWithSystemProperties(Map<String, String> toCheck) {
+        Properties systemEntries = System.getProperties();
+
+        Assert.assertEquals("size of System.getProperties().entrySet() must be the same as SystemPropertySrouce.getProperties().entrySet()",
+                            systemEntries.entrySet().size(), toCheck.size());
+
+        for (Map.Entry<String, String> propertySourceEntry : toCheck.entrySet()) {
+
+            Assert.assertEquals("Entry values for key '" + propertySourceEntry.getKey() + "' do not match",
+                                systemEntries.getProperty(propertySourceEntry.getKey()), propertySourceEntry.getValue());
+        }
+
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/58bda32a/java8/core/src/test/java/org/apache/tamaya/core/provider/JavaConfigurationProviderTest.java
----------------------------------------------------------------------
diff --git a/java8/core/src/test/java/org/apache/tamaya/core/provider/JavaConfigurationProviderTest.java b/java8/core/src/test/java/org/apache/tamaya/core/provider/JavaConfigurationProviderTest.java
new file mode 100644
index 0000000..6d16707
--- /dev/null
+++ b/java8/core/src/test/java/org/apache/tamaya/core/provider/JavaConfigurationProviderTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.core.provider;
+
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.core.provider.JavaConfigurationProvider;
+import org.apache.tamaya.spi.PropertySource;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.Collection;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.hasSize;
+import static org.hamcrest.Matchers.notNullValue;
+
+public class JavaConfigurationProviderTest {
+
+    @Test
+    public void testJavaConfigurationProvider() {
+
+        Collection<PropertySource> propertySources = new JavaConfigurationProvider().getPropertySources();
+
+        assertThat(propertySources, notNullValue());
+        assertThat(propertySources, hasSize(1));
+
+        PropertySource propertySource = propertySources.iterator().next();
+
+        assertThat(propertySource.getProperties().keySet(), hasSize(5));
+
+        for (int i = 1; i < 6; i++) {
+            String key = "confkey" + i;
+            String value = "javaconf-value" + i;
+
+            Assert.assertEquals(value, propertySource.get(key));
+
+            // check if we had our key in configuration.current
+            Assert.assertTrue(ConfigurationProvider.getConfiguration().getProperties().containsKey(key));
+            Assert.assertEquals(value, ConfigurationProvider.getConfiguration().getOptional(key).get());
+        }
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/58bda32a/java8/core/src/test/java/org/apache/tamaya/core/test/propertysource/BasePropertySourceTest.java
----------------------------------------------------------------------
diff --git a/java8/core/src/test/java/org/apache/tamaya/core/test/propertysource/BasePropertySourceTest.java b/java8/core/src/test/java/org/apache/tamaya/core/test/propertysource/BasePropertySourceTest.java
deleted file mode 100644
index a8325c6..0000000
--- a/java8/core/src/test/java/org/apache/tamaya/core/test/propertysource/BasePropertySourceTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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.core.test.propertysource;
-
-import org.apache.tamaya.core.propertysource.BasePropertySource;
-import org.apache.tamaya.spi.PropertySource;
-import org.junit.Assert;
-import org.junit.Test;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-public class BasePropertySourceTest {
-
-    @Test
-    public void testGetOrdinal() {
-
-        PropertySource defaultPropertySource = new BasePropertySource(56) {
-
-            @Override
-            public String getName() {
-                return "testWithDefault";
-            }
-
-            @Override
-            public String get(String key) {
-                return null;
-            }
-
-            @Override
-            public Map<String, String> getProperties() {
-                return Collections.emptyMap();
-            }
-        };
-
-        Assert.assertEquals(56, defaultPropertySource.getOrdinal());
-        Assert.assertEquals(1000, new OverriddenOrdinalPropertySource().getOrdinal());
-
-        // propertySource with invalid ordinal
-        Assert.assertEquals(1, new OverriddenInvalidOrdinalPropertySource().getOrdinal());
-    }
-
-    @Test
-    public void testGet() {
-        Assert.assertEquals("1000", new OverriddenOrdinalPropertySource().get(PropertySource.TAMAYA_ORDINAL));
-    }
-
-    private static class OverriddenOrdinalPropertySource extends BasePropertySource {
-
-        private OverriddenOrdinalPropertySource() {
-            super(250);
-        }
-
-        @Override
-        public String getName() {
-            return "overriddenOrdinal";
-        }
-
-        @Override
-        public Map<String, String> getProperties() {
-            Map<String, String> map = new HashMap<>(1);
-            map.put(PropertySource.TAMAYA_ORDINAL, "1000");
-            return map;
-        }
-    }
-
-    private static class OverriddenInvalidOrdinalPropertySource extends BasePropertySource {
-
-        private OverriddenInvalidOrdinalPropertySource() {
-            super(1);
-        }
-
-        @Override
-        public String getName() {
-            return "overriddenInvalidOrdinal";
-        }
-
-        @Override
-        public Map<String, String> getProperties() {
-            Map<String, String> map = new HashMap<>(1);
-            map.put(PropertySource.TAMAYA_ORDINAL, "invalid");
-            return map;
-        }
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/58bda32a/java8/core/src/test/java/org/apache/tamaya/core/test/propertysource/PropertiesFilePropertySourceTest.java
----------------------------------------------------------------------
diff --git a/java8/core/src/test/java/org/apache/tamaya/core/test/propertysource/PropertiesFilePropertySourceTest.java b/java8/core/src/test/java/org/apache/tamaya/core/test/propertysource/PropertiesFilePropertySourceTest.java
deleted file mode 100644
index 9fef3be..0000000
--- a/java8/core/src/test/java/org/apache/tamaya/core/test/propertysource/PropertiesFilePropertySourceTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.core.test.propertysource;
-
-import org.apache.tamaya.core.propertysource.SimplePropertySource;
-import org.apache.tamaya.spi.PropertySource;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-public class PropertiesFilePropertySourceTest {
-
-    private SimplePropertySource testfilePropertySource;
-    private SimplePropertySource overrideOrdinalPropertySource;
-
-
-    @Before
-    public void initTest() {
-        testfilePropertySource = new SimplePropertySource(Thread.currentThread().getContextClassLoader().getResource("testfile.properties"));
-        overrideOrdinalPropertySource = new SimplePropertySource(Thread.currentThread().getContextClassLoader().getResource("overrideOrdinal.properties"));
-    }
-
-
-    @Test
-    public void testGetOrdinal() {
-        Assert.assertEquals(0, testfilePropertySource.getOrdinal());
-        Assert.assertEquals(Integer.parseInt(overrideOrdinalPropertySource.get(PropertySource.TAMAYA_ORDINAL)), overrideOrdinalPropertySource.getOrdinal());
-    }
-
-
-    @Test
-    public void testGet() {
-        Assert.assertEquals("val3", testfilePropertySource.get("key3"));
-        Assert.assertEquals("myval5", overrideOrdinalPropertySource.get("mykey5"));
-        Assert.assertNull(testfilePropertySource.get("nonpresentkey"));
-    }
-
-
-    @Test
-    public void testGetProperties() throws Exception {
-        Assert.assertEquals(5, testfilePropertySource.getProperties().size());
-        Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key1"));
-        Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key2"));
-        Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key3"));
-        Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key4"));
-        Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key5"));
-    }
-}


Mime
View raw message