tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ple...@apache.org
Subject [08/50] [abbrv] incubator-tamaya-extensions git commit: TAMAYA-136: Adding PropertyValue for PropertySource SPI. All changes and test fixes in all modules/examples relevant for release.
Date Mon, 17 Oct 2016 18:21:28 GMT
TAMAYA-136: Adding PropertyValue for PropertySource SPI. All changes and test fixes in all
modules/examples relevant for release.


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

Branch: refs/heads/master
Commit: 2e229513e335c6c3a59a42b7093413081cacaaf2
Parents: 245defb
Author: anatole <anatole@apache.org>
Authored: Tue Feb 2 17:15:53 2016 +0100
Committer: Oliver B. Fischer <plexus@apache.org>
Committed: Fri Sep 30 21:29:37 2016 +0200

----------------------------------------------------------------------
 .../org/apache/tamaya/events/FrozenPropertySource.java   |  5 +++--
 .../tamaya/events/PropertySourceChangeBuilder.java       | 11 ++++++-----
 .../apache/tamaya/events/FrozenPropertySourceTest.java   |  2 +-
 3 files changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/2e229513/src/main/java/org/apache/tamaya/events/FrozenPropertySource.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tamaya/events/FrozenPropertySource.java b/src/main/java/org/apache/tamaya/events/FrozenPropertySource.java
index a8167f2..81e6dca 100644
--- a/src/main/java/org/apache/tamaya/events/FrozenPropertySource.java
+++ b/src/main/java/org/apache/tamaya/events/FrozenPropertySource.java
@@ -19,6 +19,7 @@
 package org.apache.tamaya.events;
 
 import org.apache.tamaya.spi.PropertySource;
+import org.apache.tamaya.spi.PropertyValue;
 
 import java.io.Serializable;
 import java.util.Collections;
@@ -81,8 +82,8 @@ public final class FrozenPropertySource implements PropertySource, Serializable
     }
 
     @Override
-    public String get(String key) {
-        return this.properties.get(key);
+    public PropertyValue get(String key) {
+        return PropertyValue.of(key, this.properties.get(key), getName());
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/2e229513/src/main/java/org/apache/tamaya/events/PropertySourceChangeBuilder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/tamaya/events/PropertySourceChangeBuilder.java b/src/main/java/org/apache/tamaya/events/PropertySourceChangeBuilder.java
index cefa4f4..0858fdb 100644
--- a/src/main/java/org/apache/tamaya/events/PropertySourceChangeBuilder.java
+++ b/src/main/java/org/apache/tamaya/events/PropertySourceChangeBuilder.java
@@ -19,6 +19,7 @@
 package org.apache.tamaya.events;
 
 import org.apache.tamaya.spi.PropertySource;
+import org.apache.tamaya.spi.PropertyValue;
 
 import java.beans.PropertyChangeEvent;
 import java.util.ArrayList;
@@ -95,19 +96,19 @@ public final class PropertySourceChangeBuilder {
     public static Collection<PropertyChangeEvent> compare(PropertySource map1, PropertySource
map2) {
         List<PropertyChangeEvent> changes = new ArrayList<>();
         for (Map.Entry<String, String> en : map1.getProperties().entrySet()) {
-            String val = map2.get(en.getKey());
+            PropertyValue val = map2.get(en.getKey());
             if (val == null) {
                 changes.add(new PropertyChangeEvent(map1, en.getKey(), null, en.getValue()));
             } else if (!val.equals(en.getValue())) {
-                changes.add(new PropertyChangeEvent(map1, en.getKey(), val, en.getValue()));
+                changes.add(new PropertyChangeEvent(map1, en.getKey(), val.getValue(), en.getValue()));
             }
         }
         for (Map.Entry<String, String> en : map2.getProperties().entrySet()) {
-            String val = map1.get(en.getKey());
+            PropertyValue val = map1.get(en.getKey());
             if (val == null) {
                 changes.add(new PropertyChangeEvent(map1, en.getKey(), en.getValue(), null));
             } else if (!val.equals(en.getValue())) {
-                changes.add(new PropertyChangeEvent(map1, en.getKey(), en.getValue(), val));
+                changes.add(new PropertyChangeEvent(map1, en.getKey(), en.getValue(), val.getValue()));
             }
         }
         return changes;
@@ -170,7 +171,7 @@ public final class PropertySourceChangeBuilder {
      * @return the builder for chaining.
      */
     public PropertySourceChangeBuilder remove(String key, String... otherKeys) {
-        String oldValue = this.source.get(key);
+        PropertyValue oldValue = this.source.get(key);
         if (oldValue == null) {
             this.delta.remove(key);
         }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/2e229513/src/test/java/org/apache/tamaya/events/FrozenPropertySourceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/tamaya/events/FrozenPropertySourceTest.java b/src/test/java/org/apache/tamaya/events/FrozenPropertySourceTest.java
index 0c61e0b..1431228 100644
--- a/src/test/java/org/apache/tamaya/events/FrozenPropertySourceTest.java
+++ b/src/test/java/org/apache/tamaya/events/FrozenPropertySourceTest.java
@@ -58,7 +58,7 @@ public class FrozenPropertySourceTest {
         PropertySource ps = FrozenPropertySource.of(myPS);
         assertNotNull(ps);
         for (Map.Entry<String, String> e : myPS.getProperties().entrySet()) {
-            assertEquals(ps.get(e.getKey()), e.getValue());
+            assertEquals(ps.get(e.getKey()).getValue(), e.getValue());
         }
     }
 


Mime
View raw message