deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From johndam...@apache.org
Subject [1/2] deltaspike git commit: DELTASPIKE-1208: Fixed variable replacement in configured values for getProjectStageAwarePropertyValue
Date Fri, 28 Oct 2016 00:47:27 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master 0596f9db2 -> ebb24accd


DELTASPIKE-1208: Fixed variable replacement in configured values for getProjectStageAwarePropertyValue


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/7215f7b7
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/7215f7b7
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/7215f7b7

Branch: refs/heads/master
Commit: 7215f7b7fdea436017c8a331d5468dc8fc5c7145
Parents: 0596f9d
Author: tzhmava4 <valentin.maechler@swisscom.com>
Authored: Thu Oct 20 07:52:42 2016 +0200
Committer: John D. Ament <johndament@apache.org>
Committed: Thu Oct 27 20:46:19 2016 -0400

----------------------------------------------------------------------
 .../core/api/config/ConfigResolver.java         |  1 -
 .../test/api/config/ConfigResolverTest.java     | 22 +++++++++++++++-----
 .../test/api/config/TestConfigSource.java       |  5 +++++
 3 files changed, 22 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/7215f7b7/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java
b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java
index 5a54abb..f8f522b 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/config/ConfigResolver.java
@@ -245,7 +245,6 @@ public final class ConfigResolver
         String value = getPropertyValue(key + '.' + ps, configResolverContext);
         if (value == null)
         {
-            configResolverContext.setProjectStageAware(false);            
             value = getPropertyValue(key, configResolverContext);
         }
 

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/7215f7b7/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/ConfigResolverTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/ConfigResolverTest.java
b/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/ConfigResolverTest.java
index 54e47ac..be24c62 100644
--- a/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/ConfigResolverTest.java
+++ b/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/ConfigResolverTest.java
@@ -197,15 +197,27 @@ public class ConfigResolverTest
     }
     
     @Test
-    public void testProjectStageAwarePropertyValueReference() {
-        final String expected = 
+    public void testProjectStageAwarePropertyValueReference_1() {
+        final String expectedFooUrl =
+                "http://bar-dev/services";
+
+        final String actualFooUrl =
+                ConfigResolver.getProjectStageAwarePropertyValue(
+                "foo.url");
+
+        Assert.assertEquals(expectedFooUrl, actualFooUrl);
+    }
+
+    @Test
+    public void testProjectStageAwarePropertyValueReference_2() {
+        final String expected =
                 "projectStageAware-exampleEntry-1-is-tomato-UnitTest";
-        
-        final String projectStageAwareExampleEntry1 = 
+
+        final String projectStageAwareExampleEntry1 =
                 ConfigResolver.getProjectStageAwarePropertyValue(
                 "deltaspike.test.exampleEntry-2", 
                 "");
-        
+
         Assert.assertEquals(expected, projectStageAwareExampleEntry1);
     }
 

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/7215f7b7/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/TestConfigSource.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/TestConfigSource.java
b/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/TestConfigSource.java
index 4798f67..ad177b0 100644
--- a/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/TestConfigSource.java
+++ b/deltaspike/core/api/src/test/java/org/apache/deltaspike/test/api/config/TestConfigSource.java
@@ -93,6 +93,11 @@ public class TestConfigSource implements ConfigSource
         props.put("deltaspike.test.projectstagefallback", "Value without ProjectStage");
         
         // ProjectStage aware property value with resolved reference
+        props.put("foo.url", "${bar.url}/services");
+        props.put("bar.url", "undefined");
+        props.put("bar.url.UnitTest", "http://bar-dev");
+        props.put("bar.url.Production", "http://bar-prod");
+
         props.put("deltaspike.test.exampleEntry-1", "tomato");
         props.put("deltaspike.test.exampleEntry-1.UnitTest", "tomato-UnitTest");
         props.put("deltaspike.test.exampleEntry-2", "default-exampleEntry-1-is-${deltaspike.test.exampleEntry-1}");


Mime
View raw message