commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1775894 - in /commons/proper/configuration/trunk/src: main/java/org/apache/commons/configuration2/builder/ test/java/org/apache/commons/configuration2/builder/ test/java/org/apache/commons/configuration2/builder/fluent/
Date Fri, 23 Dec 2016 20:09:35 GMT
Author: oheger
Date: Fri Dec 23 20:09:35 2016
New Revision: 1775894

URL: http://svn.apache.org/viewvc?rev=1775894&view=rev
Log:
[CONFIGURATION-648] Fixed IOFactory property.

Adapted the property name to the requirements of the most recent
version of BeanUtils. Added a new unit test to demonstrate the
problem. Some tests had to be adapted.

Modified:
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/builder/PropertiesBuilderParametersImpl.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/builder/TestPropertiesBuilderParametersImpl.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/builder/fluent/TestParameters.java

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/builder/PropertiesBuilderParametersImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/builder/PropertiesBuilderParametersImpl.java?rev=1775894&r1=1775893&r2=1775894&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/builder/PropertiesBuilderParametersImpl.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/builder/PropertiesBuilderParametersImpl.java
Fri Dec 23 20:09:35 2016
@@ -52,7 +52,7 @@ public class PropertiesBuilderParameters
     private static final String PROP_LAYOUT = "layout";
 
     /** The key for the IO factory property. */
-    private static final String PROP_IO_FACTORY = "iOFactory";
+    private static final String PROP_IO_FACTORY = "IOFactory";
 
     @Override
     public PropertiesBuilderParametersImpl setIncludesAllowed(boolean f)

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/builder/TestPropertiesBuilderParametersImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/builder/TestPropertiesBuilderParametersImpl.java?rev=1775894&r1=1775893&r2=1775894&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/builder/TestPropertiesBuilderParametersImpl.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/builder/TestPropertiesBuilderParametersImpl.java
Fri Dec 23 20:09:35 2016
@@ -25,6 +25,7 @@ import java.util.Map;
 import org.apache.commons.configuration2.PropertiesConfiguration;
 import org.apache.commons.configuration2.PropertiesConfigurationLayout;
 import org.apache.commons.configuration2.beanutils.BeanHelper;
+import org.apache.commons.configuration2.ex.ConfigurationException;
 import org.easymock.EasyMock;
 import org.junit.Before;
 import org.junit.Test;
@@ -80,7 +81,7 @@ public class TestPropertiesBuilderParame
         EasyMock.replay(factory);
         assertSame("Wrong result", params, params.setIOFactory(factory));
         assertSame("Factory not set", factory,
-                params.getParameters().get("iOFactory"));
+                params.getParameters().get("IOFactory"));
     }
 
     /**
@@ -102,7 +103,7 @@ public class TestPropertiesBuilderParame
         assertEquals("Wrong exception flag", Boolean.TRUE,
                 paramsMap.get("throwExceptionOnMissing"));
         assertSame("Factory not set", factory,
-                params.getParameters().get("iOFactory"));
+                params.getParameters().get("IOFactory"));
     }
 
     /**
@@ -123,9 +124,27 @@ public class TestPropertiesBuilderParame
         Map<String, Object> parameters = params2.getParameters();
         assertEquals("Exception flag not set", Boolean.TRUE,
                 parameters.get("throwExceptionOnMissing"));
-        assertEquals("IOFactory not set", factory, parameters.get("iOFactory"));
+        assertEquals("IOFactory not set", factory, parameters.get("IOFactory"));
         assertEquals("Include flag not set", Boolean.FALSE,
                 parameters.get("includesAllowed"));
         assertNull("Layout was copied", parameters.get("layout"));
     }
+
+    /**
+     * Tests whether the IOFactory property can be correctly set. This test is
+     * related to CONFIGURATION-648.
+     */
+    @Test
+    public void testSetIOFactoryProperty() throws ConfigurationException
+    {
+        PropertiesConfiguration.IOFactory factory =
+                new PropertiesConfiguration.DefaultIOFactory();
+        ConfigurationBuilder<PropertiesConfiguration> builder =
+                new FileBasedConfigurationBuilder<PropertiesConfiguration>(
+                        PropertiesConfiguration.class)
+                .configure(params.setIOFactory(factory));
+
+        PropertiesConfiguration config = builder.getConfiguration();
+        assertEquals("Wrong IO factory", factory, config.getIOFactory());
+    }
 }

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/builder/fluent/TestParameters.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/builder/fluent/TestParameters.java?rev=1775894&r1=1775893&r2=1775894&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/builder/fluent/TestParameters.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/builder/fluent/TestParameters.java
Fri Dec 23 20:09:35 2016
@@ -285,7 +285,7 @@ public class TestParameters
                 .getFileName());
         assertEquals("Wrong includes flag", Boolean.FALSE,
                 map.get("includesAllowed"));
-        assertSame("Wrong factory", factory, map.get("iOFactory"));
+        assertSame("Wrong factory", factory, map.get("IOFactory"));
     }
 
     /**



Mime
View raw message