You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by oh...@apache.org on 2014/04/13 17:59:58 UTC

svn commit: r1587013 - in /commons/proper/configuration/branches/immutableNodes/src: main/java/org/apache/commons/configuration/tree/InMemoryNodeModel.java test/java/org/apache/commons/configuration/tree/TestInMemoryNodeModel.java

Author: oheger
Date: Sun Apr 13 15:59:58 2014
New Revision: 1587013

URL: http://svn.apache.org/r1587013
Log:
Implemented getInMemoryRepresentation() in InMemoryNodeModel.

Modified:
    commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/InMemoryNodeModel.java
    commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/tree/TestInMemoryNodeModel.java

Modified: commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/InMemoryNodeModel.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/InMemoryNodeModel.java?rev=1587013&r1=1587012&r2=1587013&view=diff
==============================================================================
--- commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/InMemoryNodeModel.java (original)
+++ commons/proper/configuration/branches/immutableNodes/src/main/java/org/apache/commons/configuration/tree/InMemoryNodeModel.java Sun Apr 13 15:59:58 2014
@@ -364,11 +364,14 @@ public class InMemoryNodeModel implement
         setRootNode(newRoot);
     }
 
+    /**
+     * {@inheritDoc} This implementation simply returns the current root node of this
+     * model.
+     */
     @Override
     public ImmutableNode getInMemoryRepresentation()
     {
-        // TODO implementation
-        throw new UnsupportedOperationException("Not yet implemented!");
+        return getTreeData().getRootNode();
     }
 
     /**

Modified: commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/tree/TestInMemoryNodeModel.java
URL: http://svn.apache.org/viewvc/commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/tree/TestInMemoryNodeModel.java?rev=1587013&r1=1587012&r2=1587013&view=diff
==============================================================================
--- commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/tree/TestInMemoryNodeModel.java (original)
+++ commons/proper/configuration/branches/immutableNodes/src/test/java/org/apache/commons/configuration/tree/TestInMemoryNodeModel.java Sun Apr 13 15:59:58 2014
@@ -1055,4 +1055,18 @@ public class TestInMemoryNodeModel
         ImmutableNode rootNode = model.getRootNode();
         assertTrue("Got children", rootNode.getChildren().isEmpty());
     }
+
+    /**
+     * Tests whether the model's data can be represented as immutable node
+     * objects (which is trivial in this case).
+     */
+    @Test
+    public void testGetInMemoryRepresentation()
+    {
+        InMemoryNodeModel model =
+                new InMemoryNodeModel(NodeStructureHelper.ROOT_AUTHORS_TREE);
+        assertSame("Wrong in-memory representation",
+                NodeStructureHelper.ROOT_AUTHORS_TREE,
+                model.getInMemoryRepresentation());
+    }
 }