commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1426972 - in /commons/proper/configuration/trunk/src: main/java/org/apache/commons/configuration/reloading/ReloadingController.java test/java/org/apache/commons/configuration/reloading/TestReloadingController.java
Date Sun, 30 Dec 2012 18:17:12 GMT
Author: oheger
Date: Sun Dec 30 18:17:11 2012
New Revision: 1426972

URL: http://svn.apache.org/viewvc?rev=1426972&view=rev
Log:
ReloadingController.checkForReloading() now returns a boolean.

Modified:
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/reloading/ReloadingController.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/reloading/TestReloadingController.java

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/reloading/ReloadingController.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/reloading/ReloadingController.java?rev=1426972&r1=1426971&r2=1426972&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/reloading/ReloadingController.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/reloading/ReloadingController.java
Sun Dec 30 18:17:11 2012
@@ -142,11 +142,12 @@ public class ReloadingController
      * to the associated {@link ReloadingDetector} and sends out notifications
      * if necessary. The argument can be an arbitrary data object; it will be
      * part of the event notification sent out when a reload operation should be
-     * performed.
+     * performed. The return value indicates whether a change was detected and
+     * an event was sent.
      *
      * @param data additional data for an event notification
      */
-    public void checkForReloading(Object data)
+    public boolean checkForReloading(Object data)
     {
         boolean sendEvent = false;
         synchronized (this)
@@ -164,7 +165,9 @@ public class ReloadingController
         if (sendEvent)
         {
             listeners.fire().reloadingRequired(new ReloadingEvent(this, data));
+            return true;
         }
+        return false;
     }
 
     /**

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/reloading/TestReloadingController.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/reloading/TestReloadingController.java?rev=1426972&r1=1426971&r2=1426972&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/reloading/TestReloadingController.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/reloading/TestReloadingController.java
Sun Dec 30 18:17:11 2012
@@ -112,7 +112,7 @@ public class TestReloadingController
         ctrl.addReloadingListener(l);
         ctrl.removeReloadingListener(lRemoved);
         Object testData = "Some test data";
-        ctrl.checkForReloading(testData);
+        assertTrue("Wrong result", ctrl.checkForReloading(testData));
         assertTrue("Not in reloading state", ctrl.isInReloadingState());
         assertSame("Wrong event source", ctrl, evRef.getValue().getSource());
         assertSame("Wrong controller", ctrl, evRef.getValue().getController());
@@ -132,7 +132,7 @@ public class TestReloadingController
         EasyMock.replay(detector, l);
         ReloadingController ctrl = createController();
         ctrl.addReloadingListener(l);
-        ctrl.checkForReloading(null);
+        assertFalse("Wrong result", ctrl.checkForReloading(null));
         assertFalse("In reloading state", ctrl.isInReloadingState());
         EasyMock.verify(detector, l);
     }
@@ -150,8 +150,8 @@ public class TestReloadingController
         EasyMock.replay(detector, l);
         ReloadingController ctrl = createController();
         ctrl.addReloadingListener(l);
-        ctrl.checkForReloading(1);
-        ctrl.checkForReloading(2);
+        assertTrue("Wrong result (1)", ctrl.checkForReloading(1));
+        assertFalse("Wrong result (2)", ctrl.checkForReloading(2));
         EasyMock.verify(detector, l);
     }
 



Mime
View raw message