You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by pl...@apache.org on 2015/01/07 00:07:24 UTC

[1/2] incubator-tamaya git commit: TAMAYA-39 Renamed ConfigurationContext#current() to ConfigurationContext#context().

Repository: incubator-tamaya
Updated Branches:
  refs/heads/master a1f85650f -> 5f109da47


TAMAYA-39 Renamed ConfigurationContext#current() to ConfigurationContext#context().


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

Branch: refs/heads/master
Commit: 5f109da47dd15b36ceea9bc5788e02690a54231a
Parents: 40c671e
Author: Oliver B. Fischer <pl...@apache.org>
Authored: Wed Jan 7 00:06:39 2015 +0100
Committer: Oliver B. Fischer <pl...@apache.org>
Committed: Wed Jan 7 00:07:19 2015 +0100

----------------------------------------------------------------------
 api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java  | 2 +-
 .../tamaya/modules/json/JSONPropertySourceConfigurationTest.java   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5f109da4/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java b/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
index 5c502cf..7b51717 100644
--- a/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
+++ b/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
@@ -138,7 +138,7 @@ public interface ConfigurationContext {
      */
     List<PropertyFilter> getPropertyFilters();
 
-    public static ConfigurationContext current(){
+    public static ConfigurationContext context(){
         return ServiceContext.getInstance().getService(ConfigurationContext.class).get();
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5f109da4/modules/json/src/test/java/org/apache/tamaya/modules/json/JSONPropertySourceConfigurationTest.java
----------------------------------------------------------------------
diff --git a/modules/json/src/test/java/org/apache/tamaya/modules/json/JSONPropertySourceConfigurationTest.java b/modules/json/src/test/java/org/apache/tamaya/modules/json/JSONPropertySourceConfigurationTest.java
index 1a4c151..5d77489 100644
--- a/modules/json/src/test/java/org/apache/tamaya/modules/json/JSONPropertySourceConfigurationTest.java
+++ b/modules/json/src/test/java/org/apache/tamaya/modules/json/JSONPropertySourceConfigurationTest.java
@@ -43,7 +43,7 @@ public class JSONPropertySourceConfigurationTest {
 
         assertThat(source.getProperties().keySet(), hasSize(3));
 
-        ConfigurationContext context = ConfigurationContext.current();
+        ConfigurationContext context = ConfigurationContext.context();
 
         context.addPropertySources(source);
 


[2/2] incubator-tamaya git commit: TAMAYA-39 Added ConfigurationContext#context()

Posted by pl...@apache.org.
TAMAYA-39 Added ConfigurationContext#context()


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

Branch: refs/heads/master
Commit: 40c671e8679308d64c7ff4af12c58592e65ff613
Parents: a1f8565
Author: Oliver B. Fischer <pl...@apache.org>
Authored: Wed Jan 7 00:04:04 2015 +0100
Committer: Oliver B. Fischer <pl...@apache.org>
Committed: Wed Jan 7 00:07:19 2015 +0100

----------------------------------------------------------------------
 .../apache/tamaya/spi/ConfigurationContext.java |  5 ++
 modules/json/pom.xml                            |  6 +++
 .../JSONPropertySourceConfigurationTest.java    | 52 ++++++++++++++++++++
 3 files changed, 63 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/40c671e8/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java b/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
index efad465..5c502cf 100644
--- a/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
+++ b/api/src/main/java/org/apache/tamaya/spi/ConfigurationContext.java
@@ -137,4 +137,9 @@ public interface ConfigurationContext {
      * @return the list of registered PropertyFilters, never null.
      */
     List<PropertyFilter> getPropertyFilters();
+
+    public static ConfigurationContext current(){
+        return ServiceContext.getInstance().getService(ConfigurationContext.class).get();
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/40c671e8/modules/json/pom.xml
----------------------------------------------------------------------
diff --git a/modules/json/pom.xml b/modules/json/pom.xml
index 28abec9..16c5f74 100644
--- a/modules/json/pom.xml
+++ b/modules/json/pom.xml
@@ -41,6 +41,12 @@ under the License.
         </dependency>
 
         <dependency>
+            <groupId>org.apache.tamaya</groupId>
+            <artifactId>tamaya-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
             <groupId>com.fasterxml.jackson.core</groupId>
             <artifactId>jackson-databind</artifactId>
         </dependency>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/40c671e8/modules/json/src/test/java/org/apache/tamaya/modules/json/JSONPropertySourceConfigurationTest.java
----------------------------------------------------------------------
diff --git a/modules/json/src/test/java/org/apache/tamaya/modules/json/JSONPropertySourceConfigurationTest.java b/modules/json/src/test/java/org/apache/tamaya/modules/json/JSONPropertySourceConfigurationTest.java
new file mode 100644
index 0000000..1a4c151
--- /dev/null
+++ b/modules/json/src/test/java/org/apache/tamaya/modules/json/JSONPropertySourceConfigurationTest.java
@@ -0,0 +1,52 @@
+/*
+ * 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.modules.json;
+
+import org.apache.tamaya.spi.ConfigurationContext;
+import org.hamcrest.CoreMatchers;
+import org.junit.Test;
+
+import java.io.File;
+import java.net.URL;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.hasSize;
+
+public class JSONPropertySourceConfigurationTest {
+
+
+    @Test
+    public void testFull() throws Exception {
+        URL configURL = JSONPropertySourceTest.class.getResource("/configs/valid/simple-flat-string-only-config.json");
+
+        assertThat(configURL, CoreMatchers.notNullValue());
+
+        File configFile = new File(configURL.toURI());
+
+        JSONPropertySource source = new JSONPropertySource(configFile, 10);
+
+        assertThat(source.getProperties().keySet(), hasSize(3));
+
+        ConfigurationContext context = ConfigurationContext.current();
+
+        context.addPropertySources(source);
+
+        // @todo Finish!
+    }
+}