jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r553227 - /jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/lock/LockTest.java
Date Wed, 04 Jul 2007 14:39:06 GMT
Author: mreutegg
Date: Wed Jul  4 07:39:05 2007
New Revision: 553227

URL: http://svn.apache.org/viewvc?view=rev&rev=553227
Log:
JCR-822: TCK: Transfer of lock token should be tested using open-scoped locks

Modified:
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/lock/LockTest.java

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/lock/LockTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/lock/LockTest.java?view=diff&rev=553227&r1=553226&r2=553227
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/lock/LockTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/lock/LockTest.java
Wed Jul  4 07:39:05 2007
@@ -52,49 +52,49 @@
         testRootNode.save();
 
         // lock node and get lock token
-        Lock lock = n.lock(false, true);
-
-        // assert: session must get a non-null lock token
-        assertNotNull("session must get a non-null lock token",
-                lock.getLockToken());
-
-        // assert: session must hold lock token
-        assertTrue("session must hold lock token",
-                containsLockToken(superuser, lock.getLockToken()));
-
-        // remove lock token
+        Lock lock = n.lock(false, false);
         String lockToken = lock.getLockToken();
-        superuser.removeLockToken(lockToken);
+        try {
+            // assert: session must get a non-null lock token
+            assertNotNull("session must get a non-null lock token", lockToken);
 
-        // assert: session must get a null lock token
-        assertNull("session must get a null lock token",
-                lock.getLockToken());
+            // assert: session must hold lock token
+            assertTrue("session must hold lock token", containsLockToken(superuser, lockToken));
 
-        // assert: session must still hold lock token
-        assertFalse("session must not hold lock token",
-                containsLockToken(superuser, lockToken));
+            // remove lock token
+            superuser.removeLockToken(lockToken);
+            // assert: session must get a null lock token
+            assertNull("session must get a null lock token", lock.getLockToken());
+
+            // assert: session must still hold lock token
+            assertFalse("session must not hold lock token",
+                    containsLockToken(superuser, lockToken));
 
-        // assert: session unable to modify node
-        try {
-            n.addNode(nodeName2, testNodeType);
-            fail("session unable to modify node");
-        } catch (LockException e) {
-            // expected
-        }
+            // assert: session unable to modify node
+            try {
+                n.addNode(nodeName2, testNodeType);
+                fail("session unable to modify node");
+            } catch (LockException e) {
+                // expected
+            }
 
-        // add lock token
-        superuser.addLockToken(lockToken);
+            // add lock token
+            superuser.addLockToken(lockToken);
 
-        // assert: session must get a non-null lock token
-        assertNotNull("session must get a non-null lock token",
-                lock.getLockToken());
-
-        // assert: session must hold lock token
-        assertTrue("session must hold lock token",
-                containsLockToken(superuser, lock.getLockToken()));
+            // assert: session must get a non-null lock token
+            assertNotNull("session must get a non-null lock token",
+                    lock.getLockToken());
+
+            // assert: session must hold lock token
+            assertTrue("session must hold lock token",
+                    containsLockToken(superuser, lock.getLockToken()));
 
-        // assert: session able to modify node
-        n.addNode(nodeName2, testNodeType);
+            // assert: session able to modify node
+            n.addNode(nodeName2, testNodeType);
+        } finally {
+            // make sure lock token is added even if test fail
+            superuser.addLockToken(lockToken);
+        }
     }
 
     /**
@@ -415,7 +415,7 @@
             Node n2 = (Node) otherSuperuser.getItem(n1.getPath());
 
             // lock node
-            Lock lock = n2.lock(false, true);
+            Lock lock = n2.lock(false, false);
 
             // assert: user must get non-null token
             assertNotNull("user must get non-null token", lock.getLockToken());
@@ -434,6 +434,8 @@
         } finally {
             // log out
             otherSuperuser.logout();
+            // unlock again
+            n1.unlock();
         }
     }
 
@@ -704,4 +706,5 @@
         return false;
     }
 }
+
 



Mime
View raw message