commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1609803 - /commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestAbstractConfigurationBasicFeatures.java
Date Fri, 11 Jul 2014 20:23:27 GMT
Author: oheger
Date: Fri Jul 11 20:23:26 2014
New Revision: 1609803

URL: http://svn.apache.org/r1609803
Log:
Adapted test class to changes on event handling.

Modified:
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestAbstractConfigurationBasicFeatures.java

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestAbstractConfigurationBasicFeatures.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestAbstractConfigurationBasicFeatures.java?rev=1609803&r1=1609802&r2=1609803&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestAbstractConfigurationBasicFeatures.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestAbstractConfigurationBasicFeatures.java
Fri Jul 11 20:23:26 2014
@@ -38,7 +38,8 @@ import org.apache.commons.configuration.
 import org.apache.commons.configuration.convert.DefaultListDelimiterHandler;
 import org.apache.commons.configuration.convert.DisabledListDelimiterHandler;
 import org.apache.commons.configuration.event.ConfigurationEvent;
-import org.apache.commons.configuration.event.ConfigurationListener;
+import org.apache.commons.configuration.event.EventListener;
+import org.apache.commons.configuration.event.EventType;
 import org.apache.commons.configuration.interpol.ConfigurationInterpolator;
 import org.apache.commons.configuration.interpol.Lookup;
 import org.easymock.EasyMock;
@@ -202,9 +203,9 @@ public class TestAbstractConfigurationBa
         AbstractConfiguration config = setUpDestConfig();
         Configuration srcConfig = setUpSourceConfig();
         CollectingConfigurationListener l = new CollectingConfigurationListener();
-        config.addConfigurationListener(l);
+        config.addEventListener(ConfigurationEvent.ANY, l);
         config.copy(srcConfig);
-        checkCopyEvents(l, srcConfig, AbstractConfiguration.EVENT_SET_PROPERTY);
+        checkCopyEvents(l, srcConfig, ConfigurationEvent.SET_PROPERTY);
     }
 
     /**
@@ -284,9 +285,9 @@ public class TestAbstractConfigurationBa
         AbstractConfiguration config = setUpDestConfig();
         Configuration srcConfig = setUpSourceConfig();
         CollectingConfigurationListener l = new CollectingConfigurationListener();
-        config.addConfigurationListener(l);
+        config.addEventListener(ConfigurationEvent.ANY, l);
         config.append(srcConfig);
-        checkCopyEvents(l, srcConfig, AbstractConfiguration.EVENT_ADD_PROPERTY);
+        checkCopyEvents(l, srcConfig, ConfigurationEvent.ADD_PROPERTY);
     }
 
     /**
@@ -1015,12 +1016,12 @@ public class TestAbstractConfigurationBa
      * @param eventType the expected event type
      */
     private void checkCopyEvents(CollectingConfigurationListener l,
-            Configuration src, int eventType)
+            Configuration src, EventType<?> eventType)
     {
         Map<String, ConfigurationEvent> events = new HashMap<String, ConfigurationEvent>();
         for (ConfigurationEvent e : l.events)
         {
-            assertEquals("Wrong event type", eventType, e.getType());
+            assertEquals("Wrong event type", eventType, e.getEventType());
             assertTrue("Unknown property: " + e.getPropertyName(), src
                     .containsKey(e.getPropertyName()));
             if (!e.isBeforeUpdate())
@@ -1105,13 +1106,13 @@ public class TestAbstractConfigurationBa
      * An event listener implementation that simply collects all received
      * configuration events.
      */
-    static class CollectingConfigurationListener implements
-            ConfigurationListener
+    private static class CollectingConfigurationListener implements
+            EventListener<ConfigurationEvent>
     {
-        List<ConfigurationEvent> events = new ArrayList<ConfigurationEvent>();
+        final List<ConfigurationEvent> events = new ArrayList<ConfigurationEvent>();
 
         @Override
-        public void configurationChanged(ConfigurationEvent event)
+        public void onEvent(ConfigurationEvent event)
         {
             events.add(event);
         }



Mime
View raw message