commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1730380 - in /commons/proper/configuration/trunk/src: main/java/org/apache/commons/configuration2/builder/HierarchicalBuilderParametersImpl.java test/java/org/apache/commons/configuration2/builder/TestHierarchicalBuilderParametersImpl.java
Date Sun, 14 Feb 2016 19:03:20 GMT
Author: oheger
Date: Sun Feb 14 19:03:20 2016
New Revision: 1730380

URL: http://svn.apache.org/viewvc?rev=1730380&view=rev
Log:
[CONFIGURATION-619] Implemented inheritFrom() in HierarchicalBuilderParametersImpl.

Here some more properties are taken into account.

Modified:
    commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/builder/HierarchicalBuilderParametersImpl.java
    commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/builder/TestHierarchicalBuilderParametersImpl.java

Modified: commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/builder/HierarchicalBuilderParametersImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/builder/HierarchicalBuilderParametersImpl.java?rev=1730380&r1=1730379&r2=1730380&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/builder/HierarchicalBuilderParametersImpl.java
(original)
+++ commons/proper/configuration/trunk/src/main/java/org/apache/commons/configuration2/builder/HierarchicalBuilderParametersImpl.java
Sun Feb 14 19:03:20 2016
@@ -16,6 +16,8 @@
  */
 package org.apache.commons.configuration2.builder;
 
+import java.util.Map;
+
 import org.apache.commons.configuration2.tree.ExpressionEngine;
 
 /**
@@ -39,6 +41,17 @@ public class HierarchicalBuilderParamete
     private static final String PROP_EXPRESSION_ENGINE = "expressionEngine";
 
     /**
+     * {@inheritDoc} This implementation copies some more properties defined by
+     * this class.
+     */
+    @Override
+    public void inheritFrom(Map<String, ?> source)
+    {
+        super.inheritFrom(source);
+        copyPropertiesFrom(source, PROP_EXPRESSION_ENGINE);
+    }
+
+    /**
      * {@inheritDoc} This implementation stores the expression engine in the
      * internal parameters map.
      */

Modified: commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/builder/TestHierarchicalBuilderParametersImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/builder/TestHierarchicalBuilderParametersImpl.java?rev=1730380&r1=1730379&r2=1730380&view=diff
==============================================================================
--- commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/builder/TestHierarchicalBuilderParametersImpl.java
(original)
+++ commons/proper/configuration/trunk/src/test/java/org/apache/commons/configuration2/builder/TestHierarchicalBuilderParametersImpl.java
Sun Feb 14 19:03:20 2016
@@ -72,4 +72,26 @@ public class TestHierarchicalBuilderPara
         assertEquals("Wrong exception flag", Boolean.TRUE,
                 map.get("throwExceptionOnMissing"));
     }
+
+    /**
+     * Tests whether inheritFrom() copies additional properties.
+     */
+    @Test
+    public void testInheritFrom()
+    {
+        ExpressionEngine engine = EasyMock.createMock(ExpressionEngine.class);
+        HierarchicalBuilderParametersImpl params =
+                new HierarchicalBuilderParametersImpl();
+        params.setExpressionEngine(engine);
+        params.setThrowExceptionOnMissing(true);
+        HierarchicalBuilderParametersImpl params2 =
+                new HierarchicalBuilderParametersImpl();
+
+        params2.inheritFrom(params.getParameters());
+        Map<String, Object> parameters = params2.getParameters();
+        assertEquals("Exception flag not set", Boolean.TRUE,
+                parameters.get("throwExceptionOnMissing"));
+        assertEquals("Expression engine not set", engine,
+                parameters.get("expressionEngine"));
+    }
 }



Mime
View raw message