commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ohe...@apache.org
Subject svn commit: r1578587 - in /commons/proper/configuration/branches/immutableNodes/src: main/java/org/apache/commons/configuration/SubnodeConfiguration.java test/java/org/apache/commons/configuration/TestSubnodeConfiguration.java
Date Mon, 17 Mar 2014 21:15:02 GMT
Author: oheger
Date: Mon Mar 17 21:15:01 2014
New Revision: 1578587

URL: http://svn.apache.org/r1578587
Log:
Implemented sub configuration creation hooks in SubnodeConfiguration.

The configurationAt() methods now work correctly in SubnodeConfiguration.

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

Modified: commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/SubnodeConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/SubnodeConfiguration.java?rev=1578587&r1=1578586&r2=1578587&view=diff
==============================================================================
--- commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/SubnodeConfiguration.java
(original)
+++ commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/SubnodeConfiguration.java
Mon Mar 17 21:15:01 2014
@@ -181,4 +181,24 @@ public class SubnodeConfiguration extend
         parentModel.trackNode(getRootSelector(), getParent());
         return new TrackedNodeModel(parentModel, getRootSelector(), true);
     }
+
+    /**
+     * {@inheritDoc} This implementation returns a sub selector of the selector
+     * of this configuration.
+     */
+    @Override
+    protected NodeSelector getSubConfigurationNodeSelector(String key)
+    {
+        return getRootSelector().subSelector(key);
+    }
+
+    /**
+     * {@inheritDoc} This implementation returns the parent model of the
+     * {@link TrackedNodeModel} used by this configuration.
+     */
+    @Override
+    protected InMemoryNodeModel getSubConfigurationParentModel()
+    {
+        return ((TrackedNodeModel) getModel()).getParentModel();
+    }
 }

Modified: commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/TestSubnodeConfiguration.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/TestSubnodeConfiguration.java?rev=1578587&r1=1578586&r2=1578587&view=diff
==============================================================================
--- commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/TestSubnodeConfiguration.java
(original)
+++ commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/TestSubnodeConfiguration.java
Mon Mar 17 21:15:01 2014
@@ -344,7 +344,7 @@ public class TestSubnodeConfiguration
                 (SubnodeConfiguration) config.configurationAt("fields.field(1)", true);
         assertEquals("Wrong value of property",
                 NodeStructureHelper.field(0, 1), sub2.getString("name"));
-        assertEquals("Wrong parent", config.getParent(), sub2.getParent());
+        assertEquals("Wrong parent", config, sub2.getParent());
     }
 
     /**



Mime
View raw message