commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1157970 - /commons/proper/configuration/trunk/src/test/org/apache/commons/configuration/TestCombinedConfiguration.java
Date Mon, 15 Aug 2011 19:52:27 GMT
Author: oheger
Date: Mon Aug 15 19:52:26 2011
New Revision: 1157970

URL: http://svn.apache.org/viewvc?rev=1157970&view=rev
Log:
[CONFIGURATION-460] Added a test case to verify that reloading works for nested combined configurations.

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

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=1157970&r1=1157969&r2=1157970&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
Mon Aug 15 19:52:26 2011
@@ -512,6 +512,32 @@ public class TestCombinedConfiguration e
     }
 
     /**
+     * Tests whether reloading works for a combined configuration nested in
+     * another combined configuration.
+     */
+    public void testReloadingNestedCC() throws IOException,
+            ConfigurationException
+    {
+        config.setForceReloadCheck(true);
+        File testXmlFile =
+                writeReloadFile(RELOAD_XML_NAME, RELOAD_XML_CONTENT, 0);
+        File testPropsFile =
+                writeReloadFile(RELOAD_PROPS_NAME, RELOAD_PROPS_CONTENT, 0);
+        XMLConfiguration c1 = new XMLConfiguration(testXmlFile);
+        c1.setReloadingStrategy(new FileAlwaysReloadingStrategy());
+        PropertiesConfiguration c2 = new PropertiesConfiguration(testPropsFile);
+        c2.setReloadingStrategy(new FileAlwaysReloadingStrategy());
+        config.addConfiguration(c2);
+        CombinedConfiguration cc2 = new CombinedConfiguration();
+        cc2.setForceReloadCheck(true);
+        cc2.addConfiguration(c1);
+        config.addConfiguration(cc2);
+        assertEquals("Wrong xml reload value", 0, config.getInt("xmlReload"));
+        writeReloadFile(RELOAD_XML_NAME, RELOAD_XML_CONTENT, 1);
+        assertEquals("XML reload not detected", 1, config.getInt("xmlReload"));
+    }
+
+    /**
      * Prepares a test of the getSource() method.
      */
     private void setUpSourceTest()



Mime
View raw message