tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anat...@apache.org
Subject [15/22] incubator-tamaya git commit: TAMAYA-274/353 Added revapi reports to control/report backward compatibility breaks. Removed deprecated artifacts (ConfigurationContextBuilder) and implementations/deps. TAMAYA-355 Removed PropertyValueC
Date Sun, 18 Nov 2018 21:21:19 GMT
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/606f8ec6/code/spi-support/src/main/java/org/apache/tamaya/spisupport/DefaultConfigurationContextBuilder.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/DefaultConfigurationContextBuilder.java b/code/spi-support/src/main/java/org/apache/tamaya/spisupport/DefaultConfigurationContextBuilder.java
index f7b4fb1..368a2c4 100644
--- a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/DefaultConfigurationContextBuilder.java
+++ b/code/spi-support/src/main/java/org/apache/tamaya/spisupport/DefaultConfigurationContextBuilder.java
@@ -1,478 +1,478 @@
-/*
- * 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.spisupport;
-
-import org.apache.tamaya.TypeLiteral;
-import org.apache.tamaya.spi.*;
-import org.apache.tamaya.spisupport.propertysource.CLIPropertySource;
-import org.apache.tamaya.spisupport.propertysource.EnvironmentPropertySource;
-import org.apache.tamaya.spisupport.propertysource.JavaConfigurationPropertySource;
-import org.apache.tamaya.spisupport.propertysource.SystemPropertySource;
-
-import java.io.File;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.net.URI;
-import java.net.URL;
-import java.nio.file.Path;
-import java.util.*;
-import java.util.logging.Logger;
-
-/**
- * Default implementation of {@link ConfigurationContextBuilder}.
- */
-@Deprecated
-public class DefaultConfigurationContextBuilder implements ConfigurationContextBuilder {
-
-    private static final Logger LOG = Logger.getLogger(DefaultConfigurationContextBuilder.class.getName());
-
-    protected ServiceContext serviceContext = ServiceContextManager.getServiceContext();
-    protected List<PropertyFilter> propertyFilters = new ArrayList<>();
-    protected List<PropertySource> propertySources = new ArrayList<>();
-    protected MetadataProvider metaDataProvider = serviceContext.create(MetadataProvider.class, () -> new DefaultMetaDataProvider());
-    protected PropertyValueCombinationPolicy combinationPolicy = PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_POLICY;
-    protected Map<TypeLiteral<?>, Collection<PropertyConverter<?>>> propertyConverters = new HashMap<>();
-
-    /**
-     * Flag if the config has already been built.
-     * Configuration can be built only once
-     */
-    private boolean built;
-
-
-
-    /**
-     * Creates a new builder instance.
-     */
-    public DefaultConfigurationContextBuilder() {
-    }
-
-    /**
-     * Creates a new builder instance initializing it with the given context.
-     * @param context the context to be used, not null.
-     */
-    public DefaultConfigurationContextBuilder(ConfigurationContext context) {
-        this.propertyConverters.putAll(context.getPropertyConverters());
-        this.propertyFilters.addAll(context.getPropertyFilters());
-        for(PropertySource ps:context.getPropertySources()) {
-            addPropertySources(ps);
-        }
-        this.combinationPolicy = context.getPropertyValueCombinationPolicy();
-    }
-
-    /**
-     * Allows to reset configuration context during unit tests.
-     * @param configurationContext the context to be used, not null.
-     * @return the builder for chaining
-     */
-    public final ConfigurationContextBuilder resetWithConfigurationContext(ConfigurationContext configurationContext) {
-        checkBuilderState();
-        //noinspection deprecation
-        this.propertyFilters.clear();
-        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 setServiceContext(ServiceContext serviceContext) {
-        checkBuilderState();
-        this.serviceContext = Objects.requireNonNull(serviceContext);
-        return this;
-    }
-
-    @Override
-    public ConfigurationContextBuilder setClassLoader(ClassLoader classLoader) {
-        checkBuilderState();
-        this.serviceContext = Objects.requireNonNull(serviceContext);
-        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 addMetaData(Map<String, String> metaData) {
-        this.metaDataProvider.setMeta(metaData);
-        return this;
-    }
-
-    @Override
-    public ConfigurationContextBuilder addMetaData(String key, String value) {
-        this.metaDataProvider.setMeta(key, value);
-        return this;
-    }
-
-    @Override
-    public final 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;
-    }
-
-    @Override
-    public ConfigurationContextBuilder addDefaultPropertySources() {
-        checkBuilderState();
-        List<PropertySource> propertySources = new ArrayList<>();
-        addCorePropertyResources(propertySources);
-        for(PropertySource ps: serviceContext.getServices(PropertySource.class)) {
-            if(!propertySources.contains(ps)){
-                propertySources.add(ps);
-            }
-        }
-        for(PropertySourceProvider provider:
-                serviceContext.getServices(PropertySourceProvider.class)){
-                propertySources.addAll(provider.getPropertySources());
-        }
-        Collections.sort(propertySources, PropertySourceComparator.getInstance());
-        return addPropertySources(propertySources);
-    }
-
-    protected void addCorePropertyResources(List<PropertySource> propertySources) {
-        JavaConfigurationPropertySource jps = new JavaConfigurationPropertySource();
-        jps.init(getServiceContext().getClassLoader());
-        for(PropertySource ps: new PropertySource[]{
-                new EnvironmentPropertySource(),
-                jps,
-                new CLIPropertySource(),
-                new SystemPropertySource()
-        }){
-            if(!propertySources.contains(ps)){
-                propertySources.add(ps);
-            }
-        }
-    }
-
-    @Override
-    public ConfigurationContextBuilder addDefaultPropertyFilters() {
-        checkBuilderState();
-        for(PropertyFilter pf:serviceContext.getServices(PropertyFilter.class)){
-            addPropertyFilters(pf);
-        }
-        return this;
-    }
-
-    @Override
-    public DefaultConfigurationContextBuilder addDefaultPropertyConverters() {
-        checkBuilderState();
-        addCorePropertyConverters();
-        for(Map.Entry<TypeLiteral, Collection<PropertyConverter>> en:getDefaultPropertyConverters().entrySet()){
-            for(PropertyConverter pc: en.getValue()) {
-                addPropertyConverters(en.getKey(), pc);
-            }
-        }
-        return this;
-    }
-
-    @SuppressWarnings("unchecked")
-	protected void addCorePropertyConverters() {
-        // should be overridden by subclasses.
-    }
-
-    @Override
-    public final ConfigurationContextBuilder removePropertySources(PropertySource... propertySources) {
-        return removePropertySources(Arrays.asList(propertySources));
-    }
-
-    @Override
-    public ConfigurationContextBuilder removePropertySources(Collection<PropertySource> propertySources) {
-        checkBuilderState();
-        this.propertySources.removeAll(propertySources);
-        return this;
-    }
-
-    protected 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 Collections.unmodifiableList(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 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 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 final ConfigurationContextBuilder addPropertyFilters(PropertyFilter... filters){
-        return addPropertyFilters(Arrays.asList(filters));
-    }
-
-    @Override
-    public final ConfigurationContextBuilder addPropertyFilters(Collection<PropertyFilter> filters){
-        checkBuilderState();
-        for(PropertyFilter f:filters) {
-            if (!this.propertyFilters.contains(f)) {
-                this.propertyFilters.add(f);
-            }
-        }
-        return this;
-    }
-
-    @Override
-    public final ConfigurationContextBuilder removePropertyFilters(PropertyFilter... filters) {
-        return removePropertyFilters(Arrays.asList(filters));
-    }
-
-    @Override
-    public final ConfigurationContextBuilder removePropertyFilters(Collection<PropertyFilter> filters) {
-        checkBuilderState();
-        this.propertyFilters.removeAll(filters);
-        return this;
-    }
-
-
-    @Override
-    public final <T> ConfigurationContextBuilder removePropertyConverters(TypeLiteral<T> typeToConvert,
-                                                                    @SuppressWarnings("unchecked") PropertyConverter<T>... converters) {
-        return removePropertyConverters(typeToConvert, Arrays.asList(converters));
-    }
-
-    @Override
-    public final <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 final ConfigurationContextBuilder removePropertyConverters(TypeLiteral<?> typeToConvert) {
-        this.propertyConverters.remove(typeToConvert);
-        return this;
-    }
-
-
-    @Override
-    public final 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 <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;
-    }
-
-    protected ConfigurationContextBuilder loadDefaults() {
-        checkBuilderState();
-        this.combinationPolicy = PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_COLLECTOR;
-        addDefaultPropertySources();
-        addDefaultPropertyFilters();
-        addDefaultPropertyConverters();
-        return this;
-    }
-
-
-    protected Map<TypeLiteral, Collection<PropertyConverter>> getDefaultPropertyConverters() {
-        Map<TypeLiteral, Collection<PropertyConverter>> result = new HashMap<>();
-        for (PropertyConverter conv : serviceContext.getServices(
-                PropertyConverter.class)) {
-            for(Type type:conv.getClass().getGenericInterfaces()){
-                if(type instanceof ParameterizedType){
-                    ParameterizedType pt = (ParameterizedType)type;
-                    if(PropertyConverter.class.equals(((ParameterizedType) type).getRawType())){
-                        TypeLiteral target = TypeLiteral.of(pt.getActualTypeArguments()[0]);
-                        Collection<PropertyConverter> convList = result.get(target);
-                        if (convList == null) {
-                            convList = new ArrayList<>();
-                            result.put(target, convList);
-                        }
-                        convList.add(conv);
-                    }
-                }
-            }
-        }
-        return result;
-    }
-
-    @Override
-    public ServiceContext getServiceContext() {
-        return serviceContext;
-    }
-
-
-    /**
-     * Builds a new configuration based on the configuration of this builder instance.
-     *
-     * @return a new {@link org.apache.tamaya.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);
-    }
-
-    public MetadataProvider getMetaDataProvider() {
-        return metaDataProvider;
-    }
-}
+///*
+// * 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.spisupport;
+//
+//import org.apache.tamaya.TypeLiteral;
+//import org.apache.tamaya.spi.*;
+//import org.apache.tamaya.spisupport.propertysource.CLIPropertySource;
+//import org.apache.tamaya.spisupport.propertysource.EnvironmentPropertySource;
+//import org.apache.tamaya.spisupport.propertysource.JavaConfigurationPropertySource;
+//import org.apache.tamaya.spisupport.propertysource.SystemPropertySource;
+//
+//import java.io.File;
+//import java.lang.reflect.ParameterizedType;
+//import java.lang.reflect.Type;
+//import java.math.BigDecimal;
+//import java.math.BigInteger;
+//import java.net.URI;
+//import java.net.URL;
+//import java.nio.file.Path;
+//import java.util.*;
+//import java.util.logging.Logger;
+//
+///**
+// * Default implementation of {@link ConfigurationContextBuilder}.
+// */
+//@Deprecated
+//public class DefaultConfigurationContextBuilder implements ConfigurationContextBuilder {
+//
+//    private static final Logger LOG = Logger.getLogger(DefaultConfigurationContextBuilder.class.getName());
+//
+//    protected ServiceContext serviceContext = ServiceContextManager.getServiceContext();
+//    protected List<PropertyFilter> propertyFilters = new ArrayList<>();
+//    protected List<PropertySource> propertySources = new ArrayList<>();
+//    protected MetadataProvider metaDataProvider = serviceContext.create(MetadataProvider.class, () -> new DefaultMetaDataProvider());
+//    protected PropertyValueCombinationPolicy combinationPolicy = PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_POLICY;
+//    protected Map<TypeLiteral<?>, Collection<PropertyConverter<?>>> propertyConverters = new HashMap<>();
+//
+//    /**
+//     * Flag if the config has already been built.
+//     * Configuration can be built only once
+//     */
+//    private boolean built;
+//
+//
+//
+//    /**
+//     * Creates a new builder instance.
+//     */
+//    public DefaultConfigurationContextBuilder() {
+//    }
+//
+//    /**
+//     * Creates a new builder instance initializing it with the given context.
+//     * @param context the context to be used, not null.
+//     */
+//    public DefaultConfigurationContextBuilder(ConfigurationContext context) {
+//        this.propertyConverters.putAll(context.getPropertyConverters());
+//        this.propertyFilters.addAll(context.getPropertyFilters());
+//        for(PropertySource ps:context.getPropertySources()) {
+//            addPropertySources(ps);
+//        }
+//        this.combinationPolicy = context.getPropertyValueCombinationPolicy();
+//    }
+//
+//    /**
+//     * Allows to reset configuration context during unit tests.
+//     * @param configurationContext the context to be used, not null.
+//     * @return the builder for chaining
+//     */
+//    public final ConfigurationContextBuilder resetWithConfigurationContext(ConfigurationContext configurationContext) {
+//        checkBuilderState();
+//        //noinspection deprecation
+//        this.propertyFilters.clear();
+//        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 setServiceContext(ServiceContext serviceContext) {
+//        checkBuilderState();
+//        this.serviceContext = Objects.requireNonNull(serviceContext);
+//        return this;
+//    }
+//
+//    @Override
+//    public ConfigurationContextBuilder setClassLoader(ClassLoader classLoader) {
+//        checkBuilderState();
+//        this.serviceContext = Objects.requireNonNull(serviceContext);
+//        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 addMetaData(Map<String, String> metaData) {
+//        this.metaDataProvider.setMeta(metaData);
+//        return this;
+//    }
+//
+//    @Override
+//    public ConfigurationContextBuilder addMetaData(String key, String value) {
+//        this.metaDataProvider.setMeta(key, value);
+//        return this;
+//    }
+//
+//    @Override
+//    public final 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;
+//    }
+//
+//    @Override
+//    public ConfigurationContextBuilder addDefaultPropertySources() {
+//        checkBuilderState();
+//        List<PropertySource> propertySources = new ArrayList<>();
+//        addCorePropertyResources(propertySources);
+//        for(PropertySource ps: serviceContext.getServices(PropertySource.class)) {
+//            if(!propertySources.contains(ps)){
+//                propertySources.add(ps);
+//            }
+//        }
+//        for(PropertySourceProvider provider:
+//                serviceContext.getServices(PropertySourceProvider.class)){
+//                propertySources.addAll(provider.getPropertySources());
+//        }
+//        Collections.sort(propertySources, PropertySourceComparator.getInstance());
+//        return addPropertySources(propertySources);
+//    }
+//
+//    protected void addCorePropertyResources(List<PropertySource> propertySources) {
+//        JavaConfigurationPropertySource jps = new JavaConfigurationPropertySource();
+//        jps.init(getServiceContext().getClassLoader());
+//        for(PropertySource ps: new PropertySource[]{
+//                new EnvironmentPropertySource(),
+//                jps,
+//                new CLIPropertySource(),
+//                new SystemPropertySource()
+//        }){
+//            if(!propertySources.contains(ps)){
+//                propertySources.add(ps);
+//            }
+//        }
+//    }
+//
+//    @Override
+//    public ConfigurationContextBuilder addDefaultPropertyFilters() {
+//        checkBuilderState();
+//        for(PropertyFilter pf:serviceContext.getServices(PropertyFilter.class)){
+//            addPropertyFilters(pf);
+//        }
+//        return this;
+//    }
+//
+//    @Override
+//    public DefaultConfigurationContextBuilder addDefaultPropertyConverters() {
+//        checkBuilderState();
+//        addCorePropertyConverters();
+//        for(Map.Entry<TypeLiteral, Collection<PropertyConverter>> en:getDefaultPropertyConverters().entrySet()){
+//            for(PropertyConverter pc: en.getValue()) {
+//                addPropertyConverters(en.getKey(), pc);
+//            }
+//        }
+//        return this;
+//    }
+//
+//    @SuppressWarnings("unchecked")
+//	protected void addCorePropertyConverters() {
+//        // should be overridden by subclasses.
+//    }
+//
+//    @Override
+//    public final ConfigurationContextBuilder removePropertySources(PropertySource... propertySources) {
+//        return removePropertySources(Arrays.asList(propertySources));
+//    }
+//
+//    @Override
+//    public ConfigurationContextBuilder removePropertySources(Collection<PropertySource> propertySources) {
+//        checkBuilderState();
+//        this.propertySources.removeAll(propertySources);
+//        return this;
+//    }
+//
+//    protected 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 Collections.unmodifiableList(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 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 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 final ConfigurationContextBuilder addPropertyFilters(PropertyFilter... filters){
+//        return addPropertyFilters(Arrays.asList(filters));
+//    }
+//
+//    @Override
+//    public final ConfigurationContextBuilder addPropertyFilters(Collection<PropertyFilter> filters){
+//        checkBuilderState();
+//        for(PropertyFilter f:filters) {
+//            if (!this.propertyFilters.contains(f)) {
+//                this.propertyFilters.add(f);
+//            }
+//        }
+//        return this;
+//    }
+//
+//    @Override
+//    public final ConfigurationContextBuilder removePropertyFilters(PropertyFilter... filters) {
+//        return removePropertyFilters(Arrays.asList(filters));
+//    }
+//
+//    @Override
+//    public final ConfigurationContextBuilder removePropertyFilters(Collection<PropertyFilter> filters) {
+//        checkBuilderState();
+//        this.propertyFilters.removeAll(filters);
+//        return this;
+//    }
+//
+//
+//    @Override
+//    public final <T> ConfigurationContextBuilder removePropertyConverters(TypeLiteral<T> typeToConvert,
+//                                                                    @SuppressWarnings("unchecked") PropertyConverter<T>... converters) {
+//        return removePropertyConverters(typeToConvert, Arrays.asList(converters));
+//    }
+//
+//    @Override
+//    public final <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 final ConfigurationContextBuilder removePropertyConverters(TypeLiteral<?> typeToConvert) {
+//        this.propertyConverters.remove(typeToConvert);
+//        return this;
+//    }
+//
+//
+//    @Override
+//    public final 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 <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;
+//    }
+//
+//    protected ConfigurationContextBuilder loadDefaults() {
+//        checkBuilderState();
+//        this.combinationPolicy = PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_COLLECTOR;
+//        addDefaultPropertySources();
+//        addDefaultPropertyFilters();
+//        addDefaultPropertyConverters();
+//        return this;
+//    }
+//
+//
+//    protected Map<TypeLiteral, Collection<PropertyConverter>> getDefaultPropertyConverters() {
+//        Map<TypeLiteral, Collection<PropertyConverter>> result = new HashMap<>();
+//        for (PropertyConverter conv : serviceContext.getServices(
+//                PropertyConverter.class)) {
+//            for(Type type:conv.getClass().getGenericInterfaces()){
+//                if(type instanceof ParameterizedType){
+//                    ParameterizedType pt = (ParameterizedType)type;
+//                    if(PropertyConverter.class.equals(((ParameterizedType) type).getRawType())){
+//                        TypeLiteral target = TypeLiteral.of(pt.getActualTypeArguments()[0]);
+//                        Collection<PropertyConverter> convList = result.get(target);
+//                        if (convList == null) {
+//                            convList = new ArrayList<>();
+//                            result.put(target, convList);
+//                        }
+//                        convList.add(conv);
+//                    }
+//                }
+//            }
+//        }
+//        return result;
+//    }
+//
+//    @Override
+//    public ServiceContext getServiceContext() {
+//        return serviceContext;
+//    }
+//
+//
+//    /**
+//     * Builds a new configuration based on the configuration of this builder instance.
+//     *
+//     * @return a new {@link org.apache.tamaya.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);
+//    }
+//
+//    public MetadataProvider getMetaDataProvider() {
+//        return metaDataProvider;
+//    }
+//}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/606f8ec6/code/spi-support/src/main/java/org/apache/tamaya/spisupport/MetadataProvider.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/MetadataProvider.java b/code/spi-support/src/main/java/org/apache/tamaya/spisupport/MetadataProvider.java
index 24e28ef..b5040fa 100644
--- a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/MetadataProvider.java
+++ b/code/spi-support/src/main/java/org/apache/tamaya/spisupport/MetadataProvider.java
@@ -40,7 +40,7 @@ public interface MetadataProvider {
 
     /**
      * Access the current metadata for the given configuration context. The MetaData will be
-     * accessible from {@link ConfigurationContext#getMetadata()}. Note that the metadata must not
+     * accessible from {@link ConfigurationContext#getMetaData()}. Note that the metadata must not
      * to be cached by it's consumers, so caching/optimazitation is delegated to this implementation.
      * @return the (immutable) metadata of this configuration context.
      */

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/606f8ec6/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationBuilderTest.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationBuilderTest.java b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationBuilderTest.java
index 9c553bb..a4487e7 100644
--- a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationBuilderTest.java
+++ b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationBuilderTest.java
@@ -373,16 +373,6 @@ public class DefaultConfigurationBuilderTest {
     }
 
     @Test
-    public void setPropertyValueCombinationPolicy() throws Exception {
-        PropertyValueCombinationPolicy combPol = (currentValue, key, propertySource) -> currentValue;
-        ConfigurationBuilder b = new DefaultConfigurationBuilder()
-                .setPropertyValueCombinationPolicy(combPol);
-        Configuration cfg = b.build();
-        ConfigurationContext ctx = cfg.getContext();
-        assertThat(combPol).isEqualTo(ctx.getPropertyValueCombinationPolicy());
-    }
-
-    @Test
     public void build() throws Exception {
         assertThat(new DefaultConfigurationBuilder().build()).isNotNull();
     }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/606f8ec6/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationContextBuilderTest.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationContextBuilderTest.java b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationContextBuilderTest.java
deleted file mode 100644
index 9d04350..0000000
--- a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationContextBuilderTest.java
+++ /dev/null
@@ -1,671 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.spisupport;
-
-import org.apache.tamaya.spi.*;
-
-import static org.assertj.core.api.Assertions.*;
-
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.TypeLiteral;
-import org.junit.Test;
-
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- *
- * @author William.Lieurance 2018.02.17
- *
- * This class is an almost exact copy of
- * com.tamaya.core.internal.CoreConfigurationBuilderTest, which itself uses
- * DefaultConfigurationContextBuilder under the covers.
- *
- */
-public class DefaultConfigurationContextBuilderTest {
-
-    private MockedPropertySource testPropertySource = new MockedPropertySource() {
-    };
-
-    @Test
-    public void setContext() throws Exception {
-        ConfigurationContext context = ConfigurationProvider.getConfiguration().getContext();
-        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder()
-                .setContext(context);
-        assertThat(b.build()).isEqualTo(context);
-        boolean caughtAlreadyBuilt = false;
-        try {
-            b.setContext(context);
-        } catch (IllegalStateException e) {
-            caughtAlreadyBuilt = true;
-        }
-        assertThat(caughtAlreadyBuilt).isTrue();
-        b = new DefaultConfigurationContextBuilder(context);
-        assertThat(b.build()).isEqualTo(context);
-    }
-
-    @Test
-    public void addPropertySources_Array() throws Exception {
-        PropertySource testPS2 = new MockedPropertySource("addPropertySources_Array", 1);
-        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder()
-                .addPropertySources(testPropertySource, testPS2);
-        ConfigurationContext ctx = b.build();
-        assertThat(ctx.getPropertySources()).hasSize(2);
-        assertThat(ctx.getPropertySources().contains(testPropertySource)).isTrue();
-        assertThat(((DefaultConfigurationContextBuilder)b).getPropertySource(testPropertySource.getName())).isNotNull();
-        assertThat(ctx.getPropertySources().contains(testPS2)).isTrue();
-        assertThat(((DefaultConfigurationContextBuilder)b).getPropertySource(testPS2.getName())).isNotNull();
-        // Ensure no sorting happens during add, so switch ordinals!
-        testPS2 = new MockedPropertySource("addPropertySources_Array", 1);
-        b = new DefaultConfigurationContextBuilder();
-        ctx = b.addPropertySources(testPS2, testPropertySource).build();
-        assertThat(ctx.getPropertySources()).hasSize(2);
-        assertThat(ctx.getPropertySources().contains(testPropertySource)).isTrue();
-        assertThat(((DefaultConfigurationContextBuilder)b).getPropertySource(testPropertySource.getName())).isNotNull();
-        assertThat(ctx.getPropertySources().contains(testPS2)).isTrue();
-        assertThat(((DefaultConfigurationContextBuilder)b).getPropertySource(testPS2.getName())).isNotNull();
-        assertThat("MockedPropertySource").isEqualTo(ctx.getPropertySources().get(1).getName());
-        assertThat("addPropertySources_Array").isEqualTo(ctx.getPropertySources().get(0).getName());
-    }
-
-    @Test
-    public void addPropertySources_Collection() throws Exception {
-        PropertySource testPS2 = new MockedPropertySource("addPropertySources_Collection", 1);
-        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder()
-                .addPropertySources(Arrays.asList(new PropertySource[]{testPropertySource, testPS2}));
-        ConfigurationContext ctx = b.build();
-        assertThat(ctx.getPropertySources()).hasSize(2);
-        assertThat(ctx.getPropertySources().contains(testPropertySource)).isTrue();
-        assertThat(((DefaultConfigurationContextBuilder)b).getPropertySource(testPropertySource.getName())).isNotNull();
-        assertThat(ctx.getPropertySources().contains(testPS2)).isTrue();
-        assertThat(((DefaultConfigurationContextBuilder)b).getPropertySource(testPS2.getName())).isNotNull();
-        assertThat("MockedPropertySource").isEqualTo(ctx.getPropertySources().get(0).getName());
-        assertThat("addPropertySources_Collection").isEqualTo(ctx.getPropertySources().get(1).getName());
-        // Ensure no sorting happens during add, so switch ordinals!
-        testPS2 = new MockedPropertySource("addPropertySources_Collection", 1);
-        ctx = new DefaultConfigurationContextBuilder()
-                .addPropertySources(Arrays.asList(new PropertySource[]{testPS2, testPropertySource})).build();
-        assertThat(ctx.getPropertySources()).hasSize(2);
-        assertThat(ctx.getPropertySources().contains(testPropertySource)).isTrue();
-        assertThat(((DefaultConfigurationContextBuilder)b).getPropertySource(testPropertySource.getName())).isNotNull();
-        assertThat(ctx.getPropertySources().contains(testPS2)).isTrue();
-        assertThat(((DefaultConfigurationContextBuilder)b).getPropertySource(testPS2.getName())).isNotNull();
-        assertThat("MockedPropertySource").isEqualTo(ctx.getPropertySources().get(1).getName());
-        assertThat("addPropertySources_Collection").isEqualTo(ctx.getPropertySources().get(0).getName());
-    }
-
-    @Test
-    public void removePropertySources_Array() throws Exception {
-        PropertySource testPS2 = new MockedPropertySource("removePropertySources_Array", 1);
-        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder()
-                .addPropertySources(testPropertySource, testPS2);
-        ConfigurationContext ctx = b.build();
-        assertThat(ctx.getPropertySources()).hasSize(2);
-        assertThat(ctx.getPropertySources().contains(testPropertySource)).isTrue();
-        assertThat(((DefaultConfigurationContextBuilder)b).getPropertySource(testPropertySource.getName())).isNotNull();
-        assertThat(ctx.getPropertySources().contains(testPS2)).isTrue();
-        assertThat(((DefaultConfigurationContextBuilder)b).getPropertySource(testPS2.getName())).isNotNull();
-        b = new DefaultConfigurationContextBuilder()
-                .addPropertySources(testPropertySource, testPS2);
-        ctx = b.removePropertySources(testPropertySource).build();
-        assertThat(ctx.getPropertySources().contains(testPropertySource)).isFalse();
-        //Throws an exception
-        //assertThat(((DefaultConfigurationContextBuilder)b).getPropertySource(testPropertySource.getName())).isNull();
-        assertThat(ctx.getPropertySources().contains(testPS2)).isTrue();
-        assertThat(((DefaultConfigurationContextBuilder)b).getPropertySource(testPS2.getName())).isNotNull();
-        assertThat(ctx.getPropertySources()).hasSize(1);
-    }
-
-    @Test
-    public void removePropertySources_Collection() throws Exception {
-        PropertySource testPS2 = new MockedPropertySource("removePropertySources_Array", 1);
-        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder()
-                .addPropertySources(testPropertySource, testPS2);
-        ConfigurationContext ctx = b.build();
-        assertThat(ctx.getPropertySources()).hasSize(2);
-        assertThat(ctx.getPropertySources().contains(testPropertySource)).isTrue();
-        assertThat(((DefaultConfigurationContextBuilder)b).getPropertySource(testPropertySource.getName())).isNotNull();
-        assertThat(ctx.getPropertySources().contains(testPS2)).isTrue();
-        assertThat(ctx.getPropertySource(testPS2.getName())).isNotNull();
-        b = new DefaultConfigurationContextBuilder()
-                .addPropertySources(testPropertySource, testPS2);
-        ctx = b.removePropertySources(testPropertySource).build();
-        assertThat(ctx.getPropertySources()).hasSize(1);
-        assertThat(ctx.getPropertySources().contains(testPropertySource)).isFalse();
-        assertThat(ctx.getPropertySources().contains(testPS2)).isTrue();
-        assertThat(ctx.getPropertySource(testPS2.getName())).isNotNull();
-    }
-    
-    @Test(expected = IllegalArgumentException.class)
-    public void missingPropertySource() throws Exception {
-        PropertySource testPS2 = new MockedPropertySource("removePropertySources_Array", 1);
-        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder()
-                .addPropertySources(testPropertySource, testPS2);
-        assertThat(((DefaultConfigurationContextBuilder)b).getPropertySource("missing")).isNull();
-    }
-
-    @Test
-    public void addPropertyFilters_Array() throws Exception {
-        PropertyFilter filter1 = (value, ctx) -> value;
-        PropertyFilter filter2 = (value, ctx) -> value;
-        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder();
-        b.addPropertyFilters(filter1, filter2);
-        ConfigurationContext ctx = b.build();
-        boolean caughtAlreadyBuilt = false;
-        try {
-            b.addPropertyFilters(filter1, filter2);
-        } catch (IllegalStateException e) {
-            caughtAlreadyBuilt = true;
-        }
-        assertThat(caughtAlreadyBuilt).isTrue();
-        assertThat(ctx.getPropertyFilters().contains(filter1)).isTrue();
-        assertThat(ctx.getPropertyFilters().contains(filter2)).isTrue();
-        assertThat(ctx.getPropertyFilters()).hasSize(2);
-        b = new DefaultConfigurationContextBuilder();
-        b.addPropertyFilters(filter1, filter2);
-        b.addPropertyFilters(filter1, filter2);
-        assertThat(ctx.getPropertyFilters()).hasSize(2);
-    }
-
-    @Test
-    public void addPropertyFilters_Collection() throws Exception {
-        PropertyFilter filter1 = (value, ctx) -> value;
-        PropertyFilter filter2 = (value, ctx) -> value;
-        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder();
-        b.addPropertyFilters(Arrays.asList(new PropertyFilter[]{filter1, filter2}));
-        ConfigurationContext ctx = b.build();
-        boolean caughtAlreadyBuilt = false;
-        try {
-            b.addPropertyFilters(Arrays.asList(new PropertyFilter[]{filter1, filter2}));
-        } catch (IllegalStateException e) {
-            caughtAlreadyBuilt = true;
-        }
-        assertThat(caughtAlreadyBuilt).isTrue();
-        assertThat(ctx.getPropertyFilters().contains(filter1)).isTrue();
-        assertThat(ctx.getPropertyFilters().contains(filter2)).isTrue();
-        assertThat(ctx.getPropertyFilters()).hasSize(2);
-        b = new DefaultConfigurationContextBuilder();
-        b.addPropertyFilters(filter1, filter2);
-        b.addPropertyFilters(filter1, filter2);
-        assertThat(ctx.getPropertyFilters()).hasSize(2);
-    }
-
-    @Test
-    public void removePropertyFilters_Array() throws Exception {
-        PropertyFilter filter1 = (value, ctx) -> value;
-        PropertyFilter filter2 = (value, ctx) -> value;
-        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder()
-                .addPropertyFilters(filter1, filter2);
-        ConfigurationContext ctx = b.build();
-        assertThat(ctx.getPropertyFilters().contains(filter1)).isTrue();
-        assertThat(ctx.getPropertyFilters().contains(filter2)).isTrue();
-        assertThat(ctx.getPropertyFilters()).hasSize(2);
-        b = new DefaultConfigurationContextBuilder()
-                .addPropertyFilters(filter1, filter2);
-        ctx = b.removePropertyFilters(filter1).build();
-        assertThat(ctx.getPropertyFilters()).hasSize(1);
-        assertThat(ctx.getPropertyFilters().contains(filter1)).isFalse();
-        assertThat(ctx.getPropertyFilters().contains(filter2)).isTrue();
-        boolean caughtAlreadyBuilt = false;
-        try {
-            b.removePropertyFilters(filter1);
-        } catch (IllegalStateException e) {
-            caughtAlreadyBuilt = true;
-        }
-        assertThat(caughtAlreadyBuilt).isTrue();
-    }
-
-    @Test
-    public void removePropertyFilters_Collection() throws Exception {
-        PropertyFilter filter1 = (value, ctx) -> value;
-        PropertyFilter filter2 = (value, ctx) -> value;
-        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder()
-                .addPropertyFilters(Arrays.asList(new PropertyFilter[]{filter1, filter2}));
-        ConfigurationContext ctx = b.build();
-        assertThat(ctx.getPropertyFilters().contains(filter1)).isTrue();
-        assertThat(ctx.getPropertyFilters().contains(filter2)).isTrue();
-        assertThat(ctx.getPropertyFilters()).hasSize(2);
-        b = new DefaultConfigurationContextBuilder()
-                .addPropertyFilters(Arrays.asList(new PropertyFilter[]{filter1, filter2}));
-        ctx = b.removePropertyFilters(Arrays.asList(filter1)).build();
-        assertThat(ctx.getPropertyFilters()).hasSize(1);
-        assertThat(ctx.getPropertyFilters().contains(filter1)).isFalse();
-        assertThat(ctx.getPropertyFilters().contains(filter2)).isTrue();
-        boolean caughtAlreadyBuilt = false;
-        try {
-            b.removePropertyFilters(filter1);
-        } catch (IllegalStateException e) {
-            caughtAlreadyBuilt = true;
-        }
-        assertThat(caughtAlreadyBuilt).isTrue();
-    }
-
-    @Test
-    @SuppressWarnings({"rawtypes", "unchecked"})
-    public void addPropertyConverters_Array() throws Exception {
-        PropertyConverter converter = (value, ctx) -> value.toLowerCase();
-        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder()
-                .addPropertyConverters(TypeLiteral.of(String.class), converter);
-        ConfigurationContext ctx = b.build();
-        boolean caughtAlreadyBuilt = false;
-        try {
-            b.addPropertyConverters(TypeLiteral.of(String.class), converter);
-        } catch (IllegalStateException e) {
-            caughtAlreadyBuilt = true;
-        }
-        assertThat(caughtAlreadyBuilt).isTrue();
-        assertThat(ctx.getPropertyConverters(TypeLiteral.of(String.class)).contains(converter)).isTrue();
-        assertThat(ctx.getPropertyConverters()).hasSize(1);
-        b = new DefaultConfigurationContextBuilder()
-                .addPropertyConverters(TypeLiteral.of(String.class), converter);
-        b.addPropertyConverters(TypeLiteral.of(String.class), converter);
-        assertThat(ctx.getPropertyConverters()).hasSize(1);
-    }
-
-    @Test
-    @SuppressWarnings({"rawtypes", "unchecked"})
-    public void addPropertyConverters_Collection() throws Exception {
-        PropertyConverter converter = (value, ctx) -> value.toLowerCase();
-        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder()
-                .addPropertyConverters(TypeLiteral.of(String.class),
-                        Arrays.<PropertyConverter<Object>>asList(new PropertyConverter[]{converter}));
-        ConfigurationContext ctx = b.build();
-        boolean caughtAlreadyBuilt = false;
-        try {
-            b.addPropertyConverters(TypeLiteral.of(String.class),
-                    Arrays.<PropertyConverter<Object>>asList(new PropertyConverter[]{converter}));
-        } catch (IllegalStateException e) {
-            caughtAlreadyBuilt = true;
-        }
-        assertThat(caughtAlreadyBuilt).isTrue();
-        assertThat(ctx.getPropertyConverters(TypeLiteral.of(String.class)).contains(converter)).isTrue();
-        assertThat(1).isEqualTo(ctx.getPropertyConverters().size());
-        b = new DefaultConfigurationContextBuilder()
-                .addPropertyConverters(TypeLiteral.of(String.class),
-                        Arrays.<PropertyConverter<Object>>asList(new PropertyConverter[]{converter}));
-        b.addPropertyConverters(TypeLiteral.of(String.class), converter);
-        assertThat(1).isEqualTo(ctx.getPropertyConverters().size());
-    }
-    
-    @Test
-    @SuppressWarnings({"rawtypes", "unchecked"})
-    public void removePropertyConverters_Type() throws Exception {
-        PropertyConverter converter = (value, ctx) -> value.toLowerCase();
-        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder()
-                .addPropertyConverters(TypeLiteral.of(String.class), converter);
-        ConfigurationContext ctx = b.build();
-        assertThat(ctx.getPropertyConverters(TypeLiteral.of(String.class)).contains(converter)).isTrue();
-        assertThat(ctx.getPropertyConverters(TypeLiteral.of(String.class))).hasSize(1);
-        b = new DefaultConfigurationContextBuilder()
-                .addPropertyConverters(TypeLiteral.of(String.class), converter);
-        ctx = b.removePropertyConverters(TypeLiteral.of(String.class)).build();
-        assertThat(ctx.getPropertyConverters(TypeLiteral.of(String.class)).contains(converter)).isFalse();
-        assertThat(ctx.getPropertyConverters(TypeLiteral.of(String.class)).isEmpty()).isTrue();
-    }
-
-    @Test
-    @SuppressWarnings({"rawtypes", "unchecked"})
-    public void removePropertyConverters_Array() throws Exception {
-        PropertyConverter converter = (value, ctx) -> value.toLowerCase();
-        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder()
-                .addPropertyConverters(TypeLiteral.of(String.class), converter);
-        ConfigurationContext ctx = b.build();
-        assertThat(ctx.getPropertyConverters(TypeLiteral.of(String.class)).contains(converter)).isTrue();
-        assertThat(ctx.getPropertyConverters(TypeLiteral.of(String.class))).hasSize(1);
-        b = new DefaultConfigurationContextBuilder()
-                .addPropertyConverters(TypeLiteral.of(String.class), converter);
-        ctx = b.removePropertyConverters(TypeLiteral.of(String.class), converter).build();
-        assertThat(ctx.getPropertyConverters(TypeLiteral.of(String.class)).contains(converter)).isFalse();
-        assertThat(ctx.getPropertyConverters(TypeLiteral.of(String.class)).isEmpty()).isTrue();
-    }
-
-    @SuppressWarnings({"rawtypes", "unchecked"})
-    @Test
-    public void removePropertyConverters_Collection() throws Exception {
-        PropertyConverter converter = (value, ctx) -> value.toLowerCase();
-        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder()
-                .addPropertyConverters(TypeLiteral.of(String.class), Arrays.<PropertyConverter<Object>>asList(new PropertyConverter[]{converter}));
-        ConfigurationContext ctx = b.build();
-        assertThat(ctx.getPropertyConverters(TypeLiteral.of(String.class)).contains(converter)).isTrue();
-        assertThat(ctx.getPropertyConverters(TypeLiteral.of(String.class))).hasSize(1);
-        b = new DefaultConfigurationContextBuilder()
-                .addPropertyConverters(TypeLiteral.of(String.class), Arrays.<PropertyConverter<Object>>asList(new PropertyConverter[]{converter}));
-        ctx = b.removePropertyConverters(TypeLiteral.of(String.class), Arrays.<PropertyConverter<Object>>asList(new PropertyConverter[]{converter})).build();
-        assertThat(ctx.getPropertyConverters(TypeLiteral.of(String.class)).contains(converter)).isFalse();
-        assertThat(ctx.getPropertyConverters(TypeLiteral.of(String.class)).isEmpty()).isTrue();
-    }
-
-    @Test
-    public void setPropertyValueCombinationPolicy() throws Exception {
-        PropertyValueCombinationPolicy combPol = (currentValue, key, propertySource) -> currentValue;
-        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder()
-                .setPropertyValueCombinationPolicy(combPol);
-        ConfigurationContext ctx = b.build();
-        boolean caughtAlreadyBuilt = false;
-        try {
-            b.setPropertyValueCombinationPolicy(combPol);
-        } catch (IllegalStateException e) {
-            caughtAlreadyBuilt = true;
-        }
-        assertThat(caughtAlreadyBuilt).isTrue();
-        assertThat(combPol).isEqualTo(ctx.getPropertyValueCombinationPolicy());
-    }
-
-    @Test
-    public void increasePriority() {
-        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder();
-        MockedPropertySource[] propertySources = new MockedPropertySource[10];
-        for (int i = 0; i < propertySources.length; i++) {
-            propertySources[i] = new MockedPropertySource("ps" + i, i);
-        }
-        b.addPropertySources(propertySources);
-        b.increasePriority(propertySources[propertySources.length - 1]);
-        for (int i = 0; i < propertySources.length; i++) {
-            assertThat(b.getPropertySources().get(i)).isEqualTo(propertySources[i]);
-        }
-        b.increasePriority(propertySources[propertySources.length - 2]).build();
-        for (int i = 0; i < propertySources.length - 2; i++) {
-            assertThat(b.getPropertySources().get(i)).isEqualTo(propertySources[i]);
-        }
-        assertThat(b.getPropertySources().get(propertySources.length - 2)).isEqualTo(propertySources[propertySources.length - 1]);
-        assertThat(b.getPropertySources().get(propertySources.length - 1)).isEqualTo(propertySources[propertySources.length - 2]);
-        boolean caughtAlreadyBuilt = false;
-        try {
-            b.increasePriority(propertySources[propertySources.length - 2]);
-        } catch (IllegalStateException e) {
-            caughtAlreadyBuilt = true;
-        }
-        assertThat(caughtAlreadyBuilt).isTrue();
-    }
-
-    @Test
-    public void decreasePriority() {
-        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder();
-        MockedPropertySource[] propertySources = new MockedPropertySource[10];
-        for (int i = 0; i < propertySources.length; i++) {
-            propertySources[i] = new MockedPropertySource("ps" + i, i);
-        }
-        b.addPropertySources(propertySources);
-        b.decreasePriority(propertySources[0]);
-        for (int i = 0; i < propertySources.length; i++) {
-            assertThat(b.getPropertySources().get(i)).isEqualTo(propertySources[i]);
-        }
-        b.decreasePriority(propertySources[1]).build();
-        for (int i = 2; i < propertySources.length; i++) {
-            assertThat(b.getPropertySources().get(i)).isEqualTo(propertySources[i]);
-        }
-        assertThat(b.getPropertySources().get(1)).isEqualTo(propertySources[0]);
-        assertThat(b.getPropertySources().get(0)).isEqualTo(propertySources[1]);
-        boolean caughtAlreadyBuilt = false;
-        try {
-            b.decreasePriority(propertySources[1]);
-        } catch (IllegalStateException e) {
-            caughtAlreadyBuilt = true;
-        }
-        assertThat(caughtAlreadyBuilt).isTrue();
-    }
-
-    @Test
-    public void lowestPriority() {
-        // setup
-        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder();
-        MockedPropertySource[] propertySources = new MockedPropertySource[10];
-        for (int i = 0; i < propertySources.length; i++) {
-            propertySources[i] = new MockedPropertySource("ps" + i, i);
-        }
-        b.addPropertySources(propertySources);
-        // test
-        b.lowestPriority(propertySources[0]);
-        for (int i = 0; i < propertySources.length; i++) {
-            assertThat(b.getPropertySources().get(i)).isEqualTo(propertySources[i]);
-        }
-        b.lowestPriority(propertySources[1]);
-        for (int i = 2; i < propertySources.length; i++) {
-            assertThat(b.getPropertySources().get(i)).isEqualTo(propertySources[i]);
-        }
-        assertThat(b.getPropertySources().get(1)).isEqualTo(propertySources[0]);
-        assertThat(b.getPropertySources().get(0)).isEqualTo(propertySources[1]);
-        b.lowestPriority(propertySources[5]).build();
-        assertThat(b.getPropertySources().get(0)).isEqualTo(propertySources[5]);
-        boolean caughtAlreadyBuilt = false;
-        try {
-            b.lowestPriority(propertySources[5]);
-        } catch (IllegalStateException e) {
-            caughtAlreadyBuilt = true;
-        }
-        assertThat(caughtAlreadyBuilt).isTrue();
-    }
-
-    @Test
-    public void highestPriority() {
-        // setup
-        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder();
-        MockedPropertySource[] propertySources = new MockedPropertySource[10];
-        for (int i = 0; i < propertySources.length; i++) {
-            propertySources[i] = new MockedPropertySource("ps" + i, i);
-        }
-        b.addPropertySources(propertySources);
-        // test
-        b.highestPriority(propertySources[propertySources.length - 1]);
-        for (int i = 0; i < propertySources.length; i++) {
-            assertThat(b.getPropertySources().get(i)).isEqualTo(propertySources[i]);
-        }
-        b.highestPriority(propertySources[propertySources.length - 2]);
-        for (int i = 0; i < propertySources.length - 2; i++) {
-            assertThat(b.getPropertySources().get(i)).isEqualTo(propertySources[i]);
-        }
-        assertThat(b.getPropertySources().get(propertySources.length - 1)).isEqualTo(propertySources[propertySources.length - 2]);
-        assertThat(b.getPropertySources().get(propertySources.length - 2)).isEqualTo(propertySources[propertySources.length - 1]);
-        b.highestPriority(propertySources[5]).build();
-        assertThat(b.getPropertySources().get(propertySources.length - 1)).isEqualTo(propertySources[5]);
-        boolean caughtAlreadyBuilt = false;
-        try {
-            b.highestPriority(propertySources[5]);
-        } catch (IllegalStateException e) {
-            caughtAlreadyBuilt = true;
-        }
-        assertThat(caughtAlreadyBuilt).isTrue();
-    }
-
-    @Test
-    public void sortPropertySources() {
-        // setup
-        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder();
-        MockedPropertySource[] propertySources = new MockedPropertySource[10];
-        for (int i = 0; i < propertySources.length; i++) {
-            propertySources[i] = new MockedPropertySource("ps" + i, i);
-        }
-        b.addPropertySources(propertySources);
-        Comparator<PropertySource> psComp = (o1, o2) -> o1.toString().compareTo(o2.toString());
-        // test 
-        assertThat(b.sortPropertySources(psComp).getClass()).isEqualTo(DefaultConfigurationContextBuilder.class);
-        Arrays.sort(propertySources, psComp);
-        for (int i = 0; i < propertySources.length; i++) {
-            assertThat(b.getPropertySources().get(i)).isEqualTo(propertySources[i]);
-        }
-    }
-
-    @Test
-    public void sortPropertyFilter() {
-        // setup
-        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder();
-        PropertyFilter[] propertyFilters = new PropertyFilter[10];
-        for (int i = 0; i < propertyFilters.length; i++) {
-            propertyFilters[i] = (value, ctx) -> value.setValue(toString() + " - ");
-        }
-
-        b.addPropertyFilters(propertyFilters);
-        Comparator<PropertyFilter> pfComp = (o1, o2) -> o1.toString().compareTo(o2.toString());
-        //test
-        assertThat(b.sortPropertyFilter(pfComp).getClass()).isEqualTo(DefaultConfigurationContextBuilder.class);
-        Arrays.sort(propertyFilters, pfComp);
-        for (int i = 0; i < propertyFilters.length; i++) {
-            assertThat(b.getPropertyFilters().get(i)).isEqualTo(propertyFilters[i]);
-        }
-    }
-
-    @Test
-    public void build() throws Exception {
-        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder();
-        ConfigurationContext ctx = b.build();
-        assertThat(ctx).isNotNull();
-        assertThat(ctx.getPropertySources().isEmpty()).isTrue();
-        assertThat(ctx.getPropertyFilters().isEmpty()).isTrue();
-        boolean caughtAlreadyBuilt = false;
-        try {
-            b.build();
-        } catch (IllegalStateException e) {
-            caughtAlreadyBuilt = true;
-        }
-        assertThat(caughtAlreadyBuilt).isTrue();
-    }
-
-    @Test
-    public void testRemoveAllFilters() throws Exception {
-        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder();
-        b.addPropertyFilters((value, ctx) -> value.setValue(toString() + " - "));
-        assertThat(b.getPropertyFilters().isEmpty()).isFalse();
-        b.removePropertyFilters(b.getPropertyFilters());
-        assertThat(b.getPropertyFilters().isEmpty()).isTrue();
-    }
-
-    @Test
-    public void testRemoveAllSources() throws Exception {
-        ConfigurationContextBuilder b = new DefaultConfigurationContextBuilder();
-        b.addPropertySources(new MockedPropertySource());
-        assertThat(b.getPropertySources().isEmpty()).isFalse();
-        b.removePropertySources(b.getPropertySources());
-        assertThat(b.getPropertyFilters().isEmpty()).isTrue();
-    }
-
-    @Test
-    public void testResetContext() throws Exception {
-        PropertyConverter converter = (value, ctx) -> value.toLowerCase();
-        DefaultConfigurationContextBuilder b = new DefaultConfigurationContextBuilder();
-        ConfigurationContext empty = b.build();
-
-        b = new DefaultConfigurationContextBuilder();
-        b.addPropertyFilters((value, ctx) -> value.setValue(toString() + " - "));
-        b.addPropertySources(new MockedPropertySource());
-        b.addPropertyConverters(TypeLiteral.of(String.class), converter);
-        ConfigurationContext full = b.build();
-
-        boolean caughtAlreadyBuilt = false;
-        try {
-            b.resetWithConfigurationContext(empty);
-        } catch (IllegalStateException e) {
-            caughtAlreadyBuilt = true;
-        }
-        assertThat(caughtAlreadyBuilt).isTrue();
-
-        b = new DefaultConfigurationContextBuilder();
-        b.addPropertyFilters((value, ctx) -> value.setValue(toString() + " - "));
-        b.addPropertySources(new MockedPropertySource());
-        b.addPropertyConverters(TypeLiteral.of(String.class), converter);
-        b.resetWithConfigurationContext(empty);
-        assertThat(b.getPropertyConverter().isEmpty()).isTrue();
-        assertThat(b.getPropertySources().isEmpty()).isTrue();
-        assertThat(b.getPropertyFilters().isEmpty()).isTrue();
-        b.resetWithConfigurationContext(full).build();
-        assertThat(b.getPropertyConverter().isEmpty()).isFalse();
-        assertThat(b.getPropertySources().isEmpty()).isFalse();
-        assertThat(b.getPropertyFilters().isEmpty()).isFalse();
-
-    }
-
-    @Test
-    public void testLoadDefaults() throws Exception {
-        DefaultConfigurationContextBuilder b = new DefaultConfigurationContextBuilder();
-        b.build();
-        boolean caughtAlreadyBuilt = false;
-        try {
-            b.loadDefaults();
-        } catch (IllegalStateException e) {
-            caughtAlreadyBuilt = true;
-        }
-        assertThat(caughtAlreadyBuilt).isTrue();
-
-        ConfigurationContext ctx = new DefaultConfigurationContextBuilder().loadDefaults().build();
-        assertThat(ctx.getPropertyConverters().isEmpty()).isFalse();
-        assertThat(ctx.getPropertyFilters().isEmpty()).isFalse();
-        assertThat(ctx.getPropertySources().isEmpty()).isFalse();
-    }
-    
-    
-    @Test
-    public void testAddDefaultPropertyConverters() throws Exception {
-        DefaultConfigurationContextBuilder b = new DefaultConfigurationContextBuilder();
-        b.build();
-        boolean caughtAlreadyBuilt = false;
-        try {
-            b.addDefaultPropertyConverters();
-        } catch (IllegalStateException e) {
-            caughtAlreadyBuilt = true;
-        }
-        assertThat(caughtAlreadyBuilt).isTrue();
-
-        ConfigurationContext ctx = new DefaultConfigurationContextBuilder().addDefaultPropertyConverters().build();
-        assertThat(ctx.getPropertyConverters().isEmpty()).isFalse();
-        assertThat(ctx.getPropertyConverters(TypeLiteral.of(Integer.class))).isNotNull();
-    }
-    
-        @Test
-    public void testAddDefaultPropertyFilters() throws Exception {
-        DefaultConfigurationContextBuilder b = new DefaultConfigurationContextBuilder();
-        b.build();
-        boolean caughtAlreadyBuilt = false;
-        try {
-            b.addDefaultPropertyFilters();
-        } catch (IllegalStateException e) {
-            caughtAlreadyBuilt = true;
-        }
-        assertThat(caughtAlreadyBuilt).isTrue();
-
-        ConfigurationContext ctx = new DefaultConfigurationContextBuilder().addDefaultPropertyFilters().build();
-        assertThat(ctx.getPropertyFilters().isEmpty()).isFalse();
-    }
-        
-        @Test
-    public void testAddDefaultPropertySources() throws Exception {
-        DefaultConfigurationContextBuilder b = new DefaultConfigurationContextBuilder();
-        b.build();
-        boolean caughtAlreadyBuilt = false;
-        try {
-            b.addDefaultPropertySources();
-        } catch (IllegalStateException e) {
-            caughtAlreadyBuilt = true;
-        }
-        assertThat(caughtAlreadyBuilt).isTrue();
-
-        ConfigurationContext ctx = new DefaultConfigurationContextBuilder().addDefaultPropertySources().build();
-        assertThat(ctx.getPropertySources().isEmpty()).isFalse();
-        assertThat(ctx.getPropertySource("environment-properties")).isNotNull();
-    }
-            
-        @Test
-    public void testAddCorePropertyReources() throws Exception {
-        DefaultConfigurationContextBuilder b = new DefaultConfigurationContextBuilder();
-        List<PropertySource> ps = new ArrayList<>();
-        b.addCorePropertyResources(ps);
-        assertThat(ps.isEmpty()).isFalse();
-        
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/606f8ec6/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationContextTest.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationContextTest.java b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationContextTest.java
index 6c8bb53..e3260da 100644
--- a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationContextTest.java
+++ b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationContextTest.java
@@ -19,7 +19,13 @@
 package org.apache.tamaya.spisupport;
 
 import org.apache.tamaya.spi.PropertySource;
+import org.apache.tamaya.spi.ServiceContext;
+import org.apache.tamaya.spi.ServiceContextManager;
 import org.junit.Test;
+import org.mockito.Mockito;
+
+import java.util.Collections;
+
 import static org.assertj.core.api.Assertions.*;
 
 /**
@@ -31,12 +37,17 @@ public class DefaultConfigurationContextTest {
     @Test
     public void testEqualsAndHashAndToStringValues() {
         PropertySource sharedSource = new MockedPropertySource();
-        DefaultConfigurationContext ctx1 = (DefaultConfigurationContext) new DefaultConfigurationContextBuilder().build();
-        ctx1.addPropertySources(sharedSource);
-        DefaultConfigurationContext ctx2 = (DefaultConfigurationContext) new DefaultConfigurationContextBuilder().build();
-        ctx2.addPropertySources(sharedSource);
-        DefaultConfigurationContext ctx3 = (DefaultConfigurationContext) new DefaultConfigurationContextBuilder().build();
-        ctx3.addPropertySources(new MockedPropertySource());
+        ServiceContext serviceContext = Mockito.mock(ServiceContext.class);
+        MetadataProvider metaDataProvider = Mockito.mock(MetadataProvider.class);
+        DefaultConfigurationContext ctx1 = new DefaultConfigurationContext(
+                serviceContext, Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(),
+                metaDataProvider);
+        DefaultConfigurationContext ctx2 = new DefaultConfigurationContext(
+                serviceContext, Collections.emptyList(), Collections.emptyList(), Collections.emptyMap(),
+                metaDataProvider);
+        DefaultConfigurationContext ctx3 = new DefaultConfigurationContext(
+                serviceContext, Collections.emptyList(), Collections.singletonList(sharedSource), Collections.emptyMap(),
+                metaDataProvider);
 
         assertThat(ctx1).isEqualTo(ctx1);
         assertThat(ctx1).isNotEqualTo(null);
@@ -47,6 +58,6 @@ public class DefaultConfigurationContextTest {
         assertThat(ctx1.hashCode()).isNotEqualTo(ctx3.hashCode());
         String spaces = new String(new char[70 - sharedSource.getName().length()]).replace("\0", " ");
         System.out.println(ctx1.toString());
-        assertThat(ctx1.toString().contains(sharedSource.getName() + spaces)).isTrue();
+        assertThat(ctx3.toString().contains(sharedSource.getName() + spaces)).isTrue();
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/606f8ec6/code/spi-support/src/test/java/org/apache/tamaya/spisupport/EmptyConfigurationContextBuilder.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/EmptyConfigurationContextBuilder.java b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/EmptyConfigurationContextBuilder.java
deleted file mode 100644
index 837445d..0000000
--- a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/EmptyConfigurationContextBuilder.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.spisupport;
-
-import org.apache.tamaya.TypeLiteral;
-import org.apache.tamaya.spi.*;
-
-import java.util.*;
-
-public class EmptyConfigurationContextBuilder implements ConfigurationContextBuilder{
-
-    private static final ConfigurationContextBuilder INSTANCE = new EmptyConfigurationContextBuilder();
-
-    @Override
-    public ConfigurationContextBuilder setClassLoader(ClassLoader classLoader) {
-        return this;
-    }
-
-    @Override
-    public ConfigurationContextBuilder setServiceContext(ServiceContext serviceContext) {
-        return this;
-    }
-
-    @Override
-    public ConfigurationContextBuilder setContext(ConfigurationContext context) {
-        return this;
-    }
-
-    @Override
-    public ConfigurationContextBuilder addMetaData(Map<String, String> metaData) {
-        return this;
-    }
-
-    @Override
-    public ConfigurationContextBuilder addMetaData(String key, String value) {
-        return this;
-    }
-
-    @Override
-    public ConfigurationContextBuilder addPropertySources(PropertySource... propertySources) {
-        return this;
-    }
-
-    @Override
-    public ConfigurationContextBuilder addPropertySources(Collection<PropertySource> propertySources) {
-        return this;
-    }
-
-    @Override
-    public ConfigurationContextBuilder addDefaultPropertySources() {
-        return this;
-    }
-
-    @Override
-    public ConfigurationContextBuilder removePropertySources(PropertySource... propertySources) {
-        return this;
-    }
-
-    @Override
-    public ConfigurationContextBuilder removePropertySources(Collection<PropertySource> propertySources) {
-        return this;
-    }
-
-    @Override
-    public List<PropertySource> getPropertySources() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public List<PropertyFilter> getPropertyFilters() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public Map<TypeLiteral<?>, Collection<PropertyConverter<?>>> getPropertyConverter() {
-        return Collections.emptyMap();
-    }
-
-    @Override
-    public ConfigurationContextBuilder increasePriority(PropertySource propertySource) {
-        return this;
-    }
-
-    @Override
-    public ConfigurationContextBuilder decreasePriority(PropertySource propertySource) {
-        return this;
-    }
-
-    @Override
-    public ConfigurationContextBuilder highestPriority(PropertySource propertySource) {
-        return this;
-    }
-
-    @Override
-    public ConfigurationContextBuilder lowestPriority(PropertySource propertySource) {
-        return null;
-    }
-
-    @Override
-    public ConfigurationContextBuilder addPropertyFilters(PropertyFilter... filters) {
-        return this;
-    }
-
-    @Override
-    public ConfigurationContextBuilder addPropertyFilters(Collection<PropertyFilter> filters) {
-        return this;
-    }
-
-    @Override
-    public ConfigurationContextBuilder addDefaultPropertyFilters() {
-        return null;
-    }
-
-    @Override
-    public ConfigurationContextBuilder removePropertyFilters(PropertyFilter... filters) {
-        return this;
-    }
-
-    @Override
-    public ConfigurationContextBuilder removePropertyFilters(Collection<PropertyFilter> filters) {
-        return this;
-    }
-
-    @Override
-    public <T> ConfigurationContextBuilder addPropertyConverters(TypeLiteral<T> typeToConvert, PropertyConverter<T>... propertyConverters) {
-        return null;
-    }
-
-    @Override
-    public <T> ConfigurationContextBuilder addPropertyConverters(TypeLiteral<T> typeToConvert, Collection<PropertyConverter<T>> propertyConverters) {
-        return this;
-    }
-
-    @Override
-    public ConfigurationContextBuilder addDefaultPropertyConverters() {
-        return this;
-    }
-
-    @Override
-    public <T> ConfigurationContextBuilder removePropertyConverters(TypeLiteral<T> typeToConvert, PropertyConverter<T>... propertyConverters) {
-        return this;
-    }
-
-    @Override
-    public <T> ConfigurationContextBuilder removePropertyConverters(TypeLiteral<T> typeToConvert, Collection<PropertyConverter<T>> propertyConverters) {
-        return this;
-    }
-
-    @Override
-    public ConfigurationContextBuilder removePropertyConverters(TypeLiteral<?> typeToConvert) {
-        return this;
-    }
-
-    @Override
-    public ConfigurationContextBuilder sortPropertySources(Comparator<PropertySource> comparator) {
-        return this;
-    }
-
-    @Override
-    public ConfigurationContextBuilder sortPropertyFilter(Comparator<PropertyFilter> comparator) {
-        return this;
-    }
-
-    @Override
-    public ConfigurationContextBuilder setPropertyValueCombinationPolicy(PropertyValueCombinationPolicy policy) {
-        return this;
-    }
-
-    @Override
-    public ServiceContext getServiceContext() {
-        return ServiceContextManager.getServiceContext(getClass().getClassLoader());
-    }
-
-    @Override
-    public ConfigurationContext build() {
-        return ConfigurationContext.EMPTY;
-    }
-
-    public static ConfigurationContextBuilder instance() {
-        return INSTANCE;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/606f8ec6/code/spi-support/src/test/java/org/apache/tamaya/spisupport/MockedConfigurationContext.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/MockedConfigurationContext.java b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/MockedConfigurationContext.java
index 5c09039..02f1ede 100644
--- a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/MockedConfigurationContext.java
+++ b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/MockedConfigurationContext.java
@@ -40,7 +40,7 @@ public class MockedConfigurationContext implements ConfigurationContext {
     }
 
     @Override
-    public Map<String, String> getMetadata() {
+    public Map<String, String> getMetaData() {
         return metaData;
     }
 
@@ -50,11 +50,6 @@ public class MockedConfigurationContext implements ConfigurationContext {
     }
 
     @Override
-    public void addPropertySources(PropertySource... propertySources) {
-        throw new RuntimeException("addPropertySources should be never called in this test");
-    }
-
-    @Override
     public List<PropertySource> getPropertySources() {
         return pss;
     }
@@ -70,11 +65,6 @@ public class MockedConfigurationContext implements ConfigurationContext {
     }
 
     @Override
-    public <T> void addPropertyConverter(TypeLiteral<T> type, PropertyConverter<T> propertyConverter) {
-        pcm.register(type, propertyConverter);
-    }
-
-    @Override
     public Map<TypeLiteral<?>, List<PropertyConverter<?>>> getPropertyConverters() {
         return pcm.getPropertyConverters();
     }
@@ -89,13 +79,4 @@ public class MockedConfigurationContext implements ConfigurationContext {
         return Arrays.asList(new MockedPropertyFilter());
     }
 
-    @Override
-    public PropertyValueCombinationPolicy getPropertyValueCombinationPolicy() {
-        return PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_POLICY;
-    }
-
-    @Override
-    public ConfigurationContextBuilder toBuilder() {
-        throw new RuntimeException("toBuilder should be never called in this test");
-    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/606f8ec6/code/spi-support/src/test/java/org/apache/tamaya/spisupport/MockedPropertySource.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/MockedPropertySource.java b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/MockedPropertySource.java
index b91c8f7..7b61103 100644
--- a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/MockedPropertySource.java
+++ b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/MockedPropertySource.java
@@ -75,9 +75,4 @@ public class MockedPropertySource implements PropertySource {
         return returnable;
     }
 
-    @Override
-    public boolean isScannable() {
-        return true;
-    }
-
 }



Mime
View raw message