You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by st...@apache.org on 2018/03/05 15:15:12 UTC

[2/4] deltaspike git commit: DELTASPIKE-1322 move config internas to impl

DELTASPIKE-1322 move config internas to impl


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/f56845c4
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/f56845c4
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/f56845c4

Branch: refs/heads/master
Commit: f56845c4ff08be03e61d293e54d7bcae72dccf30
Parents: ca6b722
Author: Mark Struberg <st...@apache.org>
Authored: Mon Mar 5 12:29:35 2018 +0100
Committer: Mark Struberg <st...@apache.org>
Committed: Mon Mar 5 12:29:35 2018 +0100

----------------------------------------------------------------------
 .../deltaspike/core/api/config/Config.java      |  68 ++++
 .../core/api/config/ConfigResolver.java         |  56 +++-
 .../deltaspike/core/util/ServiceUtils.java      |  17 +-
 .../activation/EditableTestDeactivator.java     |  47 ---
 ...jectStageDependentClassDeactivationTest.java | 111 -------
 .../test/api/config/ConfigResolverTest.java     | 333 -------------------
 .../test/api/config/TestConfigSource.java       | 141 --------
 .../api/config/TestConfigSourceProvider.java    | 115 -------
 .../test/api/config/TypedResolverTest.java      | 235 -------------
 ...ache.deltaspike.core.spi.config.ConfigSource |  20 --
 ...taspike.core.spi.config.ConfigSourceProvider |  20 --
 .../deltaspike/core/impl/config/ConfigImpl.java | 156 +++++++++
 .../core/impl/config/ConfigProviderImpl.java    |  96 ++++++
 ...ore.api.config.ConfigResolver.ConfigProvider |  20 ++
 .../core/api/config/ConfigResolverTest.java     | 333 +++++++++++++++++++
 .../test/core/api/config/TestConfigSource.java  | 142 ++++++++
 .../api/config/TestConfigSourceProvider.java    | 115 +++++++
 .../test/core/api/config/TypedResolverTest.java | 235 +++++++++++++
 .../activation/EditableTestDeactivator.java     |  47 +++
 ...jectStageDependentClassDeactivationTest.java | 111 +++++++
 ...ache.deltaspike.core.spi.config.ConfigSource |  20 ++
 ...taspike.core.spi.config.ConfigSourceProvider |  20 ++
 22 files changed, 1434 insertions(+), 1024 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/f56845c4/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/Config.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/Config.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/Config.java
new file mode 100644
index 0000000..2422c7b
--- /dev/null
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/Config.java
@@ -0,0 +1,68 @@
+/*
+ * 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.deltaspike.core.api.config;
+
+import org.apache.deltaspike.core.spi.config.ConfigFilter;
+import org.apache.deltaspike.core.spi.config.ConfigSource;
+
+import java.util.List;
+
+/**
+ * The Configuration for an application/ClassLoader.
+ */
+public interface Config
+{
+
+    /**
+     * @return all the current ConfigSources for this Config
+     */
+    ConfigSource[] getConfigSources();
+
+    /**
+     * This method can be used for programmatically adding {@link ConfigSource}s.
+     * It is not needed for normal 'usage' by end users, but only for Extension Developers!
+     *
+     * @param configSourcesToAdd the ConfigSources to add
+     */
+    void addConfigSources(List<ConfigSource> configSourcesToAdd);
+
+    /**
+     * @return the {@link ConfigFilter}s for the current application.
+     */
+    List<ConfigFilter> getConfigFilters();
+
+    /**
+     * Add a {@link ConfigFilter} to the ConfigResolver. This will only affect the current WebApp (or more precisely the
+     * current ClassLoader and it's children).
+     *
+     * @param configFilter
+     */
+    void addConfigFilter(ConfigFilter configFilter);
+
+    /**
+     * Filter the configured value.
+     * This can e.g. be used for decryption.
+     * @param key the key of the config property
+     * @param value to be filtered
+     * @param forLog whether the value is intended to be presented to some humans somehow.
+     *               If filtered for logging, then secrets might get starred out '*****'.
+     * @return the filtered value
+     */
+    String filterConfigValue(String key, String value, boolean forLog);
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/f56845c4/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java
index 9082584..4339cca 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java
@@ -24,8 +24,10 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.ServiceLoader;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.TimeUnit;
@@ -92,12 +94,24 @@ public final class ConfigResolver
     private static Map<ClassLoader, List<ConfigFilter>> configFilters
         = new ConcurrentHashMap<ClassLoader, List<ConfigFilter>>();
 
+    private static ConfigProvider configProvider;
 
     private ConfigResolver()
     {
         // this is a utility class which doesn't get instantiated.
     }
 
+    public static Config getConfig()
+    {
+        ClassLoader cl = ClassUtils.getClassLoader(null);
+        return getConfig(cl);
+    }
+
+    public static Config getConfig(ClassLoader cl)
+    {
+        return getConfigProvider().getConfig(cl);
+    }
+
     /**
      * This method can be used for programmatically adding {@link ConfigSource}s.
      * It is not needed for normal 'usage' by end users, but only for Extension Developers!
@@ -356,9 +370,14 @@ public final class ConfigResolver
     
     private static String getPropertyValue(String key, ConfigResolverContext configResolverContext)
     {
-        ConfigSource[] appConfigSources = getConfigSources();
+        if (key == null)
+        {
+            return null;
+        }
 
+        ConfigSource[] appConfigSources = getConfigSources();
         String value;
+
         for (ConfigSource configSource : appConfigSources)
         {
             value = configSource.getPropertyValue(key);
@@ -1246,4 +1265,39 @@ public final class ConfigResolver
 
     }
 
+
+    private static ConfigProvider getConfigProvider()
+    {
+        if (configProvider == null)
+        {
+            synchronized (ConfigResolver.class)
+            {
+                if (configProvider == null)
+                {
+                    Iterator<ConfigProvider> configProviders = ServiceLoader.load(ConfigProvider.class).iterator();
+                    if (!configProviders.hasNext())
+                    {
+                        throw new RuntimeException("Could not load ConfigProvider");
+                    }
+                    configProvider = configProviders.next();
+
+                    if (configProviders.hasNext())
+                    {
+                        throw new RuntimeException("Found more than one ConfigProvider");
+                    }
+                }
+            }
+        }
+        return configProvider;
+    }
+
+
+    public interface ConfigProvider
+    {
+        Config getConfig();
+
+        Config getConfig(ClassLoader cl);
+
+        void releaseConfig(ClassLoader cl);
+    }
 }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/f56845c4/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ServiceUtils.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ServiceUtils.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ServiceUtils.java
index 92fa6c4..c6b7952 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ServiceUtils.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ServiceUtils.java
@@ -49,9 +49,24 @@ public abstract class ServiceUtils
     public static <T> List<T> loadServiceImplementations(Class<T> serviceType,
                                                          boolean ignoreServicesWithMissingDependencies)
     {
+        return loadServiceImplementations(serviceType, ignoreServicesWithMissingDependencies, null);
+    }
+
+    public static <T> List<T> loadServiceImplementations(Class<T> serviceType,
+                                                         boolean ignoreServicesWithMissingDependencies,
+                                                         ClassLoader classLoader)
+    {
         List<T> result = new ArrayList<T>();
 
-        Iterator<T> servicesIterator = ServiceLoader.load(serviceType).iterator();
+        Iterator<T> servicesIterator;
+        if (classLoader != null)
+        {
+            servicesIterator = ServiceLoader.load(serviceType, classLoader).iterator();
+        }
+        else
+        {
+            servicesIterator = ServiceLoader.load(serviceType).iterator();
+        }
 
         if (!servicesIterator.hasNext())
         {

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/f56845c4/deltaspike/core/api/src/test/java/org/apache/deltaspike/core/util/activation/EditableTestDeactivator.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/test/java/org/apache/deltaspike/core/util/activation/EditableTestDeactivator.java b/deltaspike/core/api/src/test/java/org/apache/deltaspike/core/util/activation/EditableTestDeactivator.java
deleted file mode 100644
index cd06855..0000000
--- a/deltaspike/core/api/src/test/java/org/apache/deltaspike/core/util/activation/EditableTestDeactivator.java
+++ /dev/null
@@ -1,47 +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.deltaspike.core.util.activation;
-
-import org.apache.deltaspike.core.spi.activation.ClassDeactivator;
-import org.apache.deltaspike.core.spi.activation.Deactivatable;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class EditableTestDeactivator implements ClassDeactivator
-{
-    private static Map<Class<? extends Deactivatable>, Boolean> result = new HashMap<Class<? extends Deactivatable>, Boolean>();
-
-    @Override
-    public Boolean isActivated(Class<? extends Deactivatable> targetClass)
-    {
-        return result.get(targetClass);
-    }
-
-    public static void activate(Class<? extends Deactivatable> classToActivate)
-    {
-        result.put(classToActivate, true);
-    }
-
-    public static void deactivate(Class<? extends Deactivatable> classToActivate)
-    {
-        result.put(classToActivate, false);
-    }
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/f56845c4/deltaspike/core/api/src/test/java/org/apache/deltaspike/core/util/activation/ProjectStageDependentClassDeactivationTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/test/java/org/apache/deltaspike/core/util/activation/ProjectStageDependentClassDeactivationTest.java b/deltaspike/core/api/src/test/java/org/apache/deltaspike/core/util/activation/ProjectStageDependentClassDeactivationTest.java
deleted file mode 100644
index 6ca2a93..0000000
--- a/deltaspike/core/api/src/test/java/org/apache/deltaspike/core/util/activation/ProjectStageDependentClassDeactivationTest.java
+++ /dev/null
@@ -1,111 +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.deltaspike.core.util.activation;
-
-import org.apache.deltaspike.core.api.projectstage.ProjectStage;
-import org.apache.deltaspike.core.spi.activation.Deactivatable;
-import org.apache.deltaspike.core.util.ClassDeactivationUtils;
-import org.apache.deltaspike.core.util.ProjectStageProducer;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class ProjectStageDependentClassDeactivationTest
-{
-    @Test
-    public void deactivationResultInProjectStageUnitTest()
-    {
-        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);
-
-        final Class<? extends Deactivatable> classToCheck = TestDeactivatable.class;
-        EditableTestDeactivator.activate(classToCheck);
-        Assert.assertEquals(true, ClassDeactivationUtils.isActivated(classToCheck));
-
-        EditableTestDeactivator.deactivate(classToCheck);
-        Assert.assertEquals(false, ClassDeactivationUtils.isActivated(classToCheck));
-    }
-
-    @Test
-    public void deactivationResultInProjectStageDevelopment()
-    {
-        ProjectStageProducer.setProjectStage(ProjectStage.Development);
-
-        final Class<? extends Deactivatable> classToCheck = TestDeactivatable.class;
-        EditableTestDeactivator.activate(classToCheck);
-        Assert.assertEquals(true, ClassDeactivationUtils.isActivated(classToCheck));
-
-        EditableTestDeactivator.deactivate(classToCheck);
-        Assert.assertEquals(false, ClassDeactivationUtils.isActivated(classToCheck));
-    }
-
-    @Test
-    public void deactivationResultInProjectStageProduction()
-    {
-        ProjectStageProducer.setProjectStage(ProjectStage.Production);
-
-        final Class<? extends Deactivatable> classToCheck = TestDeactivatable.class;
-        EditableTestDeactivator.activate(classToCheck);
-        Assert.assertEquals(true, ClassDeactivationUtils.isActivated(classToCheck));
-
-        EditableTestDeactivator.deactivate(classToCheck);
-        Assert.assertEquals(true, ClassDeactivationUtils.isActivated(classToCheck)); //due to the cached result
-    }
-
-    @Test
-    public void deactivationResultInProjectStageIntegrationTest()
-    {
-        ProjectStageProducer.setProjectStage(ProjectStage.IntegrationTest);
-
-        final Class<? extends Deactivatable> classToCheck = TestDeactivatable.class;
-        EditableTestDeactivator.activate(classToCheck);
-        Assert.assertEquals(true, ClassDeactivationUtils.isActivated(classToCheck));
-
-        EditableTestDeactivator.deactivate(classToCheck);
-        Assert.assertEquals(true, ClassDeactivationUtils.isActivated(classToCheck)); //due to the cached result
-    }
-
-    @Test
-    public void deactivationResultInProjectStageStaging()
-    {
-        ProjectStageProducer.setProjectStage(ProjectStage.Staging);
-
-        final Class<? extends Deactivatable> classToCheck = TestDeactivatable.class;
-        EditableTestDeactivator.activate(classToCheck);
-        Assert.assertEquals(true, ClassDeactivationUtils.isActivated(classToCheck));
-
-        EditableTestDeactivator.deactivate(classToCheck);
-        Assert.assertEquals(true, ClassDeactivationUtils.isActivated(classToCheck)); //due to the cached result
-    }
-
-    @Test
-    public void deactivationResultInProjectStageSystemTest()
-    {
-        ProjectStageProducer.setProjectStage(ProjectStage.SystemTest);
-
-        final Class<? extends Deactivatable> classToCheck = TestDeactivatable.class;
-        EditableTestDeactivator.activate(classToCheck);
-        Assert.assertEquals(true, ClassDeactivationUtils.isActivated(classToCheck));
-
-        EditableTestDeactivator.deactivate(classToCheck);
-        Assert.assertEquals(true, ClassDeactivationUtils.isActivated(classToCheck)); //due to the cached result
-    }
-
-    private static class TestDeactivatable implements Deactivatable
-    {
-    }
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/f56845c4/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/ConfigResolverTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/ConfigResolverTest.java b/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/ConfigResolverTest.java
deleted file mode 100644
index c8b8c99..0000000
--- a/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/ConfigResolverTest.java
+++ /dev/null
@@ -1,333 +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.deltaspike.test.api.config;
-
-import org.apache.deltaspike.core.api.config.ConfigResolver;
-import org.apache.deltaspike.core.api.projectstage.ProjectStage;
-import org.apache.deltaspike.core.spi.config.ConfigFilter;
-import org.apache.deltaspike.core.spi.config.ConfigSource;
-import org.apache.deltaspike.core.util.ProjectStageProducer;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.Arrays;
-import java.util.List;
-
-@SuppressWarnings("Duplicates")
-public class ConfigResolverTest
-{
-    private static final String DEFAULT_VALUE = "defaultValue";
-
-    @Before
-    public void init()
-    {
-        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);
-    }
-
-    @Test
-    public void testOverruledValue()
-    {
-        String result = ConfigResolver.getPropertyValue("test");
-
-        Assert.assertEquals("test2", result);
-    }
-
-    @Test
-    public void testOrderOfAllValues()
-    {
-        List<String> result = ConfigResolver.getAllPropertyValues("test");
-
-        Assert.assertEquals(2, result.size());
-        Assert.assertEquals("test1", result.get(0));
-        Assert.assertEquals("test2", result.get(1));
-    }
-
-    @Test
-    public void testStandaloneConfigSource()
-    {
-        Assert.assertNull(ConfigResolver.getPropertyValue("notexisting"));
-        Assert.assertEquals("testvalue", ConfigResolver.getPropertyValue("testkey"));
-    }
-
-    @Test
-    public void testGetProjectStageAwarePropertyValue()
-    {
-        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);
-        Assert.assertNull(ConfigResolver.getProjectStageAwarePropertyValue("notexisting", null));
-
-        Assert.assertEquals("testvalue", ConfigResolver.getPropertyValue("testkey"));
-        Assert.assertEquals("unittestvalue", ConfigResolver.getProjectStageAwarePropertyValue("testkey"));
-        Assert.assertEquals("unittestvalue", ConfigResolver.getProjectStageAwarePropertyValue("testkey", null));
-
-        Assert.assertEquals("testvalue", ConfigResolver.getPropertyValue("testkey2"));
-        Assert.assertEquals("testvalue", ConfigResolver.getProjectStageAwarePropertyValue("testkey2"));
-        Assert.assertEquals("testvalue", ConfigResolver.getProjectStageAwarePropertyValue("testkey2", null));
-
-        Assert.assertEquals("testvalue", ConfigResolver.getPropertyValue("testkey3"));
-        Assert.assertEquals("", ConfigResolver.getProjectStageAwarePropertyValue("testkey3"));
-        Assert.assertEquals(DEFAULT_VALUE, ConfigResolver.getProjectStageAwarePropertyValue("testkey3", DEFAULT_VALUE));
-
-        Assert.assertEquals(DEFAULT_VALUE, ConfigResolver.getProjectStageAwarePropertyValue("deltaspike.test.projectstagefallback", DEFAULT_VALUE));
-        Assert.assertEquals("", ConfigResolver.getProjectStageAwarePropertyValue("deltaspike.test.projectstagefallback"));
-
-        Assert.assertEquals(DEFAULT_VALUE, ConfigResolver.resolve("deltaspike.test.projectstagefallback").as(String.class).withDefault(DEFAULT_VALUE).withCurrentProjectStage(true).getValue());
-        Assert.assertEquals("", ConfigResolver.resolve("deltaspike.test.projectstagefallback").as(String.class).withCurrentProjectStage(true).getValue());
-    }
-
-    @Test
-    public void testGetPropertyAwarePropertyValue()
-    {
-        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);
-
-        Assert.assertNull(ConfigResolver.getPropertyAwarePropertyValue("notexisting", null));
-
-        Assert.assertEquals("testvalue", ConfigResolver.getPropertyValue("testkey"));
-        Assert.assertEquals("unittestvalue", ConfigResolver.getPropertyAwarePropertyValue("testkey", "dbvendor"));
-        Assert.assertEquals("unittestvalue", ConfigResolver.getPropertyAwarePropertyValue("testkey", "dbvendor", null));
-
-        Assert.assertEquals("testvalue", ConfigResolver.getPropertyValue("testkey2"));
-        Assert.assertEquals("testvalue", ConfigResolver.getPropertyAwarePropertyValue("testkey2", "dbvendor"));
-        Assert.assertEquals("testvalue", ConfigResolver.getPropertyAwarePropertyValue("testkey2", "dbvendor", null));
-
-        Assert.assertEquals("testvalue", ConfigResolver.getPropertyValue("testkey3"));
-        Assert.assertEquals("", ConfigResolver.getPropertyAwarePropertyValue("testkey3", "dbvendor"));
-        Assert.assertEquals(DEFAULT_VALUE, ConfigResolver.getPropertyAwarePropertyValue("testkey3", "dbvendor", DEFAULT_VALUE));
-
-        Assert.assertEquals("TestDataSource", ConfigResolver.getPropertyAwarePropertyValue("dataSource", "dbvendor"));
-        Assert.assertEquals("PostgreDataSource", ConfigResolver.getPropertyAwarePropertyValue("dataSource", "dbvendor2"));
-        Assert.assertEquals("UnitTestDataSource", ConfigResolver.getPropertyAwarePropertyValue("dataSource", "dbvendorX"));
-
-        Assert.assertEquals("TestDataSource", ConfigResolver.getPropertyAwarePropertyValue("dataSource", "dbvendor", null));
-        Assert.assertEquals("PostgreDataSource", ConfigResolver.getPropertyAwarePropertyValue("dataSource", "dbvendor2", null));
-        Assert.assertEquals("UnitTestDataSource", ConfigResolver.getPropertyAwarePropertyValue("dataSource", "dbvendorX", null));
-        Assert.assertEquals(DEFAULT_VALUE, ConfigResolver.getPropertyAwarePropertyValue("dataSourceX", "dbvendorX", DEFAULT_VALUE));
-    }
-
-    @Test
-    public void testConfigFilter()
-    {
-        ConfigFilter configFilter = new TestConfigFilter();
-
-        Assert.assertEquals("shouldGetDecrypted: value", configFilter.filterValue("somekey.encrypted", "value"));
-        Assert.assertEquals("**********", configFilter.filterValueForLog("somekey.password", "value"));
-
-        ConfigResolver.addConfigFilter(configFilter);
-
-        Assert.assertEquals("shouldGetDecrypted: value", ConfigResolver.getPropertyValue("testkey4.encrypted"));
-        Assert.assertEquals("shouldGetDecrypted: value", ConfigResolver.getProjectStageAwarePropertyValue("testkey4.encrypted"));
-        Assert.assertEquals("shouldGetDecrypted: value", ConfigResolver.getProjectStageAwarePropertyValue("testkey4.encrypted", null));
-        Assert.assertEquals("shouldGetDecrypted: value", ConfigResolver.getPropertyAwarePropertyValue("testkey4.encrypted", "dbvendor"));
-        Assert.assertEquals("shouldGetDecrypted: value", ConfigResolver.getPropertyAwarePropertyValue("testkey4.encrypted", "dbvendor", null));
-
-        List<String> allPropertyValues = ConfigResolver.getAllPropertyValues("testkey4.encrypted");
-        Assert.assertNotNull(allPropertyValues);
-        Assert.assertEquals(1, allPropertyValues.size());
-        Assert.assertEquals("shouldGetDecrypted: value", allPropertyValues.get(0));
-
-    }
-
-    @Test
-    public void testConfigVariableReplacement()
-    {
-        {
-            String url = ConfigResolver.getPropertyValue("deltaspike.test.someapp.soap.endpoint", "", true);
-            Assert.assertEquals("http://localhost:12345/someservice/myendpoint", url);
-        }
-
-        {
-            String url = ConfigResolver.getPropertyValue("deltaspike.test.someapp.soap.endpoint", true);
-            Assert.assertEquals("http://localhost:12345/someservice/myendpoint", url);
-        }
-    }
-
-    @Test
-    public void testConfigVariableReplacementInDefault()
-    {
-        {
-            String url = ConfigResolver.getPropertyValue("deltaspike.test.notexisting",
-                    "url: ${deltaspike.test.host.url}", true);
-            Assert.assertEquals("url: http://localhost:12345", url);
-        }
-
-        {
-            String url = ConfigResolver.getPropertyValue("deltaspike.test.someapp.soap.endpoint", true);
-            Assert.assertEquals("http://localhost:12345/someservice/myendpoint", url);
-        }
-    }
-
-    @Test
-    public void testConfigVariableNotExisting()
-    {
-        {
-            String url = ConfigResolver.getPropertyValue("deltaspike.test.nonexisting.variable", "", true);
-            Assert.assertEquals("${does.not.exist}/someservice/myendpoint", url);
-        }
-        {
-            String url = ConfigResolver.getPropertyValue("deltaspike.test.nonexisting.variable", true);
-            Assert.assertEquals("${does.not.exist}/someservice/myendpoint", url);
-        }
-    }
-
-    @Test
-    public void testConfigVariableRecursiveDeclaration()
-    {
-        String url = ConfigResolver.getPropertyValue("deltaspike.test.recursive.variable1", "", true);
-        Assert.assertEquals("pre-crazy-post/ohgosh/crazy", url);
-
-        ConfigResolver.TypedResolver<String> tr = ConfigResolver.resolve("deltaspike.test.recursive.variable1")
-            .evaluateVariables(true).logChanges(true);
-        Assert.assertEquals("pre-crazy-post/ohgosh/crazy", tr.getValue());
-    }
-
-    @Test
-    public void testTypedResolver_NonExistingValue()
-    {
-        final String key = "non.existing.key";
-
-        ConfigResolver.TypedResolver<String> resolver = ConfigResolver.resolve(key)
-            .logChanges(true);
-
-        Assert.assertNull(resolver.getValue());
-
-        setTestConfigSourceValue(key, "somevalue");
-        Assert.assertEquals("somevalue", resolver.getValue());
-
-        setTestConfigSourceValue(key, null);
-        Assert.assertNull(resolver.getValue());
-    }
-    
-    @Test
-    public void testProjectStageAwarePropertyValueReference_1() {
-        final String expectedFooUrl =
-                "http://bar-dev/services";
-
-        final String actualFooUrl =
-                ConfigResolver.getProjectStageAwarePropertyValue(
-                "foo.url");
-
-        Assert.assertEquals(expectedFooUrl, actualFooUrl);
-    }
-
-    @Test
-    public void testProjectStageAwarePropertyValueReference_2() {
-        final String expected =
-                "projectStageAware-exampleEntry-1-is-tomato-UnitTest";
-
-        final String projectStageAwareExampleEntry1 =
-                ConfigResolver.getProjectStageAwarePropertyValue(
-                "deltaspike.test.exampleEntry-2", 
-                "");
-
-        Assert.assertEquals(expected, projectStageAwareExampleEntry1);
-    }
-
-    @Test
-    public void testConfiguredListValues_WithWhitespace() {
-        List<String> emails = ConfigResolver.resolve("test.list.value.emails").asList().getValue();
-        Assert.assertNotNull(emails);
-        Assert.assertEquals(3, emails.size());
-        Assert.assertTrue(emails.contains("test1@apache.org"));
-        Assert.assertTrue(emails.contains("test2@apache.org"));
-        Assert.assertTrue(emails.contains("test3@apache.org"));
-    }
-
-    @Test
-    public void testConfiguredListValues_WithEscaping() {
-        List<String> escapedValues = ConfigResolver.resolve("test.list.value.escaped.list").asList().getValue();
-        Assert.assertNotNull(escapedValues);
-        Assert.assertEquals(3, escapedValues.size());
-        Assert.assertTrue(escapedValues.contains("val,ue1"));
-        Assert.assertTrue(escapedValues.contains("value2"));
-        Assert.assertTrue(escapedValues.contains("val\\ue3"));
-    }
-
-    @Test
-    public void testConfiguredListValues_OtherType() {
-        List<Integer> intValues = ConfigResolver.resolve("test.list.intvalues").as(Integer.class).asList().getValue();
-        Assert.assertNotNull(intValues);
-        Assert.assertEquals(4, intValues.size());
-        Assert.assertTrue(intValues.contains(3));
-        Assert.assertTrue(intValues.contains(7));
-        Assert.assertTrue(intValues.contains(11));
-        Assert.assertTrue(intValues.contains(17));
-    }
-
-    @Test
-    public void testConfiguredListValues_NotExisting() {
-        List<Integer> intValues = ConfigResolver.resolve("test.list.not_existing").as(Integer.class).asList().getValue();
-        Assert.assertNotNull(intValues);
-        Assert.assertEquals(0, intValues.size());
-    }
-
-    @Test
-    public void testConfiguredListValues_WithDefault() {
-        List<Integer> intValues = ConfigResolver.resolve("test.list.not_existing").as(Integer.class).asList().withDefault(Arrays.asList(99, 88, 77)).getValue();
-        Assert.assertNotNull(intValues);
-        Assert.assertEquals(3, intValues.size());
-        Assert.assertTrue(intValues.contains(99));
-        Assert.assertTrue(intValues.contains(88));
-        Assert.assertTrue(intValues.contains(77));
-    }
-
-    private void setTestConfigSourceValue(String key, String value)
-    {
-        ConfigSource[] configSources = ConfigResolver.getConfigSources();
-        for (ConfigSource configSource : configSources)
-        {
-            if (configSource instanceof TestConfigSource)
-            {
-                if (value == null)
-                {
-                    configSource.getProperties().remove(key);
-                }
-                else
-                {
-                    configSource.getProperties().put(key, value);
-                }
-
-                break;
-            }
-        }
-    }
-
-    public static class TestConfigFilter implements ConfigFilter
-    {
-        @Override
-        public String filterValue(String key, String value)
-        {
-            if (key.contains("encrypted"))
-            {
-                return "shouldGetDecrypted: " + value;
-            }
-            return value;
-        }
-
-        @Override
-        public String filterValueForLog(String key, String value)
-        {
-            if (key.contains("password"))
-            {
-                return "**********";
-            }
-            return value;
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/f56845c4/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/TestConfigSource.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/TestConfigSource.java b/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/TestConfigSource.java
deleted file mode 100644
index f18f7d5..0000000
--- a/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/TestConfigSource.java
+++ /dev/null
@@ -1,141 +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.deltaspike.test.api.config;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.deltaspike.core.spi.config.ConfigSource;
-
-/**
- * Test ConfigSource
- *
- * It statically returns 'testvalue' for the key 'testkey'
- */
-public class TestConfigSource implements ConfigSource
-{
-
-    private int ordinal = 700;
-
-    private Map<String, String> props = new HashMap<String, String>();
-
-
-    public TestConfigSource()
-    {
-        // a ProjectStage overloaded value
-        props.put("testkey", "testvalue");
-        props.put("testkey.UnitTest", "unittestvalue");
-
-        // a value without any overloading
-        props.put("testkey2", "testvalue");
-
-        // a value which got ProjectStage overloaded to an empty value
-        props.put("testkey3", "testvalue");
-        props.put("testkey3.UnitTest", "");
-
-        // now for the PropertyAware tests
-        props.put("dbvendor.UnitTest", "mysql");
-        props.put("dbvendor", "postgresql");
-
-        props.put("dataSource.mysql.Production", "java:/comp/env/MyDs");
-        props.put("dataSource.mysql.UnitTest", "TestDataSource");
-        props.put("dataSource.postgresql", "PostgreDataSource");
-        props.put("dataSource.UnitTest", "UnitTestDataSource");
-        props.put("dataSource", "DefaultDataSource");
-
-        // another one
-        props.put("dbvendor2.Production", "mysql");
-        props.put("dbvendor2", "postgresql");
-
-        props.put("dbvendor3", "h2");
-
-        props.put("testkey4.encrypted", "value");
-        props.put("testkey4.password", "mysecretvalue");
-
-        props.put("deltaspike.test.string-value", "configured");
-        props.put("deltaspike.test.integer-value", "5");
-        props.put("deltaspike.test.long-value", "8589934592");
-        props.put("deltaspike.test.float-value", "-1.1");
-        props.put("deltaspike.test.double-value", "4e40");
-        props.put("deltaspike.test.boolean-value", Boolean.FALSE.toString());
-        props.put("deltaspike.test.class-value", "org.apache.deltaspike.test.api.config.TestConfigSource");
-        props.put("deltaspike.test.date-value", "2014-12-24");
-        props.put("deltaspike.test.invalid-value", "wrong");
-        props.put("org.apache.deltaspike.core.spi.activation.ClassDeactivator","org.apache.deltaspike.core.util.activation.EditableTestDeactivator");
-
-        // test for variable replacement
-        props.put("deltaspike.test.host.url", "http://localhost:12345");
-        props.put("deltaspike.test.someapp.soap.endpoint", "${deltaspike.test.host.url}/someservice/myendpoint");
-
-        props.put("deltaspike.test.nonexisting.variable", "${does.not.exist}/someservice/myendpoint");
-
-        props.put("deltaspike.test.recursive.variable1", "${deltaspike.test.recursive.variable2}/ohgosh/${deltaspike.test.recursive.variable3}");
-        props.put("deltaspike.test.recursive.variable2", "pre-${deltaspike.test.recursive.variable3}-post");
-        props.put("deltaspike.test.recursive.variable3", "crazy");
-
-        props.put("deltaspike.test.projectstagefallback.UnitTest", "");
-        props.put("deltaspike.test.projectstagefallback", "Value without ProjectStage");
-        
-        // ProjectStage aware property value with resolved reference
-        props.put("foo.url", "${bar.url}/services");
-        props.put("bar.url", "undefined");
-        props.put("bar.url.UnitTest", "http://bar-dev");
-        props.put("bar.url.Production", "http://bar-prod");
-
-        props.put("deltaspike.test.exampleEntry-1", "tomato");
-        props.put("deltaspike.test.exampleEntry-1.UnitTest", "tomato-UnitTest");
-        props.put("deltaspike.test.exampleEntry-2", "default-exampleEntry-1-is-${deltaspike.test.exampleEntry-1}");
-        props.put("deltaspike.test.exampleEntry-2.UnitTest", "projectStageAware-exampleEntry-1-is-${deltaspike.test.exampleEntry-1}");
-
-        // values for testing the list handling
-        props.put("test.list.value.emails", "test1@apache.org, test2@apache.org, \n  test3@apache.org");
-        props.put("test.list.value.escaped.list","val\\,ue1,value2, val\\\\ue3");
-        props.put("test.list.intvalues","3,7, 11 ,\t 17\n");
-    }
-
-    @Override
-    public String getConfigName()
-    {
-        return "testConfig";
-    }
-
-    @Override
-    public int getOrdinal()
-    {
-        return ordinal;
-    }
-
-    @Override
-    public String getPropertyValue(String key)
-    {
-        return props.get(key);
-    }
-
-    @Override
-    public Map<String, String> getProperties()
-    {
-        return props;
-    }
-
-	@Override
-	public boolean isScannable() {
-		return true;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/f56845c4/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/TestConfigSourceProvider.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/TestConfigSourceProvider.java b/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/TestConfigSourceProvider.java
deleted file mode 100644
index 098b37b..0000000
--- a/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/TestConfigSourceProvider.java
+++ /dev/null
@@ -1,115 +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.deltaspike.test.api.config;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.deltaspike.core.spi.config.ConfigSource;
-import org.apache.deltaspike.core.spi.config.ConfigSourceProvider;
-
-/**
- * ConfigSourceProvider for basic unit-test
- */
-public class TestConfigSourceProvider implements ConfigSourceProvider
-{
-    @Override
-    public List<ConfigSource> getConfigSources()
-    {
-        return Arrays.asList(new TestConfigSource1(), new TestConfigSource2());
-    }
-
-    private static class TestConfigSource1 implements ConfigSource
-    {
-        @Override
-        public int getOrdinal()
-        {
-            return 1;
-        }
-
-        @Override
-        public String getPropertyValue(String key)
-        {
-            if ("test".equals(key))
-            {
-                return "test1";
-            }
-            return null;
-        }
-
-        @Override
-        public Map<String, String> getProperties()
-        {
-            Map<String, String> map = new HashMap<String, String>();
-            map.put("test", "test1");
-            return map;
-        }
-
-        @Override
-        public String getConfigName()
-        {
-            return TestConfigSourceProvider.class.getName();
-        }
-
-		@Override
-		public boolean isScannable() {
-			return true;
-		}
-    }
-
-    private static class TestConfigSource2 implements ConfigSource
-    {
-        @Override
-        public int getOrdinal()
-        {
-            return 2;
-        }
-
-        @Override
-        public String getPropertyValue(String key)
-        {
-            if ("test".equals(key))
-            {
-                return "test2";
-            }
-            return null;
-        }
-
-        @Override
-        public Map<String, String> getProperties()
-        {
-            Map<String, String> map = new HashMap<String, String>();
-            map.put("test", "test2");
-            return map;
-        }
-
-        @Override
-        public String getConfigName()
-        {
-            return TestConfigSourceProvider.class.getName();
-        }
-
-		@Override
-		public boolean isScannable() {
-			return false;
-		}
-    }
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/f56845c4/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/TypedResolverTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/TypedResolverTest.java b/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/TypedResolverTest.java
deleted file mode 100644
index 3a8c144..0000000
--- a/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/TypedResolverTest.java
+++ /dev/null
@@ -1,235 +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.deltaspike.test.api.config;
-
-import org.apache.deltaspike.core.api.config.ConfigResolver;
-import org.apache.deltaspike.core.api.projectstage.ProjectStage;
-import org.apache.deltaspike.core.util.ProjectStageProducer;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.concurrent.TimeUnit;
-
-public class TypedResolverTest
-{
-    @Before
-    public void init()
-    {
-        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);
-    }
-
-    @Test
-    public void testValidTypes()
-    {
-        Assert.assertEquals("configured", ConfigResolver.resolve("deltaspike.test.string-value").getValue());
-
-        Assert.assertEquals(Boolean.FALSE, ConfigResolver.resolve("deltaspike.test.boolean-value").as(Boolean.class)
-                .getValue());
-
-        Assert.assertEquals(TestConfigSource.class, ConfigResolver.resolve("deltaspike.test.class-value").as(Class
-                .class).getValue());
-
-        Assert.assertEquals(5l, (int) ConfigResolver.resolve("deltaspike.test.integer-value").as(Integer.class)
-                .getValue());
-
-        Assert.assertEquals(8589934592l, (long) ConfigResolver.resolve("deltaspike.test.long-value").as(Long.class)
-                .getValue());
-
-        Assert.assertEquals(-1.1f, (float) ConfigResolver.resolve("deltaspike.test.float-value").as(Float.class)
-                .getValue(), 0);
-
-        Assert.assertEquals(4e40d, (double) ConfigResolver.resolve("deltaspike.test.double-value").as(Double.class)
-                .getValue(), 0);
-    }
-
-    @Test
-    public void testConverter()
-    {
-        Assert.assertEquals(new GregorianCalendar(2014, 12, 24).getTime(),
-                ConfigResolver.resolve("deltaspike.test.date-value")
-                        .as(Date.class, new TestDateConverter()).getValue());
-
-        // test fallback to default
-        Assert.assertEquals(new GregorianCalendar(2015, 01, 01).getTime(),
-                ConfigResolver.resolve("deltaspike.test.INVALID-date-value")
-                        .as(Date.class, new TestDateConverter())
-                        .withDefault(new GregorianCalendar(2015, 01, 01).getTime())
-                        .getValue());
-    }
-
-    @Test
-    public void testProjectStageAware()
-    {
-        Assert.assertEquals("unittestvalue",
-                ConfigResolver.resolve("testkey")
-                        .withCurrentProjectStage(true)
-                        .getValue());
-
-        Assert.assertEquals("testvalue",
-                ConfigResolver.resolve("testkey")
-                        .withCurrentProjectStage(false)
-                        .getValue());
-
-        // property without PS, with PS-aware
-        Assert.assertEquals("testvalue",
-                ConfigResolver.resolve("testkey2")
-                        .withCurrentProjectStage(true)
-                        .getValue());
-    }
-
-    @Test
-    public void testParameterized()
-    {
-        // param OK, ps OK
-        Assert.assertEquals("TestDataSource",
-                ConfigResolver.resolve("dataSource")
-                        .withCurrentProjectStage(true)
-                        .parameterizedBy("dbvendor")
-                        .getValue());
-
-        // param OK, NO ps
-        Assert.assertEquals("PostgreDataSource",
-                ConfigResolver.resolve("dataSource")
-                        .withCurrentProjectStage(false)
-                        .parameterizedBy("dbvendor")
-                        .getValue());
-
-        // param doesn't resolve, ps OK
-        Assert.assertEquals("UnitTestDataSource",
-                ConfigResolver.resolve("dataSource")
-                        .withCurrentProjectStage(true)
-                        .parameterizedBy("INVALIDPARAMETER")
-                        .getValue());
-
-        // param OK, ps OK, NO base.param.ps, NO base.param, fall back to base.ps
-        Assert.assertEquals("UnitTestDataSource",
-                ConfigResolver.resolve("dataSource")
-                        .withCurrentProjectStage(true)
-                        .parameterizedBy("dbvendor3")
-                        .getValue());
-
-        // param OK, NO ps, base.param undefined, fall back to base
-        Assert.assertEquals("DefaultDataSource",
-                ConfigResolver.resolve("dataSource")
-                        .withCurrentProjectStage(false)
-                        .parameterizedBy("dbvendor3")
-                        .getValue());
-    }
-
-    @Test
-    public void testDefault()
-    {
-        Assert.assertEquals(10l,
-                (long) ConfigResolver.resolve("INVALIDKEY")
-                .as(Long.class)
-                .withDefault(10l).getValue());
-
-        // string default
-        Assert.assertEquals(10l,
-                (long) ConfigResolver.resolve("INVALIDKEY")
-                        .as(Long.class)
-                        .withStringDefault("10").getValue());
-    }
-
-    @Test
-    public void testStrict()
-    {
-        Assert.assertEquals("TestDataSource",
-                ConfigResolver.resolve("dataSource")
-                        .withCurrentProjectStage(true)
-                        .parameterizedBy("dbvendor")
-                        .strictly(true)
-                        .getValue());
-
-        // no base.param, no value for base.param.ps
-        Assert.assertEquals(null,
-                ConfigResolver.resolve("dataSource")
-                        .withCurrentProjectStage(true)
-                        .parameterizedBy("dbvendor3")
-                        .strictly(true)
-                        .getValue());
-
-        // valid base.param, but no base.param.ps
-        Assert.assertEquals(null,
-                ConfigResolver.resolve("dataSource")
-                        .withCurrentProjectStage(true)
-                        .parameterizedBy("dbvendor2")
-                        .strictly(true)
-                        .getValue());
-    }
-
-    @Test
-    public void testGets()
-    {
-        ConfigResolver.TypedResolver<String> resolver = ConfigResolver.resolve("dataSource")
-                .withCurrentProjectStage(true)
-                .parameterizedBy("dbvendor")
-                .withDefault("TESTDEFAULT");
-
-        Assert.assertEquals("TestDataSource", resolver.getValue());
-        Assert.assertEquals("dataSource", resolver.getKey());
-        Assert.assertEquals("TESTDEFAULT", resolver.getDefaultValue());
-        Assert.assertEquals("dataSource.mysql.UnitTest", resolver.getResolvedKey());
-
-
-        ConfigResolver.TypedResolver<String> resolver2 = ConfigResolver.resolve("testkey2")
-                .withCurrentProjectStage(true)
-                .parameterizedBy("INVALIDPARAMETER");
-
-
-        Assert.assertEquals("testvalue", resolver2.getValue());
-        Assert.assertEquals("testkey2", resolver2.getResolvedKey());
-    }
-
-    @Test
-    public void testWithCacheTime() throws Exception
-    {
-        ConfigResolver.TypedResolver<String> resolver = ConfigResolver.resolve("dataSource")
-            .withCurrentProjectStage(true)
-            .parameterizedBy("dbvendor")
-            .cacheFor(TimeUnit.MILLISECONDS, 5)
-            .withDefault("TESTDEFAULT");
-
-        Assert.assertEquals("TestDataSource", resolver.getValue());
-        Assert.assertEquals("TestDataSource", resolver.getValue());
-        Assert.assertEquals("dataSource", resolver.getKey());
-        Assert.assertEquals("TESTDEFAULT", resolver.getDefaultValue());
-        Assert.assertEquals("dataSource.mysql.UnitTest", resolver.getResolvedKey());
-
-        // because the clock steps in certain OS is only 16ms
-        Thread.sleep(35L);
-        Assert.assertEquals("TestDataSource", resolver.getValue());
-    }
-
-    public static class TestDateConverter implements ConfigResolver.Converter<Date> {
-
-        @Override
-        public Date convert(String value)
-        {
-            String[] parts = value.split("-");
-            return new GregorianCalendar(Integer.valueOf(parts[0]), Integer.valueOf(parts[1]),
-                    Integer.valueOf(parts[2])).getTime();
-        }
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/f56845c4/deltaspike/core/api/src/test/resources/META-INF/services/org.apache.deltaspike.core.spi.config.ConfigSource
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/test/resources/META-INF/services/org.apache.deltaspike.core.spi.config.ConfigSource b/deltaspike/core/api/src/test/resources/META-INF/services/org.apache.deltaspike.core.spi.config.ConfigSource
deleted file mode 100644
index 84d5875..0000000
--- a/deltaspike/core/api/src/test/resources/META-INF/services/org.apache.deltaspike.core.spi.config.ConfigSource
+++ /dev/null
@@ -1,20 +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.
-#####################################################################################
-
-org.apache.deltaspike.test.api.config.TestConfigSource

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/f56845c4/deltaspike/core/api/src/test/resources/META-INF/services/org.apache.deltaspike.core.spi.config.ConfigSourceProvider
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/test/resources/META-INF/services/org.apache.deltaspike.core.spi.config.ConfigSourceProvider b/deltaspike/core/api/src/test/resources/META-INF/services/org.apache.deltaspike.core.spi.config.ConfigSourceProvider
deleted file mode 100644
index 14674cd..0000000
--- a/deltaspike/core/api/src/test/resources/META-INF/services/org.apache.deltaspike.core.spi.config.ConfigSourceProvider
+++ /dev/null
@@ -1,20 +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.
-#
-
-org.apache.deltaspike.test.api.config.TestConfigSourceProvider

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/f56845c4/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/ConfigImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/ConfigImpl.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/ConfigImpl.java
new file mode 100644
index 0000000..54c1ca9
--- /dev/null
+++ b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/ConfigImpl.java
@@ -0,0 +1,156 @@
+/*
+ * 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.deltaspike.core.impl.config;
+
+import org.apache.deltaspike.core.api.config.Config;
+import org.apache.deltaspike.core.spi.config.ConfigFilter;
+import org.apache.deltaspike.core.spi.config.ConfigSource;
+import org.apache.deltaspike.core.spi.config.ConfigSourceProvider;
+import org.apache.deltaspike.core.util.ServiceUtils;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * The internal implementation of the Config interface
+ */
+public class ConfigImpl implements Config
+{
+    private static final Logger LOG = Logger.getLogger(ConfigImpl.class.getName());
+
+    private final ClassLoader classLoader;
+
+    private ConfigSource[] configSources;
+    private List<ConfigFilter> configFilters;
+
+    public ConfigImpl(ClassLoader classLoader)
+    {
+        this.classLoader = classLoader;
+    }
+
+    /**
+     * Performs all the initialisation of the default
+     * ConfigSources, ConfigFilters, etc
+     */
+    void init()
+    {
+        List<ConfigSource> appConfigSources
+            = ServiceUtils.loadServiceImplementations(ConfigSource.class, false, classLoader);
+
+        List<ConfigSourceProvider> configSourceProviderServiceLoader
+            = ServiceUtils.loadServiceImplementations(ConfigSourceProvider.class, false, classLoader);
+
+        for (ConfigSourceProvider configSourceProvider : configSourceProviderServiceLoader)
+        {
+            appConfigSources.addAll(configSourceProvider.getConfigSources());
+        }
+        addConfigSources(appConfigSources);
+
+        if (LOG.isLoggable(Level.FINE))
+        {
+            for (ConfigSource cs : appConfigSources)
+            {
+                LOG.log(Level.FINE, "Adding ordinal {0} ConfigSource {1}",
+                        new Object[]{cs.getOrdinal(), cs.getConfigName()});
+            }
+        }
+
+        List<ConfigFilter> configFilters
+            = ServiceUtils.loadServiceImplementations(ConfigFilter.class, false, classLoader);
+        this.configFilters = new CopyOnWriteArrayList<>(configFilters);
+    }
+
+
+    @Override
+    public ConfigSource[] getConfigSources()
+    {
+        return configSources;
+    }
+
+    @Override
+    public void addConfigSources(List<ConfigSource> configSourcesToAdd)
+    {
+        List<ConfigSource> allConfigSources = new ArrayList<>();
+        if (this.configSources != null)
+        {
+            for (ConfigSource configSource : this.configSources)
+            {
+                allConfigSources.add(configSource);
+            }
+        }
+
+        allConfigSources.addAll(configSourcesToAdd);
+
+        this.configSources = sortDescending(allConfigSources);
+    }
+
+    @Override
+    public List<ConfigFilter> getConfigFilters()
+    {
+        return Collections.unmodifiableList(configFilters);
+    }
+
+    @Override
+    public void addConfigFilter(ConfigFilter configFilter)
+    {
+        configFilters.add(configFilter);
+    }
+
+    @Override
+    public String filterConfigValue(String key, String value, boolean forLog)
+    {
+        String filteredValue = value;
+
+        for (ConfigFilter filter : configFilters)
+        {
+            filteredValue = forLog ?
+                    filter.filterValueForLog(key, filteredValue) :
+                    filter.filterValue(key, filteredValue);
+        }
+        return filteredValue;
+    }
+
+    private ConfigSource[] sortDescending(List<ConfigSource> configSources)
+    {
+        Collections.sort(configSources, new Comparator<ConfigSource>()
+        {
+            /**
+             * {@inheritDoc}
+             */
+            @Override
+            public int compare(ConfigSource configSource1, ConfigSource configSource2)
+            {
+                int o1 = configSource1.getOrdinal();
+                int o2 = configSource2.getOrdinal();
+                if (o1 == o2)
+                {
+                    return configSource1.getConfigName().compareTo(configSource2.getConfigName());
+                }
+                return (o1 > o2) ? -1 : 1;
+            }
+        });
+        return configSources.toArray(new ConfigSource[configSources.size()]);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/f56845c4/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/ConfigProviderImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/ConfigProviderImpl.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/ConfigProviderImpl.java
new file mode 100644
index 0000000..e788f8d
--- /dev/null
+++ b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/config/ConfigProviderImpl.java
@@ -0,0 +1,96 @@
+/*
+ * 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.deltaspike.core.impl.config;
+
+import org.apache.deltaspike.core.api.config.Config;
+import org.apache.deltaspike.core.api.config.ConfigResolver;
+import org.apache.deltaspike.core.util.ClassUtils;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ */
+public class ConfigProviderImpl implements ConfigResolver.ConfigProvider
+{
+    /**
+     * The content of this map will get lazily initiated and will hold the
+     * Configs for each WebApp/EAR, etc (thus the ClassLoader).
+     */
+    private static Map<ClassLoader, ConfigImpl> configs = new ConcurrentHashMap<>();
+
+    @Override
+    public Config getConfig()
+    {
+        ClassLoader cl = ClassUtils.getClassLoader(null);
+        return getConfig(cl);
+    }
+
+    @Override
+    public Config getConfig(ClassLoader cl)
+    {
+        ConfigImpl config = configs.get(cl);
+        if (config == null)
+        {
+            config = new ConfigImpl(cl);
+            config.init();
+            ConfigImpl oldConfig = configs.put(cl, config);
+            if (oldConfig != null)
+            {
+                config = oldConfig;
+            }
+        }
+        return config;
+    }
+
+    @Override
+    public void releaseConfig(ClassLoader cl)
+    {
+        configs.remove(cl);
+
+        // And remove all the children as well.
+        // This will e.g happen in EAR scenarios
+        Iterator<Map.Entry<ClassLoader, ConfigImpl>> it = configs.entrySet().iterator();
+        while (it.hasNext())
+        {
+            Map.Entry<ClassLoader, ConfigImpl> cfgEntry = it.next();
+            if (isChildClassLoader(cl, cfgEntry.getKey()))
+            {
+                it.remove();
+            }
+        }
+    }
+
+    private boolean isChildClassLoader(ClassLoader configClassLoader, ClassLoader suspect)
+    {
+        ClassLoader suspectParentCl = suspect.getParent();
+        if (suspectParentCl == null)
+        {
+            return false;
+        }
+
+        if (suspectParentCl == configClassLoader)
+        {
+            return true;
+        }
+
+        return isChildClassLoader(configClassLoader, suspectParentCl);
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/f56845c4/deltaspike/core/impl/src/main/resources/META-INF/services/org.apache.deltaspike.core.api.config.ConfigResolver.ConfigProvider
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/main/resources/META-INF/services/org.apache.deltaspike.core.api.config.ConfigResolver.ConfigProvider b/deltaspike/core/impl/src/main/resources/META-INF/services/org.apache.deltaspike.core.api.config.ConfigResolver.ConfigProvider
new file mode 100644
index 0000000..117643b
--- /dev/null
+++ b/deltaspike/core/impl/src/main/resources/META-INF/services/org.apache.deltaspike.core.api.config.ConfigResolver.ConfigProvider
@@ -0,0 +1,20 @@
+#
+# 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.
+#
+
+org.apache.deltaspike.core.impl.config.ConfigProviderImpl
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/f56845c4/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/ConfigResolverTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/ConfigResolverTest.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/ConfigResolverTest.java
new file mode 100644
index 0000000..44eea3f
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/ConfigResolverTest.java
@@ -0,0 +1,333 @@
+/*
+ * 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.deltaspike.test.core.api.config;
+
+import org.apache.deltaspike.core.api.config.ConfigResolver;
+import org.apache.deltaspike.core.api.projectstage.ProjectStage;
+import org.apache.deltaspike.core.spi.config.ConfigFilter;
+import org.apache.deltaspike.core.spi.config.ConfigSource;
+import org.apache.deltaspike.core.util.ProjectStageProducer;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.Arrays;
+import java.util.List;
+
+@SuppressWarnings("Duplicates")
+public class ConfigResolverTest
+{
+    private static final String DEFAULT_VALUE = "defaultValue";
+
+    @Before
+    public void init()
+    {
+        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);
+    }
+
+    @Test
+    public void testOverruledValue()
+    {
+        String result = ConfigResolver.getPropertyValue("test");
+
+        Assert.assertEquals("test2", result);
+    }
+
+    @Test
+    public void testOrderOfAllValues()
+    {
+        List<String> result = ConfigResolver.getAllPropertyValues("test");
+
+        Assert.assertEquals(2, result.size());
+        Assert.assertEquals("test1", result.get(0));
+        Assert.assertEquals("test2", result.get(1));
+    }
+
+    @Test
+    public void testStandaloneConfigSource()
+    {
+        Assert.assertNull(ConfigResolver.getPropertyValue("notexisting"));
+        Assert.assertEquals("testvalue", ConfigResolver.getPropertyValue("testkey"));
+    }
+
+    @Test
+    public void testGetProjectStageAwarePropertyValue()
+    {
+        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);
+        Assert.assertNull(ConfigResolver.getProjectStageAwarePropertyValue("notexisting", null));
+
+        Assert.assertEquals("testvalue", ConfigResolver.getPropertyValue("testkey"));
+        Assert.assertEquals("unittestvalue", ConfigResolver.getProjectStageAwarePropertyValue("testkey"));
+        Assert.assertEquals("unittestvalue", ConfigResolver.getProjectStageAwarePropertyValue("testkey", null));
+
+        Assert.assertEquals("testvalue", ConfigResolver.getPropertyValue("testkey2"));
+        Assert.assertEquals("testvalue", ConfigResolver.getProjectStageAwarePropertyValue("testkey2"));
+        Assert.assertEquals("testvalue", ConfigResolver.getProjectStageAwarePropertyValue("testkey2", null));
+
+        Assert.assertEquals("testvalue", ConfigResolver.getPropertyValue("testkey3"));
+        Assert.assertEquals("", ConfigResolver.getProjectStageAwarePropertyValue("testkey3"));
+        Assert.assertEquals(DEFAULT_VALUE, ConfigResolver.getProjectStageAwarePropertyValue("testkey3", DEFAULT_VALUE));
+
+        Assert.assertEquals(DEFAULT_VALUE, ConfigResolver.getProjectStageAwarePropertyValue("deltaspike.test.projectstagefallback", DEFAULT_VALUE));
+        Assert.assertEquals("", ConfigResolver.getProjectStageAwarePropertyValue("deltaspike.test.projectstagefallback"));
+
+        Assert.assertEquals(DEFAULT_VALUE, ConfigResolver.resolve("deltaspike.test.projectstagefallback").as(String.class).withDefault(DEFAULT_VALUE).withCurrentProjectStage(true).getValue());
+        Assert.assertEquals("", ConfigResolver.resolve("deltaspike.test.projectstagefallback").as(String.class).withCurrentProjectStage(true).getValue());
+    }
+
+    @Test
+    public void testGetPropertyAwarePropertyValue()
+    {
+        ProjectStageProducer.setProjectStage(ProjectStage.UnitTest);
+
+        Assert.assertNull(ConfigResolver.getPropertyAwarePropertyValue("notexisting", null));
+
+        Assert.assertEquals("testvalue", ConfigResolver.getPropertyValue("testkey"));
+        Assert.assertEquals("unittestvalue", ConfigResolver.getPropertyAwarePropertyValue("testkey", "dbvendor"));
+        Assert.assertEquals("unittestvalue", ConfigResolver.getPropertyAwarePropertyValue("testkey", "dbvendor", null));
+
+        Assert.assertEquals("testvalue", ConfigResolver.getPropertyValue("testkey2"));
+        Assert.assertEquals("testvalue", ConfigResolver.getPropertyAwarePropertyValue("testkey2", "dbvendor"));
+        Assert.assertEquals("testvalue", ConfigResolver.getPropertyAwarePropertyValue("testkey2", "dbvendor", null));
+
+        Assert.assertEquals("testvalue", ConfigResolver.getPropertyValue("testkey3"));
+        Assert.assertEquals("", ConfigResolver.getPropertyAwarePropertyValue("testkey3", "dbvendor"));
+        Assert.assertEquals(DEFAULT_VALUE, ConfigResolver.getPropertyAwarePropertyValue("testkey3", "dbvendor", DEFAULT_VALUE));
+
+        Assert.assertEquals("TestDataSource", ConfigResolver.getPropertyAwarePropertyValue("dataSource", "dbvendor"));
+        Assert.assertEquals("PostgreDataSource", ConfigResolver.getPropertyAwarePropertyValue("dataSource", "dbvendor2"));
+        Assert.assertEquals("UnitTestDataSource", ConfigResolver.getPropertyAwarePropertyValue("dataSource", "dbvendorX"));
+
+        Assert.assertEquals("TestDataSource", ConfigResolver.getPropertyAwarePropertyValue("dataSource", "dbvendor", null));
+        Assert.assertEquals("PostgreDataSource", ConfigResolver.getPropertyAwarePropertyValue("dataSource", "dbvendor2", null));
+        Assert.assertEquals("UnitTestDataSource", ConfigResolver.getPropertyAwarePropertyValue("dataSource", "dbvendorX", null));
+        Assert.assertEquals(DEFAULT_VALUE, ConfigResolver.getPropertyAwarePropertyValue("dataSourceX", "dbvendorX", DEFAULT_VALUE));
+    }
+
+    @Test
+    public void testConfigFilter()
+    {
+        ConfigFilter configFilter = new TestConfigFilter();
+
+        Assert.assertEquals("shouldGetDecrypted: value", configFilter.filterValue("somekey.encrypted", "value"));
+        Assert.assertEquals("**********", configFilter.filterValueForLog("somekey.password", "value"));
+
+        ConfigResolver.addConfigFilter(configFilter);
+
+        Assert.assertEquals("shouldGetDecrypted: value", ConfigResolver.getPropertyValue("testkey4.encrypted"));
+        Assert.assertEquals("shouldGetDecrypted: value", ConfigResolver.getProjectStageAwarePropertyValue("testkey4.encrypted"));
+        Assert.assertEquals("shouldGetDecrypted: value", ConfigResolver.getProjectStageAwarePropertyValue("testkey4.encrypted", null));
+        Assert.assertEquals("shouldGetDecrypted: value", ConfigResolver.getPropertyAwarePropertyValue("testkey4.encrypted", "dbvendor"));
+        Assert.assertEquals("shouldGetDecrypted: value", ConfigResolver.getPropertyAwarePropertyValue("testkey4.encrypted", "dbvendor", null));
+
+        List<String> allPropertyValues = ConfigResolver.getAllPropertyValues("testkey4.encrypted");
+        Assert.assertNotNull(allPropertyValues);
+        Assert.assertEquals(1, allPropertyValues.size());
+        Assert.assertEquals("shouldGetDecrypted: value", allPropertyValues.get(0));
+
+    }
+
+    @Test
+    public void testConfigVariableReplacement()
+    {
+        {
+            String url = ConfigResolver.getPropertyValue("deltaspike.test.someapp.soap.endpoint", "", true);
+            Assert.assertEquals("http://localhost:12345/someservice/myendpoint", url);
+        }
+
+        {
+            String url = ConfigResolver.getPropertyValue("deltaspike.test.someapp.soap.endpoint", true);
+            Assert.assertEquals("http://localhost:12345/someservice/myendpoint", url);
+        }
+    }
+
+    @Test
+    public void testConfigVariableReplacementInDefault()
+    {
+        {
+            String url = ConfigResolver.getPropertyValue("deltaspike.test.notexisting",
+                    "url: ${deltaspike.test.host.url}", true);
+            Assert.assertEquals("url: http://localhost:12345", url);
+        }
+
+        {
+            String url = ConfigResolver.getPropertyValue("deltaspike.test.someapp.soap.endpoint", true);
+            Assert.assertEquals("http://localhost:12345/someservice/myendpoint", url);
+        }
+    }
+
+    @Test
+    public void testConfigVariableNotExisting()
+    {
+        {
+            String url = ConfigResolver.getPropertyValue("deltaspike.test.nonexisting.variable", "", true);
+            Assert.assertEquals("${does.not.exist}/someservice/myendpoint", url);
+        }
+        {
+            String url = ConfigResolver.getPropertyValue("deltaspike.test.nonexisting.variable", true);
+            Assert.assertEquals("${does.not.exist}/someservice/myendpoint", url);
+        }
+    }
+
+    @Test
+    public void testConfigVariableRecursiveDeclaration()
+    {
+        String url = ConfigResolver.getPropertyValue("deltaspike.test.recursive.variable1", "", true);
+        Assert.assertEquals("pre-crazy-post/ohgosh/crazy", url);
+
+        ConfigResolver.TypedResolver<String> tr = ConfigResolver.resolve("deltaspike.test.recursive.variable1")
+            .evaluateVariables(true).logChanges(true);
+        Assert.assertEquals("pre-crazy-post/ohgosh/crazy", tr.getValue());
+    }
+
+    @Test
+    public void testTypedResolver_NonExistingValue()
+    {
+        final String key = "non.existing.key";
+
+        ConfigResolver.TypedResolver<String> resolver = ConfigResolver.resolve(key)
+            .logChanges(true);
+
+        Assert.assertNull(resolver.getValue());
+
+        setTestConfigSourceValue(key, "somevalue");
+        Assert.assertEquals("somevalue", resolver.getValue());
+
+        setTestConfigSourceValue(key, null);
+        Assert.assertNull(resolver.getValue());
+    }
+    
+    @Test
+    public void testProjectStageAwarePropertyValueReference_1() {
+        final String expectedFooUrl =
+                "http://bar-dev/services";
+
+        final String actualFooUrl =
+                ConfigResolver.getProjectStageAwarePropertyValue(
+                "foo.url");
+
+        Assert.assertEquals(expectedFooUrl, actualFooUrl);
+    }
+
+    @Test
+    public void testProjectStageAwarePropertyValueReference_2() {
+        final String expected =
+                "projectStageAware-exampleEntry-1-is-tomato-UnitTest";
+
+        final String projectStageAwareExampleEntry1 =
+                ConfigResolver.getProjectStageAwarePropertyValue(
+                "deltaspike.test.exampleEntry-2", 
+                "");
+
+        Assert.assertEquals(expected, projectStageAwareExampleEntry1);
+    }
+
+    @Test
+    public void testConfiguredListValues_WithWhitespace() {
+        List<String> emails = ConfigResolver.resolve("test.list.value.emails").asList().getValue();
+        Assert.assertNotNull(emails);
+        Assert.assertEquals(3, emails.size());
+        Assert.assertTrue(emails.contains("test1@apache.org"));
+        Assert.assertTrue(emails.contains("test2@apache.org"));
+        Assert.assertTrue(emails.contains("test3@apache.org"));
+    }
+
+    @Test
+    public void testConfiguredListValues_WithEscaping() {
+        List<String> escapedValues = ConfigResolver.resolve("test.list.value.escaped.list").asList().getValue();
+        Assert.assertNotNull(escapedValues);
+        Assert.assertEquals(3, escapedValues.size());
+        Assert.assertTrue(escapedValues.contains("val,ue1"));
+        Assert.assertTrue(escapedValues.contains("value2"));
+        Assert.assertTrue(escapedValues.contains("val\\ue3"));
+    }
+
+    @Test
+    public void testConfiguredListValues_OtherType() {
+        List<Integer> intValues = ConfigResolver.resolve("test.list.intvalues").as(Integer.class).asList().getValue();
+        Assert.assertNotNull(intValues);
+        Assert.assertEquals(4, intValues.size());
+        Assert.assertTrue(intValues.contains(3));
+        Assert.assertTrue(intValues.contains(7));
+        Assert.assertTrue(intValues.contains(11));
+        Assert.assertTrue(intValues.contains(17));
+    }
+
+    @Test
+    public void testConfiguredListValues_NotExisting() {
+        List<Integer> intValues = ConfigResolver.resolve("test.list.not_existing").as(Integer.class).asList().getValue();
+        Assert.assertNotNull(intValues);
+        Assert.assertEquals(0, intValues.size());
+    }
+
+    @Test
+    public void testConfiguredListValues_WithDefault() {
+        List<Integer> intValues = ConfigResolver.resolve("test.list.not_existing").as(Integer.class).asList().withDefault(Arrays.asList(99, 88, 77)).getValue();
+        Assert.assertNotNull(intValues);
+        Assert.assertEquals(3, intValues.size());
+        Assert.assertTrue(intValues.contains(99));
+        Assert.assertTrue(intValues.contains(88));
+        Assert.assertTrue(intValues.contains(77));
+    }
+
+    private void setTestConfigSourceValue(String key, String value)
+    {
+        ConfigSource[] configSources = ConfigResolver.getConfigSources();
+        for (ConfigSource configSource : configSources)
+        {
+            if (configSource instanceof TestConfigSource)
+            {
+                if (value == null)
+                {
+                    configSource.getProperties().remove(key);
+                }
+                else
+                {
+                    configSource.getProperties().put(key, value);
+                }
+
+                break;
+            }
+        }
+    }
+
+    public static class TestConfigFilter implements ConfigFilter
+    {
+        @Override
+        public String filterValue(String key, String value)
+        {
+            if (key.contains("encrypted"))
+            {
+                return "shouldGetDecrypted: " + value;
+            }
+            return value;
+        }
+
+        @Override
+        public String filterValueForLog(String key, String value)
+        {
+            if (key.contains("password"))
+            {
+                return "**********";
+            }
+            return value;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/f56845c4/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/TestConfigSource.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/TestConfigSource.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/TestConfigSource.java
new file mode 100644
index 0000000..44a8808
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/config/TestConfigSource.java
@@ -0,0 +1,142 @@
+/*
+ * 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.deltaspike.test.core.api.config;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.deltaspike.core.spi.config.ConfigSource;
+import org.apache.deltaspike.test.util.activation.EditableTestDeactivator;
+
+/**
+ * Test ConfigSource
+ *
+ * It statically returns 'testvalue' for the key 'testkey'
+ */
+public class TestConfigSource implements ConfigSource
+{
+
+    private int ordinal = 700;
+
+    private Map<String, String> props = new HashMap<String, String>();
+
+
+    public TestConfigSource()
+    {
+        // a ProjectStage overloaded value
+        props.put("testkey", "testvalue");
+        props.put("testkey.UnitTest", "unittestvalue");
+
+        // a value without any overloading
+        props.put("testkey2", "testvalue");
+
+        // a value which got ProjectStage overloaded to an empty value
+        props.put("testkey3", "testvalue");
+        props.put("testkey3.UnitTest", "");
+
+        // now for the PropertyAware tests
+        props.put("dbvendor.UnitTest", "mysql");
+        props.put("dbvendor", "postgresql");
+
+        props.put("dataSource.mysql.Production", "java:/comp/env/MyDs");
+        props.put("dataSource.mysql.UnitTest", "TestDataSource");
+        props.put("dataSource.postgresql", "PostgreDataSource");
+        props.put("dataSource.UnitTest", "UnitTestDataSource");
+        props.put("dataSource", "DefaultDataSource");
+
+        // another one
+        props.put("dbvendor2.Production", "mysql");
+        props.put("dbvendor2", "postgresql");
+
+        props.put("dbvendor3", "h2");
+
+        props.put("testkey4.encrypted", "value");
+        props.put("testkey4.password", "mysecretvalue");
+
+        props.put("deltaspike.test.string-value", "configured");
+        props.put("deltaspike.test.integer-value", "5");
+        props.put("deltaspike.test.long-value", "8589934592");
+        props.put("deltaspike.test.float-value", "-1.1");
+        props.put("deltaspike.test.double-value", "4e40");
+        props.put("deltaspike.test.boolean-value", Boolean.FALSE.toString());
+        props.put("deltaspike.test.class-value", TestConfigSource.class.getName());
+        props.put("deltaspike.test.date-value", "2014-12-24");
+        props.put("deltaspike.test.invalid-value", "wrong");
+        props.put("org.apache.deltaspike.core.spi.activation.ClassDeactivator",EditableTestDeactivator.class.getName());
+
+        // test for variable replacement
+        props.put("deltaspike.test.host.url", "http://localhost:12345");
+        props.put("deltaspike.test.someapp.soap.endpoint", "${deltaspike.test.host.url}/someservice/myendpoint");
+
+        props.put("deltaspike.test.nonexisting.variable", "${does.not.exist}/someservice/myendpoint");
+
+        props.put("deltaspike.test.recursive.variable1", "${deltaspike.test.recursive.variable2}/ohgosh/${deltaspike.test.recursive.variable3}");
+        props.put("deltaspike.test.recursive.variable2", "pre-${deltaspike.test.recursive.variable3}-post");
+        props.put("deltaspike.test.recursive.variable3", "crazy");
+
+        props.put("deltaspike.test.projectstagefallback.UnitTest", "");
+        props.put("deltaspike.test.projectstagefallback", "Value without ProjectStage");
+        
+        // ProjectStage aware property value with resolved reference
+        props.put("foo.url", "${bar.url}/services");
+        props.put("bar.url", "undefined");
+        props.put("bar.url.UnitTest", "http://bar-dev");
+        props.put("bar.url.Production", "http://bar-prod");
+
+        props.put("deltaspike.test.exampleEntry-1", "tomato");
+        props.put("deltaspike.test.exampleEntry-1.UnitTest", "tomato-UnitTest");
+        props.put("deltaspike.test.exampleEntry-2", "default-exampleEntry-1-is-${deltaspike.test.exampleEntry-1}");
+        props.put("deltaspike.test.exampleEntry-2.UnitTest", "projectStageAware-exampleEntry-1-is-${deltaspike.test.exampleEntry-1}");
+
+        // values for testing the list handling
+        props.put("test.list.value.emails", "test1@apache.org, test2@apache.org, \n  test3@apache.org");
+        props.put("test.list.value.escaped.list","val\\,ue1,value2, val\\\\ue3");
+        props.put("test.list.intvalues","3,7, 11 ,\t 17\n");
+    }
+
+    @Override
+    public String getConfigName()
+    {
+        return "testConfig";
+    }
+
+    @Override
+    public int getOrdinal()
+    {
+        return ordinal;
+    }
+
+    @Override
+    public String getPropertyValue(String key)
+    {
+        return props.get(key);
+    }
+
+    @Override
+    public Map<String, String> getProperties()
+    {
+        return props;
+    }
+
+	@Override
+	public boolean isScannable() {
+		return true;
+	}
+
+}