jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1446479 - /jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeImplTest.java
Date Fri, 15 Feb 2013 09:02:51 GMT
Author: angela
Date: Fri Feb 15 09:02:51 2013
New Revision: 1446479

URL: http://svn.apache.org/r1446479
Log:
OAK-626 : Allow for setting orderable child nodes on the parent tree (adding tests)

Modified:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeImplTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeImplTest.java?rev=1446479&r1=1446478&r2=1446479&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeImplTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/TreeImplTest.java
Fri Feb 15 09:02:51 2013
@@ -374,4 +374,38 @@ public class TreeImplTest {
 
         assertTrue(added.isEmpty());
     }
+
+    @Test
+    public void testSetOrderableChildrenSetsProperty() throws Exception {
+        Tree tree = root.getTree("/").addChild("test");
+        tree.setOrderableChildren(true);
+        assertNotNull(((TreeImpl) tree).getNodeState().getProperty(TreeImpl.OAK_CHILD_ORDER));
+
+        tree.setOrderableChildren(false);
+        assertNull(((TreeImpl) tree).getNodeState().getProperty(TreeImpl.OAK_CHILD_ORDER));
+
+        tree.setOrderableChildren(true);
+        root.commit();
+        assertNotNull(((TreeImpl) tree).getNodeState().getProperty(TreeImpl.OAK_CHILD_ORDER));
+
+        tree.setOrderableChildren(false);
+        root.commit();
+        assertNull(((TreeImpl) tree).getNodeState().getProperty(TreeImpl.OAK_CHILD_ORDER));
+    }
+
+    @Test
+    public void testSetOrderableChildren() throws Exception {
+        Tree tree = root.getTree("/").addChild("test2");
+        tree.setOrderableChildren(true);
+
+        String[] childNames = new String[]{"a", "b", "c", "d"};
+        for (String name : childNames) {
+            tree.addChild(name);
+        }
+
+        int index = 0;
+        for (Tree child : tree.getChildren()) {
+            assertEquals(childNames[index++], child.getName());
+        }
+    }
 }
\ No newline at end of file



Mime
View raw message