commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r632843 - in /commons/proper/configuration/trunk: src/java/org/apache/commons/configuration/CombinedConfiguration.java src/test/org/apache/commons/configuration/TestCombinedConfiguration.java xdocs/changes.xml
Date Sun, 02 Mar 2008 21:00:45 GMT
Author: oheger
Date: Sun Mar  2 13:00:44 2008
New Revision: 632843

URL: http://svn.apache.org/viewvc?rev=632843&view=rev
Log:
CONFIGURATION-315: CombinedConfiguration now only sends a single EVENT_COMBINED_INVALIDATE
event for a changed child configuration

Modified:
    commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/CombinedConfiguration.java
    commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestCombinedConfiguration.java
    commons/proper/configuration/trunk/xdocs/changes.xml

Modified: commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/CombinedConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/CombinedConfiguration.java?rev=632843&r1=632842&r2=632843&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/CombinedConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/CombinedConfiguration.java
Sun Mar  2 13:00:44 2008
@@ -485,7 +485,10 @@
      */
     public void configurationChanged(ConfigurationEvent event)
     {
-        invalidate();
+        if (!event.isBeforeUpdate())
+        {
+            invalidate();
+        }
     }
 
     /**

Modified: commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestCombinedConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestCombinedConfiguration.java?rev=632843&r1=632842&r2=632843&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestCombinedConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestCombinedConfiguration.java
Sun Mar  2 13:00:44 2008
@@ -319,7 +319,7 @@
         c.addProperty("test.otherTest", "yes");
         assertEquals("New property not found", "yes", config
                 .getString("test.otherTest"));
-        listener.checkEvent(3, 0);
+        listener.checkEvent(2, 0);
     }
 
     /**
@@ -567,6 +567,21 @@
         sub.addProperty("test.pi", "3\\,1415");
         config.addConfiguration(sub);
         assertEquals("Wrong value", "3,1415", config.getString("test.pi"));
+    }
+
+    /**
+     * Tests whether an invalidate event is fired only after a change. This test
+     * is related to CONFIGURATION-315.
+     */
+    public void testInvalidateAfterChange()
+    {
+        ConfigurationEvent event = new ConfigurationEvent(config, 0, null,
+                null, true);
+        config.configurationChanged(event);
+        assertEquals("Invalidate event fired", 0, listener.invalidateEvents);
+        event = new ConfigurationEvent(config, 0, null, null, false);
+        config.configurationChanged(event);
+        assertEquals("No invalidate event fired", 1, listener.invalidateEvents);
     }
 
     /**

Modified: commons/proper/configuration/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/xdocs/changes.xml?rev=632843&r1=632842&r2=632843&view=diff
==============================================================================
--- commons/proper/configuration/trunk/xdocs/changes.xml (original)
+++ commons/proper/configuration/trunk/xdocs/changes.xml Sun Mar  2 13:00:44 2008
@@ -23,6 +23,11 @@
 
   <body>
     <release version="1.6" date="in SVN" description="">
+      <action dev="oheger" type="fix" issue="CONFIGURATION-315">
+        CombinedConfiguration used to send two EVENT_COMBINED_INVALIDATE events
+        for each modified child configuration. Now this event is sent only
+        once after the affected child configuration was updated.
+      </action>
       <action dev="oheger" type="fix" issue="CONFIGURATION-306">
         INIConfiguration now preserves whitespace in quoted values.
       </action>



Mime
View raw message