commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r903554 - in /commons/proper/configuration/branches/configuration2_experimental/src: main/java/org/apache/commons/configuration2/ test/java/org/apache/commons/configuration2/ test/java/org/apache/commons/configuration2/combined/
Date Wed, 27 Jan 2010 07:26:54 GMT
Author: oheger
Date: Wed Jan 27 07:26:53 2010
New Revision: 903554

URL: http://svn.apache.org/viewvc?rev=903554&view=rev
Log:
Removed duplicate DynamicCombinedConfiguration class. The new one is in the combined package.

Removed:
    commons/proper/configuration/branches/configuration2_experimental/src/main/java/org/apache/commons/configuration2/DynamicCombinedConfiguration.java
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/TestDynamicCombinedConfiguration.java
Modified:
    commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/combined/TestDynamicCombinedConfiguration.java

Modified: commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/combined/TestDynamicCombinedConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/combined/TestDynamicCombinedConfiguration.java?rev=903554&r1=903553&r2=903554&view=diff
==============================================================================
--- commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/combined/TestDynamicCombinedConfiguration.java
(original)
+++ commons/proper/configuration/branches/configuration2_experimental/src/test/java/org/apache/commons/configuration2/combined/TestDynamicCombinedConfiguration.java
Wed Jan 27 07:26:53 2010
@@ -17,17 +17,29 @@
 
 package org.apache.commons.configuration2.combined;
 
-import junit.framework.TestCase;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+
 import org.apache.commons.configuration2.MultiFileHierarchicalConfiguration;
 import org.apache.commons.configuration2.XMLConfiguration;
+import org.apache.commons.configuration2.expr.xpath.XPathExpressionEngine;
+import org.junit.Test;
 
-public class TestDynamicCombinedConfiguration extends TestCase
+/**
+ * Test class for {@code DynamicCombinedConfiguration}.
+ *
+ * @version $Id: $
+ */
+public class TestDynamicCombinedConfiguration
 {
     private static String PATTERN ="${sys:Id}";
     private static String PATTERN1 = "target/test-classes/testMultiConfiguration_${sys:Id}.xml";
     private static String DEFAULT_FILE = "target/test-classes/testMultiConfiguration_default.xml";
 
-    public void testConfiguration() throws Exception
+    @Test
+    public void testConfiguration1() throws Exception
     {
         DynamicCombinedConfiguration config = new DynamicCombinedConfiguration();
         config.setKeyPattern(PATTERN);
@@ -42,6 +54,37 @@
         verify("1004", config, 50);
     }
 
+    @Test
+    public void testConfiguration2() throws Exception
+    {
+        DynamicCombinedConfiguration config = new DynamicCombinedConfiguration();
+        XPathExpressionEngine engine1 = new XPathExpressionEngine();
+        config.setExpressionEngine(engine1);
+        config.setKeyPattern(PATTERN);
+        config.setDelimiterParsingDisabled(true);
+        MultiFileHierarchicalConfiguration multi = new MultiFileHierarchicalConfiguration(PATTERN1);
+        XPathExpressionEngine engine2 = new XPathExpressionEngine();
+        multi.setExpressionEngine(engine2);
+        config.addConfiguration(multi, "Multi");
+        XMLConfiguration xml = new XMLConfiguration();
+        xml.setExpressionEngine(engine2);
+        xml.setDelimiterParsingDisabled(true);
+        xml.setFile(new File(DEFAULT_FILE));
+        xml.load();
+        config.addConfiguration(xml, "Default");
+
+        verify("1001", config, 15);
+        verify("1002", config, 25);
+        verify("1003", config, 35);
+        verify("1004", config, 50);
+        assertEquals("a,b,c", config.getString("split/list3/@values"));
+        assertEquals(0, config.getMaxIndex("split/list3/@values"));
+        assertEquals("a\\,b\\,c", config.getString("split/list4/@values"));
+        assertEquals("a,b,c", config.getString("split/list1"));
+        assertEquals(0, config.getMaxIndex("split/list1"));
+        assertEquals("a\\,b\\,c", config.getString("split/list2"));
+    }
+
     private void verify(String key, DynamicCombinedConfiguration config, int rows)
     {
         System.setProperty("Id", key);



Mime
View raw message