You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by an...@apache.org on 2015/03/24 22:20:28 UTC

[11/16] incubator-tamaya git commit: Simplified module, reduced to core format functionality. Established extendability, removed references to implementation classes. Switched to use of format abstraction of redefining their own.

Simplified module, reduced to core format functionality.
Established extendability, removed references to implementation classes.
Switched to use of format abstraction of redefining their own.


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

Branch: refs/heads/master
Commit: 9c32dde2ef650f1e177ca3b676bf46ee866f9baf
Parents: 312010a
Author: anatole <an...@apache.org>
Authored: Tue Mar 24 19:55:40 2015 +0100
Committer: anatole <an...@apache.org>
Committed: Tue Mar 24 19:55:40 2015 +0100

----------------------------------------------------------------------
 .../tamaya/json/JSONConfigurationFormat.java    |  47 ------
 .../java/org/apache/tamaya/json/JSONFormat.java |   7 +-
 .../apache/tamaya/json/JSONPropertySource.java  | 152 +++++--------------
 .../tamaya/json/JSONPropertySourceProvider.java |  64 --------
 .../org/apache/tamaya/json/JSONVisitor.java     |   7 +-
 .../json/CommonJSONTestCaseCollection.java      |  15 +-
 .../tamaya/json/ConfigurationDataUCD.java       |  44 ------
 .../org/apache/tamaya/json/JSONFormatTest.java  |  12 +-
 ...pertySourceProviderExistingConfigFileIT.java |  87 -----------
 ...opertySourceProviderMissingConfigFileIT.java |  69 ---------
 .../tamaya/json/JSONPropertySourceTest.java     |  12 +-
 .../tamaya/json/JSONPropertySourceUCD.java      |  39 -----
 .../apache/tamaya/json/UnifiedConfigData.java   |  32 ----
 13 files changed, 61 insertions(+), 526 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9c32dde2/modules/json/src/main/java/org/apache/tamaya/json/JSONConfigurationFormat.java
----------------------------------------------------------------------
diff --git a/modules/json/src/main/java/org/apache/tamaya/json/JSONConfigurationFormat.java b/modules/json/src/main/java/org/apache/tamaya/json/JSONConfigurationFormat.java
deleted file mode 100644
index 367bd11..0000000
--- a/modules/json/src/main/java/org/apache/tamaya/json/JSONConfigurationFormat.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.json;
-
-import org.apache.tamaya.format.ConfigurationData;
-import org.apache.tamaya.format.ConfigurationFormat;
-
-import java.io.InputStream;
-import java.net.URL;
-
-/**
- * Configuration format able to read JSON files and to turn them in
- * {@link org.apache.tamaya.format.ConfigurationData} instances.
- */
-public class JSONConfigurationFormat implements ConfigurationFormat {
-
-    @Override
-    public String getName() {
-        return "json";
-    }
-
-    @Override
-    public boolean accepts(URL url) {
-        throw new java.lang.RuntimeException("Not implemented yet!");
-    }
-
-    @Override
-    public ConfigurationData readConfiguration(String resource, InputStream inputStream) {
-        throw new java.lang.RuntimeException("Not implemented yet!");
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9c32dde2/modules/json/src/main/java/org/apache/tamaya/json/JSONFormat.java
----------------------------------------------------------------------
diff --git a/modules/json/src/main/java/org/apache/tamaya/json/JSONFormat.java b/modules/json/src/main/java/org/apache/tamaya/json/JSONFormat.java
index 80d5196..06a5f93 100644
--- a/modules/json/src/main/java/org/apache/tamaya/json/JSONFormat.java
+++ b/modules/json/src/main/java/org/apache/tamaya/json/JSONFormat.java
@@ -48,12 +48,7 @@ public class JSONFormat implements ConfigurationFormat {
 
     @Override
     public boolean accepts(URL url) {
-        Objects.requireNonNull(url);
-
-        boolean isAFile = url.getProtocol().equals("file");
-        boolean isJSON = url.getPath().endsWith(".json");
-
-        return isAFile && isJSON;
+        return Objects.requireNonNull(url).getPath().endsWith(".json");
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9c32dde2/modules/json/src/main/java/org/apache/tamaya/json/JSONPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/json/src/main/java/org/apache/tamaya/json/JSONPropertySource.java b/modules/json/src/main/java/org/apache/tamaya/json/JSONPropertySource.java
index 2712f3f..e9e0bcb 100644
--- a/modules/json/src/main/java/org/apache/tamaya/json/JSONPropertySource.java
+++ b/modules/json/src/main/java/org/apache/tamaya/json/JSONPropertySource.java
@@ -22,149 +22,81 @@ import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.core.propertysource.DefaultOrdinal;
-import org.apache.tamaya.resource.ResourceResolver;
 import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.ServiceContext;
 
-import java.io.File;
 import java.io.InputStream;
-import java.net.MalformedURLException;
 import java.net.URL;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Objects;
-import java.util.Optional;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.StampedLock;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import static java.lang.String.format;
 
 /**
  * Property source based on a JSON file.
  */
-public class JSONPropertySource
-    implements PropertySource {
-
+public class JSONPropertySource implements PropertySource {
+    /** The underlying resource. */
     private URL urlResource;
-    private int priority = DefaultOrdinal.FILE_PROPERTIES;
-
-    private HashMap<String, String> values;
+    /** The values read. */
+    private Map<String, String> values;
+    /** The evaluated ordinal. */
+    private int ordinal;
 
     /**
-     * Lock for internal synchronization.
+     * Constructor, hereby using 0 as the default ordinal.
+     * @param resource the resource modelled as URL, not null.
      */
-    private StampedLock propertySourceLock = new StampedLock();
-
     public JSONPropertySource(URL resource) {
-        init(resource);
+        this(resource, 0);
     }
 
-    public JSONPropertySource(String resourcePath) {
-        this(resourcePath, DefaultOrdinal.FILE_PROPERTIES);
-    }
-
-    public JSONPropertySource(String resourcePath, int prio) {
-        priority = prio;
-
-        Optional<ResourceResolver> resolver = ServiceContext.getInstance().getService(ResourceResolver.class);
-
-        if (!resolver.isPresent()) {
-            throw new ConfigException("Unable to load " + ResourceResolver.class.getCanonicalName());
-        }
-
-        Collection<URL> resources = resolver.get().getResources(resourcePath);
-
-        if (resources.size() == 0) {
-            throw new ConfigException("Unable to find " + resourcePath);
-        } else if (resources.size() > 1) {
-            throw new ConfigException("Unable to resolve " + resourcePath + " to a single resource.");
-        }
-
-        URL url = resources.iterator().next();
-
-        init(url, prio);
-    }
-
-    public JSONPropertySource(File file) {
-        init(file);
-    }
-
-    private void init(File resource) {
-        init(resource, DefaultOrdinal.FILE_PROPERTIES);
-    }
-
-    private void init(File resource, int prio) {
-
-        try {
-            init(resource.toURI().toURL(), prio);
-        } catch (MalformedURLException e) {
-            throw new ConfigException(format("%s seems not to be a valid file.", resource), e);
+    /**
+     * Constructor.
+     * @param resource the resource modelled as URL, not null.
+     * @param defaultOrdinal the defaultOrdinal to be used.
+     */
+    public JSONPropertySource(URL resource, int defaultOrdinal) {
+        urlResource = Objects.requireNonNull(resource);
+        this.ordinal = defaultOrdinal; // may be overriden by read...
+        this.values = readConfig(urlResource);
+        if (this.values.containsKey(TAMAYA_ORDINAL)) {
+            this.ordinal = Integer.parseInt(this.values.get(TAMAYA_ORDINAL));
         }
     }
 
-    private void init(URL resource) {
-        init(resource, DefaultOrdinal.FILE_PROPERTIES);
-    }
-
-    private void init(URL resource, int prio) {
-        priority = prio;
-        urlResource = resource;
-    }
-
-    public JSONPropertySource(File file, int priority) {
-        init(file, priority);
-    }
 
     @Override
     public int getOrdinal() {
-        Lock writeLock = propertySourceLock.asWriteLock();
-
-        try {
-            writeLock.lock();
-
-            if (values == null) {
-                readSource();
+        String configuredOrdinal = get(TAMAYA_ORDINAL);
+        if(configuredOrdinal!=null){
+            try{
+                return Integer.parseInt(configuredOrdinal);
+            } catch(Exception e){
+                Logger.getLogger(getClass().getName()).log(Level.WARNING, e,
+                        () -> "Configured Ordinal is not an int number: " + configuredOrdinal);
             }
-        } finally {
-            writeLock.unlock();
         }
-
-        return priority;
+        return ordinal;
     }
 
     @Override
     public String getName() {
-        return "json-properties";
-    }
-
-    @Override
-    public String get(String key) {
-        Objects.requireNonNull(key, "Key must not be null");
-
-        return getProperties().get(key);
+        return urlResource.toExternalForm();
     }
 
     @Override
     public Map<String, String> getProperties() {
-        Lock writeLock = propertySourceLock.asWriteLock();
-
-        try {
-            writeLock.lock();
-
-            if (values == null) {
-                readSource();
-            }
-
-            return Collections.unmodifiableMap(values);
-        } finally {
-            writeLock.unlock();
-        }
+        return Collections.unmodifiableMap(values);
     }
 
-    protected void readSource() {
+    /**
+     * Reads the configuration.
+     */
+    protected Map<String, String> readConfig(URL urlResource) {
         try (InputStream is = urlResource.openStream()) {
             ObjectMapper mapper = new ObjectMapper();
             JsonNode root = mapper.readTree(is);
@@ -174,22 +106,14 @@ public class JSONPropertySource
                 throw new ConfigException("Currently only JSON objects are supported");
             }
 
-            HashMap<String, String> values = new HashMap<>();
+            Map<String, String> values = new HashMap<>();
             JSONVisitor visitor = new JSONVisitor((ObjectNode) root, values);
             visitor.run();
-
-            this.values = values;
-
-            if (this.values.containsKey(TAMAYA_ORDINAL)) {
-                int newPriority = Integer.parseInt(this.values.get(TAMAYA_ORDINAL));
-                priority = newPriority;
-                this.values.remove(TAMAYA_ORDINAL);
-            }
+            return values;
         }
         catch (Throwable t) {
             throw new ConfigException(format("Failed to read properties from %s", urlResource.toExternalForm()), t);
         }
-
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9c32dde2/modules/json/src/main/java/org/apache/tamaya/json/JSONPropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/modules/json/src/main/java/org/apache/tamaya/json/JSONPropertySourceProvider.java b/modules/json/src/main/java/org/apache/tamaya/json/JSONPropertySourceProvider.java
deleted file mode 100644
index 23818ac..0000000
--- a/modules/json/src/main/java/org/apache/tamaya/json/JSONPropertySourceProvider.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.tamaya.json;
-
-import org.apache.tamaya.ConfigException;
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertySourceProvider;
-
-import java.net.URL;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
-
-import static java.util.stream.Collectors.toList;
-
-/**
- * Provides all <a href="http://json.org">JSON</a>
- * property sources found in the  classpath
- * in {@code META-INF/javaconfiguration.json}.
- *
- * @see PropertySourceProvider
- */
-public class JSONPropertySourceProvider implements PropertySourceProvider {
-    public final static String DEFAULT_RESOURCE_NAME = "javaconfiguration.json";
-
-    @Override
-    public Collection<PropertySource> getPropertySources() {
-        List<PropertySource> sources;
-
-        try {
-            ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-            Enumeration<URL> urls = classLoader.getResources("META-INF/" + DEFAULT_RESOURCE_NAME);
-
-            sources = Collections.list(urls)
-                                 .stream()
-                                 .map(JSONPropertySource::new)
-                                 .collect(toList());
-
-        } catch (Exception e) {
-            String msg = "Failure while loading JSON property sources.";
-
-            throw new ConfigException(msg, e);
-        }
-
-        return sources;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9c32dde2/modules/json/src/main/java/org/apache/tamaya/json/JSONVisitor.java
----------------------------------------------------------------------
diff --git a/modules/json/src/main/java/org/apache/tamaya/json/JSONVisitor.java b/modules/json/src/main/java/org/apache/tamaya/json/JSONVisitor.java
index d233005..bfa7260 100644
--- a/modules/json/src/main/java/org/apache/tamaya/json/JSONVisitor.java
+++ b/modules/json/src/main/java/org/apache/tamaya/json/JSONVisitor.java
@@ -31,9 +31,9 @@ import java.util.*;
  */
 public class JSONVisitor {
     private final ObjectNode rootNode;
-    private final HashMap<String, String> targetStore;
+    private final Map<String, String> targetStore;
 
-    public JSONVisitor(ObjectNode startNode, HashMap<String, String> target) {
+    public JSONVisitor(ObjectNode startNode, Map<String, String> target) {
         rootNode = startNode;
         targetStore = target;
     }
@@ -96,8 +96,7 @@ public class JSONVisitor {
 
 
         public boolean hasNext() {
-            boolean hasNext = elements.hasNext();
-            return hasNext;
+            return elements.hasNext();
         }
 
         public String getNSPrefix() {

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9c32dde2/modules/json/src/test/java/org/apache/tamaya/json/CommonJSONTestCaseCollection.java
----------------------------------------------------------------------
diff --git a/modules/json/src/test/java/org/apache/tamaya/json/CommonJSONTestCaseCollection.java b/modules/json/src/test/java/org/apache/tamaya/json/CommonJSONTestCaseCollection.java
index 54e8994..eb06529 100644
--- a/modules/json/src/test/java/org/apache/tamaya/json/CommonJSONTestCaseCollection.java
+++ b/modules/json/src/test/java/org/apache/tamaya/json/CommonJSONTestCaseCollection.java
@@ -19,6 +19,7 @@
 package org.apache.tamaya.json;
 
 import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.spi.PropertySource;
 import org.hamcrest.CoreMatchers;
 import org.hamcrest.Matchers;
 import org.junit.Test;
@@ -37,7 +38,7 @@ import static org.hamcrest.Matchers.hasSize;
  */
 public abstract class CommonJSONTestCaseCollection {
 
-    abstract UnifiedConfigData getPropertiesFrom(URL source) throws Exception;
+    abstract PropertySource getPropertiesFrom(URL source) throws Exception;
 
     @Test
     public void canReadNestedStringOnlyJSONConfigFile() throws Exception {
@@ -46,7 +47,7 @@ public abstract class CommonJSONTestCaseCollection {
 
         assertThat(configURL, CoreMatchers.notNullValue());
 
-        UnifiedConfigData properties = getPropertiesFrom(configURL);
+        PropertySource properties = getPropertiesFrom(configURL);
 
         assertThat(properties.getProperties().keySet(), hasSize(5));
 
@@ -70,7 +71,7 @@ public abstract class CommonJSONTestCaseCollection {
 
         assertThat(configURL, CoreMatchers.notNullValue());
 
-        UnifiedConfigData properties = getPropertiesFrom(configURL);
+        PropertySource properties = getPropertiesFrom(configURL);
 
         assertThat(properties.getProperties().keySet(), hasSize(4));
 
@@ -122,7 +123,7 @@ public abstract class CommonJSONTestCaseCollection {
 
         assertThat(configURL, CoreMatchers.notNullValue());
 
-        UnifiedConfigData properties = getPropertiesFrom(configURL);
+        PropertySource properties = getPropertiesFrom(configURL);
 
         assertThat(properties.getOrdinal(), is(16784));
     }
@@ -133,7 +134,7 @@ public abstract class CommonJSONTestCaseCollection {
 
         assertThat(configURL, CoreMatchers.notNullValue());
 
-        UnifiedConfigData properties = getPropertiesFrom(configURL);
+        PropertySource properties = getPropertiesFrom(configURL);
 
         assertThat(properties.getProperties().keySet(), hasSize(3));
 
@@ -155,7 +156,7 @@ public abstract class CommonJSONTestCaseCollection {
 
         assertThat(configURL, CoreMatchers.notNullValue());
 
-        UnifiedConfigData properties = getPropertiesFrom(configURL);
+        PropertySource properties = getPropertiesFrom(configURL);
 
         properties.getProperties();
     }
@@ -166,7 +167,7 @@ public abstract class CommonJSONTestCaseCollection {
 
         assertThat(configURL, CoreMatchers.notNullValue());
 
-        UnifiedConfigData properties = getPropertiesFrom(configURL);
+        PropertySource properties = getPropertiesFrom(configURL);
 
         assertThat(properties.getProperties().keySet(), hasSize(0));
     }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9c32dde2/modules/json/src/test/java/org/apache/tamaya/json/ConfigurationDataUCD.java
----------------------------------------------------------------------
diff --git a/modules/json/src/test/java/org/apache/tamaya/json/ConfigurationDataUCD.java b/modules/json/src/test/java/org/apache/tamaya/json/ConfigurationDataUCD.java
deleted file mode 100644
index ab3e4ce..0000000
--- a/modules/json/src/test/java/org/apache/tamaya/json/ConfigurationDataUCD.java
+++ /dev/null
@@ -1,44 +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.json;
-
-import org.apache.tamaya.format.ConfigurationData;
-import org.apache.tamaya.spi.PropertySource;
-
-import java.util.Map;
-
-public class ConfigurationDataUCD implements UnifiedConfigData {
-    private ConfigurationData data;
-
-    public ConfigurationDataUCD(ConfigurationData configurationData) {
-        data = configurationData;
-    }
-
-    @Override
-    public Map<String, String> getProperties() {
-        return data.getDefaultSection();
-    }
-
-    @Override
-    public int getOrdinal() {
-        String value = data.getDefaultSection().get(PropertySource.TAMAYA_ORDINAL);
-
-        return Integer.parseInt(value);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9c32dde2/modules/json/src/test/java/org/apache/tamaya/json/JSONFormatTest.java
----------------------------------------------------------------------
diff --git a/modules/json/src/test/java/org/apache/tamaya/json/JSONFormatTest.java b/modules/json/src/test/java/org/apache/tamaya/json/JSONFormatTest.java
index 84c57f8..175e186 100644
--- a/modules/json/src/test/java/org/apache/tamaya/json/JSONFormatTest.java
+++ b/modules/json/src/test/java/org/apache/tamaya/json/JSONFormatTest.java
@@ -20,6 +20,8 @@ package org.apache.tamaya.json;
 
 
 import org.apache.tamaya.format.ConfigurationData;
+import org.apache.tamaya.format.FlattenedDefaultPropertySource;
+import org.apache.tamaya.spi.PropertySource;
 import org.junit.Test;
 
 import java.io.InputStream;
@@ -53,23 +55,21 @@ public class JSONFormatTest extends CommonJSONTestCaseCollection {
     @Test
     public void aHTTPBasedURLIsNotAccepted() throws Exception {
         URL url = new URL("http://nowhere.somewhere/conf.json");
-
-        assertThat(format.accepts(url), is(false));
+        assertThat(format.accepts(url), is(true));
     }
 
     @Test
     public void aFTPBasedURLIsNotAccepted() throws Exception {
         URL url = new URL("ftp://nowhere.somewhere/a/b/c/d/conf.json");
 
-        assertThat(format.accepts(url), is(false));
+        assertThat(format.accepts(url), is(true));
     }
 
     @Override
-    UnifiedConfigData getPropertiesFrom(URL source) throws Exception {
+    PropertySource getPropertiesFrom(URL source) throws Exception {
         try (InputStream is = source.openStream()) {
             ConfigurationData data = format.readConfiguration(source.toString(), is);
-
-            return new ConfigurationDataUCD(data);
+            return new FlattenedDefaultPropertySource(data);
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9c32dde2/modules/json/src/test/java/org/apache/tamaya/json/JSONPropertySourceProviderExistingConfigFileIT.java
----------------------------------------------------------------------
diff --git a/modules/json/src/test/java/org/apache/tamaya/json/JSONPropertySourceProviderExistingConfigFileIT.java b/modules/json/src/test/java/org/apache/tamaya/json/JSONPropertySourceProviderExistingConfigFileIT.java
deleted file mode 100644
index f9ecb89..0000000
--- a/modules/json/src/test/java/org/apache/tamaya/json/JSONPropertySourceProviderExistingConfigFileIT.java
+++ /dev/null
@@ -1,87 +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.json;
-
-import com.fasterxml.jackson.annotation.JsonAutoDetect;
-import com.fasterxml.jackson.core.JsonFactory;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.PropertyName;
-import org.apache.tamaya.core.internal.DefaultServiceContext;
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertySourceProvider;
-import org.apache.tamaya.spi.ServiceContext;
-import org.hamcrest.Matchers;
-import org.jboss.arquillian.container.test.api.Deployment;
-import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.util.List;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.notNullValue;
-import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
-
-@RunWith(Arquillian.class)
-public class JSONPropertySourceProviderExistingConfigFileIT {
-
-    @Deployment
-    public static JavaArchive createDeployment() {
-        JavaArchive archive = ShrinkWrap.create(JavaArchive.class);
-
-        archive.addPackage(ObjectMapper.class.getPackage())
-               .addPackages(true, JsonFactory.class.getPackage())
-               .addPackages(true, PropertyName.class.getPackage())
-               .addPackages(true, JsonAutoDetect.class.getPackage());
-
-        archive.addPackage(org.apache.tamaya.Configuration.class.getPackage())
-               .addPackage(org.apache.tamaya.spi.PropertySource.class.getPackage());
-
-        archive.addPackage(DefaultServiceContext.class.getPackage())
-               .addAsServiceProvider(ServiceContext.class, DefaultServiceContext.class);
-
-        archive.addPackage(JSONPropertySource.class.getPackage())
-               .addAsServiceProvider(PropertySourceProvider.class, JSONPropertySourceProvider.class);
-
-        archive.addAsManifestResource("configs/valid/simple-flat-string-only-config.json",
-                                      JSONPropertySourceProvider.DEFAULT_RESOURCE_NAME);
-
-        return archive;
-    }
-
-    @Test
-    public void providerReturnsListOfProvidersIfThereIsOneDefaultJSONConfig() {
-        List<PropertySourceProvider> services = ServiceContext.getInstance()
-                                                              .getServices(PropertySourceProvider.class);
-
-        PropertySourceProvider provider = services.stream()
-                                                  .filter(s -> s instanceof JSONPropertySourceProvider)
-                                                  .findFirst().get();
-
-        assertThat(provider.getPropertySources(), notNullValue());
-        assertThat(provider.getPropertySources(), hasSize(1));
-
-        PropertySource source = provider.getPropertySources().iterator().next();
-
-        assertThat(source.getProperties().keySet(), Matchers.containsInAnyOrder("a", "b", "c"));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9c32dde2/modules/json/src/test/java/org/apache/tamaya/json/JSONPropertySourceProviderMissingConfigFileIT.java
----------------------------------------------------------------------
diff --git a/modules/json/src/test/java/org/apache/tamaya/json/JSONPropertySourceProviderMissingConfigFileIT.java b/modules/json/src/test/java/org/apache/tamaya/json/JSONPropertySourceProviderMissingConfigFileIT.java
deleted file mode 100644
index a87b49d..0000000
--- a/modules/json/src/test/java/org/apache/tamaya/json/JSONPropertySourceProviderMissingConfigFileIT.java
+++ /dev/null
@@ -1,69 +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.json;
-
-import org.apache.tamaya.core.internal.DefaultServiceContext;
-import org.apache.tamaya.spi.PropertySourceProvider;
-import org.apache.tamaya.spi.ServiceContext;
-import org.jboss.arquillian.container.test.api.Deployment;
-import org.jboss.arquillian.junit.Arquillian;
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.util.List;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.notNullValue;
-import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
-
-@RunWith(Arquillian.class)
-public class JSONPropertySourceProviderMissingConfigFileIT {
-
-    @Deployment
-    public static JavaArchive createDeployment() {
-        JavaArchive archive = ShrinkWrap.create(JavaArchive.class);
-
-        archive.addPackage(org.apache.tamaya.Configuration.class.getPackage())
-               .addPackage(org.apache.tamaya.spi.PropertySource.class.getPackage());
-
-        archive.addPackage(DefaultServiceContext.class.getPackage())
-               .addAsServiceProvider(ServiceContext.class, DefaultServiceContext.class);
-
-
-        archive.addPackage(JSONPropertySource.class.getPackage())
-               .addAsServiceProvider(PropertySourceProvider.class, JSONPropertySourceProvider.class);
-
-        return archive;
-    }
-
-    @Test
-    public void providerReturnsEmptyListOfProvidersIfThereIsNoOneDefaultJSONConfig() {
-        List<PropertySourceProvider> services = ServiceContext.getInstance().getServices(PropertySourceProvider.class);
-
-        PropertySourceProvider provider = services.stream()
-                                                  .filter(s -> s instanceof JSONPropertySourceProvider)
-                                                  .findFirst().get();
-
-        assertThat(provider.getPropertySources(), notNullValue());
-        assertThat(provider.getPropertySources(), hasSize(0));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9c32dde2/modules/json/src/test/java/org/apache/tamaya/json/JSONPropertySourceTest.java
----------------------------------------------------------------------
diff --git a/modules/json/src/test/java/org/apache/tamaya/json/JSONPropertySourceTest.java b/modules/json/src/test/java/org/apache/tamaya/json/JSONPropertySourceTest.java
index 0f27863..84dea2a 100644
--- a/modules/json/src/test/java/org/apache/tamaya/json/JSONPropertySourceTest.java
+++ b/modules/json/src/test/java/org/apache/tamaya/json/JSONPropertySourceTest.java
@@ -24,8 +24,8 @@ import org.junit.Test;
 
 import java.net.URL;
 
-import static org.hamcrest.CoreMatchers.nullValue;
 import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertEquals;
 
 public class JSONPropertySourceTest extends CommonJSONTestCaseCollection {
 
@@ -35,15 +35,13 @@ public class JSONPropertySourceTest extends CommonJSONTestCaseCollection {
 
         assertThat(configURL, CoreMatchers.notNullValue());
 
-        JSONPropertySource source = new JSONPropertySource(configURL.toString(), 10);
-
-        assertThat(source.get(PropertySource.TAMAYA_ORDINAL), nullValue());
+        JSONPropertySource source = new JSONPropertySource(configURL, 4);
+        assertEquals(source.get(PropertySource.TAMAYA_ORDINAL), "16784");
     }
 
     @Override
-    UnifiedConfigData getPropertiesFrom(URL source) throws Exception {
+    PropertySource getPropertiesFrom(URL source) throws Exception {
         JSONPropertySource propertySource = new JSONPropertySource(source);
-
-        return new JSONPropertySourceUCD(propertySource);
+        return propertySource;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9c32dde2/modules/json/src/test/java/org/apache/tamaya/json/JSONPropertySourceUCD.java
----------------------------------------------------------------------
diff --git a/modules/json/src/test/java/org/apache/tamaya/json/JSONPropertySourceUCD.java b/modules/json/src/test/java/org/apache/tamaya/json/JSONPropertySourceUCD.java
deleted file mode 100644
index 4feb2ed..0000000
--- a/modules/json/src/test/java/org/apache/tamaya/json/JSONPropertySourceUCD.java
+++ /dev/null
@@ -1,39 +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.json;
-
-import java.util.Map;
-
-public class JSONPropertySourceUCD implements UnifiedConfigData {
-    private JSONPropertySource propertySource;
-
-    public JSONPropertySourceUCD(JSONPropertySource source) {
-        propertySource = source;
-    }
-
-    @Override
-    public Map<String, String> getProperties() {
-        return propertySource.getProperties();
-    }
-
-    @Override
-    public int getOrdinal() {
-        return propertySource.getOrdinal();
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/9c32dde2/modules/json/src/test/java/org/apache/tamaya/json/UnifiedConfigData.java
----------------------------------------------------------------------
diff --git a/modules/json/src/test/java/org/apache/tamaya/json/UnifiedConfigData.java b/modules/json/src/test/java/org/apache/tamaya/json/UnifiedConfigData.java
deleted file mode 100644
index 645d5b5..0000000
--- a/modules/json/src/test/java/org/apache/tamaya/json/UnifiedConfigData.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.json;
-
-import java.util.Map;
-
-public interface UnifiedConfigData {
-    Map<String, String> getProperties();
-
-    int getOrdinal();
-
-    default String get(String key) {
-        return getProperties().get(key);
-    }
-
-}