tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ple...@apache.org
Subject [29/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, 26 Sep 2016 22:19:10 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/b5145392
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/b5145392
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/b5145392

Branch: refs/heads/master
Commit: b5145392970877442ee16653d4aeeb7ba984f4a1
Parents: 8e82705
Author: anatole <anatole@apache.org>
Authored: Tue Feb 2 17:15:53 2016 +0100
Committer: Oliver B. Fischer <plexus@apache.org>
Committed: Tue Sep 27 00:18:31 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/b5145392/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/b5145392/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/b5145392/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