tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anat...@apache.org
Subject [08/18] incubator-tamaya-extensions git commit: Adapted to comply with JSR API.
Date Wed, 03 Jan 2018 00:09:04 GMT
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4869d946/modules/events/src/main/java/org/apache/tamaya/events/PropertySourceChange.java
----------------------------------------------------------------------
diff --git a/modules/events/src/main/java/org/apache/tamaya/events/PropertySourceChange.java b/modules/events/src/main/java/org/apache/tamaya/events/PropertySourceChange.java
deleted file mode 100644
index e7782a0..0000000
--- a/modules/events/src/main/java/org/apache/tamaya/events/PropertySourceChange.java
+++ /dev/null
@@ -1,212 +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.events;
-
-import org.apache.tamaya.spi.PropertySource;
-
-import java.beans.PropertyChangeEvent;
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-/**
- * Event that contains a set current changes that were applied or could be applied.
- * This class is immutable and thread-safe. To create instances use
- * {@link PropertySourceChangeBuilder}.
- *
- * Created by Anatole on 22.10.2014.
- */
-public final class PropertySourceChange implements ConfigEvent<PropertySource>, Serializable{
-
-    private static final long serialVersionUID = 1L;
-    /** The base property provider/configuration. */
-    private final FrozenPropertySource propertySource;
-    /** The base version, usable for optimistic locking. */
-    private String version = UUID.randomUUID().toString();
-    /** The timestamp of the change set in millis from the epoch. */
-    private long timestamp = System.currentTimeMillis();
-    /** The recorded changes. */
-    private final Map<String,PropertyChangeEvent> changes = new HashMap<>();
-
-    /**
-     * Constructor used by {@link PropertySourceChangeBuilder}.
-     * @param builder The builder used, not null.
-     */
-    PropertySourceChange(PropertySourceChangeBuilder builder) {
-        this.propertySource = FrozenPropertySource.of(builder.source);
-        for (PropertyChangeEvent c : builder.delta.values()) {
-            this.changes.put(c.getPropertyName(), c);
-        }
-        if(builder.version!=null){
-            this.version = builder.version;
-        }
-        if(builder.timestamp!=null){
-            this.timestamp = builder.timestamp;
-        }
-    }
-
-    @Override
-    public Class<PropertySource> getResourceType() {
-        return PropertySource.class;
-    }
-
-    /**
-     * Get the underlying property provider/configuration.
-     * @return the underlying property provider/configuration, or null, if the change instance was deserialized.
-     */
-    @Override
-    public PropertySource getResource(){
-        return this.propertySource;
-    }
-
-    /**
-     * Get the base version, usable for optimistic locking.
-     * @return the base version.
-     */
-    @Override
-    public String getVersion(){
-        return version;
-    }
-
-    /**
-     * Get the timestamp in millis from the current epoch. it is expected that the timestamp and the version are unique to
-     * identify a changeset.
-     * @return the timestamp, when this changeset was created.
-     */
-    @Override
-    public long getTimestamp(){
-        return timestamp;
-    }
-
-    /**
-     * Get the changes recorded.
-     * @return the recorded changes, never null.
-     */
-    public Collection<PropertyChangeEvent> getChanges(){
-        return Collections.unmodifiableCollection(this.changes.values());
-    }
-
-    /**
-     * Access the number current removed entries.
-     * @return the number current removed entries.
-     */
-    public int getRemovedSize() {
-        int removedCount = 0;
-        for (PropertyChangeEvent ev : this.changes.values()) {
-            if (ev.getNewValue() == null) {
-                removedCount++;
-            }
-        }
-        return removedCount;
-//        return (int) this.changes.values().stream().filter((e) -> e.getNewValue() == null).count();
-    }
-
-    /**
-     * Access the number current added entries.
-     * @return the number current added entries.
-     */
-    public int getAddedSize() {
-        int addedCount = 0;
-        for (PropertyChangeEvent ev : this.changes.values()) {
-            if (ev.getOldValue() == null &&
-                    ev.getNewValue() != null) {
-                addedCount++;
-            }
-        }
-        return addedCount;
-//        return (int) this.changes.values().stream().filter((e) -> e.getOldValue() == null).count();
-    }
-
-    /**
-     * Access the number current updated entries.
-     * @return the number current updated entries.
-     */
-    public int getUpdatedSize() {
-        int updatedCount = 0;
-        for (PropertyChangeEvent ev : this.changes.values()) {
-            if (ev.getOldValue() != null && ev.getNewValue() != null) {
-                updatedCount++;
-            }
-        }
-        return updatedCount;
-//        return (int) this.changes.values().stream().filter((e) -> e.getOldValue()!=null && e.getNewValue()!=null).count();
-    }
-
-
-    /**
-     * Checks if the given key was removed.
-     * @param key the target key, not null.
-     * @return true, if the given key was removed.
-     */
-    public boolean isRemoved(String key) {
-        PropertyChangeEvent change = this.changes.get(key);
-        return change != null && change.getNewValue() == null;
-    }
-
-    /**
-     * Checks if the given key was added.
-     * @param key the target key, not null.
-     * @return true, if the given key was added.
-     */
-    public boolean isAdded(String key) {
-        PropertyChangeEvent change = this.changes.get(key);
-        return change != null && change.getOldValue() == null;
-    }
-
-    /**
-     * Checks if the given key was updated.
-     * @param key the target key, not null.
-     * @return true, if the given key was updated.
-     */
-    public boolean isUpdated(String key) {
-        PropertyChangeEvent change = this.changes.get(key);
-        return change != null && change.getOldValue() != null && change.getNewValue() != null;
-    }
-
-    /**
-     * Checks if the given key is added, or updated AND NOT removed.
-     * @param key the target key, not null.
-     * @return true, if the given key was added, or updated BUT NOT removed.
-     */
-    public boolean isKeyAffected(String key) {
-        PropertyChangeEvent change = this.changes.get(key);
-        return change != null && change.getNewValue() != null;
-    }
-
-    /**
-     * CHecks if the current change set does not contain any changes.
-     * @return tru, if the change set is empty.
-     */
-    public boolean isEmpty(){
-        return this.changes.isEmpty();
-    }
-
-
-    @Override
-    public String toString() {
-        return "PropertySourceChange{" +
-                ", propertySource=" + propertySource +
-                ", version='" + version + '\'' +
-                ", timestamp=" + timestamp +
-                '}';
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4869d946/modules/events/src/main/java/org/apache/tamaya/events/PropertySourceChangeBuilder.java
----------------------------------------------------------------------
diff --git a/modules/events/src/main/java/org/apache/tamaya/events/PropertySourceChangeBuilder.java b/modules/events/src/main/java/org/apache/tamaya/events/PropertySourceChangeBuilder.java
deleted file mode 100644
index 1e58855..0000000
--- a/modules/events/src/main/java/org/apache/tamaya/events/PropertySourceChangeBuilder.java
+++ /dev/null
@@ -1,252 +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.events;
-
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertyValue;
-
-import java.beans.PropertyChangeEvent;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-/**
- * Models a set current changes applied to a {@link org.apache.tamaya.spi.PropertySource}. Consumers of these events
- * can observing changes to property sources and
- * <ol>
- *     <li>Check if their current configuration instance ({@link org.apache.tamaya.spi.ConfigurationContext}
- *     contains the changed {@link org.apache.tamaya.spi.PropertySource} (Note: the reference tova property source is never affected by a
- *     change, its only the data of the property source).</li>
- *     <li>If so corresponding action may be taken, such as reevaluating the configuration values (depending on
- *     the update policy) or reevaluating the complete {@link org.apache.tamaya.Configuration} to create a change
- *     event on configuration level.
- * </ol>
- */
-public final class PropertySourceChangeBuilder {
-    /**
-     * The recorded changes.
-     */
-    final SortedMap<String, PropertyChangeEvent> delta = new TreeMap<>();
-    /**
-     * The underlying configuration/provider.
-     */
-    final PropertySource source;
-    /**
-     * The version configured, or null, for generating a default.
-     */
-    String version;
-    /**
-     * The optional timestamp in millis of this epoch.
-     */
-    Long timestamp;
-
-    /**
-     * Constructor.
-     *
-     * @param source the underlying configuration/provider, not null.
-     */
-    private PropertySourceChangeBuilder(PropertySource source) {
-        this.source = Objects.requireNonNull(source);
-    }
-
-    /**
-     * Creates a new instance of this builder.
-     *
-     * @param source the underlying property provider/configuration, not null.
-     * @return the builder for chaining.
-     */
-    public static PropertySourceChangeBuilder of(PropertySource source) {
-        return new PropertySourceChangeBuilder(source);
-    }
-
-    /**
-     * Compares the two property config/configurations and creates a collection current all changes
-     * that must be applied to render {@code map1} into {@code map2}.
-     *
-     * @param map1 the source map, not null.
-     * @param map2 the target map, not null.
-     * @return a collection current change events, never null.
-     */
-    public static Collection<PropertyChangeEvent> compare(PropertySource map1, PropertySource map2) {
-        List<PropertyChangeEvent> changes = new ArrayList<>();
-        for (Map.Entry<String, PropertyValue> en : map1.getProperties().entrySet()) {
-            PropertyValue val = map2.get(en.getKey());
-            if (val == null) {
-                changes.add(new PropertyChangeEvent(map1, en.getKey(), null, en.getValue().getValue()));
-            } else if (!val.equals(en.getValue())) {
-                changes.add(new PropertyChangeEvent(map1, en.getKey(), val.getValue(), en.getValue().getValue()));
-            }
-        }
-        for (Map.Entry<String, PropertyValue> en : map2.getProperties().entrySet()) {
-            PropertyValue val = map1.get(en.getKey());
-            if (val == null) {
-                changes.add(new PropertyChangeEvent(map1, en.getKey(), en.getValue().getValue(), null));
-            } else if (!val.equals(en.getValue())) {
-                changes.add(new PropertyChangeEvent(map1, en.getKey(), en.getValue().getValue(), val.getValue()));
-            }
-        }
-        return changes;
-    }
-
-    /*
-     * Apply a version/UUID to the set being built.
-     * @param version the version to apply, or null, to let the system generate a version for you.
-     * @return the builder for chaining.
-     */
-    public PropertySourceChangeBuilder setVersion(String version) {
-        this.version = version;
-        return this;
-    }
-
-    /*
-     * Apply given timestamp to the set being built.
-     * @param version the version to apply, or null, to let the system generate a version for you.
-     * @return the builder for chaining.
-     */
-    public PropertySourceChangeBuilder setTimestamp(long timestamp) {
-        this.timestamp = timestamp;
-        return this;
-    }
-
-    /**
-     * This method records all changes to be applied to the base property provider/configuration to
-     * achieve the given target state.
-     *
-     * @param newState the new target state, not null.
-     * @return the builder for chaining.
-     */
-    public PropertySourceChangeBuilder addChanges(PropertySource newState) {
-        Collection<PropertyChangeEvent> events = PropertySourceChangeBuilder.compare(newState, this.source);
-        for (PropertyChangeEvent c : events) {
-            this.delta.put(c.getPropertyName(), c);
-        }
-        return this;
-    }
-
-    /**
-     * Get the current values, also considering any changes recorded within this change set.
-     *
-     * @param key the key current the entry, not null.
-     * @return the keys, or null.
-     */
-    public String get(String key) {
-        PropertyChangeEvent change = this.delta.get(key);
-        if (change != null && !(change.getNewValue() == null)) {
-            return (String) change.getNewValue();
-        }
-        return null;
-    }
-
-    /**
-     * Marks the given key(s) fromMap the configuration/properties to be removed.
-     *
-     * @param key       the key current the entry, not null.
-     * @param otherKeys additional keys to be removed (convenience), not null.
-     * @return the builder for chaining.
-     */
-    public PropertySourceChangeBuilder remove(String key, String... otherKeys) {
-        PropertyValue oldValue = this.source.get(key);
-        if (oldValue == null) {
-            this.delta.remove(key);
-        }
-        this.delta.put(key, new PropertyChangeEvent(this.source, key, oldValue, null));
-        for (String addKey : otherKeys) {
-            oldValue = this.source.get(addKey);
-            if (oldValue == null) {
-                this.delta.remove(addKey);
-            }
-            this.delta.put(addKey, new PropertyChangeEvent(this.source, addKey, oldValue, null));
-        }
-        return this;
-    }
-
-    /**
-     * Apply all the given values to the base configuration/properties.
-     * Note that all values passed must be convertible to String, either
-     * <ul>
-     * <li>the registered codecs provider provides codecs for the corresponding keys, or </li>
-     * <li>default codecs are present for the given type, or</li>
-     * <li>the value is an instanceof String</li>
-     * </ul>
-     *
-     * @param changes the changes to be applied, not null.
-     * @return the builder for chaining.
-     */
-    public PropertySourceChangeBuilder putAll(Map<String, String> changes) {
-        for (Map.Entry<String, PropertyValue> en : this.source.getProperties().entrySet()) {
-            this.delta.put(en.getKey(), new PropertyChangeEvent(this.source, en.getKey(), null, en.getValue()));
-        }
-        return this;
-    }
-
-    /**
-     * This method will create a change set that clears all entries fromMap the given base configuration/properties.
-     *
-     * @return the builder for chaining.
-     */
-    public PropertySourceChangeBuilder deleteAll() {
-        this.delta.clear();
-        for (Map.Entry<String, PropertyValue> en : this.source.getProperties().entrySet()) {
-            this.delta.put(en.getKey(), new PropertyChangeEvent(this.source, en.getKey(), en.getValue().getValue(), null));
-        }
-        return this;
-    }
-
-    /**
-     * Checks if the change set is empty, i.e. does not contain any changes.
-     *
-     * @return true, if the set is empty.
-     */
-    public boolean isEmpty() {
-        return this.delta.isEmpty();
-    }
-
-    /**
-     * Resets this change set instance. This will clear all changes done to this builder, so the
-     * set will be empty.
-     */
-    public void reset() {
-        this.delta.clear();
-    }
-
-
-    /**
-     * Builds the corresponding change set.
-     *
-     * @return the new change set, never null.
-     */
-    public PropertySourceChange build() {
-        return new PropertySourceChange(this);
-    }
-
-    /*
-     * (non-Javadoc)
-     * @see java.lang.Object#toString()
-     */
-    @Override
-    public String toString() {
-        return "PropertiesChangeBuilder [source=" + source + ", " +
-                ", delta=" + delta + "]";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4869d946/modules/events/src/main/java/org/apache/tamaya/events/internal/DefaultConfigChangeObserver.java
----------------------------------------------------------------------
diff --git a/modules/events/src/main/java/org/apache/tamaya/events/internal/DefaultConfigChangeObserver.java b/modules/events/src/main/java/org/apache/tamaya/events/internal/DefaultConfigChangeObserver.java
index 51951de..0138aa7 100644
--- a/modules/events/src/main/java/org/apache/tamaya/events/internal/DefaultConfigChangeObserver.java
+++ b/modules/events/src/main/java/org/apache/tamaya/events/internal/DefaultConfigChangeObserver.java
@@ -18,12 +18,12 @@
  */
 package org.apache.tamaya.events.internal;
 
-import org.apache.tamaya.ConfigurationProvider;
 import org.apache.tamaya.events.ConfigEventManager;
-import org.apache.tamaya.events.ConfigurationChange;
-import org.apache.tamaya.events.ConfigurationChangeBuilder;
-import org.apache.tamaya.events.FrozenConfiguration;
+import org.apache.tamaya.events.ConfigChange;
+import org.apache.tamaya.events.ConfigChangeBuilder;
+import org.apache.tamaya.events.FrozenConfig;
 
+import javax.config.ConfigProvider;
 import java.util.*;
 import java.util.logging.Logger;
 
@@ -40,7 +40,7 @@ public class DefaultConfigChangeObserver {
 
     private long checkPeriod = 2000L;
 
-    private volatile FrozenConfiguration lastConfig;
+    private volatile FrozenConfig lastConfig;
 
     private volatile boolean running;
 
@@ -61,11 +61,11 @@ public class DefaultConfigChangeObserver {
 
     public void checkConfigurationUpdate() {
         LOG.finest("Checking configuration for changes...");
-        FrozenConfiguration frozenConfig = FrozenConfiguration.of(ConfigurationProvider.getConfiguration());
-        ConfigurationChange changes;
+        FrozenConfig frozenConfig = FrozenConfig.of(ConfigProvider.getConfig());
+        ConfigChange changes;
 
         if (getLastConfig() != null) {
-            changes = ConfigurationChangeBuilder.of(getLastConfig()).addChanges(frozenConfig)
+            changes = ConfigChangeBuilder.of(getLastConfig()).addChanges(frozenConfig)
                                                 .build();
             if(!changes.isEmpty()) {
                 LOG.info("Identified configuration changes, publishing changes:\n" + changes);
@@ -77,11 +77,11 @@ public class DefaultConfigChangeObserver {
 
     }
 
-    protected FrozenConfiguration getLastConfig() {
+    protected FrozenConfig getLastConfig() {
         return lastConfig;
     }
 
-    protected void setLastConfig(FrozenConfiguration newConfiguration) {
+    protected void setLastConfig(FrozenConfig newConfiguration) {
         lastConfig = newConfiguration;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4869d946/modules/events/src/main/java/org/apache/tamaya/events/internal/LoggingConfigListener.java
----------------------------------------------------------------------
diff --git a/modules/events/src/main/java/org/apache/tamaya/events/internal/LoggingConfigListener.java b/modules/events/src/main/java/org/apache/tamaya/events/internal/LoggingConfigListener.java
index 6483154..13b74d7 100644
--- a/modules/events/src/main/java/org/apache/tamaya/events/internal/LoggingConfigListener.java
+++ b/modules/events/src/main/java/org/apache/tamaya/events/internal/LoggingConfigListener.java
@@ -18,11 +18,11 @@
  */
 package org.apache.tamaya.events.internal;
 
-import org.apache.tamaya.Configuration;
 import org.apache.tamaya.events.ConfigEvent;
 import org.apache.tamaya.events.ConfigEventListener;
 import org.osgi.service.component.annotations.Component;
 
+import javax.config.Config;
 import java.util.logging.Logger;
 
 /**
@@ -35,7 +35,7 @@ public class LoggingConfigListener implements ConfigEventListener {
 
     @Override
     public void onConfigEvent(ConfigEvent<?> event) {
-        if(event.getResourceType()== Configuration.class) {
+        if(event.getResourceType()== Config.class) {
             LOG.info("Configuration changed: " + event);
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4869d946/modules/events/src/main/java/org/apache/tamaya/events/spi/ConfigEventManagerSpi.java
----------------------------------------------------------------------
diff --git a/modules/events/src/main/java/org/apache/tamaya/events/spi/ConfigEventManagerSpi.java b/modules/events/src/main/java/org/apache/tamaya/events/spi/ConfigEventManagerSpi.java
index 4c90224..c4e512a 100644
--- a/modules/events/src/main/java/org/apache/tamaya/events/spi/ConfigEventManagerSpi.java
+++ b/modules/events/src/main/java/org/apache/tamaya/events/spi/ConfigEventManagerSpi.java
@@ -18,6 +18,7 @@
  */
 package org.apache.tamaya.events.spi;
 
+import org.apache.tamaya.events.ConfigChange;
 import org.apache.tamaya.events.ConfigEvent;
 import org.apache.tamaya.events.ConfigEventListener;
 
@@ -119,7 +120,7 @@ public interface ConfigEventManagerSpi {
      * and trigger ConfigurationChange events if something is changed. This is quite handy for publishing
      * configuration changes to whatever systems are interested in. Hereby the origin of a configuration change
      * can be on this machine, or also remotely. For handling corresponding {@link ConfigEventListener} have
-     * to be registered, e.g. listening on {@link org.apache.tamaya.events.ConfigurationChange} events.
+     * to be registered, e.g. listening on {@link ConfigChange} events.
      * 
      * @param enable whether to enable or disable the change monitoring.
      */

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4869d946/modules/events/src/test/java/org/apache/tamaya/events/ChangeableGlobalConfigSource.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/ChangeableGlobalConfigSource.java b/modules/events/src/test/java/org/apache/tamaya/events/ChangeableGlobalConfigSource.java
new file mode 100644
index 0000000..6e3ae13
--- /dev/null
+++ b/modules/events/src/test/java/org/apache/tamaya/events/ChangeableGlobalConfigSource.java
@@ -0,0 +1,62 @@
+/*
+ * 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.events;
+
+import org.apache.tamaya.base.configsource.BaseConfigSource;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * PropertySource implementation that accesses properties that are statically stored.
+ */
+public class ChangeableGlobalConfigSource extends BaseConfigSource{
+
+    private static final Map<String,String> STORED_ENTRIES = new ConcurrentHashMap<>();
+
+    @Override
+    public String getName() {
+        return getClass().getSimpleName();
+    }
+
+    @Override
+    public Map<String, String> getProperties() {
+        return Collections.emptyMap();
+    }
+
+    /**
+     * Put a value (globally) into this property source.
+     * @param key the key, not null
+     * @param value the value, not null
+     * @return the entry replaced, or null.
+     */
+    public static String put(String key, String value){
+        return STORED_ENTRIES.put(key,value);
+    }
+
+    /**
+     * Put all the properties, overriding any existing ones with the same key.
+     * @param properties the properties, not null.
+     */
+    public static void putAll(Map<String,String> properties){
+        STORED_ENTRIES.putAll(properties);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4869d946/modules/events/src/test/java/org/apache/tamaya/events/ChangeableGlobalPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/ChangeableGlobalPropertySource.java b/modules/events/src/test/java/org/apache/tamaya/events/ChangeableGlobalPropertySource.java
deleted file mode 100644
index 94a0a9d..0000000
--- a/modules/events/src/test/java/org/apache/tamaya/events/ChangeableGlobalPropertySource.java
+++ /dev/null
@@ -1,62 +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.events;
-
-import org.apache.tamaya.spisupport.propertysource.BasePropertySource;
-import org.apache.tamaya.spi.PropertyValue;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * PropertySource implementation that accesses properties that are statically stored.
- */
-public class ChangeableGlobalPropertySource extends BasePropertySource{
-
-    private static final Map<String,String> STORED_ENTRIES = new ConcurrentHashMap<>();
-
-    @Override
-    public String getName() {
-        return getClass().getSimpleName();
-    }
-
-    @Override
-    public Map<String, PropertyValue> getProperties() {
-        return null;
-    }
-
-    /**
-     * Put a value (globally) into this property source.
-     * @param key the key, not null
-     * @param value the value, not null
-     * @return the entry replaced, or null.
-     */
-    public static String put(String key, String value){
-        return STORED_ENTRIES.put(key,value);
-    }
-
-    /**
-     * Put all the properties, overriding any existing ones with the same key.
-     * @param properties the properties, not null.
-     */
-    public static void putAll(Map<String,String> properties){
-        STORED_ENTRIES.putAll(properties);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4869d946/modules/events/src/test/java/org/apache/tamaya/events/ChangeableThreadLocalPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/ChangeableThreadLocalPropertySource.java b/modules/events/src/test/java/org/apache/tamaya/events/ChangeableThreadLocalPropertySource.java
index f8fd413..df7425c 100644
--- a/modules/events/src/test/java/org/apache/tamaya/events/ChangeableThreadLocalPropertySource.java
+++ b/modules/events/src/test/java/org/apache/tamaya/events/ChangeableThreadLocalPropertySource.java
@@ -18,8 +18,7 @@
  */
 package org.apache.tamaya.events;
 
-import org.apache.tamaya.spisupport.propertysource.BasePropertySource;
-import org.apache.tamaya.spi.PropertyValue;
+import org.apache.tamaya.base.configsource.BaseConfigSource;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -29,7 +28,7 @@ import java.util.Map;
  * PropertySource implementation that accesses properties that are stored on ThreadLocal level, e.g. good to use for
  * testing..
  */
-public class ChangeableThreadLocalPropertySource extends BasePropertySource{
+public class ChangeableThreadLocalPropertySource extends BaseConfigSource{
 
     private static final ThreadLocal<Map<String,String>> STORED_ENTRIES = new ThreadLocal<Map<String,String>>(){
         protected Map<String,String> initialValue(){
@@ -43,7 +42,7 @@ public class ChangeableThreadLocalPropertySource extends BasePropertySource{
     }
 
     @Override
-    public Map<String, PropertyValue> getProperties() {
+    public Map<String, String> getProperties() {
         return null;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4869d946/modules/events/src/test/java/org/apache/tamaya/events/ConfigChangeBuilderTest.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/ConfigChangeBuilderTest.java b/modules/events/src/test/java/org/apache/tamaya/events/ConfigChangeBuilderTest.java
new file mode 100644
index 0000000..bd4a4f9
--- /dev/null
+++ b/modules/events/src/test/java/org/apache/tamaya/events/ConfigChangeBuilderTest.java
@@ -0,0 +1,134 @@
+/*
+ * 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.events;
+
+import org.junit.Test;
+import org.mockito.Mockito;
+
+import javax.config.Config;
+import java.beans.PropertyChangeEvent;
+import java.util.*;
+
+import static java.util.Collections.emptySet;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+
+public class ConfigChangeBuilderTest {
+
+	@Test
+	public void compareReturnAnEmptyListOfChangesForTwoEmptyConfigs() {
+		Config oc = Mockito.mock(Config.class, new MethodNotMockedAnswer());
+		Config nc = Mockito.mock(Config.class, new MethodNotMockedAnswer());
+
+		doReturn(emptySet()).when(oc).getPropertyNames();
+		doReturn(emptySet()).when(nc).getPropertyNames();
+
+		Collection<PropertyChangeEvent> diff = ConfigChangeBuilder.compare(oc, nc);
+
+		assertThat(diff).isNotNull().isEmpty();
+	}
+
+	@Test
+	public void compareReturnsAChangeEventIfThereIsANewKeyInTheNewVersionOfTheConfig() {
+		Config oc = Mockito.mock(Config.class, new MethodNotMockedAnswer());
+		Config nc = Mockito.mock(Config.class, new MethodNotMockedAnswer());
+
+		doReturn(emptySet()).when(oc).getPropertyNames();
+		doThrow(new NoSuchElementException()).when(oc).getValue("a", String.class);
+		doReturn(Optional.empty()).when(oc).getOptionalValue("a", String.class);
+
+		Map<String, String> valuesNC = new HashMap<String, String>();
+		valuesNC.put("a", "19");
+
+		doReturn(valuesNC.keySet()).when(nc).getPropertyNames();
+		doReturn(Optional.of("19")).when(nc).getOptionalValue("a", String.class);
+
+		Collection<PropertyChangeEvent> diff = ConfigChangeBuilder.compare(oc, nc);
+
+		assertThat(diff).isNotNull().isNotEmpty().hasSize(1);
+
+		PropertyChangeEvent change = diff.iterator().next();
+
+		assertThat(change).isNotNull();
+		assertThat(change.getNewValue()).isEqualTo("19");
+		assertThat(change.getOldValue()).isNull();
+		assertThat(change.getPropertyName()).isEqualTo("a");
+	}
+
+	@Test
+	public void compareReturnsAChangeEventIfAKeyHasBeenRemovedInTheNewVersionOfTheConfig() {
+		Config oc = Mockito.mock(Config.class, new MethodNotMockedAnswer());
+		Config nc = Mockito.mock(Config.class, new MethodNotMockedAnswer());
+
+		Map<String, String> valuesOC = new HashMap<String, String>();
+		valuesOC.put("a", "19");
+
+		doReturn(valuesOC.keySet()).when(oc).getPropertyNames();
+		doReturn("19").when(oc).getValue("a", String.class);
+
+		doReturn(emptySet()).when(nc).getPropertyNames();
+		doReturn(Optional.empty()).when(nc).getOptionalValue("a", String.class);
+
+		Collection<PropertyChangeEvent> diff = ConfigChangeBuilder.compare(oc, nc);
+
+		assertThat(diff).isNotNull().isNotEmpty().hasSize(1);
+
+		PropertyChangeEvent change = diff.iterator().next();
+
+		assertThat(change).isNotNull();
+		assertThat(change.getNewValue()).isNull();
+		assertThat(change.getOldValue()).isEqualTo("19");
+		assertThat(change.getPropertyName()).isEqualTo("a");
+	}
+
+	@Test
+	public void compareReturnsAChangeEventIfValueOfExistingKeyHasChanged() {
+		Config oc = Mockito.mock(Config.class, new MethodNotMockedAnswer());
+		Config nc = Mockito.mock(Config.class, new MethodNotMockedAnswer());
+
+		Map<String, String> valuesOC = new HashMap<String, String>();
+		valuesOC.put("a", "91");
+
+		doReturn(valuesOC.keySet()).when(oc).getPropertyNames();
+		doReturn(Optional.of("91")).when(oc).getOptionalValue("a", String.class);
+		doReturn("91").when(oc).getValue("a",String.class);
+		doReturn("old Config").when(oc).toString();
+
+		Map<String, String> valuesNC = new HashMap<String, String>();
+		valuesNC.put("a", "19");
+
+		doReturn(valuesNC.keySet()).when(nc).getPropertyNames();
+		doReturn(Optional.of("19")).when(nc).getOptionalValue("a",String.class);
+		doReturn("19").when(nc).getValue("a",String.class);
+		doReturn("new Config").when(nc).toString();
+
+		Collection<PropertyChangeEvent> diff = ConfigChangeBuilder.compare(oc, nc);
+
+		assertThat(diff).isNotNull().isNotEmpty().hasSize(1);
+
+		PropertyChangeEvent change = diff.iterator().next();
+
+		assertThat(change).isNotNull();
+		assertThat(change.getNewValue()).isEqualTo("19");
+		assertThat(change.getOldValue()).isEqualTo("91");
+		assertThat(change.getPropertyName()).isEqualTo("a");
+	}
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4869d946/modules/events/src/test/java/org/apache/tamaya/events/ConfigChangeTest.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/ConfigChangeTest.java b/modules/events/src/test/java/org/apache/tamaya/events/ConfigChangeTest.java
new file mode 100644
index 0000000..6090576
--- /dev/null
+++ b/modules/events/src/test/java/org/apache/tamaya/events/ConfigChangeTest.java
@@ -0,0 +1,161 @@
+/*
+ * 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.events;
+
+import org.junit.Test;
+
+import javax.config.Config;
+import javax.config.ConfigProvider;
+
+import static org.junit.Assert.*;
+
+
+/**
+ * Test class for {@link ConfigChange}.
+ */
+public class ConfigChangeTest {
+
+    @Test
+    public void testEmptyChangeSet() throws Exception {
+        ConfigChange change = ConfigChange.emptyChangeSet(ConfigProvider.getConfig());
+        assertNotNull(change);
+        assertTrue(change.getChanges().isEmpty());
+    }
+
+    @Test
+    public void testGetConfig() throws Exception {
+        Config config = ConfigProvider.getConfig();
+        ConfigChange change = ConfigChangeBuilder.of(config).build();
+        assertNotNull(change);
+        assertTrue(change.getUpdatedSize()==0);
+        assertTrue(change.getAddedSize()==0);
+        assertTrue(change.getRemovedSize()==0);
+        assertTrue(change.getChanges().size()==0);
+        for (String key : config.getPropertyNames()) {
+            if (!"[meta]frozenAt".equals(key)) {
+                if(key.contains("random.new")){ // dynamic generated value!
+                    continue;
+                }
+            }
+        }
+    }
+
+    @Test
+    public void testGetVersion() throws Exception {
+        Config config = ConfigProvider.getConfig();
+        ConfigChange change = ConfigChangeBuilder.of(config).build();
+        assertNotNull(change.getVersion());
+        change = ConfigChangeBuilder.of(config).setVersion("version2").build();
+        assertEquals("version2", change.getVersion());
+    }
+
+    @Test
+    public void testGetTimestamp() throws Exception {
+        Config config = ConfigProvider.getConfig();
+        Thread.sleep(10L);
+        ConfigChange change = ConfigChangeBuilder.of(config).build();
+        assertTrue((System.currentTimeMillis() - change.getTimestamp()) > 0L);
+        change = ConfigChangeBuilder.of(config).setTimestamp(10L).build();
+        assertEquals(10L, change.getTimestamp());
+    }
+
+    @Test
+    public void testGetEvents() throws Exception {
+        Config config = ConfigProvider.getConfig();
+        ConfigChange change = ConfigChangeBuilder.of(config).removeKey("key1", "key2").build();
+        assertTrue(change.getChanges().size() == 2);
+        change = ConfigChangeBuilder.of(config).addChange("key1Added", "value1Added").build();
+        assertTrue(change.getChanges().size() == 1);
+    }
+
+    @Test
+    public void testGetRemovedSize() throws Exception {
+        Config config = ConfigProvider.getConfig();
+        ConfigChange change = ConfigChangeBuilder.of(config).removeKey("java.version", "key2").build();
+        assertTrue(change.getRemovedSize() == 2);
+        assertTrue(change.getAddedSize() == 0);
+    }
+
+    @Test
+    public void testGetAddedSize() throws Exception {
+        Config config = ConfigProvider.getConfig();
+        ConfigChange change = ConfigChangeBuilder.of(config).addChange("key1", "key2").build();
+        assertTrue(change.getAddedSize() == 1);
+        assertTrue(change.getRemovedSize() == 0);
+    }
+
+    @Test
+    public void testGetUpdatedSize() throws Exception {
+        Config config = ConfigProvider.getConfig();
+        ConfigChange change = ConfigChangeBuilder.of(config).addChange("java.version", "1.8").build();
+        assertTrue(change.getUpdatedSize() == 1);
+    }
+
+    @Test
+    public void testIsRemoved() throws Exception {
+        Config config = ConfigProvider.getConfig();
+        ConfigChange change = ConfigChangeBuilder.of(config).removeKey("java.version").build();
+        assertTrue(change.isRemoved("java.version"));
+    }
+
+    @Test
+    public void testIsAdded() throws Exception {
+        Config config = ConfigProvider.getConfig();
+        ConfigChange change = ConfigChangeBuilder.of(config).addChange("key1", "key2").build();
+        assertTrue(change.isAdded("key1"));
+    }
+
+    @Test
+    public void testIsUpdated() throws Exception {
+        Config config = ConfigProvider.getConfig();
+        ConfigChange change = ConfigChangeBuilder.of(config).addChange("java.version", "1.8").build();
+        assertTrue(change.isUpdated("java.version"));
+    }
+
+    @Test
+    public void testContainsKey() throws Exception {
+        Config config = ConfigProvider.getConfig();
+        ConfigChange change = ConfigChangeBuilder.of(config).addChange("key1", "key2").build();
+        assertTrue(change.isKeyAffected("key1"));
+        assertFalse(change.isKeyAffected("key2"));
+        change = ConfigChangeBuilder.of(config).removeKey("java.version").build();
+        assertFalse(change.isKeyAffected("java.version"));
+        assertFalse(change.isKeyAffected("key2"));
+    }
+
+    @Test
+    public void testIsEmpty() throws Exception {
+        Config config = ConfigProvider.getConfig();
+        ConfigChange change = ConfigChangeBuilder.of(config).build();
+        assertTrue(change.isEmpty());
+    }
+
+    @Test
+    public void testToString() throws Exception {
+        Config config = ConfigProvider.getConfig();
+        ConfigChange change = ConfigChangeBuilder.of(config).removeKey("java.version").build();
+        String toString =
+                change.toString();
+        assertTrue(toString.contains("timestamp"));
+        assertTrue(toString.contains("change-id"));
+        assertTrue(toString.contains("config-id"));
+        assertFalse(toString.contains("key1"));
+        assertFalse(toString.contains("key2"));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4869d946/modules/events/src/test/java/org/apache/tamaya/events/ConfigSourceChangeTest.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/ConfigSourceChangeTest.java b/modules/events/src/test/java/org/apache/tamaya/events/ConfigSourceChangeTest.java
new file mode 100644
index 0000000..30bf940
--- /dev/null
+++ b/modules/events/src/test/java/org/apache/tamaya/events/ConfigSourceChangeTest.java
@@ -0,0 +1,180 @@
+/*
+ * 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.events;
+
+import org.apache.tamaya.base.configsource.EnvironmentConfigSource;
+import org.apache.tamaya.base.configsource.SimpleConfigSource;
+import org.apache.tamaya.base.configsource.SystemConfigSource;
+import org.junit.Test;
+
+import javax.config.spi.ConfigSource;
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.Assert.*;
+
+/**
+ * Tests for {@link ConfigSourceChange} and its builder.
+ */
+public class ConfigSourceChangeTest {
+
+    private static final ConfigSource myPS = new SystemConfigSource();
+
+    @Test
+    public void testGetPropertySource() throws Exception {
+        ConfigSourceChange change = ConfigSourceChangeBuilder.of(myPS).build();
+        assertEquals(change.getResource().getName(), myPS.getName());
+    }
+
+    @Test
+    public void testGetVersion() throws Exception {
+        ConfigSourceChange change = ConfigSourceChangeBuilder.of(myPS)
+                .setVersion("myVersion1").build();
+        assertEquals(change.getVersion(), "myVersion1");
+    }
+
+    @Test
+    public void testGetTimestamp() throws Exception {
+        ConfigSourceChange change = ConfigSourceChangeBuilder.of(myPS)
+                .setTimestamp(111L).build();
+        assertEquals(change.getTimestamp(), 111L);
+    }
+
+    @Test
+    public void testGetEvents() throws Exception {
+        ConfigSourceChange change = ConfigSourceChangeBuilder.of(myPS)
+                .addChanges(
+                        new EnvironmentConfigSource()
+                ).build();
+        assertTrue(change.getChanges().size()>0);
+    }
+
+    @Test
+    public void testGetRemovedSize() throws Exception {
+        ConfigSourceChange change = ConfigSourceChangeBuilder.of(myPS)
+                .addChanges(
+                        new EnvironmentConfigSource()
+                ).build();
+        assertTrue(change.getRemovedSize()>0);
+    }
+
+    @Test
+    public void testGetAddedSize() throws Exception {
+        ConfigSourceChange change = ConfigSourceChangeBuilder.of(myPS)
+                .addChanges(
+                        new EnvironmentConfigSource()
+                ).build();
+        assertTrue(change.getAddedSize()>0);
+    }
+
+    @Test
+    public void testGetUpdatedSize() throws Exception {
+        ConfigSourceChange change = ConfigSourceChangeBuilder.of(myPS)
+                .addChanges(
+                        new EnvironmentConfigSource()
+                ).build();
+        assertTrue(change.getUpdatedSize()==0);
+    }
+
+    @Test
+    public void testIsRemoved() throws Exception {
+        Map<String, String> testData = new HashMap<>();
+        testData.put("key1", "value1");
+        testData.put("key2", "value2");
+        SimpleConfigSource ps1 = new SimpleConfigSource("test", testData);
+        testData = new HashMap<>();
+        testData.put("key1", "value2");
+        testData.put("key3", "value3");
+        SimpleConfigSource ps2 = new SimpleConfigSource("test", testData);
+        ConfigSourceChange change = ConfigSourceChangeBuilder.of(ps1)
+                .addChanges(
+                        ps2
+                ).build();
+        assertFalse(change.isRemoved("key1"));
+        assertTrue(change.isRemoved("key2"));
+        assertFalse(change.isRemoved("key3"));
+    }
+
+    @Test
+    public void testIsAdded() throws Exception {
+        Map<String, String> testData = new HashMap<>();
+        testData.put("key1", "value1");
+        testData.put("key2", "value2");
+        ConfigSource ps1 = new SimpleConfigSource("test", testData);
+        testData = new HashMap<>();
+        testData.put("key1", "value2");
+        testData.put("key3", "value3");
+        ConfigSource ps2 = new SimpleConfigSource("test", testData);
+        ConfigSourceChange change = ConfigSourceChangeBuilder.of(ps1)
+                .addChanges(
+                        ps2
+                ).build();
+        assertTrue(change.isAdded("key3"));
+        assertFalse(change.isAdded("key2"));
+        assertFalse(change.isAdded("key1"));
+    }
+
+    @Test
+    public void testIsUpdated() throws Exception {
+        Map<String, String> testData = new HashMap<>();
+        testData.put("key1", "value1");
+        testData.put("key2", "value2");
+        SimpleConfigSource ps1 = new SimpleConfigSource("test", testData);
+        testData = new HashMap<>();
+        testData.put("key1", "value2");
+        testData.put("key3", "value3");
+        SimpleConfigSource ps2 = new SimpleConfigSource("test", testData);
+        ConfigSourceChange change = ConfigSourceChangeBuilder.of(ps1)
+                .addChanges(
+                        ps2
+                ).build();
+        assertTrue(change.isUpdated("key1"));
+        assertFalse(change.isUpdated("key2"));
+        assertFalse(change.isUpdated("key3"));
+    }
+
+    @Test
+    public void testContainsKey() throws Exception {
+        ConfigSourceChange change = ConfigSourceChangeBuilder.of(new EnvironmentConfigSource())
+                .addChanges(
+                        myPS
+                ).build();
+        assertTrue(change.isKeyAffected("java.version"));
+    }
+
+    @Test
+    public void testIsEmpty() throws Exception {
+        ConfigSourceChange change = ConfigSourceChangeBuilder.of(new EnvironmentConfigSource())
+                .build();
+        assertTrue(change.isEmpty());
+        change = ConfigSourceChangeBuilder.of(new EnvironmentConfigSource())
+                .addChanges(
+                        myPS
+                ).build();
+        assertFalse(change.isEmpty());
+    }
+
+    @Test
+    public void testToString() throws Exception {
+        ConfigSourceChange change = ConfigSourceChangeBuilder.of(myPS).build();
+        String toString = change.toString();
+        assertNotNull(toString);
+        assertTrue(toString.contains(myPS.getName()));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4869d946/modules/events/src/test/java/org/apache/tamaya/events/ConfigurationChangeBuilderTest.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/ConfigurationChangeBuilderTest.java b/modules/events/src/test/java/org/apache/tamaya/events/ConfigurationChangeBuilderTest.java
deleted file mode 100644
index d0ee77a..0000000
--- a/modules/events/src/test/java/org/apache/tamaya/events/ConfigurationChangeBuilderTest.java
+++ /dev/null
@@ -1,131 +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.events;
-
-import org.apache.tamaya.Configuration;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import java.beans.PropertyChangeEvent;
-import java.util.*;
-
-import static java.util.Collections.emptyMap;
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doReturn;
-
-public class ConfigurationChangeBuilderTest {
-
-	@Test
-	public void compareReturnAnEmptyListOfChangesForTwoEmptyConfigurations() {
-		Configuration oc = Mockito.mock(Configuration.class, new MethodNotMockedAnswer());
-		Configuration nc = Mockito.mock(Configuration.class, new MethodNotMockedAnswer());
-
-		doReturn(emptyMap()).when(oc).getProperties();
-		doReturn(emptyMap()).when(nc).getProperties();
-
-		Collection<PropertyChangeEvent> diff = ConfigurationChangeBuilder.compare(oc, nc);
-
-		assertThat(diff).isNotNull().isEmpty();
-	}
-
-	@Test
-	public void compareReturnsAChangeEventIfThereIsANewKeyInTheNewVersionOfTheConfiguration() {
-		Configuration oc = Mockito.mock(Configuration.class, new MethodNotMockedAnswer());
-		Configuration nc = Mockito.mock(Configuration.class, new MethodNotMockedAnswer());
-
-		doReturn(emptyMap()).when(oc).getProperties();
-		doReturn(null).when(oc).get(eq("a"));
-
-		Map<String, String> valuesNC = new HashMap<String, String>();
-		valuesNC.put("a", "19");
-
-		doReturn(valuesNC).when(nc).getProperties();
-		doReturn("19").when(nc).get(eq("a"));
-
-		Collection<PropertyChangeEvent> diff = ConfigurationChangeBuilder.compare(oc, nc);
-
-		assertThat(diff).isNotNull().isNotEmpty().hasSize(1);
-
-		PropertyChangeEvent change = diff.iterator().next();
-
-		assertThat(change).isNotNull();
-		assertThat(change.getNewValue()).isEqualTo("19");
-		assertThat(change.getOldValue()).isNull();
-		assertThat(change.getPropertyName()).isEqualTo("a");
-	}
-
-	@Test
-	public void compareReturnsAChangeEventIfAKeyHasBeenRemovedInTheNewVersionOfTheConfiguration() {
-		Configuration oc = Mockito.mock(Configuration.class, new MethodNotMockedAnswer());
-		Configuration nc = Mockito.mock(Configuration.class, new MethodNotMockedAnswer());
-
-		Map<String, String> valuesOC = new HashMap<String, String>();
-		valuesOC.put("a", "19");
-
-		doReturn(valuesOC).when(oc).getProperties();
-		doReturn("19").when(oc).get(eq("a"));
-
-		doReturn(emptyMap()).when(nc).getProperties();
-		doReturn(null).when(nc).get(eq("a"));
-
-		Collection<PropertyChangeEvent> diff = ConfigurationChangeBuilder.compare(oc, nc);
-
-		assertThat(diff).isNotNull().isNotEmpty().hasSize(1);
-
-		PropertyChangeEvent change = diff.iterator().next();
-
-		assertThat(change).isNotNull();
-		assertThat(change.getNewValue()).isNull();
-		assertThat(change.getOldValue()).isEqualTo("19");
-		assertThat(change.getPropertyName()).isEqualTo("a");
-	}
-
-	@Test
-	public void compareReturnsAChangeEventIfValueOfExistingKeyHasChanged() {
-		Configuration oc = Mockito.mock(Configuration.class, new MethodNotMockedAnswer());
-		Configuration nc = Mockito.mock(Configuration.class, new MethodNotMockedAnswer());
-
-		Map<String, String> valuesOC = new HashMap<String, String>();
-		valuesOC.put("a", "91");
-
-		doReturn(valuesOC).when(oc).getProperties();
-		doReturn("91").when(oc).get(eq("a"));
-		doReturn("old configuration").when(oc).toString();
-
-		Map<String, String> valuesNC = new HashMap<String, String>();
-		valuesNC.put("a", "19");
-
-		doReturn(valuesNC).when(nc).getProperties();
-		doReturn("19").when(nc).get(eq("a"));
-		doReturn("new configuration").when(nc).toString();
-
-		Collection<PropertyChangeEvent> diff = ConfigurationChangeBuilder.compare(oc, nc);
-
-		assertThat(diff).isNotNull().isNotEmpty().hasSize(1);
-
-		PropertyChangeEvent change = diff.iterator().next();
-
-		assertThat(change).isNotNull();
-		assertThat(change.getNewValue()).isEqualTo("19");
-		assertThat(change.getOldValue()).isEqualTo("91");
-		assertThat(change.getPropertyName()).isEqualTo("a");
-	}
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4869d946/modules/events/src/test/java/org/apache/tamaya/events/ConfigurationChangeTest.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/ConfigurationChangeTest.java b/modules/events/src/test/java/org/apache/tamaya/events/ConfigurationChangeTest.java
deleted file mode 100644
index 60f40c2..0000000
--- a/modules/events/src/test/java/org/apache/tamaya/events/ConfigurationChangeTest.java
+++ /dev/null
@@ -1,162 +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.events;
-
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-import org.junit.Test;
-
-import java.util.Map;
-
-import static org.junit.Assert.*;
-import static org.assertj.core.api.Assertions.*;
-/**
- * Test class for {@link ConfigurationChange}.
- */
-public class ConfigurationChangeTest {
-
-    @Test
-    public void testEmptyChangeSet() throws Exception {
-        ConfigurationChange change = ConfigurationChange.emptyChangeSet(ConfigurationProvider.getConfiguration());
-        assertThat(change).isNotNull();
-        assertThat(change.getChanges()).isEmpty();
-    }
-
-    @Test
-    public void testGetConfiguration() throws Exception {
-        Configuration config = ConfigurationProvider.getConfiguration();
-        ConfigurationChange change = ConfigurationChangeBuilder.of(config).build();
-        assertNotNull(change);
-        assertTrue(change.getUpdatedSize()==0);
-        assertTrue(change.getAddedSize()==0);
-        assertTrue(change.getRemovedSize()==0);
-        assertTrue(change.getChanges().size()==0);
-        for (Map.Entry<String, String> en : config.getProperties().entrySet()) {
-            if (!"[meta]frozenAt".equals(en.getKey())) {
-                if(en.getKey().contains("random.new")){ // dynamic generated value!
-                    continue;
-                }
-                assertEquals("Error for " + en.getKey(), en.getValue(), change.getResource().get(en.getKey()));
-            }
-        }
-    }
-
-    @Test
-    public void testGetVersion() throws Exception {
-        Configuration config = ConfigurationProvider.getConfiguration();
-        ConfigurationChange change = ConfigurationChangeBuilder.of(config).build();
-        assertNotNull(change.getVersion());
-        change = ConfigurationChangeBuilder.of(config).setVersion("version2").build();
-        assertEquals("version2", change.getVersion());
-    }
-
-    @Test
-    public void testGetTimestamp() throws Exception {
-        Configuration config = ConfigurationProvider.getConfiguration();
-        Thread.sleep(10L);
-        ConfigurationChange change = ConfigurationChangeBuilder.of(config).build();
-        assertTrue((System.currentTimeMillis() - change.getTimestamp()) > 0L);
-        change = ConfigurationChangeBuilder.of(config).setTimestamp(10L).build();
-        assertEquals(10L, change.getTimestamp());
-    }
-
-    @Test
-    public void testGetEvents() throws Exception {
-        Configuration config = ConfigurationProvider.getConfiguration();
-        ConfigurationChange change = ConfigurationChangeBuilder.of(config).removeKey("key1", "key2").build();
-        assertTrue(change.getChanges().size() == 2);
-        change = ConfigurationChangeBuilder.of(config).addChange("key1Added", "value1Added").build();
-        assertTrue(change.getChanges().size() == 1);
-    }
-
-    @Test
-    public void testGetRemovedSize() throws Exception {
-        Configuration config = ConfigurationProvider.getConfiguration();
-        ConfigurationChange change = ConfigurationChangeBuilder.of(config).removeKey("java.version", "key2").build();
-        assertTrue(change.getRemovedSize() == 2);
-        assertTrue(change.getAddedSize() == 0);
-    }
-
-    @Test
-    public void testGetAddedSize() throws Exception {
-        Configuration config = ConfigurationProvider.getConfiguration();
-        ConfigurationChange change = ConfigurationChangeBuilder.of(config).addChange("key1", "key2").build();
-        assertTrue(change.getAddedSize() == 1);
-        assertTrue(change.getRemovedSize() == 0);
-    }
-
-    @Test
-    public void testGetUpdatedSize() throws Exception {
-        Configuration config = ConfigurationProvider.getConfiguration();
-        ConfigurationChange change = ConfigurationChangeBuilder.of(config).addChange("java.version", "1.8").build();
-        assertTrue(change.getUpdatedSize() == 1);
-    }
-
-    @Test
-    public void testIsRemoved() throws Exception {
-        Configuration config = ConfigurationProvider.getConfiguration();
-        ConfigurationChange change = ConfigurationChangeBuilder.of(config).removeKey("java.version").build();
-        assertTrue(change.isRemoved("java.version"));
-    }
-
-    @Test
-    public void testIsAdded() throws Exception {
-        Configuration config = ConfigurationProvider.getConfiguration();
-        ConfigurationChange change = ConfigurationChangeBuilder.of(config).addChange("key1", "key2").build();
-        assertTrue(change.isAdded("key1"));
-    }
-
-    @Test
-    public void testIsUpdated() throws Exception {
-        Configuration config = ConfigurationProvider.getConfiguration();
-        ConfigurationChange change = ConfigurationChangeBuilder.of(config).addChange("java.version", "1.8").build();
-        assertTrue(change.isUpdated("java.version"));
-    }
-
-    @Test
-    public void testContainsKey() throws Exception {
-        Configuration config = ConfigurationProvider.getConfiguration();
-        ConfigurationChange change = ConfigurationChangeBuilder.of(config).addChange("key1", "key2").build();
-        assertTrue(change.isKeyAffected("key1"));
-        assertFalse(change.isKeyAffected("key2"));
-        change = ConfigurationChangeBuilder.of(config).removeKey("java.version").build();
-        assertFalse(change.isKeyAffected("java.version"));
-        assertFalse(change.isKeyAffected("key2"));
-    }
-
-    @Test
-    public void testIsEmpty() throws Exception {
-        Configuration config = ConfigurationProvider.getConfiguration();
-        ConfigurationChange change = ConfigurationChangeBuilder.of(config).build();
-        assertTrue(change.isEmpty());
-    }
-
-    @Test
-    public void testToString() throws Exception {
-        Configuration config = ConfigurationProvider.getConfiguration();
-        ConfigurationChange change = ConfigurationChangeBuilder.of(config).removeKey("java.version").build();
-        String toString =
-                change.toString();
-        assertTrue(toString.contains("timestamp"));
-        assertTrue(toString.contains("change-id"));
-        assertTrue(toString.contains("configuration-id"));
-        assertFalse(toString.contains("key1"));
-        assertFalse(toString.contains("key2"));
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4869d946/modules/events/src/test/java/org/apache/tamaya/events/FrozenConfigSourceTest.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/FrozenConfigSourceTest.java b/modules/events/src/test/java/org/apache/tamaya/events/FrozenConfigSourceTest.java
new file mode 100644
index 0000000..8e06ece
--- /dev/null
+++ b/modules/events/src/test/java/org/apache/tamaya/events/FrozenConfigSourceTest.java
@@ -0,0 +1,108 @@
+/*
+ * 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.events;
+
+import org.apache.tamaya.base.configsource.ConfigSourceComparator;
+import org.apache.tamaya.base.configsource.SystemConfigSource;
+import org.junit.Test;
+
+import javax.config.spi.ConfigSource;
+import java.util.Map;
+
+import static org.junit.Assert.*;
+
+/**
+ * Tests for {@link FrozenConfigSource}.
+ */
+public class FrozenConfigSourceTest {
+
+    private static final ConfigSource myPS = new SystemConfigSource();
+
+    @Test
+    public void testOf() throws Exception {
+        ConfigSource ps = FrozenConfigSource.of(myPS);
+        assertNotNull(ps);
+    }
+
+    @Test
+    public void testGetName() throws Exception {
+        ConfigSource ps = FrozenConfigSource.of(myPS);
+        String name = ps.getName();
+        assertNotNull(name);
+        assertEquals(name, ps.getName());
+    }
+
+    @Test
+    public void testGetOrdinal() throws Exception {
+        ConfigSource ps = FrozenConfigSource.of(myPS);
+        assertEquals(ConfigSourceComparator.getOrdinal(myPS),
+                ConfigSourceComparator.getOrdinal(ps));
+    }
+
+    @Test
+    public void testGet() throws Exception {
+        ConfigSource ps = FrozenConfigSource.of(myPS);
+        assertNotNull(ps);
+        for (Map.Entry<String, String> e : myPS.getProperties().entrySet()) {
+            assertEquals(ps.getValue(e.getKey()), e.getValue());
+        }
+    }
+
+    @Test
+    public void testGetProperties() throws Exception {
+        ConfigSource ps = FrozenConfigSource.of(myPS);
+        assertNotNull(ps);
+        assertNotNull(ps.getProperties());
+        assertFalse(ps.getProperties().isEmpty());
+    }
+
+    @Test
+    public void testEquals() throws Exception {
+        ConfigSource ps1 = FrozenConfigSource.of(myPS);
+        ConfigSource ps2 = FrozenConfigSource.of(myPS);
+        assertEquals(ps1.getName(), ps2.getName());
+        assertEquals(ps1.getProperties().size(), ps2.getProperties().size());
+    }
+
+    @Test
+    public void testHashCode() throws Exception {
+        boolean alwaysDifferent = true;
+        for(int i=0;i<10;i++){
+            ConfigSource ps1 = FrozenConfigSource.of(myPS);
+            ConfigSource ps2 = FrozenConfigSource.of(myPS);
+            // sometimes not same, because frozenAt in ms maybe different
+            if(ps1.hashCode()==ps2.hashCode()){
+                alwaysDifferent=false;
+                break;
+            }
+        }
+        if(alwaysDifferent){
+            fail("HashCode should be same if frozenAt is in the same ms...");
+        }
+    }
+
+    @Test
+    public void testToString() throws Exception {
+        ConfigSource ps = FrozenConfigSource.of(myPS);
+        String toString = ps.toString();
+        assertNotNull(toString);
+        assertTrue(toString.contains("FrozenPropertySource"));
+        assertTrue(toString.contains(myPS.getName()));
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4869d946/modules/events/src/test/java/org/apache/tamaya/events/FrozenConfigurationTest.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/FrozenConfigurationTest.java b/modules/events/src/test/java/org/apache/tamaya/events/FrozenConfigurationTest.java
index 264d99a..03e9b7c 100644
--- a/modules/events/src/test/java/org/apache/tamaya/events/FrozenConfigurationTest.java
+++ b/modules/events/src/test/java/org/apache/tamaya/events/FrozenConfigurationTest.java
@@ -18,10 +18,11 @@
  */
 package org.apache.tamaya.events;
 
-import org.apache.tamaya.Configuration;
 import org.junit.Test;
 import org.mockito.Mockito;
 
+import javax.config.Config;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -32,11 +33,11 @@ public class FrozenConfigurationTest {
 
     @Test
     public void getFrozenAtReturnsTheCorrectTimestamp() {
-        Configuration source = Mockito.mock(Configuration.class);
-
+        Config source = Mockito.mock(Config.class);
+        doReturn(Collections.emptySet()).when(source).getPropertyNames();
         long poiStart = System.nanoTime();
 
-        FrozenConfiguration fc = FrozenConfiguration.of(source);
+        FrozenConfig fc = FrozenConfig.of(source);
 
         long poiEnd = System.nanoTime();
 
@@ -47,9 +48,9 @@ public class FrozenConfigurationTest {
 
     @Test
     public void idMustBeNotNull() {
-        Configuration source = Mockito.mock(Configuration.class);
-
-        FrozenConfiguration fc = FrozenConfiguration.of(source);
+        Config source = Mockito.mock(Config.class);
+        doReturn(Collections.emptySet()).when(source).getPropertyNames();
+        FrozenConfig fc = FrozenConfig.of(source);
 
         assertThat(fc.getId()).isNotNull();
     }
@@ -62,11 +63,11 @@ public class FrozenConfigurationTest {
         Map<String, String> properties = new HashMap<>();
         properties.put("key", "value");
 
-        Configuration configuration = Mockito.mock(Configuration.class);
-        doReturn(properties).when(configuration).getProperties();
+        Config configuration = Mockito.mock(Config.class);
+        doReturn(properties.keySet()).when(configuration).getPropertyNames();
 
-        FrozenConfiguration fcA = FrozenConfiguration.of(configuration);
-        FrozenConfiguration fcB = FrozenConfiguration.of(configuration);
+        FrozenConfig fcA = FrozenConfig.of(configuration);
+        FrozenConfig fcB = FrozenConfig.of(configuration);
 
         assertThat(fcA.getId()).isNotEqualTo(fcB.getId());
         assertThat(fcA).isNotEqualTo(fcB);

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4869d946/modules/events/src/test/java/org/apache/tamaya/events/FrozenPropertySourceTest.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/FrozenPropertySourceTest.java b/modules/events/src/test/java/org/apache/tamaya/events/FrozenPropertySourceTest.java
deleted file mode 100644
index cdc70b8..0000000
--- a/modules/events/src/test/java/org/apache/tamaya/events/FrozenPropertySourceTest.java
+++ /dev/null
@@ -1,109 +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.events;
-
-import org.apache.tamaya.spisupport.propertysource.SystemPropertySource;
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertyValue;
-import org.apache.tamaya.spisupport.PropertySourceComparator;
-import org.junit.Test;
-
-import java.util.Map;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests for {@link org.apache.tamaya.events.FrozenPropertySource}.
- */
-public class FrozenPropertySourceTest {
-
-    private static final PropertySource myPS = new SystemPropertySource();
-
-    @Test
-    public void testOf() throws Exception {
-        PropertySource ps = FrozenPropertySource.of(myPS);
-        assertNotNull(ps);
-    }
-
-    @Test
-    public void testGetName() throws Exception {
-        PropertySource ps = FrozenPropertySource.of(myPS);
-        String name = ps.getName();
-        assertNotNull(name);
-        assertEquals(name, ps.getName());
-    }
-
-    @Test
-    public void testGetOrdinal() throws Exception {
-        PropertySource ps = FrozenPropertySource.of(myPS);
-        assertEquals(PropertySourceComparator.getOrdinal(myPS),
-                PropertySourceComparator.getOrdinal(ps));
-    }
-
-    @Test
-    public void testGet() throws Exception {
-        PropertySource ps = FrozenPropertySource.of(myPS);
-        assertNotNull(ps);
-        for (Map.Entry<String, PropertyValue> e : myPS.getProperties().entrySet()) {
-            assertEquals(ps.get(e.getKey()).getValue(), e.getValue().getValue());
-        }
-    }
-
-    @Test
-    public void testGetProperties() throws Exception {
-        PropertySource ps = FrozenPropertySource.of(myPS);
-        assertNotNull(ps);
-        assertNotNull(ps.getProperties());
-        assertFalse(ps.getProperties().isEmpty());
-    }
-
-    @Test
-    public void testEquals() throws Exception {
-        PropertySource ps1 = FrozenPropertySource.of(myPS);
-        PropertySource ps2 = FrozenPropertySource.of(myPS);
-        assertEquals(ps1.getName(), ps2.getName());
-        assertEquals(ps1.getProperties().size(), ps2.getProperties().size());
-    }
-
-    @Test
-    public void testHashCode() throws Exception {
-        boolean alwaysDifferent = true;
-        for(int i=0;i<10;i++){
-            PropertySource ps1 = FrozenPropertySource.of(myPS);
-            PropertySource ps2 = FrozenPropertySource.of(myPS);
-            // sometimes not same, because frozenAt in ms maybe different
-            if(ps1.hashCode()==ps2.hashCode()){
-                alwaysDifferent=false;
-                break;
-            }
-        }
-        if(alwaysDifferent){
-            fail("HashCode should be same if frozenAt is in the same ms...");
-        }
-    }
-
-    @Test
-    public void testToString() throws Exception {
-        PropertySource ps = FrozenPropertySource.of(myPS);
-        String toString = ps.toString();
-        assertNotNull(toString);
-        assertTrue(toString.contains("FrozenPropertySource"));
-        assertTrue(toString.contains(myPS.getName()));
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4869d946/modules/events/src/test/java/org/apache/tamaya/events/ObservedConfigTest.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/ObservedConfigTest.java b/modules/events/src/test/java/org/apache/tamaya/events/ObservedConfigTest.java
index da749c3..3d81fd1 100644
--- a/modules/events/src/test/java/org/apache/tamaya/events/ObservedConfigTest.java
+++ b/modules/events/src/test/java/org/apache/tamaya/events/ObservedConfigTest.java
@@ -40,8 +40,8 @@ public class ObservedConfigTest {
             }
             ConfigEvent<?> event = MyConfigObserver.event;
             if(event!=null) {
-                assertTrue(event instanceof ConfigurationChange);
-                ConfigurationChange cChange = (ConfigurationChange) event;
+                assertTrue(event instanceof ConfigChange);
+                ConfigChange cChange = (ConfigChange) event;
                 if(cChange.isAdded("random.new")){
                     MyConfigObserver.event=null;
                 }else {

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4869d946/modules/events/src/test/java/org/apache/tamaya/events/PropertySourceChangeTest.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/PropertySourceChangeTest.java b/modules/events/src/test/java/org/apache/tamaya/events/PropertySourceChangeTest.java
deleted file mode 100644
index a1a9200..0000000
--- a/modules/events/src/test/java/org/apache/tamaya/events/PropertySourceChangeTest.java
+++ /dev/null
@@ -1,180 +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.events;
-
-import org.apache.tamaya.spisupport.propertysource.EnvironmentPropertySource;
-import org.apache.tamaya.spisupport.propertysource.SimplePropertySource;
-import org.apache.tamaya.spisupport.propertysource.SystemPropertySource;
-import org.apache.tamaya.spi.PropertySource;
-import org.junit.Test;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.junit.Assert.*;
-
-/**
- * Tests for {@link PropertySourceChange} and its builder.
- */
-public class PropertySourceChangeTest {
-
-    private static final PropertySource myPS = new SystemPropertySource();
-
-    @Test
-    public void testGetPropertySource() throws Exception {
-        PropertySourceChange change = PropertySourceChangeBuilder.of(myPS).build();
-        assertEquals(change.getResource().getName(), myPS.getName());
-    }
-
-    @Test
-    public void testGetVersion() throws Exception {
-        PropertySourceChange change = PropertySourceChangeBuilder.of(myPS)
-                .setVersion("myVersion1").build();
-        assertEquals(change.getVersion(), "myVersion1");
-    }
-
-    @Test
-    public void testGetTimestamp() throws Exception {
-        PropertySourceChange change = PropertySourceChangeBuilder.of(myPS)
-                .setTimestamp(111L).build();
-        assertEquals(change.getTimestamp(), 111L);
-    }
-
-    @Test
-    public void testGetEvents() throws Exception {
-        PropertySourceChange change = PropertySourceChangeBuilder.of(myPS)
-                .addChanges(
-                        new EnvironmentPropertySource()
-                ).build();
-        assertTrue(change.getChanges().size()>0);
-    }
-
-    @Test
-    public void testGetRemovedSize() throws Exception {
-        PropertySourceChange change = PropertySourceChangeBuilder.of(myPS)
-                .addChanges(
-                        new EnvironmentPropertySource()
-                ).build();
-        assertTrue(change.getRemovedSize()>0);
-    }
-
-    @Test
-    public void testGetAddedSize() throws Exception {
-        PropertySourceChange change = PropertySourceChangeBuilder.of(myPS)
-                .addChanges(
-                        new EnvironmentPropertySource()
-                ).build();
-        assertTrue(change.getAddedSize()>0);
-    }
-
-    @Test
-    public void testGetUpdatedSize() throws Exception {
-        PropertySourceChange change = PropertySourceChangeBuilder.of(myPS)
-                .addChanges(
-                        new EnvironmentPropertySource()
-                ).build();
-        assertTrue(change.getUpdatedSize()==0);
-    }
-
-    @Test
-    public void testIsRemoved() throws Exception {
-        Map<String, String> testData = new HashMap<>();
-        testData.put("key1", "value1");
-        testData.put("key2", "value2");
-        PropertySource ps1 = new SimplePropertySource("test", testData);
-        testData = new HashMap<>();
-        testData.put("key1", "value2");
-        testData.put("key3", "value3");
-        PropertySource ps2 = new SimplePropertySource("test", testData);
-        PropertySourceChange change = PropertySourceChangeBuilder.of(ps1)
-                .addChanges(
-                        ps2
-                ).build();
-        assertFalse(change.isRemoved("key1"));
-        assertTrue(change.isRemoved("key2"));
-        assertFalse(change.isRemoved("key3"));
-    }
-
-    @Test
-    public void testIsAdded() throws Exception {
-        Map<String, String> testData = new HashMap<>();
-        testData.put("key1", "value1");
-        testData.put("key2", "value2");
-        PropertySource ps1 = new SimplePropertySource("test", testData);
-        testData = new HashMap<>();
-        testData.put("key1", "value2");
-        testData.put("key3", "value3");
-        PropertySource ps2 = new SimplePropertySource("test", testData);
-        PropertySourceChange change = PropertySourceChangeBuilder.of(ps1)
-                .addChanges(
-                        ps2
-                ).build();
-        assertTrue(change.isAdded("key3"));
-        assertFalse(change.isAdded("key2"));
-        assertFalse(change.isAdded("key1"));
-    }
-
-    @Test
-    public void testIsUpdated() throws Exception {
-        Map<String, String> testData = new HashMap<>();
-        testData.put("key1", "value1");
-        testData.put("key2", "value2");
-        PropertySource ps1 = new SimplePropertySource("test", testData);
-        testData = new HashMap<>();
-        testData.put("key1", "value2");
-        testData.put("key3", "value3");
-        PropertySource ps2 = new SimplePropertySource("test", testData);
-        PropertySourceChange change = PropertySourceChangeBuilder.of(ps1)
-                .addChanges(
-                        ps2
-                ).build();
-        assertTrue(change.isUpdated("key1"));
-        assertFalse(change.isUpdated("key2"));
-        assertFalse(change.isUpdated("key3"));
-    }
-
-    @Test
-    public void testContainsKey() throws Exception {
-        PropertySourceChange change = PropertySourceChangeBuilder.of(new EnvironmentPropertySource())
-                .addChanges(
-                        myPS
-                ).build();
-        assertTrue(change.isKeyAffected("java.version"));
-    }
-
-    @Test
-    public void testIsEmpty() throws Exception {
-        PropertySourceChange change = PropertySourceChangeBuilder.of(new EnvironmentPropertySource())
-                .build();
-        assertTrue(change.isEmpty());
-        change = PropertySourceChangeBuilder.of(new EnvironmentPropertySource())
-                .addChanges(
-                        myPS
-                ).build();
-        assertFalse(change.isEmpty());
-    }
-
-    @Test
-    public void testToString() throws Exception {
-        PropertySourceChange change = PropertySourceChangeBuilder.of(myPS).build();
-        String toString = change.toString();
-        assertNotNull(toString);
-        assertTrue(toString.contains(myPS.getName()));
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4869d946/modules/events/src/test/java/org/apache/tamaya/events/RandomConfigSource.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/RandomConfigSource.java b/modules/events/src/test/java/org/apache/tamaya/events/RandomConfigSource.java
new file mode 100644
index 0000000..8019037
--- /dev/null
+++ b/modules/events/src/test/java/org/apache/tamaya/events/RandomConfigSource.java
@@ -0,0 +1,59 @@
+/*
+ * 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.events;
+
+import javax.config.spi.ConfigSource;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * PropertySource that provides a random entry, different on each access!
+ */
+public class RandomConfigSource implements ConfigSource{
+
+    private Map<String, String> data = new HashMap<>();
+
+    @Override
+    public int getOrdinal() {
+        return 0;
+    }
+
+    @Override
+    public String getName() {
+        return "random";
+    }
+
+    @Override
+    public String getValue(String key) {
+        if(key.equals("random.new")){
+            return String.valueOf(Math.random());
+        }
+        return data.get(key);
+    }
+
+    @Override
+    public Map<String, String> getProperties() {
+        synchronized(data) {
+            data.put("random.new", String.valueOf(Math.random()));
+            data.put("_random.new.timestamp", String.valueOf(System.currentTimeMillis()));
+            return new HashMap<>(data);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/4869d946/modules/events/src/test/java/org/apache/tamaya/events/RandomPropertySource.java
----------------------------------------------------------------------
diff --git a/modules/events/src/test/java/org/apache/tamaya/events/RandomPropertySource.java b/modules/events/src/test/java/org/apache/tamaya/events/RandomPropertySource.java
deleted file mode 100644
index 4faa1b5..0000000
--- a/modules/events/src/test/java/org/apache/tamaya/events/RandomPropertySource.java
+++ /dev/null
@@ -1,65 +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.events;
-
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertyValue;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * PropertySource that provides a random entry, different on each access!
- */
-public class RandomPropertySource implements PropertySource{
-
-    private Map<String, PropertyValue> data = new HashMap<>();
-
-    @Override
-    public int getOrdinal() {
-        return 0;
-    }
-
-    @Override
-    public String getName() {
-        return "random";
-    }
-
-    @Override
-    public PropertyValue get(String key) {
-        if(key.equals("random.new")){
-            return PropertyValue.of(key, String.valueOf(Math.random()),getName());
-        }
-        return null;
-    }
-
-    @Override
-    public Map<String, PropertyValue> getProperties() {
-        synchronized(data) {
-            data.put("random.new", PropertyValue.builder("random.new", String.valueOf(Math.random()), getName())
-            .addMetaEntry("_random.new.timestamp", String.valueOf(System.currentTimeMillis())).build());
-            return new HashMap<>(data);
-        }
-    }
-
-    @Override
-    public boolean isScannable() {
-        return true;
-    }
-}



Mime
View raw message