commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1502854 - in /commons/proper/configuration/trunk/src: main/java/org/apache/commons/configuration/SubnodeConfiguration.java test/java/org/apache/commons/configuration/TestSubnodeConfiguration.java
Date Sat, 13 Jul 2013 19:33:20 GMT
Author: oheger
Date: Sat Jul 13 19:33:20 2013
New Revision: 1502854

URL: http://svn.apache.org/r1502854
Log:
Changed list delimiter handling in SubnodeConfiguration.

Now the listDelimiterHandler property is used rather than listDelimiter, and
listDelimiterParsingDisabled.

Modified:
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/SubnodeConfiguration.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestSubnodeConfiguration.java

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/SubnodeConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/SubnodeConfiguration.java?rev=1502854&r1=1502853&r2=1502854&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/SubnodeConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/SubnodeConfiguration.java
Sat Jul 13 19:33:20 2013
@@ -297,8 +297,7 @@ public class SubnodeConfiguration extend
     protected void initFromParent(BaseHierarchicalConfiguration parentConfig)
     {
         setExpressionEngine(parentConfig.getExpressionEngine());
-        setListDelimiter(parentConfig.getListDelimiter());
-        setDelimiterParsingDisabled(parentConfig.isDelimiterParsingDisabled());
+        setListDelimiterHandler(parentConfig.getListDelimiterHandler());
         setThrowExceptionOnMissing(parentConfig.isThrowExceptionOnMissing());
     }
 

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestSubnodeConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestSubnodeConfiguration.java?rev=1502854&r1=1502853&r2=1502854&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestSubnodeConfiguration.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/TestSubnodeConfiguration.java
Sat Jul 13 19:33:20 2013
@@ -35,7 +35,6 @@ import org.apache.commons.configuration.
 import org.apache.commons.configuration.tree.ConfigurationNode;
 import org.apache.commons.configuration.tree.xpath.XPathExpressionEngine;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 
 /**
@@ -213,45 +212,25 @@ public class TestSubnodeConfiguration
     }
 
     /**
-     * Tests handling of the delimiter parsing disabled flag. This is shared
-     * with the parent, too.
+     * Tests manipulating the list delimiter handler. This object is derived
+     * from the parent.
      */
     @Test
-    public void testSetDelimiterParsingDisabled()
+    public void testSetListDelimiterHandler()
     {
-        parent.setDelimiterParsingDisabled(true);
+        ListDelimiterHandler handler1 = new DefaultListDelimiterHandler('/');
+        ListDelimiterHandler handler2 = new DefaultListDelimiterHandler(';');
+        parent.setListDelimiterHandler(handler1);
         setUpSubnodeConfig();
-        parent.setDelimiterParsingDisabled(false);
-        assertTrue("Delimiter parsing flag was not received from parent",
-                config.isDelimiterParsingDisabled());
-        config.addProperty("newProp", "test1,test2,test3");
-        assertEquals("New property was splitted", "test1,test2,test3", parent
-                .getString("tables.table(0).newProp"));
-        parent.setDelimiterParsingDisabled(true);
-        config.setDelimiterParsingDisabled(false);
-        assertTrue("Delimiter parsing flag was reset on parent", parent
-                .isDelimiterParsingDisabled());
-    }
-
-    /**
-     * Tests manipulating the list delimiter. This piece of data is derived from
-     * the parent.
-     */
-    @Ignore //TODO enable again when delimiter handling has been reworked
-    @Test
-    public void testSetListDelimiter()
-    {
-        parent.setListDelimiter('/');
-        setUpSubnodeConfig();
-        parent.setListDelimiter(';');
-        assertEquals("List delimiter not obtained from parent", '/', config
-                .getListDelimiter());
+        parent.setListDelimiterHandler(handler2);
+        assertEquals("List delimiter handler not obtained from parent",
+                handler1, config.getListDelimiterHandler());
         config.addProperty("newProp", "test1,test2/test3");
-        assertEquals("List was incorrectly splitted", "test1,test2", parent
-                .getString("tables.table(0).newProp"));
-        config.setListDelimiter(',');
-        assertEquals("List delimiter changed on parent", ';', parent
-                .getListDelimiter());
+        assertEquals("List was incorrectly splitted", "test1,test2",
+                parent.getString("tables.table(0).newProp"));
+        config.setListDelimiterHandler(DisabledListDelimiterHandler.INSTANCE);
+        assertEquals("List delimiter changed on parent", handler2,
+                parent.getListDelimiterHandler());
     }
 
     /**



Mime
View raw message