You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by dp...@apache.org on 2005/04/01 12:23:24 UTC

svn commit: r159675 - incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/lock/LockTest.java

Author: dpfister
Date: Fri Apr  1 02:23:23 2005
New Revision: 159675

URL: http://svn.apache.org/viewcvs?view=rev&rev=159675
Log:
Added test for Node.orderBefore

Modified:
    incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/lock/LockTest.java

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/lock/LockTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/lock/LockTest.java?view=diff&r1=159674&r2=159675
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/lock/LockTest.java (original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/lock/LockTest.java Fri Apr  1 02:23:23 2005
@@ -516,6 +516,35 @@
     }
 
     /**
+     * Tests if locks are maintained when child nodes are reordered
+     */
+    public void testReorder() throws Exception {
+        // create three lockable nodes with same name
+        Node testNode = testRootNode.addNode(nodeName1);
+        testNode.addMixin(mixLockable);
+        testNode = testRootNode.addNode(nodeName1);
+        testNode.addMixin(mixLockable);
+        testNode = testRootNode.addNode(nodeName1);
+        testNode.addMixin(mixLockable);
+        testRootNode.save();
+
+        // lock last node (3)
+        testNode.lock(false, true);
+
+        // assert: last node locked
+        assertTrue("Third child node locked",
+                testRootNode.getNode(nodeName1 + "[3]").isLocked());
+
+        // move last node in front of first
+        testRootNode.orderBefore(nodeName1 + "[3]", nodeName1 + "[1]");
+        testRootNode.save();
+
+        // assert: first node locked
+        assertTrue("First child node locked",
+                testRootNode.getNode(nodeName1 + "[1]").isLocked());
+    }
+
+    /**
      * Return a flag indicating whether the indicated session contains
      * a specific lock token
      */