tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anat...@apache.org
Subject [03/23] incubator-tamaya git commit: Reimplemented (also simjplified) Tamaya core completely based on latest JSR API. Moved prior Tamaya API into compat module.
Date Sun, 10 Dec 2017 22:03:26 GMT
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9bc56a38/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/BuildablePropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/BuildablePropertySourceProvider.java b/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/BuildablePropertySourceProvider.java
deleted file mode 100644
index 1becb50..0000000
--- a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/BuildablePropertySourceProvider.java
+++ /dev/null
@@ -1,114 +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.propertysource;
-
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertySourceProvider;
-
-import java.util.*;
-
-/**
- * A Buildable property source.
- */
-public class BuildablePropertySourceProvider implements PropertySourceProvider{
-
-    private List<PropertySource> sources = new ArrayList<>();
-
-    @Override
-    public Collection<PropertySource> getPropertySources() {
-        return Collections.unmodifiableCollection(sources);
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) return true;
-        if (o == null || getClass() != o.getClass()) return false;
-
-        BuildablePropertySourceProvider that = (BuildablePropertySourceProvider) o;
-
-        return sources.equals(that.sources);
-    }
-
-    @Override
-    public int hashCode() {
-        return sources.hashCode();
-    }
-
-    @Override
-    public String toString() {
-        return "BuildablePropertySourceProvider{" +
-                "sources=" + sources +
-                '}';
-    }
-
-    /**
-     * Builder builder.
-     *
-     * @return the builder
-     */
-    public static Builder builder() {
-        return new Builder();
-    }
-
-
-
-
-    /**
-     * The type Builder.
-     */
-    public static final class Builder {
-        private List<PropertySource> sources = new ArrayList<>();
-
-        private Builder() {
-        }
-
-        /**
-         * With propertySources.
-         *
-         * @param propertySources the propertySources
-         * @return the builder
-         */
-        public Builder withPropertySourcs(PropertySource... propertySources) {
-            this.sources.addAll(Arrays.asList(propertySources));
-            return this;
-        }
-
-        /**
-         * With property sources builder.
-         *
-         * @param sources the property sources
-         * @return the builder
-         */
-        public Builder withPropertySourcs(Collection<PropertySource> sources) {
-            this.sources.addAll(sources);
-            return this;
-        }
-
-        /**
-         * Build buildable property source.
-         *
-         * @return the buildable property source
-         */
-        public BuildablePropertySourceProvider build() {
-            BuildablePropertySourceProvider buildablePropertySource = new BuildablePropertySourceProvider();
-            buildablePropertySource.sources.addAll(this.sources);
-            return buildablePropertySource;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9bc56a38/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/CLIPropertySource.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/CLIPropertySource.java b/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/CLIPropertySource.java
deleted file mode 100644
index a83722f..0000000
--- a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/CLIPropertySource.java
+++ /dev/null
@@ -1,137 +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.propertysource;
-
-import org.apache.tamaya.spi.PropertyValue;
-
-import java.util.*;
-
-/**
- * PropertySource that allows to add the programs main arguments as configuration entries. Unix syntax using '--' and
- * '-' params is supported.
- */
-public class CLIPropertySource extends BasePropertySource {
-
-    /** The original main arguments. */
-    private static String[] args = new String[0];
-
-    /** The map of parsed main arguments. */
-    private static Map<String,PropertyValue> mainArgs;
-
-    /** Initializes the initial state. */
-    static{
-        initMainArgs(args);
-    }
-
-    /**
-     * Creates a new instance.
-     */
-    public CLIPropertySource(){
-        this((String[])null);
-    }
-
-    /**
-     * Creates a new instance, allows optionally to pass the main arguments.
-     * @param args the args, or null.
-     */
-    public CLIPropertySource(String... args){
-        super("CLI");
-        if(args!=null){
-            initMainArgs(args);
-        }
-    }
-
-    /**
-     * Creates a new instance, allows optionally to pass the main arguments.
-     * @param args the args, or null.
-     * @param ordinal the ordinal to be applied.
-     */
-    public CLIPropertySource(int ordinal, String... args){
-        if(args!=null){
-            initMainArgs(args);
-        }
-        setOrdinal(ordinal);
-    }
-
-
-
-    /**
-     * Configure the main arguments, hereby parsing and mapping the main arguments into
-     * configuration propertiesi as key-value pairs.
-     * @param args the main arguments, not null.
-     */
-    public static void initMainArgs(String... args){
-        CLIPropertySource.args = Objects.requireNonNull(args);
-        // TODO is there a way to figure out the args?
-        String argsProp = System.getProperty("main.args");
-        if(argsProp!=null){
-            CLIPropertySource.args = argsProp.split("\\s");
-        }
-        Map<String,String> result = null;
-        if(CLIPropertySource.args==null){
-            result = Collections.emptyMap();
-        }else{
-            result = new HashMap<>();
-            String prefix = System.getProperty("main.args.prefix");
-            if(prefix==null){
-                prefix="";
-            }
-            String key = null;
-            for(String arg:CLIPropertySource.args){
-                if(arg.startsWith("--")){
-                    arg = arg.substring(2);
-                    int index = arg.indexOf("=");
-                    if(index>0){
-                        key = arg.substring(0,index).trim();
-                        result.put(prefix+key, arg.substring(index+1).trim());
-                        key = null;
-                    }else{
-                        result.put(prefix+arg, arg);
-                    }
-                }else if(arg.startsWith("-")){
-                    key = arg.substring(1);
-                }else{
-                    if(key!=null){
-                        result.put(prefix+key, arg);
-                        key = null;
-                    }else{
-                        result.put(prefix+arg, arg);
-                    }
-                }
-            }
-        }
-        Map<String,PropertyValue> finalProps = new HashMap<>();
-        for(Map.Entry<String,String> en:result.entrySet()) {
-            finalProps.put(en.getKey(),
-                    PropertyValue.of(en.getKey(), en.getValue(), "main-args"));
-        }
-        CLIPropertySource.mainArgs = Collections.unmodifiableMap(finalProps);
-    }
-
-    @Override
-    public Map<String, PropertyValue> getProperties() {
-        return Collections.unmodifiableMap(mainArgs);
-    }
-
-    @Override
-    protected String toStringValues() {
-        return  super.toStringValues() +
-                "  args=" + Arrays.toString(args) + '\n';
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9bc56a38/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/EnvironmentPropertySource.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/EnvironmentPropertySource.java b/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/EnvironmentPropertySource.java
deleted file mode 100644
index bb9f6b8..0000000
--- a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/EnvironmentPropertySource.java
+++ /dev/null
@@ -1,287 +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.propertysource;
-
-import org.apache.tamaya.spi.PropertyValue;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * <p>{@link PropertySource} to access environment variables via Tamaya
- * which are set via {@code export VARIABLE=value} on UNIX systems or
- * {@code set VARIABLE=value} on Windows systems.</p>
- *
- * <p>Using the {@linkplain EnvironmentPropertySource} without any
- * additional configuration gives access to all existing environment
- * variables available to the Java process Tamaya is running in.</p>
- *
- * <h1>Simple usage example</h1>
- *
- * <pre>
- * $ export OPS_MODE=production
- * $ export COLOR=false
- * $ java -jar application.jar
- * </pre>
- *
- * <p>To access {@code OPS_MODE} and {@code COLOR} with the following code
- * fragment could be used:</p>
- *
- * <pre>
- * PropertySource ps = new EnvironmentPropertySource();
- * PropertyValue opsMode = ps.get("OPS_MODE");
- * PropertyValue color = ps.get("COLOR");
- * </pre>
- *
- * <h1>Application specific environmet variables with prefix</h1>
- *
- * <p>Given the case where to instances of the same application are running on
- * a single machine but need different values for the environment variable
- * {@code CUSTOMER}. The {@linkplain EnvironmentPropertySource} allows you
- * to prefix the environment variable with an application specific prefix
- * and to access it by the non-prefixed variable name.</p>
- *
- * <pre>
- * $ export CUSTOMER=none
- * $ export a81.CUSTOMER=moon
- * $ export b78.CUSTOMER=luna
- * </pre>
- *
- * <p>Given an environment with these tree variables the application running
- * for the customer called Moon could be started with the following command:</p>
- *
- * <pre>
- * $ java -Dtamaya.envprops.prefix=a81 -jar application.jar
- * </pre>
- *
- * <p>The application specific value can now be accessed from the code of the
- * application like this:</p>
- *
- * <pre>
- * PropertySource ps = new EnvironmentPropertySource();
- * PropertyValue pv = ps.get("CUSTOMER");
- * System.out.println(pv.getValue());
- * </pre>
- *
- * <p>The output of application would be {@code moon}.</p>
- *
- * <h1>Disabling the access to environment variables</h1>
- *
- * <p>The access to environment variables could be simply
- * disabled by the setting the systemproperty {@code tamaya.envprops.disable}
- * or {@code tamaya.defaults.disable} to {@code true}.</p>
- */
-public class EnvironmentPropertySource extends BasePropertySource {
-    private static final String TAMAYA_ENVPROPS_PREFIX = "tamaya.envprops.prefix";
-    private static final String TAMAYA_ENVPROPS_DISABLE = "tamaya.envprops.disable";
-    private static final String TAMAYA_DEFAULT_DISABLE = "tamaya.defaults.disable";
-
-    /**
-     * Default ordinal for {@link org.apache.tamaya.spisupport.propertysource.EnvironmentPropertySource}
-     */
-    public static final int DEFAULT_ORDINAL = 300;
-
-    /**
-     * Prefix that allows environment properties to virtually be mapped on specified sub section.
-     */
-    private String prefix;
-
-    /**
-     * If true, this property source does not return any properties. This is useful since this
-     * property source is applied by default, but can be switched off by setting the
-     * {@code tamaya.envprops.disable} system/environment property to {@code true}.
-     */
-    private boolean disabled = false;
-
-    private SystemPropertiesProvider propertiesProvider = new SystemPropertiesProvider();
-
-    /**
-     * Creates a new instance. Also initializes the {@code prefix} and {@code disabled} properties
-     * from the system-/ environment properties:
-     * <pre>
-     *     tamaya.envprops.prefix
-     *     tamaya.envprops.disable
-     * </pre>
-     */
-    public EnvironmentPropertySource(){
-        initFromSystemProperties();
-    }
-
-    /**
-     * Initializes the {@code prefix} and {@code disabled} properties from the system-/
-     * environment properties:
-     * <pre>
-     *     tamaya.envprops.prefix
-     *     tamaya.envprops.disable
-     * </pre>
-     */
-    private void initFromSystemProperties() {
-        String value = System.getProperty("tamaya.envprops.prefix");
-        if(value==null){
-            prefix = System.getenv("tamaya.envprops.prefix");
-        }
-        value = System.getProperty("tamaya.envprops.disable");
-        if(value==null){
-            value = System.getenv("tamaya.envprops.disable");
-        }
-        if(value==null){
-            value = System.getProperty("tamaya.defaults.disable");
-        }
-        if(value==null){
-            value = System.getenv("tamaya.defaults.disable");
-        }
-        if(value!=null && !value.isEmpty()) {
-            this.disabled = Boolean.parseBoolean(value);
-        }
-    }
-
-    /**
-     * Creates a new instance using a fixed ordinal value.
-     * @param ordinal the ordinal number.
-     */
-    public EnvironmentPropertySource(int ordinal){
-        this(null, ordinal);
-    }
-
-    /**
-     * Creates a new instance.
-     * @param prefix the prefix to be used, or null.
-     * @param ordinal the ordinal to be used.
-     */
-    public EnvironmentPropertySource(String prefix, int ordinal){
-        super("environment-properties");
-        this.prefix = prefix;
-        setOrdinal(ordinal);
-    }
-
-    /**
-     * Creates a new instance.
-     * @param prefix the prefix to be used, or null.
-     */
-    public EnvironmentPropertySource(String prefix){
-        this.prefix = prefix;
-    }
-
-    @Override
-    public int getDefaultOrdinal() {
-        return DEFAULT_ORDINAL;
-    }
-
-    @Override
-    public String getName() {
-        if (isDisabled()) {
-            return "environment-properties(disabled)";
-        }
-        return "environment-properties";
-    }
-
-    @Override
-    public PropertyValue get(String key) {
-        if (isDisabled()) {
-            return null;
-        }
-
-        String effectiveKey = hasPrefix() ? getPrefix() + "." + key
-                                          : key;
-
-        String value = getPropertiesProvider().getenv(effectiveKey);
-
-        return PropertyValue.of(key, value, getName());
-    }
-
-    private boolean hasPrefix() {
-        return null != prefix;
-    }
-
-    @Override
-    public Map<String, PropertyValue> getProperties() {
-        if(disabled){
-            return Collections.emptyMap();
-        }
-        String prefix = this.prefix;
-        if(prefix==null) {
-            Map<String, PropertyValue> entries = new HashMap<>(System.getenv().size());
-            for (Map.Entry<String, String> entry : System.getenv().entrySet()) {
-                entries.put(entry.getKey(), PropertyValue.of(entry.getKey(), entry.getValue(), getName()));
-            }
-            return entries;
-        }else{
-            Map<String, PropertyValue> entries = new HashMap<>(System.getenv().size());
-            for (Map.Entry<String, String> entry : System.getenv().entrySet()) {
-                entries.put(prefix + entry.getKey(), PropertyValue.of(prefix + entry.getKey(), entry.getValue(), getName()));
-            }
-            return entries;
-        }
-    }
-
-
-    @Override
-    protected String toStringValues() {
-        return  super.toStringValues() +
-                "  prefix=" + prefix + '\n' +
-                "  disabled=" + disabled + '\n';
-    }
-
-    void setPropertiesProvider(SystemPropertiesProvider spp) {
-        propertiesProvider = spp;
-        initFromSystemProperties();
-    }
-
-    SystemPropertiesProvider getPropertiesProvider() {
-        return propertiesProvider;
-    }
-
-    public String getPrefix() {
-        return prefix;
-    }
-
-    public boolean isDisabled() {
-        return disabled;
-    }
-
-    /**
-     * <p>Provides access to the system properties used to configure
-     * {@linkplain EnvironmentPropertySource}.</p>
-     *
-     * <p>This implementation delegates all property lookups
-     * to {@linkplain System#getProperty(String)}.</p>
-     */
-    static class SystemPropertiesProvider {
-        String getEnvPropsPrefix() {
-            return System.getenv(TAMAYA_ENVPROPS_PREFIX);
-        }
-
-        String getEnvPropsDisable() {
-            return System.getenv(TAMAYA_ENVPROPS_DISABLE);
-        }
-
-        String getDefaultsDisable() {
-            return System.getenv(TAMAYA_DEFAULT_DISABLE);
-        }
-
-        String getenv(String name) {
-            return System.getenv(name);
-        }
-
-        Map<String, String> getenv() {
-            return System.getenv();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9bc56a38/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/JavaConfigurationPropertySource.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/JavaConfigurationPropertySource.java b/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/JavaConfigurationPropertySource.java
deleted file mode 100644
index 92f520e..0000000
--- a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/JavaConfigurationPropertySource.java
+++ /dev/null
@@ -1,134 +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.propertysource;
-
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertyValue;
-import org.apache.tamaya.spi.ServiceContextManager;
-import org.apache.tamaya.spisupport.PropertySourceComparator;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.*;
-
-import static java.lang.String.format;
-import static java.lang.Thread.currentThread;
-
-/**
- * Provider which reads all {@value DEFAULT_SIMPLE_PROPERTIES_FILE_NAME} and
- * {@value DEFAULT_XML_PROPERTIES_FILE_NAME} files found in the
- * classpath. By setting
- * {@code tamaya.defaultprops.disable} or {@code tamaya.defaults.disable}
- * as system or environment property this feature can be disabled.
- */
-public class JavaConfigurationPropertySource extends BasePropertySource {
-    /**
-     * Default location in the classpath, where Tamaya looks for simple line based configuration by default.
-     */
-    public static final String DEFAULT_SIMPLE_PROPERTIES_FILE_NAME="META-INF/javaconfiguration.properties";
-
-    /**
-     * Default location in the classpath, where Tamaya looks for XML based configuration by default.
-     */
-    public static final String DEFAULT_XML_PROPERTIES_FILE_NAME = "META-INF/javaconfiguration.xml";
-
-    private static final int DEFAULT_ORDINAL = 900;
-
-    private boolean enabled = evaluateEnabled();
-
-    public JavaConfigurationPropertySource(){
-        super("resource:META-INF/javaconfiguration.*", DEFAULT_ORDINAL);
-    }
-
-    private boolean evaluateEnabled() {
-        String value = System.getProperty("tamaya.defaultprops.disable");
-        if(value==null){
-            value = System.getenv("tamaya.defaultprops.disable");
-        }
-        if(value==null){
-            value = System.getProperty("tamaya.defaults.disable");
-        }
-        if(value==null){
-            value = System.getenv("tamaya.defaults.disable");
-        }
-        if(value==null){
-            return true;
-        }
-        return value.isEmpty() || !Boolean.parseBoolean(value);
-    }
-
-    private List<PropertySource> getPropertySources() {
-        List<PropertySource> propertySources = new ArrayList<>();
-        propertySources.addAll(loadPropertySourcesByName(DEFAULT_SIMPLE_PROPERTIES_FILE_NAME));
-        propertySources.addAll(loadPropertySourcesByName(DEFAULT_XML_PROPERTIES_FILE_NAME));
-        Collections.sort(propertySources, PropertySourceComparator.getInstance());
-        return propertySources;
-    }
-
-    private Collection<? extends PropertySource> loadPropertySourcesByName(String filename) {
-        List<PropertySource> propertySources = new ArrayList<>();
-        Enumeration<URL> propertyLocations;
-        try {
-            propertyLocations = ServiceContextManager.getServiceContext()
-                    .getResources(filename, currentThread().getContextClassLoader());
-        } catch (IOException e) {
-            String msg = format("Error while searching for %s", filename);
-
-            throw new ConfigException(msg, e);
-        }
-
-        while (propertyLocations.hasMoreElements()) {
-            URL currentUrl = propertyLocations.nextElement();
-            SimplePropertySource sps = new SimplePropertySource(currentUrl);
-
-            propertySources.add(sps);
-        }
-
-        return propertySources;
-    }
-
-    public boolean isEnabled() {
-        return enabled;
-    }
-
-    public void setEnabled(boolean enabled){
-        this.enabled = enabled;
-    }
-
-
-    @Override
-    public Map<String, PropertyValue> getProperties() {
-        if (!isEnabled()) {
-            return Collections.emptyMap();
-        }
-        Map<String,PropertyValue> result = new HashMap<>();
-        for(PropertySource ps:getPropertySources()){
-            result.putAll(ps.getProperties());
-        }
-        return result;
-    }
-
-    @Override
-    public String toString() {
-        return "JavaConfigurationPropertySource{" +
-                "enabled=" + enabled +
-                '}';
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9bc56a38/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/MapPropertySource.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/MapPropertySource.java b/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/MapPropertySource.java
deleted file mode 100644
index 0cabb35..0000000
--- a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/MapPropertySource.java
+++ /dev/null
@@ -1,102 +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.propertysource;
-
-import org.apache.tamaya.spi.PropertyValue;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * Simple PropertySource implementation that just takes a Map and an (optional) priority.
- * Optionally the entries passed can be mapped to a different rootContext.
- */
-public class MapPropertySource extends BasePropertySource {
-
-    /**
-     * The current properties.
-     */
-    private final Map<String, PropertyValue> props = new HashMap<>();
-
-    /**
-     * Creates a new instance, hereby using the default mechanism for evaluating the property source's
-     * priority.
-     *
-     * @param name unique name of this source.
-     * @param props the properties
-     */
-    public MapPropertySource(String name, Map<String, String> props) {
-        this(name, props, null);
-    }
-
-    /**
-     * Creates a new instance, hereby using the default mechanism for evaluating the property source's
-     * priority, but applying a custom mapping {@code prefix} to the entries provided.
-     *
-     * @param name        unique name of this source.
-     * @param props       the properties
-     * @param prefix      the prefix context mapping, or null (for no mapping).
-     */
-    public MapPropertySource(String name, Map<String, String> props, String prefix) {
-        super(name);
-        if (prefix == null) {
-            for (Map.Entry<String, String> en : props.entrySet()) {
-                this.props.put(en.getKey(),
-                        PropertyValue.of(en.getKey(), en.getValue(), name));
-            }
-        } else {
-            for (Map.Entry<String, String> en : props.entrySet()) {
-                this.props.put(prefix + en.getKey(),
-                        PropertyValue.of(prefix + en.getKey(), en.getValue(), name));
-            }
-        }
-    }
-
-    /**
-     * Creates a new instance, hereby using the default mechanism for evaluating the property source's
-     * priority, but applying a custom mapping {@code rootContext} to the entries provided.
-     *
-     * @param name unique name of this source.
-     * @param props       the properties
-     * @param prefix      the prefix context mapping, or null (for no mapping).
-     */
-    public MapPropertySource(String name, Properties props, String prefix) {
-        this(name, getMap(props), prefix);
-    }
-
-    /**
-     * Simple method to convert Properties into a Map instance.
-     * @param props the properties, not null.
-     * @return the corresponding Map instance.
-     */
-    public static Map<String, String> getMap(Properties props) {
-        Map<String, String> result = new HashMap<>();
-        for (Map.Entry en : props.entrySet()) {
-            result.put(en.getKey().toString(), en.getValue().toString());
-        }
-        return result;
-    }
-
-
-    @Override
-    public Map<String, PropertyValue> getProperties() {
-        return Collections.unmodifiableMap(this.props);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9bc56a38/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/PropertiesResourcePropertySource.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/PropertiesResourcePropertySource.java b/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/PropertiesResourcePropertySource.java
deleted file mode 100644
index 27b6e4b..0000000
--- a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/PropertiesResourcePropertySource.java
+++ /dev/null
@@ -1,109 +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.propertysource;
-
-import org.apache.tamaya.spi.ServiceContextManager;
-
-import java.io.InputStream;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-/**
- * Simple PropertySource, with a fixed ordinal that reads a .properties file from a given URL.
- */
-public class PropertiesResourcePropertySource extends MapPropertySource {
-    /** The logger used. */
-    private static final Logger LOGGER = Logger.getLogger(PropertiesResourcePropertySource.class.getName());
-
-    /**
-     * Creates a new instance.
-     * @param url the resource URL, not null.
-     */
-    public PropertiesResourcePropertySource(URL url){
-        this(url, null);
-    }
-
-    /**
-     * Creates a new instance.
-     * @param prefix the (optional) prefix context for mapping (prefixing) the properties loaded.
-     * @param url the resource URL, not null.
-     */
-    public PropertiesResourcePropertySource(URL url, String prefix){
-        super(url.toExternalForm(), loadProps(url), prefix);
-    }
-
-    /**
-     * Creates a new instance.
-     * @param prefix the (optional) prefix context for mapping (prefixing) the properties loaded.
-     * @param path the resource path, not null.
-     */
-    public PropertiesResourcePropertySource(String path, String prefix){
-        super(path, loadProps(path, null), prefix);
-    }
-
-    /**
-     * Creates a new instance.
-     * @param prefix the (optional) prefix context for mapping (prefixing) the properties loaded.
-     * @param path the resource path, not null.
-     */
-    public PropertiesResourcePropertySource(String path, String prefix, ClassLoader cl){
-        super(path, loadProps(path, cl), prefix);
-    }
-
-    /**
-     * Loads the properties using the JDK's Property loading mechanism.
-     * @param path the resource classpath, not null.
-     * @return the loaded properties.
-     */
-    private static Map<String, String> loadProps(String path, ClassLoader cl) {
-        if(cl==null){
-            cl = PropertiesResourcePropertySource.class.getClassLoader();
-        }
-        URL url = ServiceContextManager.getServiceContext().getResource(path, cl);
-        return loadProps(url);
-    }
-
-    /**
-     * Loads the properties using the JDK's Property loading mechanism.
-     * @param url the resource URL, not null.
-     * @return the loaded properties.
-     */
-    private static Map<String, String> loadProps(URL url) {
-        Map<String,String> result = new HashMap<>();
-        if(url!=null) {
-            try (InputStream is = url.openStream()) {
-                Properties props = new Properties();
-                props.load(is);
-                for (Map.Entry en : props.entrySet()) {
-                    result.put(en.getKey().toString(), en.getValue().toString());
-                }
-            } catch (Exception e) {
-                LOGGER.log(Level.WARNING, "Failed to read properties from " + url, e);
-            }
-        }else{
-            LOGGER.log(Level.WARNING, "No properties found at " + url);
-        }
-        return result;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9bc56a38/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/SimplePropertySource.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/SimplePropertySource.java b/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/SimplePropertySource.java
deleted file mode 100644
index 070a564..0000000
--- a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/SimplePropertySource.java
+++ /dev/null
@@ -1,284 +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.propertysource;
-
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.spi.PropertyValue;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Properties;
-import java.util.UUID;
-import java.util.logging.Logger;
-
-/**
- * Simple implementation of a {@link org.apache.tamaya.spi.PropertySource} for
- * simple property files and XML property files.
- */
-public class SimplePropertySource extends BasePropertySource {
-
-    private static final Logger LOG = Logger.getLogger(SimplePropertySource.class.getName());
-
-    /**
-     * The current properties.
-     */
-    private Map<String, PropertyValue> properties = new HashMap<>();
-
-    /**
-     * Creates a new Properties based PropertySource based on the given URL.
-     *
-     * @param propertiesLocation the URL encoded location, not null.
-     */
-    public SimplePropertySource(File propertiesLocation) {
-        super(propertiesLocation.toString(), 0);
-        try {
-            this.properties = load(propertiesLocation.toURI().toURL());
-        } catch (IOException e) {
-            throw new ConfigException("Failed to load properties from " + propertiesLocation, e);
-        }
-    }
-
-    /**
-     * Creates a new Properties based PropertySource based on the given URL.
-     *
-     * @param propertiesLocation the URL encoded location, not null.
-     */
-    public SimplePropertySource(URL propertiesLocation) {
-        super(propertiesLocation.toString(), 0);
-        this.properties = load(Objects.requireNonNull(propertiesLocation));
-    }
-
-    /**
-     * Creates a new Properties based PropertySource.
-     *
-     * @param name the property source name, not null.
-     * @param properties the properties, not null
-     * @param defaultOrdinal the default ordinal
-     */
-    public SimplePropertySource(String name, Map<String, String> properties, int defaultOrdinal){
-        super(name, defaultOrdinal);
-        for(Map.Entry<String,String> en: properties.entrySet()) {
-            this.properties.put(en.getKey(), PropertyValue.of(en.getKey(), en.getValue(), name));
-        }
-    }
-
-    /**
-     * Creates a new Properties based PropertySource based on the given properties map.
-     *
-     * @param name       the name, not null.
-     * @param properties the properties, not null.
-     */
-    public SimplePropertySource(String name, Map<String, String> properties) {
-        this(name, properties, 0);
-    }
-
-    /**
-     * Creates a new Properties based PropertySource based on the given URL.
-     *
-     * @param name               The property source name
-     * @param propertiesLocation the URL encoded location, not null.
-     */
-    public SimplePropertySource(String name, URL propertiesLocation) {
-        super(name, 0);
-        this.properties = load(propertiesLocation);
-    }
-
-    private SimplePropertySource(Builder builder) {
-        properties = builder.properties;
-        if(builder.defaultOrdinal!=null){
-            setDefaultOrdinal(builder.defaultOrdinal);
-        }
-        if(builder.ordinal!=null){
-            setOrdinal(builder.ordinal);
-        }
-        setName(builder.name);
-    }
-
-    public static Builder newBuilder() {
-        return new Builder();
-    }
-
-    @Override
-    public Map<String, PropertyValue> getProperties() {
-        return this.properties;
-    }
-
-    /**
-     * loads the Properties from the given URL
-     *
-     * @param propertiesFile {@link URL} to load Properties from
-     * @return loaded {@link Properties}
-     * @throws IllegalStateException in case of an error while reading properties-file
-     */
-    private static Map<String, PropertyValue> load(URL propertiesFile) {
-        boolean isXML = isXMLPropertieFiles(propertiesFile);
-
-        Map<String, PropertyValue> properties = new HashMap<>();
-        try (InputStream stream = propertiesFile.openStream()) {
-            Properties props = new Properties();
-            if (stream != null) {
-                if (isXML) {
-                    props.loadFromXML(stream);
-                } else {
-                    props.load(stream);
-                }
-            }
-            String source = propertiesFile.toString();
-            for (String key : props.stringPropertyNames()) {
-                properties.put(key, PropertyValue.of(key, props.getProperty(key), source));
-            }
-        } catch (IOException e) {
-            throw new ConfigException("Error loading properties from " + propertiesFile, e);
-        }
-
-        return properties;
-    }
-
-    private static boolean isXMLPropertieFiles(URL url) {
-        return url.getFile().endsWith(".xml");
-    }
-
-
-    /**
-     * {@code SimplePropertySource} builder static inner class.
-     */
-    public static final class Builder {
-        private String name;
-        private Integer defaultOrdinal;
-        private Integer ordinal;
-        private Map<String, PropertyValue> properties = new HashMap<>();
-
-        private Builder() {
-        }
-
-        /**
-         * Sets the {@code name} to a new UUID and returns a reference to this Builder so that the methods
-         * can be chained together.
-         *
-         * @return a reference to this Builder
-         */
-        public Builder withUuidName() {
-            this.name = UUID.randomUUID().toString();
-            return this;
-        }
-
-        /**
-         * Sets the {@code name} and returns a reference to this Builder so that the methods
-         * can be chained together.
-         *
-         * @param val the {@code name} to set, not null.
-         * @return a reference to this Builder
-         */
-        public Builder withName(String val) {
-            this.name = Objects.requireNonNull(name);
-            return this;
-        }
-
-        /**
-         * Sets the {@code ordinal} and returns a reference to this Builder so that the methods
-         * can be chained together.
-         *
-         * @param val the {@code ordinal} to set
-         * @return a reference to this Builder
-         */
-        public Builder withOrdinal(int val) {
-            this.ordinal = val;
-            return this;
-        }
-
-        /**
-         * Sets the {@code defaultOrdinal} and returns a reference to this Builder so that the methods
-         * can be chained together.
-         *
-         * @param val the {@code defaultOrdinal} to set
-         * @return a reference to this Builder
-         */
-        public Builder withDefaultOrdinal(int val) {
-            this.defaultOrdinal = val;
-            return this;
-        }
-
-        /**
-         * Reads the {@code properties} from the given resource and returns a reference
-         * to this Builder so that the methods can be chained together.
-         *
-         * @param resource the {@code resource} to read
-         * @return a reference to this Builder
-         */
-        public Builder withProperties(URL resource) {
-            this.properties.putAll(load(resource));
-            return this;
-        }
-
-        /**
-         * Reads the {@code properties} from the given resource and returns a reference
-         * to this Builder so that the methods can be chained together.
-         *
-         * @param file the {@code file} to read from (xml or properties format).
-         * @return a reference to this Builder
-         */
-        public Builder withProperties(File file) {
-            try {
-                this.properties.putAll(load(file.toURI().toURL()));
-            } catch (MalformedURLException e) {
-                throw new IllegalArgumentException("Failed to read file: " + file, e);
-            }
-            return this;
-        }
-
-        /**
-         * Sets the {@code properties} and returns a reference to this Builder so that the methods can be chained together.
-         *
-         * @param val the {@code properties} to set
-         * @return a reference to this Builder
-         */
-        public Builder withProperties(Map<String, String> val) {
-            for(Map.Entry<String,String> en: val.entrySet()) {
-                this.properties.put(en.getKey(), PropertyValue.of(en.getKey(), en.getValue(), name));
-            }
-            return this;
-        }
-
-        /**
-         * Sets the {@code properties} and returns a reference to this Builder so that the methods can be chained together.
-         *
-         * @param val the {@code properties} to set
-         * @return a reference to this Builder
-         */
-        public Builder withProperty(String key, String val) {
-            this.properties.put(key, PropertyValue.of(key, val, name));
-            return this;
-        }
-
-        /**
-         * Returns a {@code SimplePropertySource} built from the parameters previously set.
-         *
-         * @return a {@code SimplePropertySource} built with parameters of this {@code SimplePropertySource.Builder}
-         */
-        public SimplePropertySource build() {
-            return new SimplePropertySource(this);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9bc56a38/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/SystemPropertySource.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/SystemPropertySource.java b/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/SystemPropertySource.java
deleted file mode 100644
index cfc60bb..0000000
--- a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/SystemPropertySource.java
+++ /dev/null
@@ -1,199 +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.propertysource;
-
-import org.apache.tamaya.spi.PropertyValue;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * This {@link org.apache.tamaya.spi.PropertySource} manages the system properties. You can disable this feature by
- * setting {@code tamaya.envprops.disable} or {@code tamaya.defaults.disable}.
- */
-public class SystemPropertySource extends BasePropertySource {
-
-    /**
-     * default ordinal used.
-     */
-    public static final int DEFAULT_ORDINAL = 1000;
-
-    private volatile Map<String,PropertyValue> cachedProperties;
-
-    /**
-     * previous System.getProperties().hashCode()
-     * so we can check if we need to reload
-     */
-    private volatile int previousHash;
-
-    /**
-     * Prefix that allows system properties to virtually be mapped on specified sub section.
-     */
-    private String prefix;
-
-    /**
-     * If true, this property source does not return any properties. This is useful since this
-     * property source is applied by default, but can be switched off by setting the
-     * {@code tamaya.envprops.disable} system/environment property to {@code true}.
-     */
-    private boolean disabled = false;
-
-    /**
-     * Creates a new instance. Also initializes the {@code prefix} and {@code disabled} properties
-     * from the system-/ environment properties:
-     * <pre>
-     *     tamaya.envprops.prefix
-     *     tamaya.envprops.disable
-     * </pre>
-     */
-    public SystemPropertySource(){
-        super("system-properties", DEFAULT_ORDINAL);
-        initFromSystemProperties();
-        if(!disabled){
-            cachedProperties = Collections.unmodifiableMap(loadProperties());
-        }
-    }
-
-    /**
-     * Initializes the {@code prefix} and {@code disabled} properties from the system-/
-     * environment properties:
-     * <pre>
-     *     tamaya.envprops.prefix
-     *     tamaya.envprops.disable
-     * </pre>
-     */
-    private void initFromSystemProperties() {
-        String value = System.getProperty("tamaya.sysprops.prefix");
-        if(value==null){
-            prefix = System.getenv("tamaya.sysprops.prefix");
-        }
-        value = System.getProperty("tamaya.sysprops.disable");
-        if(value==null){
-            value = System.getenv("tamaya.sysprops.disable");
-        }
-        if(value==null){
-            value = System.getProperty("tamaya.defaults.disable");
-        }
-        if(value==null){
-            value = System.getenv("tamaya.defaults.disable");
-        }
-        if(value!=null && !value.isEmpty()) {
-            this.disabled = Boolean.parseBoolean(value);
-        }
-    }
-
-    /**
-     * Creates a new instance using a fixed ordinal value.
-     * @param ordinal the ordinal number.
-     */
-    public SystemPropertySource(int ordinal){
-        this(null, ordinal);
-    }
-
-    /**
-     * Creates a new instance.
-     * @param prefix the prefix to be used, or null.
-     * @param ordinal the ordinal to be used.
-     */
-    public SystemPropertySource(String prefix, int ordinal){
-        this.prefix = prefix;
-        setOrdinal(ordinal);
-    }
-
-    /**
-     * Creates a new instance.
-     * @param prefix the prefix to be used, or null.
-     */
-    public SystemPropertySource(String prefix){
-        this.prefix = prefix;
-    }
-
-
-    private Map<String, PropertyValue> loadProperties() {
-        Properties sysProps = System.getProperties();
-        previousHash = System.getProperties().hashCode();
-        final String prefix = this.prefix;
-        Map<String, PropertyValue> entries = new HashMap<>();
-        for (Map.Entry<Object,Object> entry : sysProps.entrySet()) {
-            if(entry.getKey() instanceof String && entry.getValue() instanceof String) {
-                if (prefix == null) {
-                    entries.put((String) entry.getKey(),
-                            PropertyValue.of((String) entry.getKey(),
-                                    (String) entry.getValue(),
-                                    getName()));
-                } else {
-                    entries.put(prefix + entry.getKey(),
-                            PropertyValue.of(prefix + entry.getKey(),
-                                    (String) entry.getValue(),
-                                    getName()));
-                }
-            }
-        }
-        return entries;
-    }
-
-    @Override
-    public String getName() {
-        if(disabled){
-            return super.getName() + "(disabled)";
-        }
-        return super.getName();
-    }
-
-    @Override
-    public PropertyValue get(String key) {
-        if(disabled){
-            return null;
-        }
-        String prefix = this.prefix;
-        if(prefix==null) {
-            return PropertyValue.of(key, System.getProperty(key), getName());
-        }
-        return PropertyValue.of(key, System.getProperty(key.substring(prefix.length())), getName());
-    }
-
-    @Override
-    public Map<String, PropertyValue> getProperties() {
-        if(disabled){
-            return Collections.emptyMap();
-        }
-        // only need to reload and fill our map if something has changed
-        // synchronization was removed, Instance was marked as volatile. In the worst case it
-        // is reloaded twice, but the values will be the same.
-        if (previousHash != System.getProperties().hashCode()) {
-            Map<String, PropertyValue> properties = loadProperties();
-            this.cachedProperties = Collections.unmodifiableMap(properties);
-        }
-        return this.cachedProperties;
-    }
-
-    @Override
-    public boolean isScannable() {
-        return true;
-    }
-
-    @Override
-    protected String toStringValues() {
-        return  super.toStringValues() +
-                "  prefix=" + prefix + '\n' +
-                "  disabled=" + disabled + '\n';
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9bc56a38/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/WrappedPropertySource.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/WrappedPropertySource.java b/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/WrappedPropertySource.java
deleted file mode 100644
index feaaf7b..0000000
--- a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/WrappedPropertySource.java
+++ /dev/null
@@ -1,126 +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.propertysource;
-
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertyValue;
-import org.apache.tamaya.spisupport.PropertySourceComparator;
-
-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);
-    }
-
-    public int getOrdinal() {
-        if(this.ordinal!=null){
-            return this.ordinal;
-        }
-        return PropertySourceComparator.getOrdinal(delegate);
-    }
-
-    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, PropertyValue> 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() +
-                '}';
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9bc56a38/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/package-info.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/package-info.java b/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/package-info.java
deleted file mode 100644
index 21e5aec..0000000
--- a/code/spi-support/src/main/java/org/apache/tamaya/spisupport/propertysource/package-info.java
+++ /dev/null
@@ -1,23 +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.
- */
-
-/**
- * Contains internal implementations artifacts registered as services.
- */
-package org.apache.tamaya.spisupport.propertysource;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9bc56a38/code/spi-support/src/test/java/org/apache/tamaya/spisupport/A.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/A.java b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/A.java
deleted file mode 100644
index 4101f1e..0000000
--- a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/A.java
+++ /dev/null
@@ -1,29 +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;
-
-/**
- * Test class for testing transitively evaluated property converters.
- */
-class A implements AutoCloseable{
-    @Override
-    public void close() throws Exception {
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9bc56a38/code/spi-support/src/test/java/org/apache/tamaya/spisupport/B.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/B.java b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/B.java
deleted file mode 100644
index 584b923..0000000
--- a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/B.java
+++ /dev/null
@@ -1,29 +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;
-
-/**
- * Test class for testing transitively evaluated property converters.
- */
-public class B extends A implements Runnable{
-    @Override
-    public void run() {
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9bc56a38/code/spi-support/src/test/java/org/apache/tamaya/spisupport/BuildablePropertySourceProviderTest.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/BuildablePropertySourceProviderTest.java b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/BuildablePropertySourceProviderTest.java
deleted file mode 100644
index 5f95859..0000000
--- a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/BuildablePropertySourceProviderTest.java
+++ /dev/null
@@ -1,78 +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.spisupport.propertysource.BuildablePropertySource;
-import org.apache.tamaya.spisupport.propertysource.BuildablePropertySourceProvider;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-public class BuildablePropertySourceProviderTest {
-
-    @Test
-    public void getPropertySources() throws Exception {
-        BuildablePropertySource ps = BuildablePropertySource.builder()
-                .withName("test1").build();
-        BuildablePropertySourceProvider prov = BuildablePropertySourceProvider.builder()
-                .withPropertySourcs(ps).build();
-        assertNotNull(prov);
-        assertEquals(prov.getPropertySources().iterator().next(), ps);
-    }
-
-    @Test
-    public void equals() throws Exception {
-        BuildablePropertySource ps = BuildablePropertySource.builder()
-                .withName("test1").build();
-        BuildablePropertySourceProvider prov1 = BuildablePropertySourceProvider.builder()
-                .withPropertySourcs(ps).build();
-        BuildablePropertySourceProvider prov2 = BuildablePropertySourceProvider.builder()
-                .withPropertySourcs(ps).build();
-        assertEquals(prov1, prov2);
-        BuildablePropertySource ps2 = BuildablePropertySource.builder()
-                .withName("test12").build();
-        prov2 = BuildablePropertySourceProvider.builder()
-                .withPropertySourcs(ps2).build();
-        assertNotEquals(prov1, prov2);
-    }
-
-    @Test
-    public void testHashCode() throws Exception {
-        BuildablePropertySource ps = BuildablePropertySource.builder()
-                .withName("test1").build();
-        BuildablePropertySourceProvider prov1 = BuildablePropertySourceProvider.builder()
-                .withPropertySourcs(ps).build();
-        BuildablePropertySourceProvider prov2 = BuildablePropertySourceProvider.builder()
-                .withPropertySourcs(ps).build();
-        assertEquals(prov1.hashCode(), prov2.hashCode());
-        BuildablePropertySource ps2 = BuildablePropertySource.builder()
-                .withName("test12").build();
-        prov2 = BuildablePropertySourceProvider.builder()
-                .withPropertySourcs(ps2).build();
-        assertNotEquals(prov1.hashCode(), prov2.hashCode());
-    }
-
-
-    @Test
-    public void builder() throws Exception {
-        assertNotNull(BuildablePropertySource.builder());
-        assertNotEquals(BuildablePropertySource.builder(), BuildablePropertySource.builder());
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9bc56a38/code/spi-support/src/test/java/org/apache/tamaya/spisupport/BuildablePropertySourceTest.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/BuildablePropertySourceTest.java b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/BuildablePropertySourceTest.java
deleted file mode 100644
index b91cb59..0000000
--- a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/BuildablePropertySourceTest.java
+++ /dev/null
@@ -1,89 +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.spisupport.propertysource.BuildablePropertySource;
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-public class BuildablePropertySourceTest {
-    @Test
-    public void getOrdinal() throws Exception {
-        BuildablePropertySource ps1 = BuildablePropertySource.builder()
-                .withOrdinal(55).build();
-        assertEquals(55, ps1.getOrdinal());
-    }
-
-    @Test
-    public void getName() throws Exception {
-        BuildablePropertySource ps1 = BuildablePropertySource.builder()
-                .withName("test1").build();
-        assertEquals("test1", ps1.getName());
-        ps1 = BuildablePropertySource.builder().build();
-        assertNotNull(ps1.getName());
-    }
-
-    @Test
-    public void get() throws Exception {
-        BuildablePropertySource ps1 = BuildablePropertySource.builder()
-                .withSimpleProperty("a", "b").build();
-        assertEquals("b", ps1.get("a").getValue());
-    }
-
-    @Test
-    public void getProperties() throws Exception {
-        BuildablePropertySource ps1 = BuildablePropertySource.builder()
-                .withSimpleProperty("a", "b").build();
-        assertNotNull(ps1.getProperties());
-        assertEquals(1, ps1.getProperties().size());
-        assertEquals("b", ps1.getProperties().get("a").getValue());
-    }
-
-    @Test
-    public void equals() throws Exception {
-        BuildablePropertySource ps1 = BuildablePropertySource.builder()
-                .withName("test1").build();
-        BuildablePropertySource ps2 = BuildablePropertySource.builder()
-                .withName("test1").build();
-        assertEquals(ps1, ps2);
-        ps2 = BuildablePropertySource.builder()
-                .withName("test2").build();
-        assertNotEquals(ps1, ps2);
-    }
-
-    @Test
-    public void testHashCode() throws Exception {
-        BuildablePropertySource ps1 = BuildablePropertySource.builder()
-                .withName("test1").build();
-        BuildablePropertySource ps2 = BuildablePropertySource.builder()
-                .withName("test1").build();
-        assertEquals(ps1.hashCode(), ps2.hashCode());
-        ps2 = BuildablePropertySource.builder()
-                .withName("test2").build();
-        assertNotEquals(ps1.hashCode(), ps2.hashCode());
-    }
-
-    @Test
-    public void builder() throws Exception {
-        assertNotNull(BuildablePropertySource.builder());
-        assertNotEquals(BuildablePropertySource.builder(), BuildablePropertySource.builder());
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9bc56a38/code/spi-support/src/test/java/org/apache/tamaya/spisupport/C.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/C.java b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/C.java
deleted file mode 100644
index da581e6..0000000
--- a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/C.java
+++ /dev/null
@@ -1,56 +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 java.io.IOException;
-import java.nio.CharBuffer;
-
-/**
- * Test class for testing transitively evaluated property converters.
- */
-public class C extends B implements Readable{
-
-    private final String inValue;
-
-    public C(String inValue){
-        this.inValue = inValue;
-    }
-
-    @Override
-    public int read(CharBuffer cb) throws IOException {
-        return 0;
-    }
-
-    /**
-     * Returns the input value, set on creation. Used for test assertion.
-     * @return the in value.
-     */
-    public String getInValue() {
-        return inValue;
-    }
-
-    @Override
-    public String toString() {
-        return "C{" +
-                "inValue='" + inValue + '\'' +
-                '}';
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9bc56a38/code/spi-support/src/test/java/org/apache/tamaya/spisupport/CTestConverter.java
----------------------------------------------------------------------
diff --git a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/CTestConverter.java b/code/spi-support/src/test/java/org/apache/tamaya/spisupport/CTestConverter.java
deleted file mode 100644
index dce8121..0000000
--- a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/CTestConverter.java
+++ /dev/null
@@ -1,32 +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.ConversionContext;
-import org.apache.tamaya.spi.PropertyConverter;
-
-/**
- * Created by Anatole on 13.06.2015.
- */
-public class CTestConverter implements PropertyConverter<C>{
-    @Override
-    public C convert(String value, ConversionContext context) {
-        return new C(value);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9bc56a38/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
deleted file mode 100644
index c586969..0000000
--- a/code/spi-support/src/test/java/org/apache/tamaya/spisupport/DefaultConfigurationBuilderTest.java
+++ /dev/null
@@ -1,220 +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.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.TypeLiteral;
-import org.apache.tamaya.spi.ConfigurationBuilder;
-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  DefaultConfigurationBuilder} by atsticks on 06.09.16.
- */
-public class DefaultConfigurationBuilderTest {
-
-    private TestPropertySource testPropertySource = new TestPropertySource(){};
-
-    @Test
-    public void setContext() throws Exception {
-        ConfigurationContext context = ConfigurationProvider.getConfiguration().getContext();
-        ConfigurationBuilder b = new DefaultConfigurationBuilder()
-                .setContext(context);
-        assertEquals(context, b.build().getContext());
-    }
-
-    @Test
-    public void setConfiguration() throws Exception {
-        Configuration cfg = ConfigurationProvider.getConfiguration();
-        ConfigurationBuilder b = new DefaultConfigurationBuilder()
-                .setConfiguration(cfg);
-        assertEquals(cfg, b.build());
-    }
-
-    @Test
-    public void addPropertySources_Array() throws Exception {
-        PropertySource testPS2 = new TestPropertySource("addPropertySources_Array_2");
-        ConfigurationBuilder b = new DefaultConfigurationBuilder()
-                .addPropertySources(testPropertySource, testPS2);
-        Configuration cfg = b.build();
-        ConfigurationContext ctx = cfg.getContext();
-        assertEquals(2, ctx.getPropertySources().size());
-        assertTrue(ctx.getPropertySources().contains(testPropertySource));
-        assertTrue(ctx.getPropertySources().contains(testPS2));
-    }
-
-    @Test
-    public void removePropertySources_Array() throws Exception {
-        PropertySource testPS2 = new TestPropertySource("addPropertySources_Array_2");
-        ConfigurationBuilder b = new DefaultConfigurationBuilder()
-                .addPropertySources(testPropertySource, testPS2);
-        Configuration cfg = b.build();
-        ConfigurationContext ctx = cfg.getContext();
-        assertEquals(2, ctx.getPropertySources().size());
-        assertTrue(ctx.getPropertySources().contains(testPropertySource));
-        assertTrue(ctx.getPropertySources().contains(testPS2));
-        b = new DefaultConfigurationBuilder()
-                .addPropertySources(testPropertySource, testPS2);
-        b.removePropertySources(testPropertySource);
-        cfg = b.build();
-        ctx = cfg.getContext();
-        assertEquals(1, ctx.getPropertySources().size());
-        assertFalse(ctx.getPropertySources().contains(testPropertySource));
-        assertTrue(ctx.getPropertySources().contains(testPS2));
-    }
-
-    @Test
-    public void addPropertyFilters_Array() throws Exception {
-        PropertyFilter filter1 = (value, context) -> value;
-        PropertyFilter filter2 = (value, context) -> value;
-        DefaultConfigurationBuilder b = new DefaultConfigurationBuilder();
-        b.addPropertyFilters(filter1, filter2);
-        Configuration cfg = b.build();
-        ConfigurationContext ctx = cfg.getContext();
-        assertTrue(ctx.getPropertyFilters().contains(filter1));
-        assertTrue(ctx.getPropertyFilters().contains(filter2));
-        assertEquals(2, ctx.getPropertyFilters().size());
-        b = new DefaultConfigurationBuilder();
-        b.addPropertyFilters(filter1, filter2);
-        b.addPropertyFilters(filter1, filter2);
-        assertEquals(2, ctx.getPropertyFilters().size());
-    }
-
-    @Test
-    public void removePropertyFilters_Array() throws Exception {
-        PropertyFilter filter1 = (value, context) -> value;
-        PropertyFilter filter2 = (value, context) -> value;
-        ConfigurationBuilder b = new DefaultConfigurationBuilder()
-                .addPropertyFilters(filter1, filter2);
-        Configuration cfg = b.build();
-        ConfigurationContext ctx = cfg.getContext();
-        assertTrue(ctx.getPropertyFilters().contains(filter1));
-        assertTrue(ctx.getPropertyFilters().contains(filter2));
-        assertEquals(2, ctx.getPropertyFilters().size());
-        b = new DefaultConfigurationBuilder()
-                .addPropertyFilters(filter1, filter2);
-        b.removePropertyFilters(filter1);
-        cfg = b.build();
-        ctx = cfg.getContext();
-        assertEquals(1, ctx.getPropertyFilters().size());
-        assertFalse(ctx.getPropertyFilters().contains(filter1));
-        assertTrue(ctx.getPropertyFilters().contains(filter2));
-    }
-
-    @Test
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    public void addPropertyConverter() throws Exception {
-		PropertyConverter converter = (value, context) -> value.toLowerCase();
-		ConfigurationBuilder b = new DefaultConfigurationBuilder()
-                .addPropertyConverters(TypeLiteral.of(String.class), converter);
-        Configuration cfg = b.build();
-        ConfigurationContext ctx = cfg.getContext();
-        assertTrue(ctx.getPropertyConverters(TypeLiteral.of(String.class)).contains(converter));
-        assertEquals(1, ctx.getPropertyConverters().size());
-        b = new DefaultConfigurationBuilder()
-                .addPropertyConverters(TypeLiteral.of(String.class), converter);
-        b.addPropertyConverters(TypeLiteral.of(String.class), converter);
-        assertEquals(1, ctx.getPropertyConverters().size());
-    }
-
-    @Test
-    @SuppressWarnings({ "rawtypes", "unchecked" })
-    public void removePropertyConverters_Array() throws Exception {
-        PropertyConverter converter = (value, context) -> value.toLowerCase();
-        ConfigurationBuilder b = new DefaultConfigurationBuilder()
-                .addPropertyConverters(TypeLiteral.of(String.class), converter);
-        Configuration cfg = b.build();
-        ConfigurationContext ctx = cfg.getContext();
-        assertTrue(ctx.getPropertyConverters(TypeLiteral.of(String.class)).contains(converter));
-        assertEquals(1, ctx.getPropertyConverters(TypeLiteral.of(String.class)).size());
-        b = new DefaultConfigurationBuilder()
-                .addPropertyConverters(TypeLiteral.of(String.class), converter);
-        b.removePropertyConverters(TypeLiteral.of(String.class), converter);
-        cfg = b.build();
-        ctx = cfg.getContext();
-        assertFalse(ctx.getPropertyConverters(TypeLiteral.of(String.class)).contains(converter));
-        assertTrue(ctx.getPropertyConverters(TypeLiteral.of(String.class)).isEmpty());
-    }
-
-    @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();
-        assertEquals(ctx.getPropertyValueCombinationPolicy(), combPol);
-    }
-
-    @Test
-    public void build() throws Exception {
-        assertNotNull(new DefaultConfigurationBuilder().build());
-    }
-
-    @Test
-    public void bla() throws Exception {
-        ConfigurationBuilder builder = ConfigurationProvider.getConfigurationBuilder();
-        builder.addDefaultPropertyConverters();
-    }
-
-    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, PropertyValue> getProperties() {
-            return Collections.emptyMap();
-        }
-
-        @Override
-        public boolean isScannable() {
-            return false;
-        }
-    }
-
-}
\ No newline at end of file


Mime
View raw message