You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by an...@apache.org on 2016/10/30 17:22:10 UTC

[01/10] incubator-tamaya git commit: Fixed key evaluation.

Repository: incubator-tamaya
Updated Branches:
  refs/heads/master aac361a30 -> eafcadea6


Fixed key evaluation.


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

Branch: refs/heads/master
Commit: 8a8a5352253f5ba81abad3f2298bfda612717d8b
Parents: a41d143
Author: anatole <an...@apache.org>
Authored: Fri Sep 23 08:13:14 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Fri Sep 23 08:13:14 2016 +0200

----------------------------------------------------------------------
 .../apache/tamaya/inject/api/InjectionUtils.java | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/8a8a5352/modules/injection-api/src/main/java/org/apache/tamaya/inject/api/InjectionUtils.java
----------------------------------------------------------------------
diff --git a/modules/injection-api/src/main/java/org/apache/tamaya/inject/api/InjectionUtils.java b/modules/injection-api/src/main/java/org/apache/tamaya/inject/api/InjectionUtils.java
index a010e96..7920f89 100644
--- a/modules/injection-api/src/main/java/org/apache/tamaya/inject/api/InjectionUtils.java
+++ b/modules/injection-api/src/main/java/org/apache/tamaya/inject/api/InjectionUtils.java
@@ -104,14 +104,17 @@ public final class InjectionUtils {
         if (keys.isEmpty()) {
             keys.add(member.getName());
         }
-        ListIterator<String> iterator = keys.listIterator();
-        while (iterator.hasNext()) {
-            String next = iterator.next();
-            if (next.startsWith("[") && next.endsWith("]")) {
-                // absolute key, strip away brackets, take key as is
-                iterator.set(next.substring(1, next.length() - 1));
-            } else {
-                if (areasAnnot != null && areasAnnot.value().length>0) {
+        if (areasAnnot == null || areasAnnot.value().length==0) {
+            keys.add(member.getDeclaringClass().getName() + '.' + member.getName());
+            keys.add(member.getDeclaringClass().getSimpleName() + '.' + member.getName());
+        }else{
+            ListIterator<String> iterator = keys.listIterator();
+            while (iterator.hasNext()) {
+                String next = iterator.next();
+                if (next.startsWith("[") && next.endsWith("]")) {
+                    // absolute key, strip away brackets, take key as is
+                    iterator.set(next.substring(1, next.length() - 1));
+                } else {
                     // Remove original entry, since it will be replaced with prefixed entries
                     iterator.remove();
                     // Add prefixed entries, including absolute (root) entry for "" area keys.


[03/10] incubator-tamaya git commit: TAMAYA-182: Streamlined/unified builder API and impl: Adapted examples to new API.

Posted by an...@apache.org.
TAMAYA-182: Streamlined/unified builder API and impl: Adapted examples to new API.


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

Branch: refs/heads/master
Commit: a82a44affe3a19c81aa3ac3505a43a51d8e593c7
Parents: 32a1616 36b437a
Author: anatole <an...@apache.org>
Authored: Sun Oct 23 15:50:37 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Sun Oct 23 15:50:37 2016 +0200

----------------------------------------------------------------------
 attic/java8/api/pom.xml                         |  43 -
 .../java/org/apache/tamaya/ConfigException.java |  46 -
 .../java/org/apache/tamaya/ConfigOperator.java  |  38 -
 .../java/org/apache/tamaya/ConfigQuery.java     |  38 -
 .../java/org/apache/tamaya/Configuration.java   | 232 -----
 .../apache/tamaya/ConfigurationProvider.java    |  87 --
 .../java/org/apache/tamaya/TypeLiteral.java     | 202 -----
 .../apache/tamaya/spi/ConfigurationContext.java | 152 ----
 .../tamaya/spi/ConfigurationContextBuilder.java | 193 ----
 .../tamaya/spi/ConfigurationProviderSpi.java    |  77 --
 .../apache/tamaya/spi/PropertyConverter.java    |  49 -
 .../org/apache/tamaya/spi/PropertyFilter.java   |  49 -
 .../org/apache/tamaya/spi/PropertySource.java   | 153 ----
 .../tamaya/spi/PropertySourceProvider.java      |  43 -
 .../spi/PropertyValueCombinationPolicy.java     |  61 --
 .../org/apache/tamaya/spi/ServiceContext.java   |  66 --
 .../tamaya/spi/ServiceContextManager.java       | 115 ---
 .../org/apache/tamaya/ConfigExceptionTest.java  |  47 -
 .../tamaya/ConfigurationProviderTest.java       |  63 --
 .../org/apache/tamaya/ConfigurationTest.java    |  75 --
 .../org/apache/tamaya/TestConfiguration.java    |  80 --
 .../tamaya/TestConfigurationProvider.java       |  47 -
 .../java/org/apache/tamaya/TypeLiteralTest.java |  61 --
 .../tamaya/spi/ServiceContextManagerTest.java   | 131 ---
 .../apache/tamaya/spi/ServiceContextTest.java   |  91 --
 .../apache/tamaya/spi/TestServiceContext.java   |  83 --
 ...g.apache.tamaya.spi.ConfigurationProviderSpi |  19 -
 .../org.apache.tamaya.spi.ServiceContext        |  19 -
 .../test/resources/ServiceContextWithOrdinal    |  25 -
 attic/java8/core/pom.xml                        |  87 --
 .../core/internal/DefaultConfiguration.java     | 235 -----
 .../internal/DefaultConfigurationContext.java   | 239 -----
 .../DefaultConfigurationContextBuilder.java     | 145 ---
 .../internal/DefaultConfigurationProvider.java  |  62 --
 .../core/internal/DefaultServiceContext.java    | 148 ---
 .../core/internal/PropertyConverterManager.java | 390 --------
 .../converters/BigDecimalConverter.java         |  60 --
 .../converters/BigIntegerConverter.java         |  92 --
 .../internal/converters/BooleanConverter.java   |  65 --
 .../core/internal/converters/ByteConverter.java |  60 --
 .../core/internal/converters/CharConverter.java |  66 --
 .../internal/converters/ClassConverter.java     |  58 --
 .../internal/converters/CurrencyConverter.java  |  87 --
 .../internal/converters/DoubleConverter.java    |  70 --
 .../core/internal/converters/EnumConverter.java |  67 --
 .../internal/converters/FloatConverter.java     |  78 --
 .../internal/converters/IntegerConverter.java   |  70 --
 .../internal/converters/LocalDateConverter.java |  36 -
 .../converters/LocalDateTimeConverter.java      |  36 -
 .../internal/converters/LocalTimeConverter.java |  42 -
 .../core/internal/converters/LongConverter.java |  68 --
 .../internal/converters/NumberConverter.java    |  72 --
 .../internal/converters/ShortConverter.java     |  70 --
 .../core/internal/converters/URIConverter.java  |  45 -
 .../core/internal/converters/URLConverter.java  |  45 -
 .../internal/converters/ZoneIdConverter.java    |  47 -
 .../core/propertysource/BasePropertySource.java |  55 --
 .../EnvironmentPropertySource.java              |  54 --
 .../propertysource/SimplePropertySource.java    | 118 ---
 .../propertysource/SystemPropertySource.java    |  87 --
 .../provider/JavaConfigurationProvider.java     |  58 --
 ...pache.tamaya.spi.ConfigurationContextBuilder |  19 -
 ...g.apache.tamaya.spi.ConfigurationProviderSpi |  19 -
 .../org.apache.tamaya.spi.PropertyConverter     |  37 -
 .../org.apache.tamaya.spi.PropertySource        |  20 -
 ...org.apache.tamaya.spi.PropertySourceProvider |  19 -
 .../org.apache.tamaya.spi.ServiceContext        |  19 -
 .../apache/tamaya/core/ConfigurationTest.java   |  58 --
 .../org/apache/tamaya/core/NotMockedAnswer.java |  55 --
 .../java/org/apache/tamaya/core/internal/A.java |  29 -
 .../java/org/apache/tamaya/core/internal/B.java |  29 -
 .../java/org/apache/tamaya/core/internal/C.java |  56 --
 .../tamaya/core/internal/CTestConverter.java    |  31 -
 .../core/internal/DefaultConfigurationTest.java | 204 -----
 .../internal/DefaultServiceContextTest.java     | 128 ---
 .../internal/PropertyConverterManagerTest.java  | 162 ----
 .../converters/BigDecimalConverterTest.java     | 104 ---
 .../converters/BooleanConverterTest.java        | 131 ---
 .../internal/converters/ByteConverterTest.java  | 113 ---
 .../internal/converters/CharConverterTest.java  |  90 --
 .../ConverterTestsPropertySource.java           | 252 ------
 .../converters/CurrencyConverterTest.java       | 155 ----
 .../converters/DoubleConverterTest.java         | 176 ----
 .../internal/converters/EnumConverterTest.java  |  53 --
 .../internal/converters/FloatConverterTest.java | 178 ----
 .../converters/IntegerConverterTest.java        | 113 ---
 .../converters/LocalDateConverterTest.java      |  41 -
 .../internal/converters/LongConverterTest.java  | 113 ---
 .../converters/NumberConverterTest.java         | 104 ---
 .../internal/converters/ShortConverterTest.java | 113 ---
 .../propertysource/BasePropertySourceTest.java  | 104 ---
 .../EnvironmentPropertySourceTest.java          |  62 --
 .../PropertiesFilePropertySourceTest.java       |  64 --
 .../SystemPropertySourceTest.java               | 101 ---
 .../provider/JavaConfigurationProviderTest.java |  60 --
 .../testdata/TestPropertyDefaultSource.java     |  51 --
 .../core/testdata/TestPropertyFilter.java       |  37 -
 .../testdata/TestPropertySourceProvider.java    |  73 --
 .../testdata/TestRemovingPropertyFilter.java    |  41 -
 .../META-INF/javaconfiguration.properties       |  22 -
 ...tServiceContextTest$InvalidPriorityInterface |  19 -
 ...efaultServiceContextTest$MultiImplsInterface |  20 -
 .../org.apache.tamaya.spi.PropertyConverter     |  19 -
 .../org.apache.tamaya.spi.PropertyFilter        |  20 -
 .../org.apache.tamaya.spi.PropertySource        |  22 -
 ...org.apache.tamaya.spi.PropertySourceProvider |  20 -
 .../core/src/test/resources/arquillian.xml      |  30 -
 .../test/resources/javaconfiguration.properties |  22 -
 .../test/resources/overrideOrdinal.properties   |  25 -
 .../core/src/test/resources/testfile.properties |  22 -
 .../core/src/test/resources/x34.properties      |  19 -
 attic/pom.xml                                   | 109 ---
 distribution/pom.xml                            | 490 ----------
 .../src/main/assembly/distribution-bin.xml      | 371 --------
 examples/1-minimal-example/pom.xml              |  50 -
 .../tamaya/examples/resolver/ExampleMain.java   |  58 --
 .../META-INF/javaconfiguration.properties       |  26 -
 .../tamaya/examples/minimal/MinimalTests.java   |  99 --
 .../org/tamaya/examples/minimal/TestEnum.java   |  26 -
 .../META-INF/javaconfiguration.properties       |  27 -
 .../2-simple-propertysource-example/pom.xml     |  46 -
 .../tamaya/examples/simple/ExampleMain.java     |  63 --
 .../examples/simple/SimplePropertySource.java   |  62 --
 .../simple/SimplePropertySourceProvider.java    |  48 -
 .../META-INF/MyOtherConfigProperties.properties |  21 -
 .../META-INF/javaconfiguration.properties       |  25 -
 .../org.apache.tamaya.spi.PropertySource        |  20 -
 ...org.apache.tamaya.spi.PropertySourceProvider |  19 -
 .../src/main/resources/cfgOther/a.properties    |  19 -
 .../src/main/resources/cfgOther/b.properties    |  19 -
 .../src/main/resources/cfgOther/c.properties    |  20 -
 examples/3-resources-example/pom.xml            |  52 --
 .../tamaya/examples/resources/ExampleMain.java  |  63 --
 .../resources/MyPathPropertySourceProvider.java |  42 -
 .../META-INF/MyOtherConfigProperties.properties |  21 -
 .../META-INF/javaconfiguration.properties       |  25 -
 ...org.apache.tamaya.spi.PropertySourceProvider |  19 -
 .../main/resources/cfgOther/subs/a.properties   |  19 -
 .../main/resources/cfgOther/subs/b.properties   |  19 -
 .../main/resources/cfgOther/subs/c.properties   |  19 -
 examples/4-resolver-example/pom.xml             |  55 --
 .../tamaya/examples/resolver/ExampleMain.java   |  63 --
 .../META-INF/javaconfiguration.properties       |  32 -
 .../src/main/resources/buildata                 |  19 -
 .../tamaya/examples/minimal/MinimalTests.java   |  98 --
 .../org/tamaya/examples/minimal/TestEnum.java   |  26 -
 .../META-INF/javaconfiguration.properties       |  24 -
 examples/5-injection-example/pom.xml            |  71 --
 .../tamaya/examples/injection/Example.java      |  48 -
 .../tamaya/examples/injection/ExampleMain.java  |  51 --
 .../examples/injection/ExampleTemplate.java     |  40 -
 .../META-INF/javaconfiguration.properties       |  27 -
 .../tamaya/examples/minimal/MinimalTests.java   |  98 --
 .../org/tamaya/examples/minimal/TestEnum.java   |  26 -
 .../META-INF/javaconfiguration.properties       |  25 -
 examples/6-fileobserver-example/pom.xml         |  67 --
 .../fileobserver/ObservedConfigExampleTest.java | 139 ---
 .../examples/fileobserver/TestConfigView.java   | 153 ----
 .../fileobserver/TestObservingProvider.java     |  38 -
 ...org.apache.tamaya.spi.PropertySourceProvider |  20 -
 .../src/test/resources/test.properties          |  21 -
 examples/7-builder-example/pom.xml              |  65 --
 .../examples/builder/UsingABuilderExample.java  |  45 -
 examples/8-remote-example/client/pom.xml        |  80 --
 .../tamaya/examples/remote/client/Client.java   |  98 --
 .../remote/client/PrintConfigServlet.java       |  78 --
 .../org.apache.tamaya.spi.PropertySource        |  19 -
 examples/8-remote-example/pom.xml               |  69 --
 examples/8-remote-example/server/pom.xml        | 135 ---
 .../server/src/main/java/ExampleServer.java     |  33 -
 .../META-INF/javaconfiguration.properties       |  31 -
 .../server/src/main/resources/config-server.yml |  29 -
 examples/pom.xml                                |  83 --
 keys/KEYS                                       |  57 --
 modules/builder/pom.xml                         | 104 ---
 .../tamaya/builder/ConfigurationBuilder.java    | 605 -------------
 .../ProgrammaticConfigurationContext.java       | 388 --------
 .../tamaya/builder/PropertySourceBuilder.java   | 118 ---
 .../tamaya/builder/SimplePropertySource.java    |  86 --
 .../org/apache/tamaya/builder/package-info.java |  28 -
 .../builder/ConfigurationBuilderTest.java       | 907 -------------------
 .../builder/TestANonSPIPropertyFilter.java      |  35 -
 .../builder/TestBNonSPIPropertyFilter.java      |  35 -
 .../tamaya/builder/TestPropertyFilter.java      |  35 -
 .../tamaya/builder/TestPropertySource.java      |  59 --
 .../builder/TestPropertySourceProvider.java     |  91 --
 .../builder/TestPropertySourceProviderB.java    |  91 --
 .../builder/util/mockito/NotMockedAnswer.java   |  57 --
 .../tamaya/builder/util/types/CustomTypeA.java  |  34 -
 .../tamaya/builder/util/types/CustomTypeB.java  |  39 -
 .../tamaya/builder/util/types/CustomTypeC.java  |  36 -
 .../types/CustomTypeCPropertyConverter.java     |  29 -
 .../org.apache.tamaya.spi.PropertyConverter     |  19 -
 .../org.apache.tamaya.spi.PropertyFilter        |  19 -
 .../org.apache.tamaya.spi.PropertySource        |  19 -
 ...org.apache.tamaya.spi.PropertySourceProvider |  19 -
 .../test/resources/configfiles/json/first.json  |   4 -
 .../test/resources/configfiles/json/second.json |   4 -
 .../test/resources/configfiles/json/simple.json |   4 -
 .../test/resources/configfiles/json/third.json  |   4 -
 .../test/resources/configfiles/other/simple.oml |  19 -
 modules/classloader-support/pom.xml             |  74 --
 .../AbstractClassloaderAwareItemLoader.java     | 268 ------
 .../clsupport/CLAwareConfigurationContext.java  | 105 ---
 .../tamaya/clsupport/CLAwareServiceContext.java | 248 -----
 .../tamaya/clsupport/ServiceContainer.java      | 306 -------
 .../apache/tamaya/clsupport/package-info.java   |  22 -
 .../org.apache.tamaya.spi.ServiceContext        |  19 -
 ...he.tamaya.environment.spi.ContextProviderSpi |  23 -
 ...org.apache.tamaya.environment.spi.ContextSpi |  19 -
 modules/collections/pom.xml                     |  74 --
 .../internal/AdaptiveCombinationPolicy.java     | 125 ---
 .../internal/ArrayListConverter.java            |  62 --
 .../internal/CollectionConverter.java           |  63 --
 .../internal/ConcurrentHashMapConverter.java    |  63 --
 .../collections/internal/HashMapConverter.java  |  63 --
 .../collections/internal/HashSetConverter.java  |  62 --
 .../collections/internal/ItemTokenizer.java     | 171 ----
 .../internal/LinkedListConverter.java           |  63 --
 .../collections/internal/ListConverter.java     |  55 --
 .../collections/internal/MapConverter.java      |  58 --
 .../collections/internal/SetConverter.java      |  55 --
 .../internal/SortedMapConverter.java            |  36 -
 .../internal/SortedSetConverter.java            |  36 -
 .../collections/internal/TreeMapConverter.java  |  62 --
 .../collections/internal/TreeSetConverter.java  |  63 --
 .../org.apache.tamaya.spi.PropertyConverter     |  31 -
 ...he.tamaya.spi.PropertyValueCombinationPolicy |  19 -
 .../collections/CollectionAdvancedTests.java    | 117 ---
 .../collections/CollectionsBaseTests.java       | 227 -----
 .../CollectionsTypedReadOnlyTests.java          | 173 ----
 .../collections/CollectionsTypedTests.java      | 208 -----
 .../collections/MyUpperCaseConverter.java       |  33 -
 .../META-INF/javaconfiguration.properties       |  73 --
 modules/events/pom.xml                          |  99 --
 .../org/apache/tamaya/events/ChangeType.java    |  31 -
 .../org/apache/tamaya/events/ConfigEvent.java   |  55 --
 .../tamaya/events/ConfigEventListener.java      |  31 -
 .../tamaya/events/ConfigEventManager.java       | 186 ----
 .../tamaya/events/ConfigurationChange.java      | 218 -----
 .../events/ConfigurationChangeBuilder.java      | 274 ------
 .../events/ConfigurationContextChange.java      | 210 -----
 .../ConfigurationContextChangeBuilder.java      | 174 ----
 .../tamaya/events/FrozenConfiguration.java      | 194 ----
 .../tamaya/events/FrozenPropertySource.java     | 126 ---
 .../tamaya/events/PropertySourceChange.java     | 242 -----
 .../events/PropertySourceChangeBuilder.java     | 263 ------
 .../tamaya/events/delta/package-info.java       |  23 -
 .../folderobserver/FileChangeListener.java      | 144 ---
 .../folderobserver/FileChangeObserver.java      |  33 -
 .../ObservingPropertySourceProvider.java        | 209 -----
 .../events/folderobserver/package-info.java     |  24 -
 .../internal/DefaultConfigChangeObserver.java   | 111 ---
 .../internal/DefaultConfigEventManagerSpi.java  | 202 -----
 ...faultConfigurationContextChangeListener.java |  74 --
 .../events/internal/LoggingConfigListener.java  |  40 -
 .../tamaya/events/internal/package-info.java    |  22 -
 .../org/apache/tamaya/events/package-info.java  |  24 -
 .../tamaya/events/spi/BaseConfigEvent.java      |  69 --
 .../events/spi/ConfigEventManagerSpi.java       | 128 ---
 .../apache/tamaya/events/spi/package-info.java  |  23 -
 ...org.apache.tamaya.events.ConfigEventListener |  19 -
 ...ache.tamaya.events.spi.ConfigEventManagerSpi |  19 -
 .../events/ChangeableGlobalPropertySource.java  |  62 --
 .../ChangeableThreadLocalPropertySource.java    |  57 --
 .../tamaya/events/ConfigEventManagerTest.java   |  66 --
 .../tamaya/events/FrozenPropertySourceTest.java | 106 ---
 .../tamaya/events/ObservedConfigTest.java       |  69 --
 .../tamaya/events/RandomPropertySource.java     |  66 --
 .../org/apache/tamaya/events/SimpleEvent.java   |  32 -
 .../apache/tamaya/events/TestConfigView.java    | 156 ----
 .../tamaya/events/TestObservingProvider.java    |  92 --
 .../events/delta/ConfigurationChangeTest.java   | 163 ----
 .../delta/ConfigurationContextChangeTest.java   | 138 ---
 .../events/delta/PropertySourceChangeTest.java  | 209 -----
 .../DefaultConfigEventManagerSpiTest.java       |  66 --
 ...org.apache.tamaya.events.ConfigEventListener |  19 -
 .../org.apache.tamaya.spi.PropertySource        |  19 -
 ...org.apache.tamaya.spi.PropertySourceProvider |  19 -
 .../src/test/resources/data/test1.properties    |  20 -
 .../src/test/resources/data/test1b.properties   |  20 -
 .../src/test/resources/data/test2.properties    |  20 -
 .../src/test/resources/data/test3.properties    |  20 -
 .../events/src/test/resources/test.properties   |  21 -
 modules/filter/pom.xml                          |  81 --
 .../tamaya/filter/ConfigurationFilter.java      | 121 ---
 .../tamaya/filter/ProgrammableFilter.java       | 118 ---
 .../tamaya/filter/RegexPropertyFilter.java      |  56 --
 .../filter/internal/DefaultMetadataFilter.java  |  43 -
 .../org.apache.tamaya.spi.PropertyFilter        |  19 -
 .../tamaya/filter/ConfigurationFilterTest.java  | 122 ---
 .../tamaya/filter/ProgrammableFilterTest.java   | 141 ---
 .../tamaya/filter/RegexPropertyFilterTest.java  |  55 --
 modules/formats/pom.xml                         |  86 --
 .../BaseFormatPropertySourceProvider.java       | 154 ----
 .../apache/tamaya/format/ConfigurationData.java | 206 -----
 .../tamaya/format/ConfigurationDataBuilder.java | 219 -----
 .../tamaya/format/ConfigurationFormat.java      | 103 ---
 .../tamaya/format/ConfigurationFormats.java     | 187 ----
 .../format/FlattenedDefaultPropertySource.java  | 118 ---
 .../tamaya/format/InputStreamFactory.java       |  89 --
 .../format/formats/IniConfigurationFormat.java  |  95 --
 .../tamaya/format/formats/PropertiesFormat.java |  71 --
 .../format/formats/PropertiesXmlFormat.java     |  69 --
 .../tamaya/format/formats/package-info.java     |  23 -
 .../org/apache/tamaya/format/package-info.java  |  28 -
 ...org.apache.tamaya.format.ConfigurationFormat |  21 -
 .../tamaya/format/ConfigurationFormatsTest.java |  68 --
 .../FlattenedDefaultPropertySourceTest.java     |  98 --
 .../tamaya/format/InputStreamFactoryTest.java   | 145 ---
 modules/formats/src/test/resources/Test.ini     |  26 -
 .../formats/src/test/resources/Test.properties  |  21 -
 modules/functions/pom.xml                       |  79 --
 .../tamaya/functions/CombinedConfiguration.java | 146 ---
 .../functions/ConfigWrappingPropertySource.java |  80 --
 .../functions/ConfigurationFunctions.java       | 662 --------------
 .../tamaya/functions/EnrichedConfiguration.java | 159 ----
 .../functions/EnrichedPropertySource.java       |  97 --
 .../tamaya/functions/FilteredConfiguration.java | 126 ---
 .../functions/FilteredPropertySource.java       |  84 --
 .../org/apache/tamaya/functions/KeyMapper.java  |  37 -
 .../tamaya/functions/MappedConfiguration.java   | 132 ---
 .../tamaya/functions/MappedPropertySource.java  |  88 --
 .../org/apache/tamaya/functions/Predicate.java  |  42 -
 .../apache/tamaya/functions/PropertyMapper.java |  36 -
 .../tamaya/functions/PropertyMatcher.java       |  38 -
 .../functions/PropertySourceFunctions.java      | 348 -------
 .../functions/ValueMappedPropertySource.java    |  85 --
 .../apache/tamaya/functions/package-info.java   |  22 -
 .../functions/ConfigurationFunctionsTest.java   | 143 ---
 .../functions/PropertySourceFunctionsTest.java  | 106 ---
 modules/injection-api/pom.xml                   |  79 --
 .../tamaya/inject/api/BaseDynamicValue.java     | 125 ---
 .../org/apache/tamaya/inject/api/Config.java    |  93 --
 .../tamaya/inject/api/ConfigAutoInject.java     |  36 -
 .../inject/api/ConfigDefaultSections.java       |  44 -
 .../inject/api/ConfiguredItemSupplier.java      |  41 -
 .../apache/tamaya/inject/api/DynamicValue.java  | 161 ----
 .../tamaya/inject/api/InjectionUtils.java       | 130 ---
 .../apache/tamaya/inject/api/LoadPolicy.java    |  42 -
 .../org/apache/tamaya/inject/api/NoConfig.java  |  36 -
 .../apache/tamaya/inject/api/UpdatePolicy.java  |  40 -
 .../tamaya/inject/api/WithConfigOperator.java   |  45 -
 .../inject/api/WithPropertyConverter.java       |  46 -
 .../apache/tamaya/inject/api/package-info.java  |  22 -
 .../tamaya/inject/spi/ConfiguredField.java      |  68 --
 .../tamaya/inject/spi/ConfiguredMethod.java     |  70 --
 .../tamaya/inject/spi/ConfiguredType.java       |  63 --
 modules/injection/pom.xml                       | 102 ---
 .../tamaya/inject/ConfigurationInjection.java   |  42 -
 .../tamaya/inject/ConfigurationInjector.java    |  94 --
 .../ConfigTemplateInvocationHandler.java        |  73 --
 .../inject/internal/ConfiguredFieldImpl.java    | 170 ----
 .../inject/internal/ConfiguredSetterMethod.java | 139 ---
 .../inject/internal/ConfiguredTypeImpl.java     | 237 -----
 .../internal/DefaultConfigurationInjector.java  | 179 ----
 .../inject/internal/DefaultDynamicValue.java    | 498 ----------
 .../tamaya/inject/internal/InjectionHelper.java | 244 -----
 .../apache/tamaya/inject/internal/Utils.java    | 128 ---
 .../tamaya/inject/internal/package-info.java    |  22 -
 .../org/apache/tamaya/inject/package-info.java  |  22 -
 ...g.apache.tamaya.inject.ConfigurationInjector |  19 -
 .../java/annottext/AnnotatedConfigBean.java     |  78 --
 .../java/annottext/AnnotatedConfigTemplate.java |  47 -
 .../java/annottext/NonAnnotatedConfigBean.java  |  45 -
 .../tamaya/inject/TamayaInjectionTest.java      |  87 --
 .../tamaya/inject/TestPropertySource.java       |  68 --
 .../internal/DefaultDynamicValueTest.java       | 315 -------
 .../org.apache.tamaya.spi.PropertySource        |  19 -
 modules/integration/camel/pom.xml               | 100 --
 .../camel/TamayaPropertiesComponent.java        |  78 --
 .../camel/TamayaPropertyResolver.java           |  53 --
 .../camel/TamayaPropertyResolverTest.java       | 116 ---
 .../test/resources/META-INF/camelcontext.xml    |  52 --
 .../META-INF/javaconfiguration.properties       |  19 -
 .../src/test/resources/META-INF/routes.xml      |  39 -
 modules/integration/cdi-se/pom.xml              | 210 -----
 .../integration/cdi/CDIAwareServiceContext.java | 169 ----
 .../cdi/DefaultConfigurationContext.java        | 286 ------
 .../cdi/DefaultConfigurationContextBuilder.java | 152 ----
 .../tamaya/integration/cdi/EnumConverter.java   |  71 --
 .../cdi/PropertyConverterManager.java           | 427 ---------
 .../integration/cdi/SEInjectorCDIExtension.java | 112 ---
 .../cdi/ServiceLoaderServiceContext.java        | 151 ---
 .../integration/cdi/TamayaCDIIntegration.java   |  52 --
 .../integration/cdi/TamayaConfigProvider.java   |  54 --
 .../cdi/config/ConfiguredVetoExtension.java     |  42 -
 .../src/main/resources/META-INF/beans.xml       |  24 -
 .../javax.enterprise.inject.spi.Extension       |  20 -
 .../org.apache.tamaya.spi.ServiceContext        |  19 -
 .../tamaya/integration/cdi/ConfiguredClass.java | 112 ---
 .../tamaya/integration/cdi/ConfiguredTest.java  |  83 --
 .../tamaya/integration/cdi/InjectedClass.java   |  62 --
 .../cdi/cfg/ProvidedPropertySource.java         |  67 --
 .../integration/cdi/cfg/TestConfigProvider.java |  45 -
 .../integration/cdi/cfg/TestPropertySource.java |  79 --
 .../src/test/resources/META-INF/beans.xml       |  24 -
 .../META-INF/javaconfiguration.properties       |  20 -
 modules/integration/cdi/pom.xml                 | 224 -----
 .../integration/cdi/CDIConfiguredField.java     |  77 --
 .../integration/cdi/CDIConfiguredMethod.java    |  77 --
 .../integration/cdi/CDIConfiguredType.java      |  94 --
 .../integration/cdi/ConfigurationExtension.java | 287 ------
 .../integration/cdi/ConfigurationProducer.java  | 146 ---
 .../integration/cdi/DefaultDynamicValue.java    | 499 ----------
 .../cdi/src/main/resources/META-INF/beans.xml   |  19 -
 .../javax.enterprise.inject.spi.Extension       |  19 -
 ...onfigurationProducerFailedInjectionTest.java |  33 -
 .../cdi/ConfigurationProducerTest.java          | 168 ----
 .../cdi/ConfigurationResolverTest.java          | 112 ---
 .../integration/cdi/EnvironmentsTest.java       |  83 --
 .../integration/cdi/InterpolationTest.java      |  62 --
 .../integration/cdi/NotFoundNoDefault.java      |  78 --
 .../cdi/src/test/resources/META-INF/beans.xml   |  19 -
 .../META-INF/javaconfiguration.properties       |  32 -
 .../cdi/src/test/resources/base.properties      |  32 -
 .../cdi/src/test/resources/cert.properties      |  20 -
 .../cdi/src/test/resources/dev.properties       |  19 -
 .../cdi/src/test/resources/prod.properties      |  20 -
 .../cdi/src/test/resources/qa.properties        |  20 -
 .../cdi/src/test/resources/test.properties      |  20 -
 modules/integration/consul/pom.xml              | 112 ---
 .../apache/tamaya/consul/ConsulBackends.java    |  59 --
 .../tamaya/consul/ConsulPropertySource.java     | 198 ----
 .../org.apache.tamaya.spi.PropertySource        |  19 -
 .../tamaya/etcd/ConsulPropertySourceTest.java   |  75 --
 .../org/apache/tamaya/etcd/ConsulWriteTest.java |  80 --
 modules/integration/etcd/pom.xml                | 110 ---
 .../org/apache/tamaya/etcd/EtcdAccessor.java    | 520 -----------
 .../org/apache/tamaya/etcd/EtcdBackends.java    |  65 --
 .../apache/tamaya/etcd/EtcdPropertySource.java  | 209 -----
 .../org.apache.tamaya.spi.PropertySource        |  19 -
 .../apache/tamaya/etcd/EtcdAccessorTest.java    | 116 ---
 .../tamaya/etcd/EtcdPropertySourceTest.java     |  74 --
 modules/integration/osgi/pom.xml                | 102 ---
 .../tamaya/integration/osgi/Activator.java      | 134 ---
 .../integration/osgi/OSGIConfigRootMapper.java  |  36 -
 .../osgi/OSGIEnhancedConfiguration.java         | 117 ---
 .../integration/osgi/TamayaConfigAdminImpl.java | 196 ----
 .../osgi/TamayaConfigurationImpl.java           | 127 ---
 .../META-INF/javaconfiguration.properties       |  18 -
 .../osgi/src/test/resources/arquillian.xml      |  27 -
 .../osgi/src/test/resources/felix.properties    |  23 -
 modules/integration/pom.xml                     |  43 -
 modules/integration/spring/pom.xml              | 116 ---
 .../SpringConfigInjectionPostProcessor.java     |  42 -
 .../integration/spring/TamayaEnvironment.java   |  33 -
 .../integration/spring/TamayaSpringConfig.java  |  56 --
 .../spring/TamayaSpringPropertySource.java      |  39 -
 .../spring/src/main/resources/spring-config.xml |  32 -
 .../spring/ConfiguredSpringBean.java            |  62 --
 .../integration/spring/SpringConfigTest.java    |  61 --
 .../integration/spring/SpringConfigTest2.java   |  47 -
 .../META-INF/javaconfiguration.properties       |  20 -
 .../test/resources/spring-config-scanOnly.xml   |  35 -
 .../spring/src/test/resources/spring-config.xml |  31 -
 modules/json/pom.xml                            | 147 ---
 .../java/org/apache/tamaya/json/JSONFormat.java |  85 --
 .../apache/tamaya/json/JSONPropertySource.java  | 149 ---
 .../org/apache/tamaya/json/JSONVisitor.java     | 119 ---
 ...org.apache.tamaya.format.ConfigurationFormat |  19 -
 .../json/CommonJSONTestCaseCollection.java      | 190 ----
 .../org/apache/tamaya/json/JSONFormatIT.java    |  48 -
 .../org/apache/tamaya/json/JSONFormatTest.java  |  75 --
 .../tamaya/json/JSONPropertySourceTest.java     |  56 --
 modules/json/src/test/resources/arquillian.xml  |  30 -
 .../test/resources/configs/invalid/array.json   |  21 -
 .../resources/configs/invalid/empty-file.json   |  18 -
 .../configs/invalid/only-opening-bracket.json   |  19 -
 .../resources/configs/invalid/with-array.json   |  27 -
 .../test/resources/configs/valid/cyrillic.json  |  22 -
 .../configs/valid/empty-object-config.json      |  20 -
 .../valid/simple-flat-string-only-config.json   |  23 -
 .../simple-nested-string-only-config-1.json     |  27 -
 .../simple-nested-string-only-config-2.json     |  26 -
 .../configs/valid/with-explicit-priority.json   |  25 -
 modules/management/pom.xml                      |  81 --
 .../management/ConfigManagementSupport.java     | 128 ---
 .../apache/tamaya/management/ManagedConfig.java | 110 ---
 .../tamaya/management/ManagedConfigMBean.java   | 119 ---
 .../src/main/resources/META-INF/beans.xml       |  24 -
 .../META-INF/javaconfiguration.properties       |  19 -
 ....apache.tamaya.management.ManagedConfigMBean |  19 -
 .../management/internal/ManagedConfigTest.java  | 118 ---
 .../src/test/resources/META-INF/beans.xml       |  24 -
 modules/model/pom.xml                           | 120 ---
 .../org/apache/tamaya/model/ConfigModel.java    |  78 --
 .../apache/tamaya/model/ConfigModelManager.java | 289 ------
 .../apache/tamaya/model/ConfigUsageStats.java   | 129 ---
 .../org/apache/tamaya/model/ModelTarget.java    |  37 -
 .../java/org/apache/tamaya/model/Usage.java     | 312 -------
 .../org/apache/tamaya/model/Validation.java     | 203 -----
 .../apache/tamaya/model/ValidationResult.java   |  59 --
 .../model/internal/ConfigDocumentationBean.java | 197 ----
 .../ConfiguredInlineModelProviderSpi.java       |  69 --
 .../ConfiguredPropertiesModelProviderSpi.java   | 154 ----
 .../ConfiguredResourcesModelProviderSpi.java    | 160 ----
 .../ConfiguredTypeEventsModelPopulator.java     |  90 --
 .../ConfiguredTypeEventsModelProvider.java      |  51 --
 .../model/internal/DefaultConfigUsageStats.java | 176 ----
 .../model/internal/UsageTrackerFilter.java      |  46 -
 .../tamaya/model/spi/AbstractConfigModel.java   |  88 --
 .../model/spi/ConfigDocumentationMBean.java     |  53 --
 .../tamaya/model/spi/ConfigModelReader.java     | 144 ---
 .../tamaya/model/spi/ConfigUsageStatsSpi.java   | 101 ---
 .../org/apache/tamaya/model/spi/GroupModel.java | 110 ---
 .../tamaya/model/spi/ModelProviderSpi.java      |  39 -
 .../apache/tamaya/model/spi/ParameterModel.java | 242 -----
 .../apache/tamaya/model/spi/SectionModel.java   | 202 -----
 .../resources/META-INF/configmodel.properties   |  35 -
 ...org.apache.tamaya.events.ConfigEventListener |  19 -
 ...he.tamaya.model.spi.ConfigDocumentationMBean |  19 -
 ....apache.tamaya.model.spi.ConfigUsageStatsSpi |  19 -
 ...org.apache.tamaya.model.spi.ModelProviderSpi |  22 -
 .../org.apache.tamaya.spi.PropertyFilter        |  19 -
 .../tamaya/model/ConfigModelProviderTest.java   |  68 --
 .../tamaya/model/ConfigUsageStatsTest.java      | 114 ---
 .../apache/tamaya/model/ValidationTests.java    |  52 --
 .../internal/ConfigDocumentationBeanTest.java   | 108 ---
 .../java/test/model/TestConfigAccessor.java     |  45 -
 .../resources/META-INF/configmodel.properties   |  96 --
 .../META-INF/javaconfiguration.properties       |  22 -
 ...org.apache.tamaya.model.spi.ModelProviderSpi |  19 -
 .../src/test/resources/examples/configmodel.ini |  76 --
 .../test/resources/examples/configmodel.json    | 108 ---
 .../resources/examples/configmodel.properties   |  96 --
 .../src/test/resources/examples/configmodel.xml |  97 --
 .../test/resources/examples/configmodel.yaml    | 106 ---
 modules/mutable-config/pom.xml                  |  83 --
 .../mutableconfig/ChangePropagationPolicy.java  |  53 --
 .../mutableconfig/MutableConfiguration.java     | 126 ---
 .../MutableConfigurationProvider.java           | 239 -----
 .../internal/DefaultMutableConfiguration.java   | 170 ----
 .../DefaultMutableConfigurationSpi.java         |  38 -
 .../MutablePropertiesPropertySource.java        | 196 ----
 .../MutableXmlPropertiesPropertySource.java     | 198 ----
 .../mutableconfig/spi/ConfigChangeRequest.java  | 176 ----
 .../spi/MutableConfigurationProviderSpi.java    |  42 -
 .../spi/MutablePropertySource.java              |  47 -
 ...leconfig.spi.MutableConfigurationProviderSpi |  19 -
 .../mutableconfig/MutableConfigurationTest.java | 187 ----
 .../PropertiesFileConfigBackendTest.java        |  29 -
 .../internal/WritablePropertiesSource.java      |  49 -
 .../internal/WritableXmlPropertiesSource.java   |  49 -
 .../org.apache.tamaya.spi.PropertySource        |  20 -
 modules/optional/pom.xml                        |  81 --
 .../tamaya/optional/EvaluationPolicy.java       |  33 -
 .../tamaya/optional/OptionalConfiguration.java  | 214 -----
 .../apache/tamaya/optional/ValueProvider.java   |  40 -
 .../optional/OptionalConfigurationTest.java     | 101 ---
 modules/pom.xml                                 | 119 ---
 modules/resolver/pom.xml                        |  85 --
 .../org/apache/tamaya/resolver/Resolver.java    |  77 --
 .../resolver/internal/ConfigResolver.java       |  43 -
 .../internal/DefaultExpressionEvaluator.java    | 260 ------
 .../internal/EnvironmentPropertyResolver.java   |  42 -
 .../internal/ExpressionResolutionFilter.java    |  86 --
 .../tamaya/resolver/internal/FileResolver.java  | 120 ---
 .../resolver/internal/ResourceResolver.java     | 151 ---
 .../internal/SystemPropertyResolver.java        |  42 -
 .../tamaya/resolver/internal/URLResolver.java   |  66 --
 .../tamaya/resolver/internal/package-info.java  |  23 -
 .../apache/tamaya/resolver/package-info.java    |  22 -
 .../resolver/spi/ExpressionEvaluator.java       |  66 --
 .../tamaya/resolver/spi/ExpressionResolver.java |  48 -
 .../tamaya/resolver/spi/package-info.java       |  23 -
 ...ache.tamaya.resolver.spi.ExpressionEvaluator |  19 -
 ...pache.tamaya.resolver.spi.ExpressionResolver |  24 -
 .../org.apache.tamaya.spi.PropertyFilter        |  19 -
 .../tamaya/resolver/ConfigResolutionTest.java   | 121 ---
 .../tamaya/resolver/MyTestPropertySource.java   | 102 ---
 .../apache/tamaya/resolver/ResolverTest.java    |  41 -
 .../org.apache.tamaya.spi.PropertySource        |  19 -
 .../src/test/resources/Testresource.txt         |  19 -
 .../src/test/resources/Testresource2.txt        |  19 -
 modules/resources/README.md                     |  26 -
 modules/resources/pom.xml                       |  77 --
 .../AbstractPathPropertySourceProvider.java     | 193 ----
 .../tamaya/resource/BaseResourceResolver.java   | 111 ---
 .../apache/tamaya/resource/ConfigResources.java |  51 --
 .../apache/tamaya/resource/ResourceLocator.java |  37 -
 .../tamaya/resource/ResourceResolver.java       | 101 ---
 .../internal/ClassPathResourceLocator.java      |  69 --
 .../resource/internal/ClasspathCollector.java   | 381 --------
 .../internal/DefaultResourceResolver.java       |  60 --
 .../tamaya/resource/internal/FileCollector.java | 178 ----
 .../resource/internal/FileResourceLocator.java  |  69 --
 .../tamaya/resource/internal/Locator.java       | 155 ----
 .../resource/internal/PathResourceLocator.java  |  65 --
 .../resource/internal/URLResourceLocator.java   |  66 --
 .../tamaya/resource/internal/VfsSupport.java    | 252 ------
 .../tamaya/resource/internal/package-info.java  |  23 -
 .../apache/tamaya/resource/package-info.java    |  22 -
 .../org.apache.tamaya.resource.ResourceLocator  |  22 -
 .../org.apache.tamaya.resource.ResourceResolver |  19 -
 .../AbstractPathPropertySourceProviderTest.java | 133 ---
 .../internal/ClasspathCollectorTest.java        |  89 --
 .../internal/DefaultResourceResolverTest.java   |  59 --
 .../resource/internal/FileCollectorTest.java    |  72 --
 .../PathBasedPropertySourceProvider.java        |  97 --
 .../resources/resources_testroot/aa_a/a1_1.file |  18 -
 .../resources/resources_testroot/aa_a/a1_2.file |  18 -
 .../resources/resources_testroot/aa_a/a2.file   |  18 -
 .../resources/resources_testroot/aa_a/a3.file   |  18 -
 .../resources/resources_testroot/aa_a/z3.file   |  18 -
 .../resources_testroot/bb/b1/b2/b12.file        |  18 -
 .../resources_testroot/bb/b2/b2_1.file          |  18 -
 .../resources_testroot/bb/b2/b2_2.datei         |  18 -
 .../resources/resources_testroot/bb/b2/b3.foo   |  18 -
 .../src/test/resources/test.properties          |  18 -
 modules/server/pom.xml                          | 203 -----
 .../apache/tamaya/server/ConfigServiceApp.java  |  77 --
 .../tamaya/server/ConfigurationResource.java    | 310 -------
 .../apache/tamaya/server/VersionProperties.java |  68 --
 .../apache/tamaya/server/spi/ScopeManager.java  |  84 --
 .../apache/tamaya/server/spi/ScopeProvider.java |  40 -
 .../META-INF/tamaya-server-version.properties   |  22 -
 modules/server/src/main/resources/banner.txt    |  14 -
 .../server/src/main/resources/config-server.yml |  31 -
 .../tamaya/server/ConfigServiceAppTest.java     |  32 -
 .../org/apache/tamaya/server/EtcdAccessor.java  | 519 -----------
 .../tamaya/server/VersionPropertiesTest.java    |  46 -
 modules/spi-support/pom.xml                     |  75 --
 .../tamaya/spisupport/BasePropertySource.java   |  86 --
 .../tamaya/spisupport/DefaultConfiguration.java | 228 -----
 .../spisupport/DefaultConfigurationContext.java | 256 ------
 .../apache/tamaya/spisupport/EnumConverter.java |  68 --
 .../tamaya/spisupport/MapPropertySource.java    | 147 ---
 .../spisupport/PriorityServiceComparator.java   |  59 --
 .../PropertiesResourcePropertySource.java       |  78 --
 .../spisupport/PropertyConverterManager.java    | 437 ---------
 .../tamaya/spisupport/PropertyFiltering.java    | 131 ---
 .../spisupport/PropertySourceComparator.java    |  54 --
 modules/yaml/pom.xml                            | 117 ---
 .../java/org/apache/tamaya/json/YAMLFormat.java | 156 ----
 .../apache/tamaya/json/YAMLPropertySource.java  | 100 --
 ...org.apache.tamaya.format.ConfigurationFormat |  19 -
 .../org/apache/tamaya/json/YAMLFormatTest.java  |  73 --
 .../tamaya/json/YAMLPropertySourceTest.java     |  54 --
 .../test/resources/configs/valid/contact.yaml   |  46 -
 .../resources/configs/valid/test-with-prio.yaml |  39 -
 .../src/test/resources/configs/valid/test.yaml  |  35 -
 pom.xml                                         |  79 +-
 643 files changed, 2 insertions(+), 56426 deletions(-)
----------------------------------------------------------------------




[02/10] incubator-tamaya git commit: TAMAYA-182: Streamlined/unified builder API and impl.

Posted by an...@apache.org.
TAMAYA-182: Streamlined/unified builder API and impl.


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

Branch: refs/heads/master
Commit: 32a1616cd358059d7e715ce4e0b7cfd4b586d1b1
Parents: 8a8a535
Author: anatole <an...@apache.org>
Authored: Sun Oct 23 15:38:00 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Sun Oct 23 15:38:00 2016 +0200

----------------------------------------------------------------------
 .../apache/tamaya/ConfigurationProvider.java    |  10 +
 .../apache/tamaya/spi/ConfigurationContext.java |  45 ++-
 .../tamaya/spi/ConfigurationContextBuilder.java | 233 ++++++++++---
 .../tamaya/spi/ConfigurationProviderSpi.java    |  47 ++-
 .../tamaya/TestConfigurationProvider.java       |  14 +
 .../internal/DefaultConfigurationContext.java   | 127 +++----
 .../DefaultConfigurationContextBuilder.java     | 349 ++++++++++++++++---
 .../internal/DefaultConfigurationProvider.java  |  35 +-
 .../core/internal/PropertyConverterManager.java |  15 +-
 .../propertysource/SystemPropertySource.java    |   1 -
 .../apache/tamaya/core/ConfigurationTest.java   |   6 +
 jqassistant/serviceloader-rules.xml             |   2 +-
 12 files changed, 678 insertions(+), 206 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/32a1616c/code/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java b/code/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
index bc4cd13..875f8fc 100644
--- a/code/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
+++ b/code/api/src/main/java/org/apache/tamaya/ConfigurationProvider.java
@@ -88,6 +88,16 @@ public final class ConfigurationProvider {
     }
 
     /**
+     * Creates a new configuration instance based on the given context.
+     *
+     * @param context the configuration context, not null.
+     * @return a new Configuration instance, never null.
+     */
+    public static Configuration createConfiguration(ConfigurationContext context) {
+        return PROVIDER_SPI.createConfiguration(context);
+    }
+
+    /**
      * Get access to the current ConfigurationContext.
      *
      * @return the current ConfigurationContext, never null.

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/32a1616c/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java b/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
index 3a757a0..f631d55 100644
--- a/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
+++ b/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
@@ -35,9 +35,30 @@ public interface ConfigurationContext {
      * This method can be used for programmatically adding {@link PropertySource}s.
      * It is not needed for normal 'usage' by end users, but only for Extension Developers!
      *
-     * @param propertySourcesToAdd the PropertySources to add
+     * @param propertySources the PropertySources to add
+     * @deprecated Use {@link ConfigurationContextBuilder} to create a new {@link ConfigurationContext}.
+     * @see #toBuilder()
      */
-    void addPropertySources(PropertySource... propertySourcesToAdd);
+    @Deprecated
+    void addPropertySources(PropertySource... propertySources);
+
+    /**
+     * This method can be used for programmatically adding {@link PropertyFilter}s.
+     * It is not needed for normal 'usage' by end users, but only for Extension Developers!
+     *
+     * @param propertyFilters the PropertyFilters to add
+     * @deprecated Use {@link ConfigurationContextBuilder} to create a new {@link ConfigurationContext}.
+     * @see #toBuilder()
+     */
+    @Deprecated
+    void addPropertyFilter(PropertyFilter... propertyFilters);
+
+    /**
+     * Allows to check if a given property source is registered, using its name.
+     * @param name the property source name.
+     * @return true, if a property source with the given name is present.
+     */
+    boolean containsPropertySource(String name);
 
     /**
      * This method returns the current list of registered PropertySources ordered via their ordinal.
@@ -53,23 +74,25 @@ public interface ConfigurationContext {
      */
     List<PropertySource> getPropertySources();
 
-
-//    /**
-//     * Access a {@link PropertySource} using its (unique) name.
-//     * @param name the propoerty source's name, not null.
-//     * @return the propoerty source found, or null.
-//     */
-//    PropertySource getPropertySource(String name);
+    /**
+     * Access a {@link PropertySource} using its (unique) name.
+     * @param name the propoerty source's name, not null.
+     * @return the propoerty source found, or null.
+     */
+    PropertySource getPropertySource(String name);
 
     /**
      * This method can be used for programmatically adding {@link PropertyConverter}s.
      * It is not needed for normal 'usage' by end users, but only for Extension Developers!
      *
      * @param <T> the type of the type literal
-     * @param typeToConvert the type which the converter is for
+     * @param type the type which the converter is for
      * @param propertyConverter the PropertyConverters to add for this type
+     * @deprecated Use {@link ConfigurationContextBuilder} to create a new {@link ConfigurationContext}.
+     * @see #toBuilder()
      */
-    <T> void addPropertyConverter(TypeLiteral<T> typeToConvert, PropertyConverter<T> propertyConverter);
+    @Deprecated
+    <T> void addPropertyConverter(TypeLiteral<T> type, PropertyConverter<T> propertyConverter);
 
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/32a1616c/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java b/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java
index 6416959..66a2426 100644
--- a/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java
+++ b/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java
@@ -20,7 +20,7 @@ package org.apache.tamaya.spi;
 
 import org.apache.tamaya.TypeLiteral;
 
-import java.util.Collection;
+import java.util.*;
 
 /**
  * A builder for creating new or adapting instances of {@link ConfigurationContext}.
@@ -36,20 +36,13 @@ import java.util.Collection;
  * {@link org.apache.tamaya.ConfigurationProvider#setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext)}.
  * 
  */
-
-/* @todo This is some Javadoc which is outdated. I am not sure if I can deleted it. The author
- *       should take care. Oliver B. Fischer, 2015-12-23
- * Since this method can
- * throw an UnsupportedOperationException, you should check before if changing the current ConfigurationContext
- * programmatically is supported by calling
- * {@link org.apache.tamaya.ConfigurationProvider#is}.
- */
 public interface ConfigurationContextBuilder {
 
     /**
      * Init this builder instance with the given {@link ConfigurationContext} instance. This
-     * method will replace any existing data in the current builder with the data contained in the given
-     * {@link ConfigurationContext}.
+     * method will use any existing property sources, filters, converters and the combination
+     * policy of the given {@link ConfigurationContext} and initialize the current builder
+     * with them.
      *
      * @param context the {@link ConfigurationContext} instance to be used, not null.
      * @return this builder, for chaining, never null.
@@ -57,43 +50,127 @@ public interface ConfigurationContextBuilder {
     ConfigurationContextBuilder setContext(ConfigurationContext context);
 
     /**
-     * This method can be used for programmatically adding {@link PropertySource}s.
-     * It is not needed for normal 'usage' by end users, but only for Extension Developers!
+     * This method can be used for adding {@link PropertySource}s.
+     * Hereby the property source is added to the tail of property sources with
+     * lowest priority  regardless of its current ordinal value. To sort the property
+     * sources based on their ordinals call {@kink #sortPropertySources}.
      *
-     * @param propertySourcesToAdd the PropertySources to add
+     * @param propertySources the PropertySources to add
      * @return this builder, for chaining, never null.
+     * @throws IllegalArgumentException If a property source with a given name already
+     * exists.
      */
-    ConfigurationContextBuilder addPropertySources(PropertySource... propertySourcesToAdd);
+    ConfigurationContextBuilder addPropertySources(PropertySource... propertySources);
 
     /**
      * This method can be used for programmatically adding {@link PropertySource}s.
-     * It is not needed for normal 'usage' by end users, but only for Extension Developers!
+     * Hereby the property source is added to the tail of property sources with
+     * lowest priority regardless of its current ordinal value. To sort the property
+     * sources based on their ordinals call {@kink #sortPropertySources}.
      *
-     * @param propertySourcesToAdd the PropertySources to add
+     * @param propertySources the PropertySources to add
      * @return this builder, for chaining, never null.
+     * @throws IllegalArgumentException If a property source with a given name already
+     * exists.
      */
-    ConfigurationContextBuilder addPropertySources(Collection<PropertySource> propertySourcesToAdd);
+    ConfigurationContextBuilder addPropertySources(Collection<PropertySource> propertySources);
 
     /**
-     * This method can be used for programmatically adding {@link PropertySource}s.
-     * It is not needed for normal 'usage' by end users, but only for Extension Developers!
+     * Removes the given property sources, if existing. The existing order of property
+     * sources is preserved.
      *
-     * @param propertySourcesNames the PropertySource names of the sources to remove
-     * @return this builder, for chaining, never null.
+     * @param propertySources the property sources to remove, not null.
+     * @return the builder for chaining.
      */
-    ConfigurationContextBuilder removePropertySources(String... propertySourcesNames);
+    ConfigurationContextBuilder removePropertySources(PropertySource... propertySources);
 
     /**
-     * This method can be used for programmatically adding {@link PropertySource}s.
-     * It is not needed for normal 'usage' by end users, but only for Extension Developers!
+     * Removes the given property sources, if existing. The existing order of property
+     * sources is preserved.
      *
-     * @param propertySourcesNames the PropertySource names of the sources to remove
-     * @return this builder, for chaining, never null.
+     * @param propertySources the property sources to remove, not null.
+     * @return the builder for chaining.
+     */
+    ConfigurationContextBuilder removePropertySources(Collection<PropertySource> propertySources);
+
+    /**
+     * Access the current chain of property sources. Items at the end of the list have
+     * precedence/more significance.
+     *
+     * @return the property source chain, never null.
+     */
+    List<PropertySource> getPropertySources();
+
+    /**
+     * Access the current chain of property filters. Items at the end of the list have
+     * precedence/more significance.
+     *
+     * @return the property source chain, never null.
      */
-    ConfigurationContextBuilder removePropertySources(Collection<String> propertySourcesNames);
+    List<PropertyFilter> getPropertyFilters();
 
     /**
-     * Adds the given PropertyFilter instances.
+     * Access the current registered property converters.
+     *
+     * @return the current registered property converters.
+     */
+    Map<TypeLiteral<?>, Collection<PropertyConverter<?>>> getPropertyConverter();
+
+    /**
+     * Increases the priority of the given property source, by moving it towards the end
+     * of the chain of property sources. If the property source given is already at the end
+     * this method has no effect. This operation does not change any ordinal values.
+     *
+     * @param propertySource the property source to be incresed regarding its significance.
+     * @return the builder for chaining.
+     * @throws IllegalArgumentException If no such property source exists in the current
+     * chain.
+     */
+    ConfigurationContextBuilder increasePriority(PropertySource propertySource);
+
+    /**
+     * Decreases the priority of the given property source, by moving it towards the start
+     * of the chain of property sources. If the property source given is already the first
+     * this method has no effect. This operation does not change any ordinal values.
+     *
+     * @param propertySource the property source to be decresed regarding its significance.
+     * @return the builder for chaining.
+     * @throws IllegalArgumentException If no such property source exists in the current
+     * chain.
+     */
+    ConfigurationContextBuilder decreasePriority(PropertySource propertySource);
+
+    /**
+     * Increases the priority of the given property source to be maximal, by moving it to
+     * the tail of the of property source chain. If the property source given is
+     * already the last item this method has no effect. This operation does not change
+     * any ordinal values.
+     *
+     * @param propertySource the property source to be maximized regarding its significance.
+     * @return the builder for chaining.
+     * @throws IllegalArgumentException If no such property source exists in the current
+     * chain.
+     */
+    ConfigurationContextBuilder highestPriority(PropertySource propertySource);
+
+    /**
+     * Decreases the priority of the given property source to be minimal, by moving it to
+     * the start of the chain of property source chain. If the property source given is
+     * already the first item this method has no effect. This operation does not change
+     * any ordinal values.
+     *
+     * @param propertySource the property source to be minimized regarding its significance.
+     * @return the builder for chaining.
+     * @throws IllegalArgumentException If no such property source exists in the current
+     * chain.
+     */
+    ConfigurationContextBuilder lowestPriority(PropertySource propertySource);
+
+    /**
+     * Adds the given PropertyFilter instances, hereby the instances are added
+     * to the end of the list with highest priority. The ordering of existing
+     * property filters remains unchanged. To sort the property
+     * filters call {@kink #sortPropertyFilter}.
      *
      * @param filters the filters to add
      * @return this builder, for chaining, never null.
@@ -101,7 +178,10 @@ public interface ConfigurationContextBuilder {
     ConfigurationContextBuilder addPropertyFilters(PropertyFilter... filters);
 
     /**
-     * Adds the given PropertyFilter instances.
+     * Adds the given PropertyFilter instances, hereby the instances are added
+     * to the end of the list with highest priority. The ordering of existing
+     * property filters remains unchanged. To sort the property
+     * filters call {@kink #sortPropertyFilter}.
      *
      * @param filters the filters to add
      * @return this builder, for chaining, never null.
@@ -109,52 +189,99 @@ public interface ConfigurationContextBuilder {
     ConfigurationContextBuilder addPropertyFilters(Collection<PropertyFilter> filters);
 
     /**
-     * Removes the given PropertyFilter instances.
+     * Removes the given PropertyFilter instances, if existing. The order of the remaining
+     * filters is preserved.
      *
-     * @param filters the filters to remove
+     * @param filters the filter to remove
      * @return this builder, for chaining, never null.
      */
     ConfigurationContextBuilder removePropertyFilters(PropertyFilter... filters);
 
     /**
-     * Removes the given PropertyFilter instances.
+     * Removes the given PropertyFilter instances, if existing. The order of the remaining
+     * filters is preserved.
      *
-     * @param filters the filters to remove
+     * @param filters the filter to remove
      * @return this builder, for chaining, never null.
      */
     ConfigurationContextBuilder removePropertyFilters(Collection<PropertyFilter> filters);
 
     /**
-     * This method can be used for programmatically adding {@link PropertyConverter}s.
-     * It is not needed for normal 'usage' by end users, but only for Extension Developers!
+     * This method can be used for adding {@link PropertyConverter}s.
+     * Converters are added at the end after any existing converters.
+     * For converters already registered for the current target type the
+     * method has no effect.
      *
-     * @param <T> the type of the type literal
      * @param typeToConvert     the type for which the converter is for
-     * @param propertyConverter the PropertyConverters to add for this type
+     * @param propertyConverters the PropertyConverters to add for this type
      * @return this builder, for chaining, never null.
      */
-    <T> ConfigurationContextBuilder addPropertyConverter(TypeLiteral<T> typeToConvert,
-                                                         PropertyConverter<T> propertyConverter);
+    <T> ConfigurationContextBuilder addPropertyConverters(TypeLiteral<T> typeToConvert,
+                                                          PropertyConverter<T>... propertyConverters);
 
     /**
-     * Removes the given PropertyConverter instances.
+     * This method can be used for adding {@link PropertyConverter}s.
+     * Converters are added at the end after any existing converters.
+     * For converters already registered for the current target type the
+     * method has no effect.
+     *
+     * @param typeToConvert     the type for which the converter is for
+     * @param propertyConverters the PropertyConverters to add for this type
+     * @return this builder, for chaining, never null.
+     */
+    <T> ConfigurationContextBuilder addPropertyConverters(TypeLiteral<T> typeToConvert,
+                                                          Collection<PropertyConverter<T>> propertyConverters);
+
+    /**
+     * Removes the given PropertyConverter instances for the given type,
+     * if existing.
      *
      * @param typeToConvert the type which the converter is for
-     * @param converters    the converters to remove
+     * @param propertyConverters    the converter to remove
      * @return this builder, for chaining, never null.
      */
-    ConfigurationContextBuilder removePropertyConverters(TypeLiteral<?> typeToConvert,
-                                                         PropertyConverter<?>... converters);
+    <T> ConfigurationContextBuilder removePropertyConverters(TypeLiteral<T> typeToConvert,
+                                                         PropertyConverter<T>... propertyConverters);
 
     /**
-     * Removes the given PropertyConverter instances.
+     * Removes the given PropertyConverter instances for the given type,
+     * if existing.
      *
      * @param typeToConvert the type which the converter is for
-     * @param converters    the converters to remove
+     * @param propertyConverters    the converter to remove
      * @return this builder, for chaining, never null.
      */
-    ConfigurationContextBuilder removePropertyConverters(TypeLiteral<?> typeToConvert,
-                                                         Collection<PropertyConverter<?>> converters);
+    <T> ConfigurationContextBuilder removePropertyConverters(TypeLiteral<T> typeToConvert,
+                                                             Collection<PropertyConverter<T>> propertyConverters);
+
+    /**
+     * Removes all converters for the given type, which actually renders a given type
+     * unsupported for type conversion.
+     *
+     * @param typeToConvert the type which the converter is for
+     * @return this builder, for chaining, never null.
+     */
+    ConfigurationContextBuilder removePropertyConverters(TypeLiteral<?> typeToConvert);
+
+    /**
+     * Sorts the current registered property sources using the given comparator.
+     *
+     * NOTE: property sources at the beginning have minimal significance.
+     *
+     * @param comparator the comparator to be used, not null.
+     * @return this instance for chaining.
+     */
+    ConfigurationContextBuilder sortPropertySources(Comparator<PropertySource> comparator);
+
+    /**
+     * Sorts the current registered property filters using the given comparator.
+     *
+     * NOTE: property filters at the beginning have minimal significance.
+     *
+     * @param comparator the comparator to be used, not null.
+     * @return this instance for chaining.
+     */
+    ConfigurationContextBuilder sortPropertyFilter(Comparator<PropertyFilter> comparator);
 
     /**
      * Sets the {@link PropertyValueCombinationPolicy} used to evaluate the final
@@ -166,9 +293,15 @@ public interface ConfigurationContextBuilder {
     ConfigurationContextBuilder setPropertyValueCombinationPolicy(PropertyValueCombinationPolicy policy);
 
     /**
-     * Builds a {@link ConfigurationContext} based on the data set.
-     * @return final context with the current builder's properties.
+     * Builds a new {@link ConfigurationContext} based on the data in this builder. The ordering of property
+     * sources and property filters is not changed, regardless of their ordinals. For ensure a certain
+     * ordering/significance call {@link #sortPropertyFilter(Comparator)} and/or {@link #sortPropertySources(Comparator)}
+     * before building the context.
+     *
+     * @return the final context to be used to create a configuration.
+     * @see org.apache.tamaya.ConfigurationProvider#createConfiguration(ConfigurationContext)
      */
     ConfigurationContext build();
 
 }
+

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/32a1616c/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationProviderSpi.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationProviderSpi.java b/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationProviderSpi.java
index d179d1e..1f473e3 100644
--- a/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationProviderSpi.java
+++ b/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationProviderSpi.java
@@ -36,6 +36,43 @@ public interface ConfigurationProviderSpi {
     Configuration getConfiguration();
 
     /**
+     * Create a {@link Configuration} instance using the given context. The configuration
+     * created hereby must respect the artifacts provided by its context (property sources,
+     * filters, converters, policies etc), including their ordering and significance.
+     * @param context the context to be used, not null.
+     * @return the corresponding configuration instance.
+     */
+    Configuration createConfiguration(ConfigurationContext context);
+
+    /**
+     * Creates a new {@link org.apache.tamaya.spi.ConfigurationContextBuilder} instance.
+     *
+     * @return a new {@link org.apache.tamaya.spi.ConfigurationContextBuilder}, never null.
+     */
+    ConfigurationContextBuilder getConfigurationContextBuilder();
+
+    /**
+     * This method allows to replace the current {@link org.apache.tamaya.Configuration} with a new
+     * instance. This can be used to update the configuration with a new one, e.g. because some of the
+     * data has changed and must be updated. It is the responsibility of the ConfigurationProvider to trigger
+     * corresponding update events for the current {@link org.apache.tamaya.Configuration}.
+     *
+     * @param config the new Configuration to be applied.
+     * @throws java.lang.UnsupportedOperationException if the current provider is read-only.
+     */
+    void setConfiguration(Configuration config);
+
+    /**
+     * Method that allows to determine if a new {@link org.apache.tamaya.Configuration} can be applied
+     * programmatically.
+     *
+     * @return true, if {@link #setConfiguration(org.apache.tamaya.Configuration)} is supported
+     * by the current implementation.
+     * @see #setConfiguration(org.apache.tamaya.Configuration)
+     */
+    boolean isConfigurationSettable();
+
+    /**
      * Get access to the current {@link ConfigurationContext}.
      *
      * @return the current {@link ConfigurationContext}, never null.
@@ -53,7 +90,9 @@ public interface ConfigurationProviderSpi {
      *
      * @param context the new ConfigurationContext to be applied.
      * @throws java.lang.UnsupportedOperationException if the current provider is read-only.
+     * @deprecated use {@link #setConfiguration(Configuration)}
      */
+    @Deprecated
     void setConfigurationContext(ConfigurationContext context);
 
     /**
@@ -63,14 +102,10 @@ public interface ConfigurationProviderSpi {
      * @return true, if {@link #setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext)} is supported
      * by the current implementation.
      * @see #setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext)
+     * @deprecated use {@link #isConfigurationSettable()}
      */
+    @Deprecated
     boolean isConfigurationContextSettable();
 
-    /**
-     * Creates a new {@link org.apache.tamaya.spi.ConfigurationContextBuilder} instance.
-     *
-     * @return a new {@link org.apache.tamaya.spi.ConfigurationContextBuilder}, never null.
-     */
-    ConfigurationContextBuilder getConfigurationContextBuilder();
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/32a1616c/code/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/code/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java b/code/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java
index 1c84b83..3c913a1 100644
--- a/code/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java
+++ b/code/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java
@@ -38,6 +38,11 @@ public class TestConfigurationProvider implements ConfigurationProviderSpi {
     }
 
     @Override
+    public Configuration createConfiguration(ConfigurationContext context) {
+        return null;
+    }
+
+    @Override
     public ConfigurationContext getConfigurationContext() {
         return null;
     }
@@ -56,4 +61,13 @@ public class TestConfigurationProvider implements ConfigurationProviderSpi {
     public ConfigurationContextBuilder getConfigurationContextBuilder() {
         return null;
     }
+
+    @Override
+    public void setConfiguration(Configuration config) {
+    }
+
+    @Override
+    public boolean isConfigurationSettable() {
+        return false;
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/32a1616c/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
----------------------------------------------------------------------
diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
index a1a2f64..15c6147 100644
--- a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
+++ b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
@@ -25,19 +25,12 @@ import org.apache.tamaya.spi.ConfigurationContextBuilder;
 import org.apache.tamaya.spi.PropertyConverter;
 import org.apache.tamaya.spi.PropertyFilter;
 import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertySourceProvider;
 import org.apache.tamaya.spi.PropertyValueCombinationPolicy;
 import org.apache.tamaya.spi.ServiceContextManager;
 
 import javax.annotation.Priority;
 import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 import java.util.logging.Logger;
@@ -73,71 +66,36 @@ public class DefaultConfigurationContext implements ConfigurationContext {
      * Lock for internal synchronization.
      */
     private final ReentrantReadWriteLock propertySourceLock = new ReentrantReadWriteLock();
-
-    /** Comparator used for ordering property sources. */
-    private final PropertySourceComparator propertySourceComparator = new PropertySourceComparator();
-
-    /** Comparator used for ordering property filters. */
-    private final PropertyFilterComparator propertyFilterComparator = new PropertyFilterComparator();
-
-
     /**
-     * The first time the Configuration system gets invoked we do initialize
-     * all our {@link org.apache.tamaya.spi.PropertySource}s and
-     * {@link org.apache.tamaya.spi.PropertyFilter}s which are known at startup.
+     * Lock for internal synchronization.
      */
-    public DefaultConfigurationContext() {
-        List<PropertySource> propertySources = new ArrayList<>();
-
-        // first we load all PropertySources which got registered via java.util.ServiceLoader
-        propertySources.addAll(ServiceContextManager.getServiceContext().getServices(PropertySource.class));
-
-        // after that we add all PropertySources which get dynamically registered via their PropertySourceProviders
-        propertySources.addAll(evaluatePropertySourcesFromProviders());
-
-        // now sort them according to their ordinal values
-        Collections.sort(propertySources, new PropertySourceComparator());
+    private final ReentrantReadWriteLock propertyFilterLock = new ReentrantReadWriteLock();
 
-        immutablePropertySources = Collections.unmodifiableList(propertySources);
-        LOG.info("Registered " + immutablePropertySources.size() + " property sources: " +
-                immutablePropertySources);
-
-        // as next step we pick up the PropertyFilters pretty much the same way
-        List<PropertyFilter> propertyFilters = new ArrayList<>();
-        propertyFilters.addAll(ServiceContextManager.getServiceContext().getServices(PropertyFilter.class));
-        Collections.sort(propertyFilters, new PropertyFilterComparator());
-        immutablePropertyFilters = Collections.unmodifiableList(propertyFilters);
-        LOG.info("Registered " + immutablePropertyFilters.size() + " property filters: " +
-                immutablePropertyFilters);
-
-        immutablePropertyFilters = Collections.unmodifiableList(propertyFilters);
-        LOG.info("Registered " + immutablePropertyFilters.size() + " property filters: " +
-                immutablePropertyFilters);
-        propertyValueCombinationPolicy = ServiceContextManager.getServiceContext().getService(PropertyValueCombinationPolicy.class);
-        if(propertyValueCombinationPolicy==null) {
-            propertyValueCombinationPolicy = PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_COLLECTOR;
-        }
-        LOG.info("Using PropertyValueCombinationPolicy: " + propertyValueCombinationPolicy);
-    }
 
     DefaultConfigurationContext(DefaultConfigurationContextBuilder builder) {
         List<PropertySource> propertySources = new ArrayList<>();
         // first we load all PropertySources which got registered via java.util.ServiceLoader
-        propertySources.addAll(builder.propertySources.values());
+        propertySources.addAll(builder.propertySources);
         // now sort them according to their ordinal values
-        Collections.sort(propertySources, propertySourceComparator);
         immutablePropertySources = Collections.unmodifiableList(propertySources);
         LOG.info("Registered " + immutablePropertySources.size() + " property sources: " +
                 immutablePropertySources);
 
         // as next step we pick up the PropertyFilters pretty much the same way
-        List<PropertyFilter> propertyFilters = new ArrayList<>();
-        propertyFilters.addAll(ServiceContextManager.getServiceContext().getServices(PropertyFilter.class));
-        Collections.sort(propertyFilters, propertyFilterComparator);
+        List<PropertyFilter> propertyFilters = new ArrayList<>(builder.getPropertyFilters());
         immutablePropertyFilters = Collections.unmodifiableList(propertyFilters);
         LOG.info("Registered " + immutablePropertyFilters.size() + " property filters: " +
                 immutablePropertyFilters);
 
+        // Finally add the converters
+        for(Map.Entry<TypeLiteral<?>, Collection<PropertyConverter<?>>> en:builder.getPropertyConverter().entrySet()) {
+            for (PropertyConverter converter : en.getValue()) {
+                this.propertyConverterManager.register(en.getKey(), converter);
+            }
+        }
+        LOG.info("Registered " + propertyConverterManager.getPropertyConverters().size() + " property converters: " +
+                propertyConverterManager.getPropertyConverters());
+
         propertyValueCombinationPolicy = builder.combinationPolicy;
         if(propertyValueCombinationPolicy==null){
             propertyValueCombinationPolicy = ServiceContextManager.getServiceContext().getService(PropertyValueCombinationPolicy.class);
@@ -148,23 +106,8 @@ public class DefaultConfigurationContext implements ConfigurationContext {
         LOG.info("Using PropertyValueCombinationPolicy: " + propertyValueCombinationPolicy);
     }
 
-    /**
-     * Pick up all {@link org.apache.tamaya.spi.PropertySourceProvider}s and return all the
-     * {@link org.apache.tamaya.spi.PropertySource}s they like to register.
-     */
-    private Collection<? extends PropertySource> evaluatePropertySourcesFromProviders() {
-        List<PropertySource> propertySources = new ArrayList<>();
-        Collection<PropertySourceProvider> propertySourceProviders = ServiceContextManager.getServiceContext().getServices(PropertySourceProvider.class);
-        for (PropertySourceProvider propertySourceProvider : propertySourceProviders) {
-            Collection<PropertySource> sources = propertySourceProvider.getPropertySources();
-            LOG.finer("PropertySourceProvider " + propertySourceProvider.getClass().getName() +
-                    " provided the following property sources: " + sources);
-                propertySources.addAll(sources);
-        }
-
-        return propertySources;
-    }
 
+    @Deprecated
     @Override
     public void addPropertySources(PropertySource... propertySourcesToAdd) {
         Lock writeLock = propertySourceLock.writeLock();
@@ -180,6 +123,28 @@ public class DefaultConfigurationContext implements ConfigurationContext {
         }
     }
 
+
+    @Deprecated
+    @Override
+    public void addPropertyFilter(PropertyFilter... propertyFiltersToAdd) {
+        Lock writeLock = propertyFilterLock.writeLock();
+        try {
+            writeLock.lock();
+            List<PropertyFilter> newPropertyFilters = new ArrayList<>(this.immutablePropertyFilters);
+            newPropertyFilters.addAll(Arrays.asList(propertyFiltersToAdd));
+            Collections.sort(newPropertyFilters, new PropertyFilterComparator());
+
+            this.immutablePropertyFilters = Collections.unmodifiableList(newPropertyFilters);
+        } finally {
+            writeLock.unlock();
+        }
+    }
+
+    @Override
+    public boolean containsPropertySource(String name) {
+        return getPropertySource(name)!=null;
+    }
+
     @Override
     public boolean equals(Object o) {
         if (this == o) return true;
@@ -331,15 +296,15 @@ public class DefaultConfigurationContext implements ConfigurationContext {
         return immutablePropertySources;
     }
 
-//    @Override
-//    public PropertySource getPropertySource(String name) {
-//        for(PropertySource ps:getPropertySources()){
-//            if(name.equals(ps.getName())){
-//                return ps;
-//            }
-//        }
-//        return null;
-//    }
+    @Override
+    public PropertySource getPropertySource(String name) {
+        for(PropertySource ps:getPropertySources()){
+            if(name.equals(ps.getName())){
+                return ps;
+            }
+        }
+        return null;
+    }
 
     @Override
     public <T> void addPropertyConverter(TypeLiteral<T> typeToConvert, PropertyConverter<T> propertyConverter) {

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/32a1616c/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java
----------------------------------------------------------------------
diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java
index 944a1e0..f3d823e 100644
--- a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java
+++ b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java
@@ -18,95 +18,243 @@
  */
 package org.apache.tamaya.core.internal;
 
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.spi.PropertyConverter;
+import org.apache.tamaya.Configuration;
 import org.apache.tamaya.TypeLiteral;
 import org.apache.tamaya.spi.ConfigurationContext;
 import org.apache.tamaya.spi.ConfigurationContextBuilder;
+import org.apache.tamaya.spi.PropertyConverter;
 import org.apache.tamaya.spi.PropertyFilter;
 import org.apache.tamaya.spi.PropertySource;
+import org.apache.tamaya.spi.PropertySourceProvider;
 import org.apache.tamaya.spi.PropertyValueCombinationPolicy;
+import org.apache.tamaya.spi.ServiceContextManager;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
+import java.util.logging.Logger;
 
 /**
  * Default implementation of {@link org.apache.tamaya.spi.ConfigurationContextBuilder}.
  */
 public class DefaultConfigurationContextBuilder implements ConfigurationContextBuilder {
 
-    final Map<String, PropertySource> propertySources = new HashMap<>();
-    final List<PropertyFilter> propertyFilters = new ArrayList<>();
-    final Map<TypeLiteral<?>, List<PropertyConverter<?>>> propertyConverters = new HashMap<>();
-    PropertyValueCombinationPolicy combinationPolicy;
+    private static final Logger LOG = Logger.getLogger(DefaultConfigurationContextBuilder.class.getName());
+
+    public static final Comparator<PropertySource> DEFAULT_PROPERTYSOURCE_COMPARATOR = new PropertySourceComparator();
+    public static final Comparator<?> DEFAULT_PROPERTYFILTER_COMPARATOR = new PriorityServiceComparator();
+
+    List<PropertyFilter> propertyFilters = new ArrayList<>();
+    List<PropertySource> propertySources = new ArrayList<>();
+    PropertyValueCombinationPolicy combinationPolicy =
+            PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_COLLECTOR;
+    Map<TypeLiteral<?>, Collection<PropertyConverter<?>>> propertyConverters = new HashMap<>();
 
-    public DefaultConfigurationContextBuilder(){
+    /**
+     * Flag if the config has already been built.
+     * Configuration can be built only once
+     */
+    private boolean built;
+
+
+
+    /**
+     * Creates a new builder instance.
+     */
+    public DefaultConfigurationContextBuilder() {
     }
 
-    @Override
-    public ConfigurationContextBuilder setContext(ConfigurationContext context) {
-        this.propertySources.clear();
+    /**
+     * Creates a new builder instance.
+     */
+    public DefaultConfigurationContextBuilder(ConfigurationContext context) {
+        this.propertyConverters.putAll(context.getPropertyConverters());
+        this.propertyFilters.addAll(context.getPropertyFilters());
         for(PropertySource ps:context.getPropertySources()) {
-            this.propertySources.put(ps.getName(), ps);
+            addPropertySources(ps);
         }
+        this.combinationPolicy = context.getPropertyValueCombinationPolicy();
+    }
+
+    /**
+     * Allows to set configuration context during unit tests.
+     */
+    ConfigurationContextBuilder setConfigurationContext(ConfigurationContext configurationContext) {
+        checkBuilderState();
+        //noinspection deprecation
         this.propertyFilters.clear();
-        this.propertyFilters.addAll(context.getPropertyFilters());
+        this.propertyFilters.addAll(configurationContext.getPropertyFilters());
+        this.propertySources.clear();
+        for(PropertySource ps:configurationContext.getPropertySources()) {
+            addPropertySources(ps);
+        }
         this.propertyConverters.clear();
+        this.propertyConverters.putAll(configurationContext.getPropertyConverters());
+        this.combinationPolicy = configurationContext.getPropertyValueCombinationPolicy();
+        return this;
+    }
+
+
+    @Override
+    public ConfigurationContextBuilder setContext(ConfigurationContext context) {
+        checkBuilderState();
         this.propertyConverters.putAll(context.getPropertyConverters());
+        for(PropertySource ps:context.getPropertySources()){
+            this.propertySources.add(ps);
+        }
+        this.propertyFilters.addAll(context.getPropertyFilters());
         this.combinationPolicy = context.getPropertyValueCombinationPolicy();
         return this;
     }
 
     @Override
-    public ConfigurationContextBuilder addPropertySources(Collection<PropertySource> propertySourcesToAdd) {
-        for(PropertySource ps:propertySourcesToAdd){
-            if(this.propertySources.containsKey(ps.getName())){
-                throw new ConfigException("Duplicate PropertySource: " + ps.getName());
+    public ConfigurationContextBuilder addPropertySources(PropertySource... sources){
+        return addPropertySources(Arrays.asList(sources));
+    }
+
+    @Override
+    public ConfigurationContextBuilder addPropertySources(Collection<PropertySource> sources){
+        checkBuilderState();
+        for(PropertySource source:sources) {
+            if (!this.propertySources.contains(source)) {
+                this.propertySources.add(source);
+            }
+        }
+        return this;
+    }
+
+    protected DefaultConfigurationContextBuilder loadDefaultPropertyFilters() {
+        checkBuilderState();
+        for(PropertyFilter pf:ServiceContextManager.getServiceContext().getServices(PropertyFilter.class)){
+            addPropertyFilters(pf);
+        }
+        return this;
+    }
+
+    protected DefaultConfigurationContextBuilder loadDefaultPropertySources() {
+        checkBuilderState();
+        for(PropertySource ps:ServiceContextManager.getServiceContext().getServices(PropertySource.class)){
+            addPropertySources(ps);
+        }
+        for(PropertySourceProvider pv:ServiceContextManager.getServiceContext().getServices(PropertySourceProvider.class)){
+            for(PropertySource ps:pv.getPropertySources()){
+                addPropertySources(ps);
             }
         }
-        for(PropertySource ps:propertySourcesToAdd) {
-            this.propertySources.put(ps.getName(), ps);
+        return this;
+    }
+
+    protected DefaultConfigurationContextBuilder loadDefaultPropertyConverters() {
+        checkBuilderState();
+        for(Map.Entry<TypeLiteral, Collection<PropertyConverter>> en:getDefaultPropertyConverters().entrySet()){
+            for(PropertyConverter pc: en.getValue()) {
+                addPropertyConverters(en.getKey(), pc);
+            }
         }
         return this;
     }
 
     @Override
-    public ConfigurationContextBuilder addPropertySources(PropertySource... propertySourcesToAdd) {
-        return addPropertySources(Arrays.asList(propertySourcesToAdd));
+    public ConfigurationContextBuilder removePropertySources(PropertySource... propertySources) {
+        return removePropertySources(Arrays.asList(propertySources));
     }
 
     @Override
-    public ConfigurationContextBuilder removePropertySources(Collection<String> propertySourcesToRemove) {
-        for(String key: propertySourcesToRemove){
-            this.propertySources.remove(key);
+    public ConfigurationContextBuilder removePropertySources(Collection<PropertySource> propertySources) {
+        checkBuilderState();
+        this.propertySources.removeAll(propertySources);
+        return this;
+    }
+
+    public PropertySource getPropertySource(String name) {
+        for(PropertySource ps:propertySources){
+            if(ps.getName().equals(name)){
+                return ps;
+            }
+        }
+        throw new IllegalArgumentException("No such PropertySource: "+name);
+    }
+
+    @Override
+    public List<PropertySource> getPropertySources() {
+        return this.propertySources;
+    }
+
+    @Override
+    public ConfigurationContextBuilder increasePriority(PropertySource propertySource) {
+        checkBuilderState();
+        int index = propertySources.indexOf(propertySource);
+        if(index<0){
+            throw new IllegalArgumentException("No such PropertySource: " + propertySource);
+        }
+        if(index<(propertySources.size()-1)){
+            propertySources.remove(propertySource);
+            propertySources.add(index+1, propertySource);
         }
         return this;
     }
 
     @Override
-    public ConfigurationContextBuilder removePropertySources(String... propertySourcesToRemove) {
-        return removePropertySources(Arrays.asList(propertySourcesToRemove));
+    public ConfigurationContextBuilder decreasePriority(PropertySource propertySource) {
+        checkBuilderState();
+        int index = propertySources.indexOf(propertySource);
+        if(index<0){
+            throw new IllegalArgumentException("No such PropertySource: " + propertySource);
+        }
+        if(index>0){
+            propertySources.remove(propertySource);
+            propertySources.add(index-1, propertySource);
+        }
+        return this;
+    }
+
+    @Override
+    public ConfigurationContextBuilder highestPriority(PropertySource propertySource) {
+        checkBuilderState();
+        int index = propertySources.indexOf(propertySource);
+        if(index<0){
+            throw new IllegalArgumentException("No such PropertySource: " + propertySource);
+        }
+        if(index<(propertySources.size()-1)){
+            propertySources.remove(propertySource);
+            propertySources.add(propertySource);
+        }
+        return this;
     }
 
     @Override
-    public ConfigurationContextBuilder addPropertyFilters(Collection<PropertyFilter> filters) {
-        this.propertyFilters.addAll(filters);
+    public ConfigurationContextBuilder lowestPriority(PropertySource propertySource) {
+        checkBuilderState();
+        int index = propertySources.indexOf(propertySource);
+        if(index<0){
+            throw new IllegalArgumentException("No such PropertySource: " + propertySource);
+        }
+        if(index>0){
+            propertySources.remove(propertySource);
+            propertySources.add(0, propertySource);
+        }
         return this;
     }
 
     @Override
-    public ConfigurationContextBuilder addPropertyFilters(PropertyFilter... filters) {
+    public ConfigurationContextBuilder addPropertyFilters(PropertyFilter... filters){
         return addPropertyFilters(Arrays.asList(filters));
     }
 
     @Override
-    public ConfigurationContextBuilder removePropertyFilters(Collection<PropertyFilter> filters) {
-        this.propertyFilters.removeAll(filters);
+    public ConfigurationContextBuilder addPropertyFilters(Collection<PropertyFilter> filters){
+        checkBuilderState();
+        for(PropertyFilter f:filters) {
+            if (!this.propertyFilters.contains(f)) {
+                this.propertyFilters.add(f);
+            }
+        }
         return this;
     }
 
@@ -116,38 +264,153 @@ public class DefaultConfigurationContextBuilder implements ConfigurationContextB
     }
 
     @Override
-    public <T> ConfigurationContextBuilder addPropertyConverter(TypeLiteral<T> typeToConvert, PropertyConverter<T> propertyConverter) {
-        List<PropertyConverter<?>> converters = this.propertyConverters.get(typeToConvert);
-        if(converters==null){
-            converters =  new ArrayList<>();
-            this.propertyConverters.put(typeToConvert, converters);
-        }
+    public ConfigurationContextBuilder removePropertyFilters(Collection<PropertyFilter> filters) {
+        checkBuilderState();
+        this.propertyFilters.removeAll(filters);
         return this;
     }
 
+
     @Override
-    public ConfigurationContextBuilder removePropertyConverters(TypeLiteral<?> typeToConvert, PropertyConverter<?>... converters) {
+    public <T> ConfigurationContextBuilder removePropertyConverters(TypeLiteral<T> typeToConvert,
+                                                                    PropertyConverter<T>... converters) {
         return removePropertyConverters(typeToConvert, Arrays.asList(converters));
     }
 
     @Override
-    public ConfigurationContextBuilder removePropertyConverters(TypeLiteral<?> typeToConvert, Collection<PropertyConverter<?>> converters) {
-        List<PropertyConverter<?>> existing = this.propertyConverters.get(typeToConvert);
-        if(existing!=null) {
-            existing.removeAll(converters);
+    public <T> ConfigurationContextBuilder removePropertyConverters(TypeLiteral<T> typeToConvert,
+                                                                    Collection<PropertyConverter<T>> converters) {
+        Collection<PropertyConverter<?>> subConverters = this.propertyConverters.get(typeToConvert);
+        if(subConverters!=null) {
+            subConverters.removeAll(converters);
+        }
+        return this;
+    }
+
+    @Override
+    public ConfigurationContextBuilder removePropertyConverters(TypeLiteral<?> typeToConvert) {
+        this.propertyConverters.remove(typeToConvert);
+        return this;
+    }
+
+
+    @Override
+    public ConfigurationContextBuilder setPropertyValueCombinationPolicy(PropertyValueCombinationPolicy combinationPolicy){
+        checkBuilderState();
+        this.combinationPolicy = Objects.requireNonNull(combinationPolicy);
+        return this;
+    }
+
+
+    @Override
+    public <T> ConfigurationContextBuilder addPropertyConverters(TypeLiteral<T> type, PropertyConverter<T>... propertyConverters){
+        checkBuilderState();
+        Objects.requireNonNull(type);
+        Objects.requireNonNull(propertyConverters);
+        Collection<PropertyConverter<?>> converters = this.propertyConverters.get(type);
+        if(converters==null){
+            converters = new ArrayList<>();
+            this.propertyConverters.put(type, converters);
+        }
+        for(PropertyConverter<T> propertyConverter:propertyConverters) {
+            if (!converters.contains(propertyConverter)) {
+                converters.add(propertyConverter);
+            } else {
+                LOG.warning("Converter ignored, already registered: " + propertyConverter);
+            }
         }
         return this;
     }
 
     @Override
-    public ConfigurationContextBuilder setPropertyValueCombinationPolicy(PropertyValueCombinationPolicy policy) {
-        this.combinationPolicy = Objects.requireNonNull(policy);
+    public <T> ConfigurationContextBuilder addPropertyConverters(TypeLiteral<T> type, Collection<PropertyConverter<T>> propertyConverters){
+        checkBuilderState();
+        Objects.requireNonNull(type);
+        Objects.requireNonNull(propertyConverters);
+        Collection<PropertyConverter<?>> converters = this.propertyConverters.get(type);
+        if(converters==null){
+            converters = new ArrayList<>();
+            this.propertyConverters.put(type, converters);
+        }
+        for(PropertyConverter<T> propertyConverter:propertyConverters) {
+            if (!converters.contains(propertyConverter)) {
+                converters.add(propertyConverter);
+            } else {
+                LOG.warning("Converter ignored, already registered: " + propertyConverter);
+            }
+        }
+        return this;
+    }
+
+    private WrappedPropertySource getWrappedPropertySource(PropertySource delegate) {
+        PropertySource ps = getPropertySource(delegate.getName());
+        return WrappedPropertySource.of(ps);
+    }
+
+    protected ConfigurationContextBuilder loadDefaults() {
+        checkBuilderState();
+        this.combinationPolicy = PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_COLLECTOR;
+        loadDefaultPropertySources();
+        loadDefaultPropertyFilters();
+        loadDefaultPropertyConverters();
         return this;
     }
 
+
+    protected Map<TypeLiteral, Collection<PropertyConverter>> getDefaultPropertyConverters() {
+        Map<TypeLiteral, Collection<PropertyConverter>> result = new HashMap<>();
+        for (PropertyConverter conv : ServiceContextManager.getServiceContext().getServices(
+                PropertyConverter.class)) {
+            TypeLiteral target = TypeLiteral.of(TypeLiteral.of(conv.getClass()).getType());
+            Collection<PropertyConverter> convList = result.get(target);
+            if (convList == null) {
+                convList = new ArrayList<>();
+                result.put(target, convList);
+            }
+            convList.add(conv);
+        }
+        return result;
+    }
+
+
+    /**
+     * Builds a new configuration based on the configuration of this builder instance.
+     *
+     * @return a new {@link Configuration configuration instance},
+     *         never {@code null}.
+     */
     @Override
     public ConfigurationContext build() {
+        checkBuilderState();
+        built = true;
         return new DefaultConfigurationContext(this);
     }
 
+    @Override
+    public ConfigurationContextBuilder sortPropertyFilter(Comparator<PropertyFilter> comparator) {
+        Collections.sort(propertyFilters, comparator);
+        return this;
+    }
+
+    @Override
+    public ConfigurationContextBuilder sortPropertySources(Comparator<PropertySource> comparator) {
+        Collections.sort(propertySources, comparator);
+        return this;
+    }
+
+    private void checkBuilderState() {
+        if (built) {
+            throw new IllegalStateException("Configuration has already been build.");
+        }
+    }
+
+    @Override
+    public List<PropertyFilter> getPropertyFilters() {
+        return propertyFilters;
+    }
+
+    @Override
+    public Map<TypeLiteral<?>, Collection<PropertyConverter<?>>> getPropertyConverter() {
+        return Collections.unmodifiableMap(this.propertyConverters);
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/32a1616c/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationProvider.java b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationProvider.java
index 4330b7e..e03d9ce 100644
--- a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationProvider.java
+++ b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationProvider.java
@@ -24,6 +24,8 @@ import org.apache.tamaya.spi.ConfigurationContextBuilder;
 import org.apache.tamaya.spi.ConfigurationProviderSpi;
 import org.apache.tamaya.spi.ServiceContextManager;
 
+import java.util.Objects;
+
 /**
  * Implementation of the Configuration API. This class uses the current {@link org.apache.tamaya.spi.ConfigurationContext} to evaluate the
  * chain of {@link org.apache.tamaya.spi.PropertySource} and {@link org.apache.tamaya.spi.PropertyFilter}
@@ -31,7 +33,11 @@ import org.apache.tamaya.spi.ServiceContextManager;
  */
 public class DefaultConfigurationProvider implements ConfigurationProviderSpi {
 
-    private ConfigurationContext context = new DefaultConfigurationContext();
+    ConfigurationContext context = new DefaultConfigurationContextBuilder()
+            .loadDefaultPropertyConverters()
+            .loadDefaultPropertyFilters()
+            .loadDefaultPropertySources().build();
+
     private Configuration config = new DefaultConfiguration(context);
 
     @Override
@@ -40,23 +46,42 @@ public class DefaultConfigurationProvider implements ConfigurationProviderSpi {
     }
 
     @Override
-    public ConfigurationContext getConfigurationContext() {
-        return context;
+    public Configuration createConfiguration(ConfigurationContext context) {
+        return new DefaultConfiguration(context);
     }
 
     @Override
     public ConfigurationContextBuilder getConfigurationContextBuilder() {
-        return ServiceContextManager.getServiceContext().getService(ConfigurationContextBuilder.class);
+        return new DefaultConfigurationContextBuilder();
+    }
+
+    @Override
+    public void setConfiguration(Configuration config) {
+        Objects.requireNonNull(config.getContext());
+        this.config = Objects.requireNonNull(config);
+        this.context = config.getContext();
+    }
+
+    @Override
+    public boolean isConfigurationSettable() {
+        return true;
+    }
+
+    @Deprecated
+    @Override
+    public ConfigurationContext getConfigurationContext() {
+        return context;
     }
 
+    @Deprecated
     @Override
     public void setConfigurationContext(ConfigurationContext context){
-        // TODO think on a SPI or move event part into API...
         this.config = new DefaultConfiguration(context);
         this.context = context;
     }
 
 
+    @Deprecated
     @Override
     public boolean isConfigurationContextSettable() {
         return true;

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/32a1616c/code/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java
----------------------------------------------------------------------
diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java b/code/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java
index 9360a35..ab35b90 100644
--- a/code/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java
+++ b/code/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java
@@ -112,11 +112,16 @@ public class PropertyConverterManager {
         try {
             writeLock.lock();
             List converters = List.class.cast(this.converters.get(targetType));
+            if(converters!=null && converters.contains(converter)){
+                return;
+            }
             List<PropertyConverter<?>> newConverters = new ArrayList<>();
             if (converters != null) {
                 newConverters.addAll(converters);
             }
-            newConverters.add(converter);
+            if(!newConverters.contains(converter)) {
+                newConverters.add(converter);
+            }
             Collections.sort(newConverters, PRIORITY_COMPARATOR);
             this.converters.put(targetType, Collections.unmodifiableList(newConverters));
             // evaluate transitive closure for all inherited supertypes and implemented interfaces
@@ -222,12 +227,6 @@ public class PropertyConverterManager {
         try {
             readLock.lock();
             addConvertersToList(List.class.cast(this.converters.get(targetType)), converterList);
-        } finally {
-            readLock.unlock();
-        }
-        // transitive converter
-        try {
-            readLock.lock();
             addConvertersToList(List.class.cast(this.transitiveConverters.get(targetType)), converterList);
         } finally {
             readLock.unlock();
@@ -242,7 +241,7 @@ public class PropertyConverterManager {
                 readLock.unlock();
             }
         }
-        if (converterList.isEmpty()) {
+        if (converterList.isEmpty() && !TypeLiteral.of(String.class).equals(targetType)) {
             // adding any converters created on the fly, e.g. for enum types.
             PropertyConverter<T> defaultConverter = createDefaultPropertyConverter(targetType);
             if (defaultConverter != null) {

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/32a1616c/code/core/src/main/java/org/apache/tamaya/core/propertysource/SystemPropertySource.java
----------------------------------------------------------------------
diff --git a/code/core/src/main/java/org/apache/tamaya/core/propertysource/SystemPropertySource.java b/code/core/src/main/java/org/apache/tamaya/core/propertysource/SystemPropertySource.java
index 40576fa..bd568d4 100644
--- a/code/core/src/main/java/org/apache/tamaya/core/propertysource/SystemPropertySource.java
+++ b/code/core/src/main/java/org/apache/tamaya/core/propertysource/SystemPropertySource.java
@@ -20,7 +20,6 @@ package org.apache.tamaya.core.propertysource;
 
 import org.apache.tamaya.spi.PropertySource;
 import org.apache.tamaya.spi.PropertyValue;
-import org.apache.tamaya.spi.PropertyValueBuilder;
 
 import java.util.Collections;
 import java.util.HashMap;

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/32a1616c/code/core/src/test/java/org/apache/tamaya/core/ConfigurationTest.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/ConfigurationTest.java b/code/core/src/test/java/org/apache/tamaya/core/ConfigurationTest.java
index 98bb29c..3b3b407 100644
--- a/code/core/src/test/java/org/apache/tamaya/core/ConfigurationTest.java
+++ b/code/core/src/test/java/org/apache/tamaya/core/ConfigurationTest.java
@@ -45,6 +45,12 @@ public class ConfigurationTest {
 
     @Test
     public void testContent(){
+        assertNotNull(current().get("name"));
+        assertNotNull(current().get("name2")); // from default
+        assertNotNull(current().get("name3")); // overridden default, mapped by filter to name property
+        assertNotNull(current().get("name4")); // final only
+
+
         assertEquals("Robin", current().get("name"));
         assertEquals("Sabine", current().get("name2")); // from default
         assertEquals("Mapped to name: Robin", current().get("name3"));  // oderridden default, mapped by filter to name property

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/32a1616c/jqassistant/serviceloader-rules.xml
----------------------------------------------------------------------
diff --git a/jqassistant/serviceloader-rules.xml b/jqassistant/serviceloader-rules.xml
index 6c69b11..082430a 100644
--- a/jqassistant/serviceloader-rules.xml
+++ b/jqassistant/serviceloader-rules.xml
@@ -74,7 +74,7 @@ under the License.
                          OR impl.name =~'.*Test\\$.*')
 
                 AND NOT impl.fqn IN [// All classes of the builder MUST not use the SPI mechanism
-                                     'org.apache.tamaya.builder.ProgrammaticConfigurationContext'
+                                     'org.apache.tamaya.builder.internal.ProgrammaticConfigurationContext'
                                      // See TAMAYA-77 and TAMAYA-78, Oliver B. Fischer, 2015-04-25
                                      // 'org.apache.tamaya.core.internal.DefaultConfigurationContextBuilder'
                                     ]


[04/10] incubator-tamaya git commit: TAMAYA-182: Fixed test issues.

Posted by an...@apache.org.
TAMAYA-182: Fixed test issues.


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

Branch: refs/heads/master
Commit: e442b3177f340f8bef3243563236329fa375d081
Parents: a82a44a
Author: anatole <an...@apache.org>
Authored: Sun Oct 23 16:19:30 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Sun Oct 23 16:19:30 2016 +0200

----------------------------------------------------------------------
 .../java/org/apache/tamaya/spi/ConfigurationContextBuilder.java  | 4 ++--
 .../test/java/org/apache/tamaya/TestConfigurationProvider.java   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/e442b317/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java b/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java
index 66a2426..a57234e 100644
--- a/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java
+++ b/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContextBuilder.java
@@ -34,7 +34,7 @@ import java.util.*;
  * After all changes are applied to a builder a new {@link ConfigurationContext} instance can
  * be created and can be applied by calling
  * {@link org.apache.tamaya.ConfigurationProvider#setConfigurationContext(org.apache.tamaya.spi.ConfigurationContext)}.
- * 
+ *
  */
 public interface ConfigurationContextBuilder {
 
@@ -241,7 +241,7 @@ public interface ConfigurationContextBuilder {
      * @return this builder, for chaining, never null.
      */
     <T> ConfigurationContextBuilder removePropertyConverters(TypeLiteral<T> typeToConvert,
-                                                         PropertyConverter<T>... propertyConverters);
+                                                             PropertyConverter<T>... propertyConverters);
 
     /**
      * Removes the given PropertyConverter instances for the given type,

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/e442b317/code/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/code/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java b/code/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java
index 3c913a1..4b6ca31 100644
--- a/code/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java
+++ b/code/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java
@@ -27,7 +27,7 @@ import javax.annotation.Priority;
 /**
  * Test Configuration class, that is used to testdata the default methods provided by the API.
  */
-@Priority(0)
+@Priority(2)
 public class TestConfigurationProvider implements ConfigurationProviderSpi {
 
     private static final Configuration config = new TestConfiguration();


[08/10] incubator-tamaya git commit: TAMAYA-182: Fixed test issues.

Posted by an...@apache.org.
TAMAYA-182: Fixed test issues.


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

Branch: refs/heads/master
Commit: d1ae885f17debb8f2dccaeaab67cce9fe091bc4e
Parents: 0ed1864
Author: anatole <an...@apache.org>
Authored: Fri Oct 28 01:35:32 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Fri Oct 28 01:35:32 2016 +0200

----------------------------------------------------------------------
 .../core/propertysource/PropertiesFilePropertySourceTest.java    | 2 +-
 .../tamaya/core/propertysource/SimplePropertySourceTest.java     | 4 ++--
 .../tamaya/core/provider/JavaConfigurationProviderTest.java      | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d1ae885f/code/core/src/test/java/org/apache/tamaya/core/propertysource/PropertiesFilePropertySourceTest.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/propertysource/PropertiesFilePropertySourceTest.java b/code/core/src/test/java/org/apache/tamaya/core/propertysource/PropertiesFilePropertySourceTest.java
index 279403e..39aeb3b 100644
--- a/code/core/src/test/java/org/apache/tamaya/core/propertysource/PropertiesFilePropertySourceTest.java
+++ b/code/core/src/test/java/org/apache/tamaya/core/propertysource/PropertiesFilePropertySourceTest.java
@@ -49,7 +49,7 @@ public class PropertiesFilePropertySourceTest {
 
     @Test
     public void testGetProperties() throws Exception {
-        Assert.assertEquals(10, testfilePropertySource.getProperties().size()); // double the size for .source values.
+        Assert.assertEquals(5, testfilePropertySource.getProperties().size()); // double the size for .source values.
         Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key1"));
         Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key2"));
         Assert.assertTrue(testfilePropertySource.getProperties().containsKey("key3"));

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d1ae885f/code/core/src/test/java/org/apache/tamaya/core/propertysource/SimplePropertySourceTest.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/propertysource/SimplePropertySourceTest.java b/code/core/src/test/java/org/apache/tamaya/core/propertysource/SimplePropertySourceTest.java
index 518ed18..34902fa 100644
--- a/code/core/src/test/java/org/apache/tamaya/core/propertysource/SimplePropertySourceTest.java
+++ b/code/core/src/test/java/org/apache/tamaya/core/propertysource/SimplePropertySourceTest.java
@@ -39,7 +39,7 @@ public class SimplePropertySourceTest {
         SimplePropertySource source = new SimplePropertySource(resource);
 
         assertThat(source, notNullValue());
-        assertThat(source.getProperties(), aMapWithSize(4)); // double the size for .source values.
+        assertThat(source.getProperties(), aMapWithSize(2)); // double the size for .source values.
         assertThat(source.getProperties(), hasEntry("a", "b"));
         assertThat(source.getProperties(), hasEntry("b", "1"));
 
@@ -83,6 +83,6 @@ public class SimplePropertySourceTest {
         SimplePropertySource source = new SimplePropertySource(resource);
 
         assertThat(source, notNullValue());
-        assertThat(source.getProperties(), aMapWithSize(10)); // double the size for .source values.
+        assertThat(source.getProperties(), aMapWithSize(5)); // double the size for .source values.
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/d1ae885f/code/core/src/test/java/org/apache/tamaya/core/provider/JavaConfigurationProviderTest.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/provider/JavaConfigurationProviderTest.java b/code/core/src/test/java/org/apache/tamaya/core/provider/JavaConfigurationProviderTest.java
index 59b9e33..41bd8a1 100644
--- a/code/core/src/test/java/org/apache/tamaya/core/provider/JavaConfigurationProviderTest.java
+++ b/code/core/src/test/java/org/apache/tamaya/core/provider/JavaConfigurationProviderTest.java
@@ -44,7 +44,7 @@ public class JavaConfigurationProviderTest {
 
         PropertySource propertySource = propertySources.iterator().next();
 
-        assertThat(propertySource.getProperties().keySet(), hasSize(10));  // double the size for .source values.
+        assertThat(propertySource.getProperties().keySet(), hasSize(5));  // double the size for .source values.
 
         for (int i = 1; i < 6; i++) {
             String key = "confkey" + i;


[07/10] incubator-tamaya git commit: TAMAYA-182: Fixed test issues.

Posted by an...@apache.org.
TAMAYA-182: Fixed test issues.


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

Branch: refs/heads/master
Commit: 0ed186482faa265571ad178626613fe1765ee28c
Parents: 4cfc2d3 aac361a
Author: anatole <an...@apache.org>
Authored: Fri Oct 28 00:28:37 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Fri Oct 28 00:28:37 2016 +0200

----------------------------------------------------------------------
 .../src/test/java/org/apache/tamaya/ConfigurationTest.java    | 1 -
 .../test/java/org/apache/tamaya/core/ConfigurationTest.java   | 7 -------
 .../core/propertysource/PropertiesFilePropertySourceTest.java | 2 +-
 .../tamaya/core/propertysource/SimplePropertySourceTest.java  | 4 ++--
 .../tamaya/core/provider/JavaConfigurationProviderTest.java   | 2 +-
 5 files changed, 4 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/0ed18648/code/core/src/test/java/org/apache/tamaya/core/ConfigurationTest.java
----------------------------------------------------------------------


[10/10] incubator-tamaya git commit: TAMAYA-188: Added explicit converters for File and Path.

Posted by an...@apache.org.
TAMAYA-188: Added explicit converters for File and Path.


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

Branch: refs/heads/master
Commit: eafcadea6e3ff925d916966462f4f7a37738940d
Parents: 77dbcc4
Author: anatole <an...@apache.org>
Authored: Sat Oct 29 14:41:15 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Sat Oct 29 14:41:15 2016 +0200

----------------------------------------------------------------------
 .../core/internal/WrappedPropertySource.java    | 130 +++++++++++++++++++
 .../core/internal/converters/FileConverter.java |  51 ++++++++
 .../core/internal/converters/PathConverter.java |  54 ++++++++
 .../org.apache.tamaya.spi.PropertyConverter     |   2 +
 .../internal/converters/URIConverterTest.java   |  69 ++++++++++
 .../internal/converters/URLConverterTest.java   |  69 ++++++++++
 6 files changed, 375 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/eafcadea/code/core/src/main/java/org/apache/tamaya/core/internal/WrappedPropertySource.java
----------------------------------------------------------------------
diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/WrappedPropertySource.java b/code/core/src/main/java/org/apache/tamaya/core/internal/WrappedPropertySource.java
new file mode 100644
index 0000000..a6f4742
--- /dev/null
+++ b/code/core/src/main/java/org/apache/tamaya/core/internal/WrappedPropertySource.java
@@ -0,0 +1,130 @@
+/*
+ * 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.internal;
+
+import org.apache.tamaya.spi.PropertySource;
+import org.apache.tamaya.spi.PropertyValue;
+
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * Property source effectively managed by the configuration context, allowing resetting of ordinal and its
+ * delegate (e.g. in case of refresh).
+ */
+class WrappedPropertySource implements PropertySource{
+
+    private Integer ordinal;
+    private PropertySource delegate;
+    private long loaded = System.currentTimeMillis();
+
+    private WrappedPropertySource(PropertySource delegate) {
+        this(delegate, null);
+    }
+
+    private WrappedPropertySource(PropertySource delegate, Integer ordinal) {
+        this.delegate = Objects.requireNonNull(delegate);
+        this.ordinal = ordinal;
+    }
+
+    public static WrappedPropertySource of(PropertySource ps) {
+        if(ps instanceof  WrappedPropertySource){
+            return (WrappedPropertySource)ps;
+        }
+        return new WrappedPropertySource(ps);
+    }
+
+    public static WrappedPropertySource of(PropertySource ps, Integer ordinal) {
+        if(ps instanceof  WrappedPropertySource){
+            return new WrappedPropertySource(((WrappedPropertySource)ps).getDelegate(), ordinal);
+        }
+        return new WrappedPropertySource(ps, ordinal);
+    }
+
+    @Override
+    public int getOrdinal() {
+        if(this.ordinal!=null){
+            return this.ordinal;
+        }
+        return delegate.getOrdinal();
+    }
+
+    public void setOrdinal(Integer ordinal) {
+        this.ordinal = ordinal;
+    }
+
+    public void setDelegate(PropertySource delegate) {
+        this.delegate = Objects.requireNonNull(delegate);
+        this.loaded = System.currentTimeMillis();
+    }
+
+    @Override
+    public String getName() {
+        return delegate.getName();
+    }
+
+    @Override
+    public PropertyValue get(String key) {
+        return delegate.get(key);
+    }
+
+    @Override
+    public Map<String, String> getProperties() {
+        return delegate.getProperties();
+    }
+
+    @Override
+    public boolean isScannable() {
+        return delegate.isScannable();
+    }
+
+    public PropertySource getDelegate() {
+        return delegate;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (!(o instanceof WrappedPropertySource)) return false;
+
+        WrappedPropertySource that = (WrappedPropertySource) o;
+
+        return getDelegate().getName().equals(that.getDelegate().getName());
+
+    }
+
+    @Override
+    public int hashCode() {
+        return getDelegate().getName().hashCode();
+    }
+
+    @Override
+    public String toString() {
+        return "WrappedPropertySource{" +
+                "name=" + getName() +
+                ", ordinal=" + getOrdinal() +
+                ", scannable=" + isScannable() +
+                ", loadedAt=" + loaded +
+                ", delegate-class=" + delegate.getClass().getName() +
+                ", delegate-ordinal=" + delegate.getOrdinal() +
+                '}';
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/eafcadea/code/core/src/main/java/org/apache/tamaya/core/internal/converters/FileConverter.java
----------------------------------------------------------------------
diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/converters/FileConverter.java b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/FileConverter.java
new file mode 100644
index 0000000..6e4109d
--- /dev/null
+++ b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/FileConverter.java
@@ -0,0 +1,51 @@
+/*
+ * 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.internal.converters;
+
+import org.apache.tamaya.spi.ConversionContext;
+import org.apache.tamaya.spi.PropertyConverter;
+
+import java.io.File;
+import java.net.URL;
+import java.util.Objects;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Converter, converting from String to URI, using new URL(value).
+ */
+public class FileConverter implements PropertyConverter<File> {
+
+    private final Logger LOG = Logger.getLogger(getClass().getName());
+
+    @Override
+    public File convert(String value, ConversionContext context) {
+        if(value==null || value.isEmpty()){
+            return null;
+        }
+        context.addSupportedFormats(getClass(),"<File>");
+        String trimmed = Objects.requireNonNull(value).trim();
+        try {
+            return new File(trimmed);
+        } catch (Exception e) {
+            LOG.log(Level.FINE, "Unparseable File Name: " + trimmed, e);
+        }
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/eafcadea/code/core/src/main/java/org/apache/tamaya/core/internal/converters/PathConverter.java
----------------------------------------------------------------------
diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/converters/PathConverter.java b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/PathConverter.java
new file mode 100644
index 0000000..6c0b287
--- /dev/null
+++ b/code/core/src/main/java/org/apache/tamaya/core/internal/converters/PathConverter.java
@@ -0,0 +1,54 @@
+/*
+ * 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.internal.converters;
+
+import org.apache.tamaya.spi.ConversionContext;
+import org.apache.tamaya.spi.PropertyConverter;
+
+import java.io.File;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Objects;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Converter, converting from String to URI, using new URL(value).
+ */
+public class PathConverter implements PropertyConverter<Path> {
+
+    private final Logger LOG = Logger.getLogger(getClass().getName());
+
+    @Override
+    public Path convert(String value, ConversionContext context) {
+        if(value==null || value.isEmpty()){
+            return null;
+        }
+        context.addSupportedFormats(getClass(),"<File>");
+        String trimmed = Objects.requireNonNull(value).trim();
+        try {
+            return FileSystems.getDefault().getPath(value);
+        } catch (Exception e) {
+            LOG.log(Level.FINE, "Unparseable Path: " + trimmed, e);
+        }
+        return null;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/eafcadea/code/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
----------------------------------------------------------------------
diff --git a/code/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter b/code/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
index 93f7b11..878e8a7 100644
--- a/code/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
+++ b/code/core/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
@@ -31,3 +31,5 @@ org.apache.tamaya.core.internal.converters.CurrencyConverter
 org.apache.tamaya.core.internal.converters.NumberConverter
 org.apache.tamaya.core.internal.converters.URIConverter
 org.apache.tamaya.core.internal.converters.URLConverter
+org.apache.tamaya.core.internal.converters.FileConverter
+org.apache.tamaya.core.internal.converters.PathConverter

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/eafcadea/code/core/src/test/java/org/apache/tamaya/core/internal/converters/URIConverterTest.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/internal/converters/URIConverterTest.java b/code/core/src/test/java/org/apache/tamaya/core/internal/converters/URIConverterTest.java
new file mode 100644
index 0000000..0ac4ba7
--- /dev/null
+++ b/code/core/src/test/java/org/apache/tamaya/core/internal/converters/URIConverterTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.internal.converters;
+
+import org.apache.tamaya.TypeLiteral;
+import org.apache.tamaya.spi.ConversionContext;
+import org.junit.Test;
+
+import java.math.BigDecimal;
+import java.net.URI;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+/**
+ * Tests conversion of the {@link ClassConverter}.
+ */
+public class URIConverterTest {
+
+    ConversionContext context = new ConversionContext.Builder(TypeLiteral.of(URI.class))
+            .build();
+
+    @Test
+    public void testConvert_URI() throws Exception {
+        URIConverter converter = new URIConverter();
+        assertEquals(new URI("test:path"), converter.convert("test:path", context));
+    }
+
+    @Test
+    public void testConvert_URI_WithSpaces() throws Exception {
+        URIConverter converter = new URIConverter();
+        assertEquals(new URI("test:path"), converter.convert("  test:path\t", context));
+    }
+
+    @Test
+    public void testConvert_URI_WithSpacesBefore() throws Exception {
+        URIConverter converter = new URIConverter();
+        assertEquals(new URI("test:path"), converter.convert("  test:path", context));
+    }
+
+    @Test
+    public void testConvert_URI_WithSpacesAfter() throws Exception {
+        URIConverter converter = new URIConverter();
+        assertEquals(new URI("test:path"), converter.convert("test:path  ", context));
+    }
+
+    @Test
+    public void testConvert_NotPresent() throws Exception {
+        URIConverter converter = new URIConverter();
+        assertNull(converter.convert("", context));
+        assertNull(converter.convert(null, context));
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/eafcadea/code/core/src/test/java/org/apache/tamaya/core/internal/converters/URLConverterTest.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/internal/converters/URLConverterTest.java b/code/core/src/test/java/org/apache/tamaya/core/internal/converters/URLConverterTest.java
new file mode 100644
index 0000000..e740331
--- /dev/null
+++ b/code/core/src/test/java/org/apache/tamaya/core/internal/converters/URLConverterTest.java
@@ -0,0 +1,69 @@
+/*
+ * 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.internal.converters;
+
+import org.apache.tamaya.TypeLiteral;
+import org.apache.tamaya.spi.ConversionContext;
+import org.junit.Test;
+
+import java.net.URI;
+import java.net.URL;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+/**
+ * Tests conversion of the {@link ClassConverter}.
+ */
+public class URLConverterTest {
+
+    ConversionContext context = new ConversionContext.Builder(TypeLiteral.of(URI.class))
+            .build();
+
+    @Test
+    public void testConvert_URL() throws Exception {
+        URLConverter converter = new URLConverter();
+        assertEquals(new URL("http://google.com:4000/path"), converter.convert("http://google.com:4000/path", context));
+    }
+
+    @Test
+    public void testConvert_URL_WithSpaces() throws Exception {
+        URLConverter converter = new URLConverter();
+        assertEquals(new URL("http://google.com:4000/path"), converter.convert("  http://google.com:4000/path\t", context));
+    }
+
+    @Test
+    public void testConvert_URL_WithSpacesBefore() throws Exception {
+        URLConverter converter = new URLConverter();
+        assertEquals(new URL("http://google.com:4000/path"), converter.convert("  http://google.com:4000/path", context));
+    }
+
+    @Test
+    public void testConvert_URL_WithSpacesAfter() throws Exception {
+        URLConverter converter = new URLConverter();
+        assertEquals(new URL("http://google.com:4000/path"), converter.convert("http://google.com:4000/path  ", context));
+    }
+
+    @Test
+    public void testConvert_NotPresent() throws Exception {
+        URLConverter converter = new URLConverter();
+        assertNull(converter.convert("", context));
+        assertNull(converter.convert(null, context));
+    }
+}


[09/10] incubator-tamaya git commit: TAMAYA-182: Streamlined/unified builder API and impl: bugfixes.

Posted by an...@apache.org.
TAMAYA-182: Streamlined/unified builder API and impl: bugfixes.


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

Branch: refs/heads/master
Commit: 77dbcc4d3a9fa38f0e9bbc4901ea5cae7efcf24c
Parents: d1ae885
Author: anatole <an...@apache.org>
Authored: Sat Oct 29 14:38:24 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Sat Oct 29 14:38:24 2016 +0200

----------------------------------------------------------------------
 .../tamaya/TestConfigurationProvider.java       |   7 +-
 .../tamaya/spi/ConversionContextTest.java       | 194 +++++++
 .../apache/tamaya/spi/FilterContextTest.java    |  72 +++
 .../tamaya/spi/ServiceContextManagerTest.java   |  67 +++
 .../core/internal/DefaultConfiguration.java     |   8 +-
 .../internal/DefaultConfigurationContext.java   |  43 +-
 .../internal/DefaultConfigurationProvider.java  |   1 +
 .../core/ConfigurationContextBuilderTest.java   | 513 +++++++++++++++++++
 .../apache/tamaya/core/TestPropertySource.java  |  73 +++
 .../DefaultConfigurationContextBuilderTest.java | 232 +++++++++
 .../DefaultConfigurationContextTest.java        | 177 +++++++
 .../DefaultConfigurationProviderTest.java       |  61 +++
 .../internal/PriorityServiceComparatorTest.java |  47 ++
 13 files changed, 1485 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/77dbcc4d/code/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/code/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java b/code/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java
index 4b6ca31..e326ee8 100644
--- a/code/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java
+++ b/code/api/src/test/java/org/apache/tamaya/TestConfigurationProvider.java
@@ -23,11 +23,12 @@ import org.apache.tamaya.spi.ConfigurationContextBuilder;
 import org.apache.tamaya.spi.ConfigurationProviderSpi;
 
 import javax.annotation.Priority;
+import java.util.Objects;
 
 /**
  * Test Configuration class, that is used to testdata the default methods provided by the API.
  */
-@Priority(2)
+@Priority(-1)
 public class TestConfigurationProvider implements ConfigurationProviderSpi {
 
     private static final Configuration config = new TestConfiguration();
@@ -39,12 +40,12 @@ public class TestConfigurationProvider implements ConfigurationProviderSpi {
 
     @Override
     public Configuration createConfiguration(ConfigurationContext context) {
-        return null;
+        return config;
     }
 
     @Override
     public ConfigurationContext getConfigurationContext() {
-        return null;
+        return config.getContext();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/77dbcc4d/code/api/src/test/java/org/apache/tamaya/spi/ConversionContextTest.java
----------------------------------------------------------------------
diff --git a/code/api/src/test/java/org/apache/tamaya/spi/ConversionContextTest.java b/code/api/src/test/java/org/apache/tamaya/spi/ConversionContextTest.java
new file mode 100644
index 0000000..30f5aba
--- /dev/null
+++ b/code/api/src/test/java/org/apache/tamaya/spi/ConversionContextTest.java
@@ -0,0 +1,194 @@
+/*
+ * 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.spi;
+
+import org.apache.tamaya.ConfigOperator;
+import org.apache.tamaya.ConfigQuery;
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.TypeLiteral;
+import org.junit.Test;
+
+import java.net.InetAddress;
+import java.util.List;
+import java.util.Map;
+
+import static org.junit.Assert.*;
+
+/**
+ * Tests for {@link ConversionContext}, created by atsticks on 20.08.16.
+ */
+public class ConversionContextTest {
+    @Test
+    public void getKey() throws Exception {
+        ConversionContext ctx = new ConversionContext.Builder("getKey", TypeLiteral.of(String.class)).build();
+        assertEquals("getKey", ctx.getKey());
+    }
+
+    @Test
+    public void getTargetType() throws Exception {
+        ConversionContext ctx = new ConversionContext.Builder("getTargetType", TypeLiteral.of(String.class)).build();
+        assertEquals(TypeLiteral.of(String.class), ctx.getTargetType());
+    }
+
+    @Test
+    public void getAnnotatedElement() throws Exception {
+        ConversionContext ctx = new ConversionContext.Builder("getAnnotatedElement", TypeLiteral.of(List.class)).build();
+        assertNull(ctx.getAnnotatedElement());
+    }
+
+    @Test
+    public void testConfiguration() throws Exception {
+        Configuration config = new MyConfiguration();
+        ConversionContext ctx = new ConversionContext.Builder("testConfiguration", TypeLiteral.of(List.class))
+                .setConfiguration(config).build();
+        assertEquals(config, ctx.getConfiguration());
+    }
+
+    @Test
+    public void testSupportedFormats() throws Exception {
+        ConversionContext ctx = new ConversionContext.Builder("getAnnotatedElement", TypeLiteral.of(List.class))
+                .addSupportedFormats(MyConverter.class, "0.0.0.0/nnn").build();
+        assertTrue(ctx.getSupportedFormats().contains("0.0.0.0/nnn (MyConverter)"));
+    }
+
+    @Test
+    public void testToString() throws Exception {
+        ConversionContext ctx = new ConversionContext.Builder("getAnnotatedElement", TypeLiteral.of(List.class))
+                .addSupportedFormats(MyConverter.class, "0.0.0.0/nnn").build();
+        assertEquals("ConversionContext{configuration=null, key='getAnnotatedElement', targetType=TypeLiteral{type=interface java.util.List}, annotatedElement=null, supportedFormats=[0.0.0.0/nnn (MyConverter)]}", ctx.toString());
+    }
+
+    @Test
+    public void getConfigurationContext() throws Exception {
+        ConfigurationContext context = new MyConfigurationContext();
+        ConversionContext ctx = new ConversionContext.Builder("getAnnotatedElement", TypeLiteral.of(List.class))
+                .setConfigurationContext(context).build();
+        assertEquals(context, ctx.getConfigurationContext());
+    }
+
+
+    private static final class MyConverter implements PropertyConverter<InetAddress>{
+        @Override
+        public InetAddress convert(String value, ConversionContext context) {
+            return null;
+        }
+    }
+
+    private static final class MyConfigurationContext implements ConfigurationContext{
+
+        @Override
+        public void addPropertySources(PropertySource... propertySources) {
+
+        }
+
+        @Override
+        public List<PropertySource> getPropertySources() {
+            return null;
+        }
+
+        @Override
+        public PropertySource getPropertySource(String name) {
+            return null;
+        }
+
+        @Override
+        public <T> void addPropertyConverter(TypeLiteral<T> typeToConvert, PropertyConverter<T> propertyConverter) {
+
+        }
+
+        @Override
+        public Map<TypeLiteral<?>, List<PropertyConverter<?>>> getPropertyConverters() {
+            return null;
+        }
+
+        @Override
+        public <T> List<PropertyConverter<T>> getPropertyConverters(TypeLiteral<T> type) {
+            return null;
+        }
+
+        @Override
+        public List<PropertyFilter> getPropertyFilters() {
+            return null;
+        }
+
+        @Override
+        public PropertyValueCombinationPolicy getPropertyValueCombinationPolicy() {
+            return null;
+        }
+
+        @Override
+        public ConfigurationContextBuilder toBuilder() {
+            return null;
+        }
+    }
+
+    private static final class MyConfiguration implements Configuration{
+
+        @Override
+        public String get(String key) {
+            return null;
+        }
+
+        @Override
+        public String getOrDefault(String key, String defaultValue) {
+            return null;
+        }
+
+        @Override
+        public <T> T getOrDefault(String key, Class<T> type, T defaultValue) {
+            return null;
+        }
+
+        @Override
+        public <T> T get(String key, Class<T> type) {
+            return null;
+        }
+
+        @Override
+        public <T> T get(String key, TypeLiteral<T> type) {
+            return null;
+        }
+
+        @Override
+        public <T> T getOrDefault(String key, TypeLiteral<T> type, T defaultValue) {
+            return null;
+        }
+
+        @Override
+        public Map<String, String> getProperties() {
+            return null;
+        }
+
+        @Override
+        public Configuration with(ConfigOperator operator) {
+            return null;
+        }
+
+        @Override
+        public <T> T query(ConfigQuery<T> query) {
+            return null;
+        }
+
+        @Override
+        public ConfigurationContext getContext() {
+            return null;
+        }
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/77dbcc4d/code/api/src/test/java/org/apache/tamaya/spi/FilterContextTest.java
----------------------------------------------------------------------
diff --git a/code/api/src/test/java/org/apache/tamaya/spi/FilterContextTest.java b/code/api/src/test/java/org/apache/tamaya/spi/FilterContextTest.java
new file mode 100644
index 0000000..590d450
--- /dev/null
+++ b/code/api/src/test/java/org/apache/tamaya/spi/FilterContextTest.java
@@ -0,0 +1,72 @@
+/*
+ * 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.spi;
+
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.Assert.*;
+
+/**
+ * Tests for {@link FilterContext}.
+ */
+public class FilterContextTest {
+    @Test
+    public void getKey() throws Exception {
+        FilterContext ctx = new FilterContext("getKey",
+                new HashMap<String,String>(), true);
+        assertEquals("getKey", ctx.getKey());
+    }
+
+    @Test
+    public void isSinglePropertyScoped() throws Exception {
+        FilterContext ctx = new FilterContext("isSinglePropertyScoped",
+                new HashMap<String,String>(), true);
+        assertEquals(true, ctx.isSinglePropertyScoped());
+        ctx = new FilterContext("isSinglePropertyScoped",
+                new HashMap<String,String>(), false);
+        assertEquals(false, ctx.isSinglePropertyScoped());
+    }
+
+    @Test
+    public void getConfigEntries() throws Exception {
+        Map<String,String> config = new HashMap<>();
+        for(int i=0;i<10;i++) {
+            config.put("key-"+i, "value-"+i);
+        }
+        FilterContext ctx = new FilterContext("getConfigEntries",
+                config, true);
+        assertEquals(config, ctx.getConfigEntries());
+        assertTrue(config != ctx.getConfigEntries());
+    }
+
+    @Test
+    public void testToString() throws Exception {
+        Map<String,String> config = new HashMap<>();
+        for(int i=0;i<2;i++) {
+            config.put("key-"+i, "value-"+i);
+        }
+        FilterContext ctx = new FilterContext("testToString",
+                config, true);
+        assertEquals("FilterContext{key='testToString', configEntries={key-0=value-0, key-1=value-1}}", ctx.toString());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/77dbcc4d/code/api/src/test/java/org/apache/tamaya/spi/ServiceContextManagerTest.java
----------------------------------------------------------------------
diff --git a/code/api/src/test/java/org/apache/tamaya/spi/ServiceContextManagerTest.java b/code/api/src/test/java/org/apache/tamaya/spi/ServiceContextManagerTest.java
new file mode 100644
index 0000000..7e9a010
--- /dev/null
+++ b/code/api/src/test/java/org/apache/tamaya/spi/ServiceContextManagerTest.java
@@ -0,0 +1,67 @@
+/*
+ * 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.spi;
+
+import org.junit.Test;
+
+import java.util.Collections;
+import java.util.List;
+
+import static org.junit.Assert.*;
+
+/**
+ * Additional tests for {@link ServiceContextManager}, created by atsticks on 20.08.16.
+ */
+public class ServiceContextManagerTest {
+
+    @Test
+    public void setGetServiceContext() throws Exception {
+        ServiceContext prev = ServiceContextManager.getServiceContext();
+        try {
+            MyServiceContext mine = new MyServiceContext();
+            ServiceContextManager.set(mine);
+            assertTrue(ServiceContextManager.getServiceContext() == mine);
+            ServiceContextManager.set(mine);
+            assertTrue(ServiceContextManager.getServiceContext() == mine);
+        }finally{
+            ServiceContextManager.set(prev);
+            assertTrue(ServiceContextManager.getServiceContext() == prev);
+        }
+
+    }
+
+    private static final class MyServiceContext implements ServiceContext{
+
+        @Override
+        public int ordinal() {
+            return 0;
+        }
+
+        @Override
+        public <T> T getService(Class<T> serviceType) {
+            return null;
+        }
+
+        @Override
+        public <T> List<T> getServices(Class<T> serviceType) {
+            return Collections.emptyList();
+        }
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/77dbcc4d/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfiguration.java
----------------------------------------------------------------------
diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfiguration.java b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfiguration.java
index 1c76d8c..1b37233 100644
--- a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfiguration.java
+++ b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfiguration.java
@@ -168,7 +168,8 @@ public class DefaultConfiguration implements Configuration {
     protected <T> T convertValue(String key, String value, TypeLiteral<T> type) {
         if (value != null) {
             List<PropertyConverter<T>> converters = configurationContext.getPropertyConverters(type);
-            ConversionContext context = new ConversionContext.Builder(this, this.configurationContext, key, type).build();
+            ConversionContext context = new ConversionContext.Builder(this, this.configurationContext, key, type)
+                    .build();
             for (PropertyConverter<T> converter : converters) {
                 try {
                     T t = converter.convert(value, context);
@@ -179,6 +180,11 @@ public class DefaultConfiguration implements Configuration {
                     LOG.log(Level.INFO, "PropertyConverter: " + converter + " failed to convert value: " + value, e);
                 }
             }
+            // if the target type is a String, we can return the value, no conversion required.
+            if(type.equals(TypeLiteral.of(String.class))){
+                return (T)value;
+            }
+            // unsupported type, throw an exception
             throw new ConfigException("Unparseable config value for type: " + type.getRawType().getName() + ": " + key +
                     ", supported formats: " + context.getSupportedFormats());
         }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/77dbcc4d/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
----------------------------------------------------------------------
diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
index 29be92f..7a65fa5 100644
--- a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
+++ b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
@@ -78,14 +78,33 @@ public class DefaultConfigurationContext implements ConfigurationContext {
         propertySources.addAll(builder.propertySources);
         // now sort them according to their ordinal values
         immutablePropertySources = Collections.unmodifiableList(propertySources);
-        LOG.info("Registered " + immutablePropertySources.size() + " property sources: " +
-                immutablePropertySources);
+        StringBuilder b= new StringBuilder();
+        b.append("Registered " + immutablePropertySources.size() + " property sources: \n");
+        b.append("   NAME [TYPE]\n");
+        b.append("   ---------------------------------------------------\n");
+        for(PropertySource ps: immutablePropertySources){
+            b.append("   ").append(ps.getName()).append("  [").append(ps.getClass().getSimpleName()).append("],\n");
+        }
+        if(b.length()>0) {
+            b.setLength(b.length() - 2);
+        }
+        LOG.info(b.toString());
+        b.setLength(0);
 
         // as next step we pick up the PropertyFilters pretty much the same way
         List<PropertyFilter> propertyFilters = new ArrayList<>(builder.getPropertyFilters());
         immutablePropertyFilters = Collections.unmodifiableList(propertyFilters);
-        LOG.info("Registered " + immutablePropertyFilters.size() + " property filters: " +
-                immutablePropertyFilters);
+        b.append("Registered " + immutablePropertyFilters.size() + " property filters: \n");
+        b.append("   TYPE\n");
+        b.append("   ----------------------------------------------------------\n");
+        for(PropertyFilter pf: immutablePropertyFilters){
+            b.append("   ").append(pf.getClass().getName()).append(",\n");
+        }
+        if(b.length()>0) {
+            b.setLength(b.length() - 2);
+        }
+        LOG.info(b.toString());
+        b.setLength(0);
 
         // Finally add the converters
         for(Map.Entry<TypeLiteral<?>, Collection<PropertyConverter<?>>> en:builder.getPropertyConverter().entrySet()) {
@@ -93,8 +112,20 @@ public class DefaultConfigurationContext implements ConfigurationContext {
                 this.propertyConverterManager.register(en.getKey(), converter);
             }
         }
-        LOG.info("Registered " + propertyConverterManager.getPropertyConverters().size() + " property converters: " +
-                propertyConverterManager.getPropertyConverters());
+        b.append("Registered " + propertyConverterManager.getPropertyConverters().size() + " property converters:\n");
+        b.append("   TYPE\n");
+        b.append("   ----------------------------------------------------------\n");
+        for(Map.Entry<TypeLiteral<?>,List<PropertyConverter<?>>> list: propertyConverterManager.getPropertyConverters().entrySet()){
+            b.append("   ").append(list.getKey().getRawType().getName()).append(" -> \n");
+            for(PropertyConverter<?> conv:list.getValue()) {
+                b.append("     ").append(conv.toString()).append(",\n");
+            }
+        }
+        if(b.length()>0) {
+            b.setLength(b.length() - 2);
+        }
+        LOG.info(b.toString());
+        b.setLength(0);
 
         propertyValueCombinationPolicy = builder.combinationPolicy;
         if(propertyValueCombinationPolicy==null){

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/77dbcc4d/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationProvider.java b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationProvider.java
index e03d9ce..be04a6e 100644
--- a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationProvider.java
+++ b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationProvider.java
@@ -24,6 +24,7 @@ import org.apache.tamaya.spi.ConfigurationContextBuilder;
 import org.apache.tamaya.spi.ConfigurationProviderSpi;
 import org.apache.tamaya.spi.ServiceContextManager;
 
+import javax.annotation.Priority;
 import java.util.Objects;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/77dbcc4d/code/core/src/test/java/org/apache/tamaya/core/ConfigurationContextBuilderTest.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/ConfigurationContextBuilderTest.java b/code/core/src/test/java/org/apache/tamaya/core/ConfigurationContextBuilderTest.java
new file mode 100644
index 0000000..f6f7316
--- /dev/null
+++ b/code/core/src/test/java/org/apache/tamaya/core/ConfigurationContextBuilderTest.java
@@ -0,0 +1,513 @@
+/*
+ * 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;
+
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.TypeLiteral;
+import org.apache.tamaya.core.internal.DefaultConfigurationContextBuilder;
+import org.apache.tamaya.spi.*;
+import org.junit.Test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.Map;
+
+import static org.junit.Assert.*;
+
+/**
+ * Tests for {@link DefaultConfigurationContextBuilder} by atsticks on 06.09.16.
+ */
+public class ConfigurationContextBuilderTest {
+
+    private TestPropertySource testPropertySource = new TestPropertySource(){};
+
+    @Test
+    public void setContext() throws Exception {
+        ConfigurationContext context = ConfigurationProvider.getConfiguration().getContext();
+        ConfigurationContextBuilder b = ConfigurationProvider.getConfigurationContextBuilder()
+                .setContext(context);
+        assertEquals(context, b.build());
+    }
+
+    @Test
+    public void addPropertySources_Array() throws Exception {
+        PropertySource testPS2 = new TestPropertySource("addPropertySources_Array", 1);
+        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder()
+                .addPropertySources(testPropertySource, testPS2);
+        ConfigurationContext ctx = b.build();
+        assertTrue(ctx.getPropertySources().size()==2);
+        assertTrue(ctx.getPropertySources().contains(testPropertySource));
+        assertTrue(ctx.getPropertySources().contains(testPS2));
+        // Ensure no sorting happens during add, so switch ordinals!
+        testPS2 = new TestPropertySource("addPropertySources_Array", 1);
+        b = ConfigurationProvider.getConfigurationContextBuilder()
+                .addPropertySources(testPS2, testPropertySource);
+        ctx = b.build();
+        assertTrue(ctx.getPropertySources().size()==2);
+        assertTrue(ctx.getPropertySources().contains(testPropertySource));
+        assertTrue(ctx.getPropertySources().contains(testPS2));
+        assertEquals(ctx.getPropertySources().get(1).getName(), "TestPropertySource");
+        assertEquals(ctx.getPropertySources().get(0).getName(), "addPropertySources_Array");
+    }
+
+    @Test
+    public void addPropertySources_Collection() throws Exception {
+        PropertySource testPS2 = new TestPropertySource("addPropertySources_Collection", 1);
+        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder()
+                .addPropertySources(Arrays.asList(new PropertySource[]{testPropertySource, testPS2}));
+        ConfigurationContext ctx = b.build();
+        assertTrue(ctx.getPropertySources().size()==2);
+        assertTrue(ctx.getPropertySources().contains(testPropertySource));
+        assertTrue(ctx.getPropertySources().contains(testPS2));
+        assertEquals(ctx.getPropertySources().get(0).getName(), "TestPropertySource");
+        assertEquals(ctx.getPropertySources().get(1).getName(), "addPropertySources_Collection");
+        // Ensure no sorting happens during add, so switch ordinals!
+        testPS2 = new TestPropertySource("addPropertySources_Collection", 1);
+        b = ConfigurationProvider.getConfigurationContextBuilder()
+                .addPropertySources(Arrays.asList(new PropertySource[]{testPS2, testPropertySource}));
+        ctx = b.build();
+        assertTrue(ctx.getPropertySources().size()==2);
+        assertTrue(ctx.getPropertySources().contains(testPropertySource));
+        assertTrue(ctx.getPropertySources().contains(testPS2));
+        assertEquals(ctx.getPropertySources().get(1).getName(), "TestPropertySource");
+        assertEquals(ctx.getPropertySources().get(0).getName(), "addPropertySources_Collection");
+    }
+
+    @Test
+    public void removePropertySources_Array() throws Exception {
+        PropertySource testPS2 = new TestPropertySource("removePropertySources_Array", 1);
+        ConfigurationContextBuilder b = ConfigurationProvider.getConfigurationContextBuilder()
+                .addPropertySources(testPropertySource, testPS2);
+        ConfigurationContext ctx = b.build();
+        assertTrue(ctx.getPropertySources().size()==2);
+        assertTrue(ctx.getPropertySources().contains(testPropertySource));
+        assertTrue(ctx.getPropertySources().contains(testPS2));
+        b = ConfigurationProvider.getConfigurationContextBuilder()
+                .addPropertySources(testPropertySource, testPS2);
+        b.removePropertySources(testPropertySource);
+        ctx = b.build();
+        assertFalse(ctx.getPropertySources().contains(testPropertySource));
+        assertTrue(ctx.getPropertySources().contains(testPS2));
+        assertTrue(ctx.getPropertySources().size()==1);
+    }
+
+    @Test
+    public void removePropertySources_Collection() throws Exception {
+        PropertySource testPS2 = new TestPropertySource("removePropertySources_Array", 1);
+        ConfigurationContextBuilder b = ConfigurationProvider.getConfigurationContextBuilder()
+                .addPropertySources(testPropertySource, testPS2);
+        ConfigurationContext ctx = b.build();
+        assertTrue(ctx.getPropertySources().size()==2);
+        assertTrue(ctx.getPropertySources().contains(testPropertySource));
+        assertTrue(ctx.getPropertySources().contains(testPS2));
+        b = ConfigurationProvider.getConfigurationContextBuilder()
+                .addPropertySources(testPropertySource, testPS2);
+        b.removePropertySources(testPropertySource);
+        ctx = b.build();
+        assertTrue(ctx.getPropertySources().size()==1);
+        assertFalse(ctx.getPropertySources().contains(testPropertySource));
+        assertTrue(ctx.getPropertySources().contains(testPS2));
+    }
+
+    @Test
+    public void addPropertyFilters_Array() throws Exception {
+        PropertyFilter filter1 = new PropertyFilter(){
+            @Override
+            public String filterProperty(String value, FilterContext context) {
+                return value;
+            }
+        };
+        PropertyFilter filter2 = new PropertyFilter(){
+            @Override
+            public String filterProperty(String value, FilterContext context) {
+                return value;
+            }
+        };
+        ConfigurationContextBuilder b = ConfigurationProvider.getConfigurationContextBuilder();
+        b.addPropertyFilters(filter1, filter2);
+        ConfigurationContext ctx = b.build();
+        assertTrue(ctx.getPropertyFilters().contains(filter1));
+        assertTrue(ctx.getPropertyFilters().contains(filter2));
+        assertTrue(ctx.getPropertyFilters().size()==2);
+        b = ConfigurationProvider.getConfigurationContextBuilder();
+        b.addPropertyFilters(filter1, filter2);
+        b.addPropertyFilters(filter1, filter2);
+        assertTrue(ctx.getPropertyFilters().size()==2);
+    }
+
+    @Test
+    public void addPropertyFilters_Collection() throws Exception {
+        PropertyFilter filter1 = new PropertyFilter(){
+            @Override
+            public String filterProperty(String value, FilterContext context) {
+                return value;
+            }
+        };
+        PropertyFilter filter2 = new PropertyFilter(){
+            @Override
+            public String filterProperty(String value, FilterContext context) {
+                return value;
+            }
+        };
+        ConfigurationContextBuilder b = ConfigurationProvider.getConfigurationContextBuilder();
+        b.addPropertyFilters(Arrays.asList(new PropertyFilter[]{filter1, filter2}));
+        ConfigurationContext ctx = b.build();
+        assertTrue(ctx.getPropertyFilters().contains(filter1));
+        assertTrue(ctx.getPropertyFilters().contains(filter2));
+        assertTrue(ctx.getPropertyFilters().size()==2);
+        b = ConfigurationProvider.getConfigurationContextBuilder();
+        b.addPropertyFilters(filter1, filter2);
+        b.addPropertyFilters(filter1, filter2);
+        assertTrue(ctx.getPropertyFilters().size()==2);
+    }
+
+    @Test
+    public void removePropertyFilters_Array() throws Exception {
+        PropertyFilter filter1 = new PropertyFilter(){
+            @Override
+            public String filterProperty(String value, FilterContext context) {
+                return value;
+            }
+        };
+        PropertyFilter filter2 = new PropertyFilter(){
+            @Override
+            public String filterProperty(String value, FilterContext context) {
+                return value;
+            }
+        };
+        ConfigurationContextBuilder b = ConfigurationProvider.getConfigurationContextBuilder()
+                .addPropertyFilters(filter1, filter2);
+        ConfigurationContext ctx = b.build();
+        assertTrue(ctx.getPropertyFilters().contains(filter1));
+        assertTrue(ctx.getPropertyFilters().contains(filter2));
+        assertTrue(ctx.getPropertyFilters().size()==2);
+        b = ConfigurationProvider.getConfigurationContextBuilder()
+                .addPropertyFilters(filter1, filter2);
+        b.removePropertyFilters(filter1);
+        ctx = b.build();
+        assertTrue(ctx.getPropertyFilters().size()==1);
+        assertFalse(ctx.getPropertyFilters().contains(filter1));
+        assertTrue(ctx.getPropertyFilters().contains(filter2));
+    }
+
+    @Test
+    public void removePropertyFilters_Collection() throws Exception {
+        PropertyFilter filter1 = new PropertyFilter(){
+            @Override
+            public String filterProperty(String value, FilterContext context) {
+                return value;
+            }
+        };
+        PropertyFilter filter2 = new PropertyFilter(){
+            @Override
+            public String filterProperty(String value, FilterContext context) {
+                return value;
+            }
+        };
+        ConfigurationContextBuilder b = ConfigurationProvider.getConfigurationContextBuilder()
+                .addPropertyFilters(Arrays.asList(new PropertyFilter[]{filter1, filter2}));
+        ConfigurationContext ctx = b.build();
+        assertTrue(ctx.getPropertyFilters().contains(filter1));
+        assertTrue(ctx.getPropertyFilters().contains(filter2));
+        assertTrue(ctx.getPropertyFilters().size()==2);
+        b = ConfigurationProvider.getConfigurationContextBuilder()
+                .addPropertyFilters(Arrays.asList(new PropertyFilter[]{filter1, filter2}));
+        b.removePropertyFilters(filter1);
+        ctx = b.build();
+        assertTrue(ctx.getPropertyFilters().size()==1);
+        assertFalse(ctx.getPropertyFilters().contains(filter1));
+        assertTrue(ctx.getPropertyFilters().contains(filter2));
+    }
+
+
+    @Test
+    public void addPropertyConverters_Array() throws Exception {
+        PropertyConverter converter = new PropertyConverter(){
+
+            @Override
+            public Object convert(String value, ConversionContext context) {
+                return value.toLowerCase();
+            }
+        };
+        ConfigurationContextBuilder b = ConfigurationProvider.getConfigurationContextBuilder()
+                .addPropertyConverters(TypeLiteral.of(String.class), converter);
+        ConfigurationContext ctx = b.build();
+        assertTrue(ctx.getPropertyConverters(TypeLiteral.of(String.class)).contains(converter));
+        assertEquals(ctx.getPropertyConverters().size(), 19);
+        b = ConfigurationProvider.getConfigurationContextBuilder()
+                .addPropertyConverters(TypeLiteral.of(String.class), converter);
+        b.addPropertyConverters(TypeLiteral.of(String.class), converter);
+        assertEquals(ctx.getPropertyConverters().size(), 19);
+    }
+
+    @Test
+    public void addPropertyConverters_Collection() throws Exception {
+        PropertyConverter converter = new PropertyConverter(){
+
+            @Override
+            public Object convert(String value, ConversionContext context) {
+                return value.toLowerCase();
+            }
+        };
+        ConfigurationContextBuilder b = ConfigurationProvider.getConfigurationContextBuilder()
+                .addPropertyConverters(TypeLiteral.of(String.class),
+                        Arrays.<PropertyConverter<Object>>asList(new PropertyConverter[]{converter}));
+        ConfigurationContext ctx = b.build();
+        assertTrue(ctx.getPropertyConverters(TypeLiteral.of(String.class)).contains(converter));
+        assertEquals(ctx.getPropertyConverters().size(), 19);
+        b = ConfigurationProvider.getConfigurationContextBuilder()
+                .addPropertyConverters(TypeLiteral.of(String.class),
+                        Arrays.<PropertyConverter<Object>>asList(new PropertyConverter[]{converter}));
+        b.addPropertyConverters(TypeLiteral.of(String.class), converter);
+        assertEquals(ctx.getPropertyConverters().size(), 19);
+    }
+
+    @Test
+    public void removePropertyConverters_Array() throws Exception {
+        PropertyConverter converter = new PropertyConverter(){
+
+            @Override
+            public Object convert(String value, ConversionContext context) {
+                return value.toLowerCase();
+            }
+        };
+        ConfigurationContextBuilder b = ConfigurationProvider.getConfigurationContextBuilder()
+                .addPropertyConverters(TypeLiteral.of(String.class), converter);
+        ConfigurationContext ctx = b.build();
+        assertTrue(ctx.getPropertyConverters(TypeLiteral.of(String.class)).contains(converter));
+        assertEquals(ctx.getPropertyConverters(TypeLiteral.of(String.class)).size(), 1);
+        b = ConfigurationProvider.getConfigurationContextBuilder()
+                .addPropertyConverters(TypeLiteral.of(String.class), converter);
+        b.removePropertyConverters(TypeLiteral.of(String.class), converter);
+        ctx = b.build();
+        assertFalse(ctx.getPropertyConverters(TypeLiteral.of(String.class)).contains(converter));
+        assertEquals(ctx.getPropertyConverters(TypeLiteral.of(String.class)).size(), 0);
+    }
+
+    @Test
+    public void removePropertyConverters_Collection() throws Exception {
+        PropertyConverter converter = new PropertyConverter(){
+
+            @Override
+            public Object convert(String value, ConversionContext context) {
+                return value.toLowerCase();
+            }
+        };
+        ConfigurationContextBuilder b = ConfigurationProvider.getConfigurationContextBuilder()
+                .addPropertyConverters(TypeLiteral.of(String.class), Arrays.<PropertyConverter<Object>>asList(new PropertyConverter[]{converter}));
+        ConfigurationContext ctx = b.build();
+        assertTrue(ctx.getPropertyConverters(TypeLiteral.of(String.class)).contains(converter));
+        assertEquals(ctx.getPropertyConverters(TypeLiteral.of(String.class)).size(), 1);
+        b = ConfigurationProvider.getConfigurationContextBuilder()
+                .addPropertyConverters(TypeLiteral.of(String.class), Arrays.<PropertyConverter<Object>>asList(new PropertyConverter[]{converter}));
+        b.removePropertyConverters(TypeLiteral.of(String.class), Arrays.<PropertyConverter<Object>>asList(new PropertyConverter[]{converter}));
+        ctx = b.build();
+        assertFalse(ctx.getPropertyConverters(TypeLiteral.of(String.class)).contains(converter));
+        assertEquals(ctx.getPropertyConverters(TypeLiteral.of(String.class)).size(), 0);
+    }
+
+    @Test
+    public void setPropertyValueCombinationPolicy() throws Exception {
+        PropertyValueCombinationPolicy combPol = new PropertyValueCombinationPolicy(){
+
+            @Override
+            public Map<String, String> collect(Map<String, String> currentValue, String key, PropertySource propertySource) {
+                return currentValue;
+            }
+        };
+        ConfigurationContextBuilder b = ConfigurationProvider.getConfigurationContextBuilder()
+                .setPropertyValueCombinationPolicy(combPol);
+        ConfigurationContext ctx = b.build();
+        assertEquals(ctx.getPropertyValueCombinationPolicy(), combPol);
+    }
+
+    @Test
+    public void increasePriority(){
+        ConfigurationContextBuilder b = ConfigurationProvider.getConfigurationContextBuilder();
+        TestPropertySource[] propertySources = new TestPropertySource[10];
+        for(int i=0;i<propertySources.length;i++){
+            propertySources[i] = new TestPropertySource("ps"+i,i);
+        }
+        b.addPropertySources(propertySources);
+        b.increasePriority(propertySources[propertySources.length-1]);
+        for(int i=0;i<propertySources.length;i++){
+            assertEquals(propertySources[i], b.getPropertySources().get(i));
+        }
+        b.increasePriority(propertySources[propertySources.length-2]);
+        for(int i=0;i<propertySources.length-2;i++){
+            assertEquals(propertySources[i], b.getPropertySources().get(i));
+        }
+        assertEquals(propertySources[propertySources.length-1], b.getPropertySources().get(propertySources.length-2));
+        assertEquals(propertySources[propertySources.length-2], b.getPropertySources().get(propertySources.length-1));
+    }
+
+    @Test
+    public void decreasePriority(){
+        ConfigurationContextBuilder b = ConfigurationProvider.getConfigurationContextBuilder();
+        TestPropertySource[] propertySources = new TestPropertySource[10];
+        for(int i=0;i<propertySources.length;i++){
+            propertySources[i] = new TestPropertySource("ps"+i,i);
+        }
+        b.addPropertySources(propertySources);
+        b.decreasePriority(propertySources[0]);
+        for(int i=0;i<propertySources.length;i++){
+            assertEquals(propertySources[i], b.getPropertySources().get(i));
+        }
+        b.decreasePriority(propertySources[1]);
+        for(int i=2;i<propertySources.length;i++){
+            assertEquals(propertySources[i], b.getPropertySources().get(i));
+        }
+        assertEquals(propertySources[0], b.getPropertySources().get(1));
+        assertEquals(propertySources[1], b.getPropertySources().get(0));
+    }
+
+    @Test
+    public void lowestPriority(){
+        // setup
+        ConfigurationContextBuilder b = ConfigurationProvider.getConfigurationContextBuilder();
+        TestPropertySource[] propertySources = new TestPropertySource[10];
+        for(int i=0;i<propertySources.length;i++){
+            propertySources[i] = new TestPropertySource("ps"+i,i);
+        }
+        b.addPropertySources(propertySources);
+        // test
+        b.lowestPriority(propertySources[0]);
+        for(int i=0;i<propertySources.length;i++){
+            assertEquals(propertySources[i], b.getPropertySources().get(i));
+        }
+        b.lowestPriority(propertySources[1]);
+        for(int i=2;i<propertySources.length;i++){
+            assertEquals(propertySources[i], b.getPropertySources().get(i));
+        }
+        assertEquals(propertySources[0], b.getPropertySources().get(1));
+        assertEquals(propertySources[1], b.getPropertySources().get(0));
+        b.lowestPriority(propertySources[5]);
+        assertEquals(propertySources[5], b.getPropertySources().get(0));
+    }
+
+    @Test
+    public void highestPriority(){
+        // setup
+        ConfigurationContextBuilder b = ConfigurationProvider.getConfigurationContextBuilder();
+        TestPropertySource[] propertySources = new TestPropertySource[10];
+        for(int i=0;i<propertySources.length;i++){
+            propertySources[i] = new TestPropertySource("ps"+i,i);
+        }
+        b.addPropertySources(propertySources);
+        // test
+        b.highestPriority(propertySources[propertySources.length-1]);
+        for(int i=0;i<propertySources.length;i++){
+            assertEquals(propertySources[i], b.getPropertySources().get(i));
+        }
+        b.highestPriority(propertySources[propertySources.length-2]);
+        for(int i=0;i<propertySources.length-2;i++){
+            assertEquals(propertySources[i], b.getPropertySources().get(i));
+        }
+        assertEquals(propertySources[propertySources.length-2], b.getPropertySources().get(propertySources.length-1));
+        assertEquals(propertySources[propertySources.length-1], b.getPropertySources().get(propertySources.length-2));
+        b.highestPriority(propertySources[5]);
+        assertEquals(propertySources[5], b.getPropertySources().get(propertySources.length-1));
+    }
+
+    @Test
+    public void sortPropertySources(){
+        // setup
+        ConfigurationContextBuilder b = ConfigurationProvider.getConfigurationContextBuilder();
+        TestPropertySource[] propertySources = new TestPropertySource[10];
+        for(int i=0;i<propertySources.length;i++){
+            propertySources[i] = new TestPropertySource("ps"+i,i);
+        }
+        b.addPropertySources(propertySources);
+        Comparator<PropertySource> psComp = new Comparator<PropertySource>() {
+            @Override
+            public int compare(PropertySource o1, PropertySource o2) {
+                return o1.toString().compareTo(o2.toString());
+            }
+        };
+        // test
+        b.sortPropertySources(psComp);
+        Arrays.sort(propertySources, psComp);
+        for(int i=0;i<propertySources.length;i++){
+            assertEquals(propertySources[i], b.getPropertySources().get(i));
+        }
+    }
+
+    @Test
+    public void sortPropertyFilter(){
+        // setup
+        ConfigurationContextBuilder b = ConfigurationProvider.getConfigurationContextBuilder();
+        PropertyFilter[] propertyFilters = new PropertyFilter[10];
+        for(int i=0;i<propertyFilters.length;i++){
+            propertyFilters[i] = new PropertyFilter(){
+                @Override
+                public String filterProperty(String value, FilterContext context) {
+                    return toString() + " - ";
+                }
+            };
+        }
+        b.addPropertyFilters(propertyFilters);
+        Comparator<PropertyFilter> pfComp = new Comparator<PropertyFilter>() {
+            @Override
+            public int compare(PropertyFilter o1, PropertyFilter o2) {
+                return o1.toString().compareTo(o2.toString());
+            }
+        };
+        // test
+        b.sortPropertyFilter(pfComp);
+        Arrays.sort(propertyFilters, pfComp);
+        for(int i=0;i<propertyFilters.length;i++){
+            assertEquals(propertyFilters[i], b.getPropertyFilters().get(i));
+        }
+    }
+
+    @Test
+    public void build() throws Exception {
+        ConfigurationContextBuilder b = ConfigurationProvider.getConfigurationContextBuilder();
+        ConfigurationContext ctx = b.build();
+        assertNotNull(ctx);
+        assertTrue(ctx.getPropertySources().isEmpty());
+        assertTrue(ctx.getPropertyFilters().isEmpty());
+    }
+
+    @Test
+    public void testRemoveAllFilters() throws Exception {
+        ConfigurationContextBuilder b = ConfigurationProvider.getConfigurationContextBuilder();
+        b.addPropertyFilters(new PropertyFilter(){
+            @Override
+            public String filterProperty(String value, FilterContext context) {
+                return toString() + " - ";
+            }
+        });
+        assertFalse(b.getPropertyFilters().isEmpty());
+        b.removePropertyFilters(b.getPropertyFilters());
+        assertTrue(b.getPropertyFilters().isEmpty());
+    }
+
+    @Test
+    public void testRemoveAllSources() throws Exception {
+        ConfigurationContextBuilder b = ConfigurationProvider.getConfigurationContextBuilder();
+        b.addPropertySources(new TestPropertySource());
+        assertFalse(b.getPropertySources().isEmpty());
+        b.removePropertySources(b.getPropertySources());
+        assertTrue(b.getPropertyFilters().isEmpty());
+    }
+
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/77dbcc4d/code/core/src/test/java/org/apache/tamaya/core/TestPropertySource.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/TestPropertySource.java b/code/core/src/test/java/org/apache/tamaya/core/TestPropertySource.java
new file mode 100644
index 0000000..1125f7a
--- /dev/null
+++ b/code/core/src/test/java/org/apache/tamaya/core/TestPropertySource.java
@@ -0,0 +1,73 @@
+/*
+ * 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;
+
+import org.apache.tamaya.spi.PropertySource;
+import org.apache.tamaya.spi.PropertyValue;
+
+import java.util.Collections;
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * Created by atsticks on 18.10.16.
+ */
+public class TestPropertySource implements PropertySource {
+
+    private String id;
+    private int ordinal;
+
+    public TestPropertySource() {
+        this("TestPropertySource", 0);
+    }
+
+    public TestPropertySource(String id, int ordinal) {
+        this.id = id;
+        this.ordinal = ordinal;
+    }
+
+    @Override
+    public int getOrdinal() {
+        return ordinal;
+    }
+
+    @Override
+    public String getName() {
+        return id != null ? id : "TestPropertySource";
+    }
+
+    @Override
+    public PropertyValue get(String key) {
+        return PropertyValue.builder(key, key + "Value", getName())
+                .addContextData("ordinal", String.valueOf(getOrdinal()))
+                .addContextData("createdAt", String.valueOf(new Date()))
+                .build();
+    }
+
+    @Override
+    public Map<String, String> getProperties() {
+        return Collections.emptyMap();
+    }
+
+    @Override
+    public boolean isScannable() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/77dbcc4d/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilderTest.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilderTest.java b/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilderTest.java
new file mode 100644
index 0000000..1075fcc
--- /dev/null
+++ b/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilderTest.java
@@ -0,0 +1,232 @@
+/*
+ * 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.internal;
+
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.TypeLiteral;
+import org.apache.tamaya.spi.*;
+import org.junit.Test;
+
+import java.util.Collections;
+import java.util.Map;
+
+import static org.junit.Assert.*;
+
+/**
+ * Tests for {@link DefaultConfigurationContextBuilder} by atsticks on 06.09.16.
+ */
+public class DefaultConfigurationContextBuilderTest {
+
+    private TestPropertySource testPropertySource = new TestPropertySource(){};
+
+    @Test
+    public void setContext() throws Exception {
+        ConfigurationContext context = ConfigurationProvider.getConfiguration().getContext();
+        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder()
+                .setContext(context);
+        assertEquals(context, b.build());
+    }
+
+    @Test
+    public void addPropertySources_Array() throws Exception {
+        PropertySource testPS2 = new TestPropertySource("addPropertySources_Array_2");
+        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder()
+                .addPropertySources(testPropertySource, testPS2);
+        ConfigurationContext ctx = b.build();
+        assertTrue(ctx.getPropertySources().size()==2);
+        assertTrue(ctx.getPropertySources().contains(testPropertySource));
+        assertTrue(ctx.getPropertySources().contains(testPS2));
+    }
+
+    @Test
+    public void removePropertySources_Array() throws Exception {
+        PropertySource testPS2 = new TestPropertySource("addPropertySources_Array_2");
+        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder()
+                .addPropertySources(testPropertySource, testPS2);
+        ConfigurationContext ctx = b.build();
+        assertTrue(ctx.getPropertySources().size()==2);
+        assertTrue(ctx.getPropertySources().contains(testPropertySource));
+        assertTrue(ctx.getPropertySources().contains(testPS2));
+        b = new DefaultConfigurationContextBuilder()
+                .addPropertySources(testPropertySource, testPS2);
+        b.removePropertySources(testPropertySource);
+        ctx = b.build();
+        assertTrue(ctx.getPropertySources().size()==1);
+        assertFalse(ctx.getPropertySources().contains(testPropertySource));
+        assertTrue(ctx.getPropertySources().contains(testPS2));
+    }
+
+    @Test
+    public void addPropertyFilters_Array() throws Exception {
+        PropertyFilter filter1 = new PropertyFilter(){
+            @Override
+            public String filterProperty(String value, FilterContext context) {
+                return value;
+            }
+        };
+        PropertyFilter filter2 = new PropertyFilter(){
+            @Override
+            public String filterProperty(String value, FilterContext context) {
+                return value;
+            }
+        };
+        DefaultConfigurationContextBuilder b = new DefaultConfigurationContextBuilder();
+        b.addPropertyFilters(filter1, filter2);
+        ConfigurationContext ctx = b.build();
+        assertTrue(ctx.getPropertyFilters().contains(filter1));
+        assertTrue(ctx.getPropertyFilters().contains(filter2));
+        assertTrue(ctx.getPropertyFilters().size()==2);
+        b = new DefaultConfigurationContextBuilder();
+        b.addPropertyFilters(filter1, filter2);
+        b.addPropertyFilters(filter1, filter2);
+        assertTrue(ctx.getPropertyFilters().size()==2);
+    }
+
+    @Test
+    public void removePropertyFilters_Array() throws Exception {
+        PropertyFilter filter1 = new PropertyFilter(){
+            @Override
+            public String filterProperty(String value, FilterContext context) {
+                return value;
+            }
+        };
+        PropertyFilter filter2 = new PropertyFilter(){
+            @Override
+            public String filterProperty(String value, FilterContext context) {
+                return value;
+            }
+        };
+        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder()
+                .addPropertyFilters(filter1, filter2);
+        ConfigurationContext ctx = b.build();
+        assertTrue(ctx.getPropertyFilters().contains(filter1));
+        assertTrue(ctx.getPropertyFilters().contains(filter2));
+        assertTrue(ctx.getPropertyFilters().size()==2);
+        b = new DefaultConfigurationContextBuilder()
+                .addPropertyFilters(filter1, filter2);
+        b.removePropertyFilters(filter1);
+        ctx = b.build();
+        assertTrue(ctx.getPropertyFilters().size()==1);
+        assertFalse(ctx.getPropertyFilters().contains(filter1));
+        assertTrue(ctx.getPropertyFilters().contains(filter2));
+    }
+
+    @Test
+    public void addPropertyConverter() throws Exception {
+        PropertyConverter converter = new PropertyConverter(){
+
+            @Override
+            public Object convert(String value, ConversionContext context) {
+                return value.toLowerCase();
+            }
+        };
+        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder()
+                .addPropertyConverters(TypeLiteral.of(String.class), converter);
+        ConfigurationContext ctx = b.build();
+        assertTrue(ctx.getPropertyConverters(TypeLiteral.of(String.class)).contains(converter));
+        assertEquals(ctx.getPropertyConverters().size(), 19);
+        b = new DefaultConfigurationContextBuilder()
+                .addPropertyConverters(TypeLiteral.of(String.class), converter);
+        b.addPropertyConverters(TypeLiteral.of(String.class), converter);
+        assertEquals(ctx.getPropertyConverters().size(), 19);
+    }
+
+    @Test
+    public void removePropertyConverters_Array() throws Exception {
+        PropertyConverter converter = new PropertyConverter(){
+
+            @Override
+            public Object convert(String value, ConversionContext context) {
+                return value.toLowerCase();
+            }
+        };
+        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder()
+                .addPropertyConverters(TypeLiteral.of(String.class), converter);
+        ConfigurationContext ctx = b.build();
+        assertTrue(ctx.getPropertyConverters(TypeLiteral.of(String.class)).contains(converter));
+        assertEquals(ctx.getPropertyConverters(TypeLiteral.of(String.class)).size(), 1);
+        b = new DefaultConfigurationContextBuilder()
+                .addPropertyConverters(TypeLiteral.of(String.class), converter);
+        b.removePropertyConverters(TypeLiteral.of(String.class), converter);
+        ctx = b.build();
+        assertFalse(ctx.getPropertyConverters(TypeLiteral.of(String.class)).contains(converter));
+        assertEquals(ctx.getPropertyConverters(TypeLiteral.of(String.class)).size(), 0);
+    }
+
+    @Test
+    public void setPropertyValueCombinationPolicy() throws Exception {
+        PropertyValueCombinationPolicy combPol = new PropertyValueCombinationPolicy(){
+
+            @Override
+            public Map<String, String> collect(Map<String, String> currentValue, String key, PropertySource propertySource) {
+                return currentValue;
+            }
+        };
+        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder()
+                .setPropertyValueCombinationPolicy(combPol);
+        ConfigurationContext ctx = b.build();
+        assertEquals(ctx.getPropertyValueCombinationPolicy(), combPol);
+    }
+
+    @Test
+    public void build() throws Exception {
+        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder();
+        assertNotNull(b.build());
+    }
+
+
+    private static class TestPropertySource implements PropertySource{
+
+        private String id;
+
+        public TestPropertySource(){
+            this(null);
+        }
+
+        public TestPropertySource(String id){
+            this.id = id;
+        }
+
+        @Override
+        public int getOrdinal() {
+            return 200;
+        }
+
+        @Override
+        public String getName() {
+            return id!=null?id:"TestPropertySource";
+        }
+
+        @Override
+        public PropertyValue get(String key) {
+            return PropertyValue.of(key, key + "Value", getName());
+        }
+
+        @Override
+        public Map<String, String> getProperties() {
+            return Collections.emptyMap();
+        }
+
+        @Override
+        public boolean isScannable() {
+            return false;
+        }
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/77dbcc4d/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationContextTest.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationContextTest.java b/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationContextTest.java
new file mode 100644
index 0000000..ac18b32
--- /dev/null
+++ b/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationContextTest.java
@@ -0,0 +1,177 @@
+/*
+ * 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.internal;
+
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.TypeLiteral;
+import org.apache.tamaya.core.testdata.TestPropertyDefaultSource;
+import org.apache.tamaya.spi.*;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Simple tests for {@link DefaultConfigurationContext} by atsticks on 16.08.16.
+ */
+public class DefaultConfigurationContextTest {
+
+    @Test
+    public void addPropertySources() throws Exception {
+        ConfigurationContext ctx = new DefaultConfigurationContextBuilder().build();
+        TestPropertyDefaultSource def = new TestPropertyDefaultSource();
+        assertFalse(ctx.getPropertySources().contains(def));
+        ctx.addPropertySources(def);
+        assertTrue(ctx.getPropertySources().contains(def));
+    }
+
+    @Test
+    public void testToString() throws Exception {
+        String toString = ConfigurationProvider.getConfiguration().getContext().toString();
+        System.out.println(toString);
+    }
+
+    @Test
+    public void getPropertySources() throws Exception {
+        ConfigurationContext ctx = new DefaultConfigurationContextBuilder().build();
+        assertNotNull(ctx.getPropertySources());
+        assertEquals(ctx.getPropertySources().size(), 0);
+        ctx = new DefaultConfigurationContextBuilder().loadDefaultPropertySources().build();
+        assertNotNull(ctx.getPropertySources());
+        assertEquals(8, ctx.getPropertySources().size());
+    }
+
+    @Test
+    public void getPropertySource() throws Exception {
+        TestPropertyDefaultSource ps = new TestPropertyDefaultSource();
+        ConfigurationContext ctx = new DefaultConfigurationContextBuilder()
+                .addPropertySources(ps).build();
+        assertNotNull(ctx.getPropertySources());
+        assertEquals(ctx.getPropertySources().size(), 1);
+        assertNotNull(((DefaultConfigurationContext)ctx).getPropertySource(ps.getName()));
+        assertEquals(ps.getName(), ((DefaultConfigurationContext)ctx).getPropertySource(ps.getName()).getName());
+        assertNull(((DefaultConfigurationContext)ctx).getPropertySource("huhu"));
+
+    }
+
+    @Test
+    public void testHashCode() throws Exception {
+        TestPropertyDefaultSource ps = new TestPropertyDefaultSource();
+        ConfigurationContext ctx1 = new DefaultConfigurationContextBuilder()
+                .addPropertySources(ps).build();
+        ConfigurationContext ctx2 = new DefaultConfigurationContextBuilder()
+                .addPropertySources(ps).build();
+        assertEquals(ctx1.hashCode(), ctx2.hashCode());
+        ctx2 = new DefaultConfigurationContextBuilder()
+                .build();
+        assertNotEquals(ctx1.hashCode(), ctx2.hashCode());
+
+    }
+
+    @Test
+    public void addPropertyConverter() throws Exception {
+        ConfigurationContext ctx = new DefaultConfigurationContextBuilder().build();
+        PropertyConverter testConverter = new PropertyConverter() {
+            @Override
+            public Object convert(String value, ConversionContext context) {
+                return "";
+            }
+        };
+        assertFalse(ctx.getPropertyConverters(TypeLiteral.of(String.class)).contains(testConverter));
+        ctx.addPropertyConverter(TypeLiteral.of(String.class), testConverter);
+        assertTrue(ctx.getPropertyConverters(TypeLiteral.of(String.class)).contains(testConverter));
+    }
+
+    @Test
+    public void getPropertyConverters() throws Exception {
+        ConfigurationContext ctx = new DefaultConfigurationContextBuilder().build();
+        PropertyConverter testConverter = new PropertyConverter() {
+            @Override
+            public Object convert(String value, ConversionContext context) {
+                return "";
+            }
+        };
+        ctx.addPropertyConverter(TypeLiteral.of(String.class), testConverter);
+        assertNotNull(ctx.getPropertyConverters());
+        assertTrue(ctx.getPropertyConverters().containsKey(TypeLiteral.of(String.class)));
+        assertTrue(ctx.getPropertyConverters().get(TypeLiteral.of(String.class)).contains(testConverter));
+        testConverter = new PropertyConverter() {
+            @Override
+            public Object convert(String value, ConversionContext context) {
+                return Integer.valueOf(5);
+            }
+        };
+        ctx.addPropertyConverter(TypeLiteral.of(Integer.class), testConverter);
+        assertTrue(ctx.getPropertyConverters().containsKey(TypeLiteral.of(Integer.class)));
+        assertTrue(ctx.getPropertyConverters().get(TypeLiteral.of(Integer.class)).contains(testConverter));
+    }
+
+    @Test
+    public void getPropertyConverters1() throws Exception {
+        ConfigurationContext ctx = new DefaultConfigurationContextBuilder().build();
+        PropertyConverter testConverter = new PropertyConverter() {
+            @Override
+            public Object convert(String value, ConversionContext context) {
+                return "";
+            }
+        };
+        assertNotNull(ctx.getPropertyConverters(TypeLiteral.of(String.class)));
+        assertEquals(ctx.getPropertyConverters(TypeLiteral.of(String.class)).size(),0);
+        ctx.addPropertyConverter(TypeLiteral.of(String.class), testConverter);
+        assertNotNull(ctx.getPropertyConverters(TypeLiteral.of(String.class)));
+        assertEquals(ctx.getPropertyConverters(TypeLiteral.of(String.class)).size(),1);
+        assertTrue(ctx.getPropertyConverters(TypeLiteral.of(String.class)).contains(testConverter));
+
+    }
+
+    @Test
+    public void getPropertyFilters() throws Exception {
+        ConfigurationContext ctx = new DefaultConfigurationContextBuilder().build();
+        PropertyFilter testFilter = new PropertyFilter() {
+
+            @Override
+            public String filterProperty(String value, FilterContext context) {
+                return value;
+            }
+        };
+        assertNotNull(ctx.getPropertyFilters());
+        assertFalse(ctx.getPropertyFilters().contains(testFilter));
+        ctx = ctx.toBuilder().addPropertyFilters(testFilter).build();
+        assertTrue(ctx.getPropertyFilters().contains(testFilter));
+    }
+
+    @Test
+    public void getPropertyValueCombinationPolicy() throws Exception {
+        ConfigurationContext ctx = new DefaultConfigurationContextBuilder().build();
+        assertNotNull(ctx.getPropertyValueCombinationPolicy());
+        assertEquals(ctx.getPropertyValueCombinationPolicy(),
+                PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_COLLECTOR);
+    }
+
+    @Test
+    public void toBuilder() throws Exception {
+        assertNotNull(new DefaultConfigurationContextBuilder().build().toBuilder());
+    }
+
+    @Test
+    public void testRoundTrip() throws Exception {
+        ConfigurationContext ctx = new DefaultConfigurationContextBuilder().build();
+        assertEquals(ctx.toBuilder().build(), ctx);
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/77dbcc4d/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationProviderTest.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationProviderTest.java b/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationProviderTest.java
new file mode 100644
index 0000000..b5fb80c
--- /dev/null
+++ b/code/core/src/test/java/org/apache/tamaya/core/internal/DefaultConfigurationProviderTest.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.core.internal;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by atsticks on 11.09.16.
+ */
+public class DefaultConfigurationProviderTest {
+
+    @Test
+    public void testInstantiation() throws Exception {
+        new DefaultConfigurationProvider();
+    }
+
+    @Test
+    public void getConfiguration() throws Exception {
+        assertNotNull(new DefaultConfigurationProvider().getConfiguration());
+    }
+
+    @Test
+    public void getConfigurationContext() throws Exception {
+        assertNotNull(new DefaultConfigurationProvider().getConfigurationContext());
+    }
+
+    @Test
+    public void getConfigurationContextBuilder() throws Exception {
+        assertNotNull(new DefaultConfigurationProvider().getConfigurationContextBuilder());
+    }
+
+    @Test
+    public void setConfigurationContext() throws Exception {
+        new DefaultConfigurationProvider()
+                .setConfigurationContext(new DefaultConfigurationProvider().getConfigurationContext());
+    }
+
+    @Test
+    public void isConfigurationContextSettable() throws Exception {
+        assertTrue(new DefaultConfigurationProvider().isConfigurationContextSettable());
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/77dbcc4d/code/core/src/test/java/org/apache/tamaya/core/internal/PriorityServiceComparatorTest.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/internal/PriorityServiceComparatorTest.java b/code/core/src/test/java/org/apache/tamaya/core/internal/PriorityServiceComparatorTest.java
new file mode 100644
index 0000000..e08c8b0
--- /dev/null
+++ b/code/core/src/test/java/org/apache/tamaya/core/internal/PriorityServiceComparatorTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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.internal;
+
+import org.apache.tamaya.core.propertysource.EnvironmentPropertySource;
+import org.apache.tamaya.core.propertysource.SystemPropertySource;
+import org.junit.Test;
+
+import javax.annotation.Priority;
+
+import static org.junit.Assert.*;
+
+/**
+ * Created by atsticks on 12.09.16.
+ */
+public class PriorityServiceComparatorTest {
+
+    private PriorityServiceComparator comp = new PriorityServiceComparator();
+
+    @Test
+    public void compare() throws Exception {
+        assertTrue(comp.compare("a", "b")==0);
+        assertTrue(comp.compare(getClass(), getClass())==0);
+        assertTrue(comp.compare(new A(), new SystemPropertySource())==-1);
+        assertTrue(comp.compare(new SystemPropertySource(), new A())==1);
+    }
+
+    @Priority(100)
+    private static final class A{}
+
+}
\ No newline at end of file


[06/10] incubator-tamaya git commit: TAMAYA-182: Added Null check.

Posted by an...@apache.org.
TAMAYA-182: Added Null check.


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

Branch: refs/heads/master
Commit: 4cfc2d31f02894414f3c3f94f0051592ccaeacb4
Parents: 76963e7
Author: anatole <an...@apache.org>
Authored: Fri Oct 28 00:27:31 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Fri Oct 28 00:27:31 2016 +0200

----------------------------------------------------------------------
 .../tamaya/core/internal/DefaultConfigurationContextBuilder.java | 4 ++--
 .../apache/tamaya/core/propertysource/SimplePropertySource.java  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/4cfc2d31/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java
----------------------------------------------------------------------
diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java
index f3d823e..486fb05 100644
--- a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java
+++ b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContextBuilder.java
@@ -172,7 +172,7 @@ public class DefaultConfigurationContextBuilder implements ConfigurationContextB
         return this;
     }
 
-    public PropertySource getPropertySource(String name) {
+    private PropertySource getPropertySource(String name) {
         for(PropertySource ps:propertySources){
             if(ps.getName().equals(name)){
                 return ps;
@@ -357,7 +357,7 @@ public class DefaultConfigurationContextBuilder implements ConfigurationContextB
     }
 
 
-    protected Map<TypeLiteral, Collection<PropertyConverter>> getDefaultPropertyConverters() {
+    private Map<TypeLiteral, Collection<PropertyConverter>> getDefaultPropertyConverters() {
         Map<TypeLiteral, Collection<PropertyConverter>> result = new HashMap<>();
         for (PropertyConverter conv : ServiceContextManager.getServiceContext().getServices(
                 PropertyConverter.class)) {

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/4cfc2d31/code/core/src/main/java/org/apache/tamaya/core/propertysource/SimplePropertySource.java
----------------------------------------------------------------------
diff --git a/code/core/src/main/java/org/apache/tamaya/core/propertysource/SimplePropertySource.java b/code/core/src/main/java/org/apache/tamaya/core/propertysource/SimplePropertySource.java
index e875d8c..bce68da 100644
--- a/code/core/src/main/java/org/apache/tamaya/core/propertysource/SimplePropertySource.java
+++ b/code/core/src/main/java/org/apache/tamaya/core/propertysource/SimplePropertySource.java
@@ -70,7 +70,7 @@ public class SimplePropertySource extends BasePropertySource {
      */
     public SimplePropertySource(URL propertiesLocation) {
         super(0);
-        this.properties = load(propertiesLocation);
+        this.properties = load(Objects.requireNonNull(propertiesLocation));
         this.name = propertiesLocation.toString();
     }
 


[05/10] incubator-tamaya git commit: TAMAYA-182: Removed unused methods.

Posted by an...@apache.org.
TAMAYA-182: Removed unused methods.


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

Branch: refs/heads/master
Commit: 76963e71cb3b61316b127c8c2591b3998fc98130
Parents: e442b31
Author: anatole <an...@apache.org>
Authored: Sun Oct 23 17:40:12 2016 +0200
Committer: anatole <an...@apache.org>
Committed: Sun Oct 23 17:40:12 2016 +0200

----------------------------------------------------------------------
 .../apache/tamaya/spi/ConfigurationContext.java | 18 ----------------
 .../internal/DefaultConfigurationContext.java   | 22 --------------------
 pom.xml                                         |  2 +-
 3 files changed, 1 insertion(+), 41 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/76963e71/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
----------------------------------------------------------------------
diff --git a/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java b/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
index f631d55..8f15e85 100644
--- a/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
+++ b/code/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
@@ -43,24 +43,6 @@ public interface ConfigurationContext {
     void addPropertySources(PropertySource... propertySources);
 
     /**
-     * This method can be used for programmatically adding {@link PropertyFilter}s.
-     * It is not needed for normal 'usage' by end users, but only for Extension Developers!
-     *
-     * @param propertyFilters the PropertyFilters to add
-     * @deprecated Use {@link ConfigurationContextBuilder} to create a new {@link ConfigurationContext}.
-     * @see #toBuilder()
-     */
-    @Deprecated
-    void addPropertyFilter(PropertyFilter... propertyFilters);
-
-    /**
-     * Allows to check if a given property source is registered, using its name.
-     * @param name the property source name.
-     * @return true, if a property source with the given name is present.
-     */
-    boolean containsPropertySource(String name);
-
-    /**
      * This method returns the current list of registered PropertySources ordered via their ordinal.
      * PropertySources with a lower ordinal come last. The PropertySource with the
      * highest ordinal comes first.

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/76963e71/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
----------------------------------------------------------------------
diff --git a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
index 15c6147..29be92f 100644
--- a/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
+++ b/code/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
@@ -123,28 +123,6 @@ public class DefaultConfigurationContext implements ConfigurationContext {
         }
     }
 
-
-    @Deprecated
-    @Override
-    public void addPropertyFilter(PropertyFilter... propertyFiltersToAdd) {
-        Lock writeLock = propertyFilterLock.writeLock();
-        try {
-            writeLock.lock();
-            List<PropertyFilter> newPropertyFilters = new ArrayList<>(this.immutablePropertyFilters);
-            newPropertyFilters.addAll(Arrays.asList(propertyFiltersToAdd));
-            Collections.sort(newPropertyFilters, new PropertyFilterComparator());
-
-            this.immutablePropertyFilters = Collections.unmodifiableList(newPropertyFilters);
-        } finally {
-            writeLock.unlock();
-        }
-    }
-
-    @Override
-    public boolean containsPropertySource(String name) {
-        return getPropertySource(name)!=null;
-    }
-
     @Override
     public boolean equals(Object o) {
         if (this == o) return true;

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/76963e71/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ccc0c5f..4c2f975 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@ under the License.
     <version>0.3-incubating-SNAPSHOT</version>
     <packaging>pom</packaging>
 
-    <name>Apache Tamaya</name>
+    <name>Apache Tamaya Base</name>
     <description>Apache Tamaya - Java Configuration</description>
     <url>https://tamaya.incubator.apache.org</url>
     <inceptionYear>2014</inceptionYear>