jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r158051 - incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/lock/LockTest.java
Date Fri, 18 Mar 2005 10:53:58 GMT
Author: mreutegg
Date: Fri Mar 18 02:53:56 2005
New Revision: 158051

URL: http://svn.apache.org/viewcvs?view=rev&rev=158051
Log:
Additional locking test case.

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=158050&r2=158051
==============================================================================
--- 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 Mar 18 02:53:56 2005
@@ -22,6 +22,7 @@
 import javax.jcr.Node;
 import javax.jcr.Session;
 import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
 import javax.jcr.lock.LockException;
 import javax.jcr.lock.Lock;
 
@@ -221,6 +222,44 @@
 
         assertFalse("Shallow lock must not lock the child nodes of a node.",
                 n2.isLocked());
+    }
+
+    /**
+     * Test if it is possible to lock and unlock a checked-in node.
+     */
+    public void testCheckedIn()
+            throws NotExecutableException, RepositoryException {
+
+        Session session = testRootNode.getSession();
+
+        if (session.getRepository().getDescriptor(Repository.OPTION_LOCKING_SUPPORTED) ==
null) {
+            throw new NotExecutableException("Versioning is not supported.");
+        }
+
+        // create a node that is lockable and versionable
+        Node node = testRootNode.addNode(nodeName1, testNodeType);
+        node.addMixin(mixLockable);
+        // try to make it versionable if it is not
+        if (!node.isNodeType(mixVersionable)) {
+            if (node.canAddMixin(mixVersionable)) {
+                node.addMixin(mixVersionable);
+            } else {
+                throw new NotExecutableException("Node " + nodeName1 + " is " +
+                        "not versionable and does not allow to add " +
+                        "mix:versionable");
+            }
+        }
+        testRootNode.save();
+
+        node.checkin();
+
+        node.lock(false, false);
+        assertTrue("Locking of a checked-in node failed.",
+                node.isLocked());
+
+        node.unlock();
+        assertFalse("Unlocking of a checked-in node failed.",
+                node.isLocked());
     }
 
     /**



Mime
View raw message