commons-commits mailing list archives

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

URL: http://svn.apache.org/r1502845
Log:
BasicBuilderParameters now supports the new listDelimiterHandler property.

The properties for the list delimiter character and for disabling list
delimiter parsing were removed. This caused a bunch of changes in several test
classes.

Modified:
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/BasicBuilderParameters.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/BasicBuilderProperties.java
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/combined/CombinedConfigurationBuilderProvider.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestBasicBuilderParameters.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestBasicConfigurationBuilder.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestFileBasedBuilderParameters.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestJndiBuilderParametersImpl.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestBaseConfigurationBuilderProvider.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestCombinedBuilderParametersImpl.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestCombinedConfigurationBuilder.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestMultiFileConfigurationBuilder.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestMultiWrapDynaBean.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/fluent/TestParameters.java
    commons/proper/configuration/trunk/src/test/resources/testCCMultiTenent.xml
    commons/proper/configuration/trunk/src/test/resources/testMultiTenentConfigurationBuilder4.xml
    commons/proper/configuration/trunk/src/test/resources/testMultiTenentConfigurationBuilder5.xml

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/BasicBuilderParameters.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/BasicBuilderParameters.java?rev=1502845&r1=1502844&r2=1502845&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/BasicBuilderParameters.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/BasicBuilderParameters.java
Sat Jul 13 19:27:19 2013
@@ -21,6 +21,8 @@ import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.commons.configuration.AbstractConfiguration;
+import org.apache.commons.configuration.ListDelimiterHandler;
 import org.apache.commons.configuration.interpol.ConfigurationInterpolator;
 import org.apache.commons.configuration.interpol.InterpolatorSpecification;
 import org.apache.commons.configuration.interpol.Lookup;
@@ -54,12 +56,8 @@ public class BasicBuilderParameters impl
     private static final String PROP_THROW_EXCEPTION_ON_MISSING =
             "throwExceptionOnMissing";
 
-    /** The key of the <em>delimiterParsingDisabled</em> property. */
-    private static final String PROP_DELIMITER_PARSING_DISABLED =
-            "delimiterParsingDisabled";
-
-    /** The key of the <em>listDelimiter</em> property. */
-    private static final String PROP_LIST_DELIMITER = "listDelimiter";
+    /** The key of the <em>listDelimiterHandler</em> property. */
+    private static final String PROP_LIST_DELIMITER_HANDLER = "listDelimiterHandler";
 
     /** The key of the <em>logger</em> property. */
     private static final String PROP_LOGGER = "logger";
@@ -88,7 +86,6 @@ public class BasicBuilderParameters impl
     public BasicBuilderParameters()
     {
         properties = new HashMap<String, Object>();
-        initDefaults();
     }
 
     /**
@@ -127,21 +124,6 @@ public class BasicBuilderParameters impl
     }
 
     /**
-     * Sets the value of the <em>delimiterParsingDisabled</em> property. This
-     * property controls whether the configuration should look for list
-     * delimiter characters in the values of newly added properties. If the
-     * property value is <b>true</b> and such characters are encountered,
-     * multiple values are stored for the affected property.
-     *
-     * @param b the value of the property
-     * @return a reference to this object for method chaining
-     */
-    public BasicBuilderParameters setDelimiterParsingDisabled(boolean b)
-    {
-        return setProperty(PROP_DELIMITER_PARSING_DISABLED, Boolean.valueOf(b));
-    }
-
-    /**
      * Sets the value of the <em>throwExceptionOnMissing</em> property. This
      * property controls the configuration's behavior if missing properties are
      * queried: a value of <b>true</b> causes the configuration to throw an
@@ -158,17 +140,20 @@ public class BasicBuilderParameters impl
     }
 
     /**
-     * Sets the value of the <em>listDelimiter</em> property. This property
-     * defines the list delimiter character. It is evaluated only if the
-     * <em>delimiterParsingDisabled</em> property is set to <b>false</b>.
+     * Sets the value of the <em>listDelimiterHandler</em> property. This
+     * property defines the object responsible for dealing with list delimiter
+     * and escaping characters. Note: {@link AbstractConfiguration} does not
+     * allow setting this property to <b>null</b>. If the default
+     * {@code ListDelimiterHandler} is to be used, do not call this method.
      *
-     * @param c the list delimiter character
+     * @param handler the {@code ListDelimiterHandler}
      * @return a reference to this object for method chaining
-     * @see #setDelimiterParsingDisabled(boolean)
+     * @see AbstractConfiguration#setListDelimiterHandler(ListDelimiterHandler)
      */
-    public BasicBuilderParameters setListDelimiter(char c)
+    public BasicBuilderParameters setListDelimiterHandler(
+            ListDelimiterHandler handler)
     {
-        return setProperty(PROP_LIST_DELIMITER, Character.valueOf(c));
+        return setProperty(PROP_LIST_DELIMITER_HANDLER, handler);
     }
 
     /**
@@ -360,14 +345,6 @@ public class BasicBuilderParameters impl
     }
 
     /**
-     * Sets default parameter values.
-     */
-    private void initDefaults()
-    {
-        properties.put(PROP_DELIMITER_PARSING_DISABLED, Boolean.TRUE);
-    }
-
-    /**
      * Helper method for setting a property value.
      *
      * @param key the key of the property

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/BasicBuilderProperties.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/BasicBuilderProperties.java?rev=1502845&r1=1502844&r2=1502845&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/BasicBuilderProperties.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/BasicBuilderProperties.java
Sat Jul 13 19:27:19 2013
@@ -19,6 +19,8 @@ package org.apache.commons.configuration
 import java.util.Collection;
 import java.util.Map;
 
+import org.apache.commons.configuration.AbstractConfiguration;
+import org.apache.commons.configuration.ListDelimiterHandler;
 import org.apache.commons.configuration.interpol.ConfigurationInterpolator;
 import org.apache.commons.configuration.interpol.Lookup;
 import org.apache.commons.configuration.sync.Synchronizer;
@@ -53,18 +55,6 @@ public interface BasicBuilderProperties<
     T setLogger(Log log);
 
     /**
-     * Sets the value of the <em>delimiterParsingDisabled</em> property. This
-     * property controls whether the configuration should look for list
-     * delimiter characters in the values of newly added properties. If the
-     * property value is <b>true</b> and such characters are encountered,
-     * multiple values are stored for the affected property.
-     *
-     * @param b the value of the property
-     * @return a reference to this object for method chaining
-     */
-    T setDelimiterParsingDisabled(boolean b);
-
-    /**
      * Sets the value of the <em>throwExceptionOnMissing</em> property. This
      * property controls the configuration's behavior if missing properties are
      * queried: a value of <b>true</b> causes the configuration to throw an
@@ -78,15 +68,17 @@ public interface BasicBuilderProperties<
     T setThrowExceptionOnMissing(boolean b);
 
     /**
-     * Sets the value of the <em>listDelimiter</em> property. This property
-     * defines the list delimiter character. It is evaluated only if the
-     * <em>delimiterParsingDisabled</em> property is set to <b>false</b>.
+     * Sets the value of the <em>listDelimiterHandler</em> property. This
+     * property defines the object responsible for dealing with list delimiter
+     * and escaping characters. Note: {@link AbstractConfiguration} does not
+     * allow setting this property to <b>null</b>. If the default
+     * {@code ListDelimiterHandler} is to be used, do not call this method.
      *
-     * @param c the list delimiter character
+     * @param handler the {@code ListDelimiterHandler}
      * @return a reference to this object for method chaining
-     * @see #setDelimiterParsingDisabled(boolean)
+     * @see AbstractConfiguration#setListDelimiterHandler(ListDelimiterHandler)
      */
-    T setListDelimiter(char c);
+    T setListDelimiterHandler(ListDelimiterHandler handler);
 
     /**
      * Sets the {@code ConfigurationInterpolator} to be used for this

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/combined/CombinedConfigurationBuilderProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/combined/CombinedConfigurationBuilderProvider.java?rev=1502845&r1=1502844&r2=1502845&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/combined/CombinedConfigurationBuilderProvider.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration/builder/combined/CombinedConfigurationBuilderProvider.java
Sat Jul 13 19:27:19 2013
@@ -126,8 +126,7 @@ public class CombinedConfigurationBuilde
     private static void setUpBasicParameters(CombinedConfiguration config,
             BasicBuilderParameters params)
     {
-        params.setDelimiterParsingDisabled(config.isDelimiterParsingDisabled())
-                .setListDelimiter(config.getListDelimiter())
+        params.setListDelimiterHandler(config.getListDelimiterHandler())
                 .setLogger(config.getLogger())
                 .setThrowExceptionOnMissing(config.isThrowExceptionOnMissing());
     }

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestBasicBuilderParameters.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestBasicBuilderParameters.java?rev=1502845&r1=1502844&r2=1502845&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestBasicBuilderParameters.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestBasicBuilderParameters.java
Sat Jul 13 19:27:19 2013
@@ -29,6 +29,7 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.commons.configuration.ListDelimiterHandler;
 import org.apache.commons.configuration.interpol.ConfigurationInterpolator;
 import org.apache.commons.configuration.interpol.InterpolatorSpecification;
 import org.apache.commons.configuration.interpol.Lookup;
@@ -61,9 +62,7 @@ public class TestBasicBuilderParameters
     public void testDefaults()
     {
         Map<String, Object> paramMap = params.getParameters();
-        assertEquals("Wrong number of parameters", 1, paramMap.size());
-        assertEquals("Delimiter flag not set", Boolean.TRUE,
-                paramMap.get("delimiterParsingDisabled"));
+        assertTrue("Got parameters", paramMap.isEmpty());
     }
 
     /**
@@ -95,18 +94,6 @@ public class TestBasicBuilderParameters
     }
 
     /**
-     * Tests whether the delimiter parsing disabled property can be set.
-     */
-    @Test
-    public void testSetDelimiterParsingDisabled()
-    {
-        assertSame("Wrong result", params,
-                params.setDelimiterParsingDisabled(false));
-        assertEquals("Wrong flag value", Boolean.FALSE, params.getParameters()
-                .get("delimiterParsingDisabled"));
-    }
-
-    /**
      * Tests whether the throw exception on missing property can be set.
      */
     @Test
@@ -119,14 +106,18 @@ public class TestBasicBuilderParameters
     }
 
     /**
-     * Tests whether the list delimiter property can be set.
+     * Tests whether the list delimiter handler property can be set.
      */
     @Test
     public void testSetListDelimiter()
     {
-        assertSame("Wrong result", params, params.setListDelimiter(';'));
-        assertEquals("Wrong delimiter", Character.valueOf(';'), params
-                .getParameters().get("listDelimiter"));
+        ListDelimiterHandler handler =
+                EasyMock.createMock(ListDelimiterHandler.class);
+        EasyMock.replay(handler);
+        assertSame("Wrong result", params,
+                params.setListDelimiterHandler(handler));
+        assertSame("Wrong delimiter handler", handler, params.getParameters()
+                .get("listDelimiterHandler"));
     }
 
     /**
@@ -256,20 +247,22 @@ public class TestBasicBuilderParameters
     @Test
     public void testMerge()
     {
+        ListDelimiterHandler handler1 = EasyMock.createMock(ListDelimiterHandler.class);
+        ListDelimiterHandler handler2 = EasyMock.createMock(ListDelimiterHandler.class);
         Map<String, Object> props = new HashMap<String, Object>();
         props.put("throwExceptionOnMissing", Boolean.TRUE);
-        props.put("listDelimiter", Character.valueOf('-'));
+        props.put("listDelimiterHandler", handler1);
         props.put("other", "test");
         props.put(BuilderParameters.RESERVED_PARAMETER_PREFIX + "test",
                 "reserved");
         BuilderParameters p = EasyMock.createMock(BuilderParameters.class);
         EasyMock.expect(p.getParameters()).andReturn(props);
         EasyMock.replay(p);
-        params.setListDelimiter('+');
+        params.setListDelimiterHandler(handler2);
         params.merge(p);
         Map<String, Object> map = params.getParameters();
-        assertEquals("Wrong list delimiter", Character.valueOf('+'),
-                map.get("listDelimiter"));
+        assertEquals("Wrong list delimiter handler", handler2,
+                map.get("listDelimiterHandler"));
         assertEquals("Wrong exception flag", Boolean.TRUE,
                 map.get("throwExceptionOnMissing"));
         assertEquals("Wrong other property", "test", map.get("other"));
@@ -410,18 +403,20 @@ public class TestBasicBuilderParameters
         Log log = EasyMock.createMock(Log.class);
         ConfigurationInterpolator ci =
                 EasyMock.createMock(ConfigurationInterpolator.class);
-        params.setListDelimiter('#');
+        ListDelimiterHandler handler1 = EasyMock.createMock(ListDelimiterHandler.class);
+        ListDelimiterHandler handler2 = EasyMock.createMock(ListDelimiterHandler.class);
+        params.setListDelimiterHandler(handler1);
         params.setLogger(log);
         params.setInterpolator(ci);
         params.setThrowExceptionOnMissing(true);
         BasicBuilderParameters clone = params.clone();
-        params.setListDelimiter('.');
+        params.setListDelimiterHandler(handler2);
         params.setThrowExceptionOnMissing(false);
         Map<String, Object> map = clone.getParameters();
         assertSame("Wrong logger", log, map.get("logger"));
         assertSame("Wrong interpolator", ci, map.get("interpolator"));
-        assertEquals("Wrong list delimiter", Character.valueOf('#'),
-                map.get("listDelimiter"));
+        assertEquals("Wrong list delimiter handler", handler1,
+                map.get("listDelimiterHandler"));
         assertEquals("Wrong exception flag", Boolean.TRUE,
                 map.get("throwExceptionOnMissing"));
     }

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestBasicConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestBasicConfigurationBuilder.java?rev=1502845&r1=1502844&r2=1502845&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestBasicConfigurationBuilder.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestBasicConfigurationBuilder.java
Sat Jul 13 19:27:19 2013
@@ -35,7 +35,9 @@ import org.apache.commons.configuration.
 import org.apache.commons.configuration.Configuration;
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.ConfigurationRuntimeException;
+import org.apache.commons.configuration.DefaultListDelimiterHandler;
 import org.apache.commons.configuration.Initializable;
+import org.apache.commons.configuration.ListDelimiterHandler;
 import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.commons.configuration.XMLConfiguration;
 import org.apache.commons.configuration.beanutils.BeanDeclaration;
@@ -43,6 +45,7 @@ import org.apache.commons.configuration.
 import org.apache.commons.configuration.event.ConfigurationErrorListener;
 import org.apache.commons.configuration.event.ConfigurationListener;
 import org.easymock.EasyMock;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
 /**
@@ -52,6 +55,15 @@ import org.junit.Test;
  */
 public class TestBasicConfigurationBuilder
 {
+    /** A test list delimiter handler. */
+    private static ListDelimiterHandler listHandler;
+
+    @BeforeClass
+    public static void setUpBeforeClass() throws Exception
+    {
+        listHandler = new DefaultListDelimiterHandler(';');
+    }
+
     /**
      * Tries to create an instance without a result class.
      */
@@ -71,8 +83,7 @@ public class TestBasicConfigurationBuild
     {
         Map<String, Object> params = new HashMap<String, Object>();
         params.put("throwExceptionOnMissing", Boolean.TRUE);
-        params.put("delimiterParsingDisabled", Boolean.TRUE);
-        params.put("listDelimiter", Character.valueOf('.'));
+        params.put("listDelimiterHandler", listHandler);
         return params;
     }
 
@@ -141,8 +152,7 @@ public class TestBasicConfigurationBuild
                 new BasicConfigurationBuilder<PropertiesConfiguration>(
                         PropertiesConfiguration.class)
                         .configure(new BasicBuilderParameters()
-                                .setDelimiterParsingDisabled(true)
-                                .setListDelimiter('.')
+                                .setListDelimiterHandler(listHandler)
                                 .setThrowExceptionOnMissing(true));
         Map<String, Object> params2 =
                 new HashMap<String, Object>(builder.getParameters());
@@ -223,13 +233,12 @@ public class TestBasicConfigurationBuild
         PropertiesConfiguration config =
                 new BasicConfigurationBuilder<PropertiesConfiguration>(
                         PropertiesConfiguration.class).configure(
-                        new BasicBuilderParameters().setListDelimiter('*')
-                                .setThrowExceptionOnMissing(true))
+                        new BasicBuilderParameters().setListDelimiterHandler(
+                                listHandler).setThrowExceptionOnMissing(true))
                         .getConfiguration();
-        assertTrue("Delimiter parsing not disabled",
-                config.isDelimiterParsingDisabled());
         assertTrue("Wrong exception flag", config.isThrowExceptionOnMissing());
-        assertEquals("Wrong list delimiter", '*', config.getListDelimiter());
+        assertEquals("Wrong list delimiter handler", listHandler,
+                config.getListDelimiterHandler());
     }
 
     /**

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestFileBasedBuilderParameters.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestFileBasedBuilderParameters.java?rev=1502845&r1=1502844&r2=1502845&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestFileBasedBuilderParameters.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestFileBasedBuilderParameters.java
Sat Jul 13 19:27:19 2013
@@ -200,13 +200,11 @@ public class TestFileBasedBuilderParamet
         FileBasedBuilderParametersImpl params =
                 new FileBasedBuilderParametersImpl()
                         .setReloadingRefreshDelay(1000L);
-        params.setListDelimiter('*');
+        params.setThrowExceptionOnMissing(true);
         Map<String, Object> map = params.getParameters();
         assertTrue("Object not stored", map.values().contains(params));
-        assertEquals("Wrong delimiter parsing flag", Boolean.TRUE,
-                map.get("delimiterParsingDisabled"));
-        assertEquals("Wrong delimiter", Character.valueOf('*'), params
-                .getParameters().get("listDelimiter"));
+        assertEquals("Wrong exception flag", Boolean.TRUE, params
+                .getParameters().get("throwExceptionOnMissing"));
     }
 
     /**

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestJndiBuilderParametersImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestJndiBuilderParametersImpl.java?rev=1502845&r1=1502844&r2=1502845&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestJndiBuilderParametersImpl.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/TestJndiBuilderParametersImpl.java
Sat Jul 13 19:27:19 2013
@@ -76,12 +76,10 @@ public class TestJndiBuilderParametersIm
     public void testGetParametersBaseProperties()
     {
         params.setPrefix("somePrefix");
-        params.setListDelimiter('?');
+        params.setThrowExceptionOnMissing(true);
         Map<String, Object> paramsMap = params.getParameters();
-        assertEquals("Wrong delimiter parsing flag", Boolean.TRUE,
-                paramsMap.get("delimiterParsingDisabled"));
-        assertEquals("Wrong list delimiter", Character.valueOf('?'),
-                paramsMap.get("listDelimiter"));
+        assertEquals("Wrong exception flag", Boolean.TRUE,
+                paramsMap.get("throwExceptionOnMissing"));
     }
 
     /**

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestBaseConfigurationBuilderProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestBaseConfigurationBuilderProvider.java?rev=1502845&r1=1502844&r2=1502845&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestBaseConfigurationBuilderProvider.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestBaseConfigurationBuilderProvider.java
Sat Jul 13 19:27:19 2013
@@ -25,6 +25,8 @@ import org.apache.commons.configuration.
 import org.apache.commons.configuration.Configuration;
 import org.apache.commons.configuration.ConfigurationAssert;
 import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.DefaultListDelimiterHandler;
+import org.apache.commons.configuration.DisabledListDelimiterHandler;
 import org.apache.commons.configuration.HierarchicalConfiguration;
 import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.commons.configuration.builder.BasicBuilderParameters;
@@ -54,11 +56,14 @@ public class TestBaseConfigurationBuilde
         HierarchicalConfiguration config = new BaseHierarchicalConfiguration();
         config.addProperty(CombinedConfigurationBuilder.ATTR_RELOAD,
                 Boolean.valueOf(reload));
-        config.addProperty("[@delimiterParsingDisabled]", Boolean.TRUE);
-        config.addProperty("[@listDelimiter]", ';');
+        config.addProperty("[@throwExceptionOnMissing]", Boolean.TRUE);
         config.addProperty("[@path]",
                 ConfigurationAssert.getTestFile("test.properties")
                         .getAbsolutePath());
+        config.addProperty("listDelimiterHandler[@config-class]",
+                DefaultListDelimiterHandler.class.getName());
+        config.addProperty(
+                "listDelimiterHandler.config-constrarg[@config-value]", ";");
         return config;
     }
 
@@ -83,7 +88,7 @@ public class TestBaseConfigurationBuilde
                         if (params instanceof BasicBuilderParameters)
                         {
                             ((BasicBuilderParameters) params)
-                                    .setListDelimiter('!');
+                                    .setListDelimiterHandler(DisabledListDelimiterHandler.INSTANCE);
                         }
                     }
                 };
@@ -132,9 +137,11 @@ public class TestBaseConfigurationBuilde
         assertEquals("Wrong configuration class",
                 PropertiesConfiguration.class, config.getClass());
         PropertiesConfiguration pconfig = (PropertiesConfiguration) config;
-        assertTrue("Wrong delimiter parsing flag",
-                pconfig.isDelimiterParsingDisabled());
-        assertEquals("Wrong list delimiter", ';', pconfig.getListDelimiter());
+        assertTrue("Wrong exception flag",
+                pconfig.isThrowExceptionOnMissing());
+        DefaultListDelimiterHandler listHandler =
+                (DefaultListDelimiterHandler) pconfig.getListDelimiterHandler();
+        assertEquals("Wrong list delimiter", ';', listHandler.getDelimiter());
         assertTrue("Configuration not loaded",
                 pconfig.getBoolean("configuration.loaded"));
         return builder;

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestCombinedBuilderParametersImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestCombinedBuilderParametersImpl.java?rev=1502845&r1=1502844&r2=1502845&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestCombinedBuilderParametersImpl.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestCombinedBuilderParametersImpl.java
Sat Jul 13 19:27:19 2013
@@ -96,8 +96,6 @@ public class TestCombinedBuilderParamete
         Map<String, Object> map = params.getParameters();
         assertEquals("Exception flag not found", Boolean.TRUE,
                 map.get("throwExceptionOnMissing"));
-        assertEquals("Wrong delimiter parsing flag", Boolean.TRUE,
-                map.get("delimiterParsingDisabled"));
     }
 
     /**

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestCombinedConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestCombinedConfigurationBuilder.java?rev=1502845&r1=1502844&r2=1502845&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestCombinedConfigurationBuilder.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestCombinedConfigurationBuilder.java
Sat Jul 13 19:27:19 2013
@@ -45,9 +45,11 @@ import org.apache.commons.configuration.
 import org.apache.commons.configuration.ConfigurationRuntimeException;
 import org.apache.commons.configuration.ConfigurationUtils;
 import org.apache.commons.configuration.DefaultFileSystem;
+import org.apache.commons.configuration.DefaultListDelimiterHandler;
 import org.apache.commons.configuration.DynamicCombinedConfiguration;
 import org.apache.commons.configuration.FileSystem;
 import org.apache.commons.configuration.HierarchicalConfiguration;
+import org.apache.commons.configuration.ListDelimiterHandler;
 import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.commons.configuration.SubnodeConfiguration;
 import org.apache.commons.configuration.XMLConfiguration;
@@ -842,15 +844,18 @@ public class TestCombinedConfigurationBu
     {
         File testFile =
                 ConfigurationAssert.getTestFile("testCCResultClass.xml");
+        ListDelimiterHandler listHandler = new DefaultListDelimiterHandler('.');
         builder.configure(new CombinedBuilderParametersImpl()
                 .setDefinitionBuilderParameters(
                         new XMLBuilderParametersImpl().setFile(testFile))
-                .setListDelimiter('.').setThrowExceptionOnMissing(false));
+                .setListDelimiterHandler(listHandler)
+                .setThrowExceptionOnMissing(false));
         CombinedConfiguration cc = builder.getConfiguration();
         assertTrue("Wrong configuration class: " + cc.getClass(),
                 cc instanceof CombinedConfigurationTestImpl);
         assertTrue("Wrong exception flag", cc.isThrowExceptionOnMissing());
-        assertEquals("Wrong list delimiter", '.', cc.getListDelimiter());
+        assertEquals("Wrong list delimiter handler", listHandler,
+                cc.getListDelimiterHandler());
     }
 
     /**
@@ -885,15 +890,17 @@ public class TestCombinedConfigurationBu
         File testFile =
                 ConfigurationAssert
                         .getTestFile("testCCCombinedChildBuilder.xml");
+        ListDelimiterHandler listHandler = new DefaultListDelimiterHandler('*');
         builder.configure(new CombinedBuilderParametersImpl()
                 .setDefinitionBuilderParameters(
                         new XMLBuilderParametersImpl().setFile(testFile))
-                .setListDelimiter('*'));
+                .setListDelimiterHandler(listHandler));
         CombinedConfiguration cc = builder.getConfiguration();
         CombinedConfiguration cc2 =
                 (CombinedConfiguration) cc.getConfiguration("subcc");
         assertFalse("Wrong exception flag", cc2.isThrowExceptionOnMissing());
-        assertEquals("Wrong list delimiter", '*', cc2.getListDelimiter());
+        assertEquals("Wrong list delimiter handler", listHandler,
+                cc2.getListDelimiterHandler());
     }
 
     /**

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestMultiFileConfigurationBuilder.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestMultiFileConfigurationBuilder.java?rev=1502845&r1=1502844&r2=1502845&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestMultiFileConfigurationBuilder.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestMultiFileConfigurationBuilder.java
Sat Jul 13 19:27:19 2013
@@ -30,6 +30,7 @@ import java.util.Collections;
 
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.ConfigurationLookup;
+import org.apache.commons.configuration.DefaultListDelimiterHandler;
 import org.apache.commons.configuration.DynamicCombinedConfiguration;
 import org.apache.commons.configuration.HierarchicalConfiguration;
 import org.apache.commons.configuration.XMLConfiguration;
@@ -162,18 +163,22 @@ public class TestMultiFileConfigurationB
         ExpressionEngine engine = new XPathExpressionEngine();
         BuilderParameters xmlParams =
                 new XMLBuilderParametersImpl().setExpressionEngine(engine)
-                        .setListDelimiter(';');
+                        .setListDelimiterHandler(
+                                new DefaultListDelimiterHandler(';'));
         MultiFileBuilderParametersImpl params =
                 new MultiFileBuilderParametersImpl().setFilePattern(PATTERN)
                         .setManagedBuilderParameters(xmlParams);
         ConfigurationInterpolator ci = createInterpolator();
-        params.setInterpolator(ci).setListDelimiter('#');
+        params.setInterpolator(ci).setListDelimiterHandler(
+                new DefaultListDelimiterHandler('#'));
         builder.configure(params);
         switchToConfig(1);
         XMLConfiguration config = builder.getConfiguration();
         assertSame("Wrong expression engine", engine,
                 config.getExpressionEngine());
-        assertEquals("Wrong list delimiter", ';', config.getListDelimiter());
+        DefaultListDelimiterHandler listHandler =
+                (DefaultListDelimiterHandler) config.getListDelimiterHandler();
+        assertEquals("Wrong list delimiter", ';', listHandler.getDelimiter());
         assertNotSame("Interpolator was copied", ci, config.getInterpolator());
     }
 

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestMultiWrapDynaBean.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestMultiWrapDynaBean.java?rev=1502845&r1=1502844&r2=1502845&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestMultiWrapDynaBean.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/combined/TestMultiWrapDynaBean.java
Sat Jul 13 19:27:19 2013
@@ -28,6 +28,8 @@ import java.util.Map;
 import org.apache.commons.beanutils.DynaClass;
 import org.apache.commons.beanutils.LazyDynaBean;
 import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.configuration.DefaultListDelimiterHandler;
+import org.apache.commons.configuration.ListDelimiterHandler;
 import org.apache.commons.configuration.builder.BasicBuilderParameters;
 import org.apache.commons.configuration.builder.FileBasedBuilderParametersImpl;
 import org.junit.Test;
@@ -224,15 +226,16 @@ public class TestMultiWrapDynaBean
             beans.add(new BasicBuilderParameters());
         }
         MultiWrapDynaBean bean = new MultiWrapDynaBean(beans);
+        ListDelimiterHandler listHandler = new DefaultListDelimiterHandler('+');
         PropertyUtils
                 .setProperty(bean, "throwExceptionOnMissing", Boolean.TRUE);
         PropertyUtils
-                .setProperty(bean, "listDelimiter", Character.valueOf('+'));
+                .setProperty(bean, "listDelimiterHandler", listHandler);
         Map<String, Object> map = params.getParameters();
         assertEquals("Exception flag not set", Boolean.TRUE,
                 map.get("throwExceptionOnMissing"));
-        assertEquals("List delimiter not set", Character.valueOf('+'),
-                map.get("listDelimiter"));
+        assertEquals("List delimiter handler not set", listHandler,
+                map.get("listDelimiterHandler"));
     }
 
     /**

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/fluent/TestParameters.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/fluent/TestParameters.java?rev=1502845&r1=1502844&r2=1502845&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/fluent/TestParameters.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration/builder/fluent/TestParameters.java
Sat Jul 13 19:27:19 2013
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertTru
 
 import java.util.Map;
 
+import org.apache.commons.configuration.ListDelimiterHandler;
 import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.commons.configuration.builder.BasicBuilderParameters;
 import org.apache.commons.configuration.builder.BuilderParameters;
@@ -31,6 +32,7 @@ import org.apache.commons.configuration.
 import org.apache.commons.configuration.builder.combined.MultiFileBuilderParametersImpl;
 import org.apache.commons.configuration.tree.ExpressionEngine;
 import org.easymock.EasyMock;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
 /**
@@ -40,6 +42,15 @@ import org.junit.Test;
  */
 public class TestParameters
 {
+    /** A test list delimiter handler. */
+    private static ListDelimiterHandler listHandler;
+
+    @BeforeClass
+    public static void setUpBeforeClass() throws Exception
+    {
+        listHandler = EasyMock.createMock(ListDelimiterHandler.class);
+    }
+
     /**
      * Tests whether a basic parameters object can be created.
      */
@@ -58,10 +69,8 @@ public class TestParameters
      */
     private static void checkBasicProperties(Map<String, Object> map)
     {
-        assertEquals("Delimiter flag not set", Boolean.TRUE,
-                map.get("delimiterParsingDisabled"));
-        assertEquals("Wrong delimiter", Character.valueOf('#'),
-                map.get("listDelimiter"));
+        assertEquals("Wrong delimiter handler", listHandler,
+                map.get("listDelimiterHandler"));
         assertEquals("Wrong exception flag value", Boolean.TRUE,
                 map.get("throwExceptionOnMissing"));
     }
@@ -74,7 +83,7 @@ public class TestParameters
     {
         Map<String, Object> map =
                 Parameters.fileBased().setThrowExceptionOnMissing(true)
-                        .setEncoding("UTF-8").setListDelimiter('#')
+                        .setEncoding("UTF-8").setListDelimiterHandler(listHandler)
                         .setFileName("test.xml").getParameters();
         FileBasedBuilderParametersImpl fbparams =
                 FileBasedBuilderParametersImpl.fromParameters(map);
@@ -108,7 +117,7 @@ public class TestParameters
     {
         Map<String, Object> map =
                 Parameters.combined().setThrowExceptionOnMissing(true)
-                        .setBasePath("test").setListDelimiter('#')
+                        .setBasePath("test").setListDelimiterHandler(listHandler)
                         .getParameters();
         CombinedBuilderParametersImpl cparams =
                 CombinedBuilderParametersImpl.fromParameters(map);
@@ -124,7 +133,7 @@ public class TestParameters
     {
         Map<String, Object> map =
                 Parameters.jndi().setThrowExceptionOnMissing(true)
-                        .setPrefix("test").setListDelimiter('#')
+                        .setPrefix("test").setListDelimiterHandler(listHandler)
                         .getParameters();
         assertEquals("Wrong prefix", "test", map.get("prefix"));
         checkBasicProperties(map);
@@ -141,7 +150,7 @@ public class TestParameters
         Map<String, Object> map =
                 Parameters.hierarchical().setThrowExceptionOnMissing(true)
                         .setExpressionEngine(engine).setFileName("test.xml")
-                        .setListDelimiter('#').getParameters();
+                        .setListDelimiterHandler(listHandler).getParameters();
         checkBasicProperties(map);
         FileBasedBuilderParametersImpl fbp =
                 FileBasedBuilderParametersImpl.fromParameters(map);
@@ -162,7 +171,7 @@ public class TestParameters
         Map<String, Object> map =
                 Parameters.xml().setThrowExceptionOnMissing(true)
                         .setFileName("test.xml").setValidating(true)
-                        .setExpressionEngine(engine).setListDelimiter('#')
+                        .setExpressionEngine(engine).setListDelimiterHandler(listHandler)
                         .setSchemaValidation(true).getParameters();
         checkBasicProperties(map);
         FileBasedBuilderParametersImpl fbp =
@@ -189,7 +198,7 @@ public class TestParameters
         Map<String, Object> map =
                 Parameters.properties().setThrowExceptionOnMissing(true)
                         .setFileName("test.properties").setIOFactory(factory)
-                        .setListDelimiter('#').setIncludesAllowed(false)
+                        .setListDelimiterHandler(listHandler).setIncludesAllowed(false)
                         .getParameters();
         checkBasicProperties(map);
         FileBasedBuilderParametersImpl fbp =
@@ -211,7 +220,7 @@ public class TestParameters
         String pattern = "a pattern";
         Map<String, Object> map =
                 Parameters.multiFile().setThrowExceptionOnMissing(true)
-                        .setFilePattern(pattern).setListDelimiter('#')
+                        .setFilePattern(pattern).setListDelimiterHandler(listHandler)
                         .setManagedBuilderParameters(bp).getParameters();
         checkBasicProperties(map);
         MultiFileBuilderParametersImpl params =
@@ -231,7 +240,7 @@ public class TestParameters
         Map<String, Object> map =
                 Parameters.database().setThrowExceptionOnMissing(true)
                         .setAutoCommit(true).setTable("table")
-                        .setListDelimiter('#').setKeyColumn("keyColumn")
+                        .setListDelimiterHandler(listHandler).setKeyColumn("keyColumn")
                         .getParameters();
         checkBasicProperties(map);
         assertEquals("Wrong table name", "table", map.get("table"));

Modified: commons/proper/configuration/trunk/src/test/resources/testCCMultiTenent.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/resources/testCCMultiTenent.xml?rev=1502845&r1=1502844&r2=1502845&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/resources/testCCMultiTenent.xml (original)
+++ commons/proper/configuration/trunk/src/test/resources/testCCMultiTenent.xml Sat Jul 13
19:27:19 2013
@@ -36,7 +36,7 @@
           config-class="org.apache.commons.configuration.tree.xpath.XPathExpressionEngine"/>
     </multiXml>
     <xml fileName="testMultiConfiguration_default.xml"
-         config-name="defaultConfig" delimiterParsingDisabled="true">
+         config-name="defaultConfig">
       <expressionEngine
           config-class="org.apache.commons.configuration.tree.xpath.XPathExpressionEngine"/>
     </xml>

Modified: commons/proper/configuration/trunk/src/test/resources/testMultiTenentConfigurationBuilder4.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/resources/testMultiTenentConfigurationBuilder4.xml?rev=1502845&r1=1502844&r2=1502845&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/resources/testMultiTenentConfigurationBuilder4.xml
(original)
+++ commons/proper/configuration/trunk/src/test/resources/testMultiTenentConfigurationBuilder4.xml
Sat Jul 13 19:27:19 2013
@@ -36,13 +36,13 @@
   <override>
     <multiXml filePattern="testMultiConfiguration_$${test:Id}.xml"
                config-name="clientConfig" config-optional="true"
-               config-forceCreate="true" delimiterParsingDisabled="true"
+               config-forceCreate="true"
                schemaValidation="true">
        <expressionEngine
           config-class="org.apache.commons.configuration.tree.xpath.XPathExpressionEngine"/>
     </multiXml>
     <xml fileName="testMultiConfiguration_default.xml"
-         config-name="defaultConfig" delimiterParsingDisabled="true" schemaValidation="true">
+         config-name="defaultConfig" schemaValidation="true">
       <expressionEngine
           config-class="org.apache.commons.configuration.tree.xpath.XPathExpressionEngine"/>
     </xml>

Modified: commons/proper/configuration/trunk/src/test/resources/testMultiTenentConfigurationBuilder5.xml
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/resources/testMultiTenentConfigurationBuilder5.xml?rev=1502845&r1=1502844&r2=1502845&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/resources/testMultiTenentConfigurationBuilder5.xml
(original)
+++ commons/proper/configuration/trunk/src/test/resources/testMultiTenentConfigurationBuilder5.xml
Sat Jul 13 19:27:19 2013
@@ -34,14 +34,13 @@
   <override>
     <multiXml filePattern="testwrite/testMultiConfiguration_$${sys:Id}.xml"
                config-name="clientConfig" config-optional="true"
-               config-forceCreate="true" delimiterParsingDisabled="true"
-               schemaValidation="false">
+               config-forceCreate="true" schemaValidation="false">
        <expressionEngine
           config-class="org.apache.commons.configuration.tree.xpath.XPathExpressionEngine"/>
     </multiXml>
     <xml fileName="testwrite/testMultiDynamic_default.xml"
          config-name="defaultConfig" config-reload="true" 
-         delimiterParsingDisabled="true" schemaValidation="false">
+         schemaValidation="false">
       <expressionEngine
           config-class="org.apache.commons.configuration.tree.xpath.XPathExpressionEngine"/>
     </xml>



Mime
View raw message