Return-Path: Delivered-To: apmail-incubator-jackrabbit-commits-archive@www.apache.org Received: (qmail 85265 invoked from network); 26 Apr 2005 16:40:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 26 Apr 2005 16:40:19 -0000 Received: (qmail 65535 invoked by uid 500); 26 Apr 2005 16:41:01 -0000 Mailing-List: contact jackrabbit-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jackrabbit-dev@incubator.apache.org Delivered-To: mailing list jackrabbit-commits@incubator.apache.org Received: (qmail 65519 invoked by uid 500); 26 Apr 2005 16:41:01 -0000 Delivered-To: apmail-incubator-jackrabbit-cvs@incubator.apache.org Received: (qmail 65516 invoked by uid 99); 26 Apr 2005 16:41:01 -0000 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Tue, 26 Apr 2005 09:40:59 -0700 Received: (qmail 85226 invoked by uid 65534); 26 Apr 2005 16:40:15 -0000 Message-ID: <20050426164015.85225.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: svn commit: r164811 - in /incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api: ./ lock/ query/ version/ Date: Tue, 26 Apr 2005 16:40:07 -0000 To: jackrabbit-cvs@incubator.apache.org From: mreutegg@apache.org X-Mailer: svnmailer-1.0.0-dev X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: mreutegg Date: Tue Apr 26 09:40:05 2005 New Revision: 164811 URL: http://svn.apache.org/viewcvs?rev=3D164811&view=3Drev Log: Fix missing calls to Session.logout() in various test cases. Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Abst= ractWorkspaceCopyBetweenTest.java incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Name= spaceRegistryReadMethodsTest.java incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Node= AddMixinTest.java incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Node= CanAddMixinTest.java incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Node= ReadMethodsTest.java incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Node= RemoveMixinTest.java incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Node= Test.java incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Node= UUIDTest.java incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Sess= ionTest.java incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Sess= ionUUIDTest.java incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/SetP= ropertyConstraintViolationExceptionTest.java incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/SetV= alueConstraintViolationExceptionTest.java incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Work= spaceCloneTest.java incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Work= spaceCopyBetweenWorkspacesTest.java incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Work= spaceCopyTest.java incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Work= spaceMoveTest.java incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Work= spaceReadMethodsTest.java incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/lock= /LockTest.java incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/quer= y/SaveTest.java incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/vers= ion/MergeNodeTest.java incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/vers= ion/VersionStorageTest.java incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/vers= ion/WorkspaceRestoreTest.java Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/ap= i/AbstractWorkspaceCopyBetweenTest.java URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/= apache/jackrabbit/test/api/AbstractWorkspaceCopyBetweenTest.java?rev=3D1648= 11&r1=3D164810&r2=3D164811&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Abst= ractWorkspaceCopyBetweenTest.java (original) +++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Abst= ractWorkspaceCopyBetweenTest.java Tue Apr 26 09:40:05 2005 @@ -92,6 +92,9 @@ superuserW2.logout(); } } + if (rwSessionW2 !=3D null) { + rwSessionW2.logout(); + } super.tearDown(); } =20 Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/ap= i/NamespaceRegistryReadMethodsTest.java URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/= apache/jackrabbit/test/api/NamespaceRegistryReadMethodsTest.java?rev=3D1648= 11&r1=3D164810&r2=3D164811&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Name= spaceRegistryReadMethodsTest.java (original) +++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Name= spaceRegistryReadMethodsTest.java Tue Apr 26 09:40:05 2005 @@ -49,12 +49,25 @@ /** The NamespaceRegistry of the repository */ private NamespaceRegistry nsr; =20 + /** A read-only session */ + private Session session; + public void setUp() throws Exception { isReadOnly =3D true; super.setUp(); - Session session =3D helper.getReadOnlySession(); + session =3D helper.getReadOnlySession(); Workspace ws =3D session.getWorkspace(); nsr =3D ws.getNamespaceRegistry(); + } + + /** + * Releases the session aquired in {@link #setUp()}. + */ + protected void tearDown() throws Exception { + if (session !=3D null) { + session.logout(); + } + super.tearDown(); } =20 /** Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/ap= i/NodeAddMixinTest.java URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/= apache/jackrabbit/test/api/NodeAddMixinTest.java?rev=3D164811&r1=3D164810&r= 2=3D164811&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Node= AddMixinTest.java (original) +++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Node= AddMixinTest.java Tue Apr 26 09:40:05 2005 @@ -146,19 +146,23 @@ =20 // access node through another session to lock it Session session2 =3D helper.getSuperuserSession(); - Node node2 =3D session2.getRootNode().getNode(pathRelToRoot); - node2.lock(true, true); - try { - node.addMixin(mixinName); - fail("Node.addMixin(String mixinName) must throw a LockExcepti= on " + - "if the node is locked."); - } catch (LockException e) { - // success - } + Node node2 =3D session2.getRootNode().getNode(pathRelToRoot); + node2.lock(true, true); =20 - // unlock to remove node at tearDown() - node2.unlock(); + try { + node.addMixin(mixinName); + fail("Node.addMixin(String mixinName) must throw a LockExc= eption " + + "if the node is locked."); + } catch (LockException e) { + // success + } + + // unlock to remove node at tearDown() + node2.unlock(); + } finally { + session2.logout(); + } } =20 /** Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/ap= i/NodeCanAddMixinTest.java URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/= apache/jackrabbit/test/api/NodeCanAddMixinTest.java?rev=3D164811&r1=3D16481= 0&r2=3D164811&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Node= CanAddMixinTest.java (original) +++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Node= CanAddMixinTest.java Tue Apr 26 09:40:05 2005 @@ -73,15 +73,18 @@ =20 // access node through another session to lock it Session session2 =3D helper.getSuperuserSession(); - Node node2 =3D session2.getRootNode().getNode(pathRelToRoot); - node2.lock(true, true); + try { + Node node2 =3D session2.getRootNode().getNode(pathRelToRoot); + node2.lock(true, true); =20 - assertFalse("Node.canAddMixin(String mixinName) must return false = " + - "if the node is locked.", - node.canAddMixin(mixinName)); + assertFalse("Node.canAddMixin(String mixinName) must return fa= lse " + + "if the node is locked.", + node.canAddMixin(mixinName)); =20 - node2.unlock(); - session2.logout(); + node2.unlock(); + } finally { + session2.logout(); + } } =20 /** Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/ap= i/NodeReadMethodsTest.java URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/= apache/jackrabbit/test/api/NodeReadMethodsTest.java?rev=3D164811&r1=3D16481= 0&r2=3D164811&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Node= ReadMethodsTest.java (original) +++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Node= ReadMethodsTest.java Tue Apr 26 09:40:05 2005 @@ -227,10 +227,15 @@ */ public void testIsSame() throws RepositoryException { // access same node through different session - Item otherTestNode =3D helper.getReadOnlySession().getRootNode().g= etNode(testPath); - assertTrue("isSame(Item item) must return true for the same " + - "item retrieved through different sessions.", - testRootNode.isSame(otherTestNode)); + Session s =3D helper.getReadOnlySession(); + try { + Item otherTestNode =3D s.getRootNode().getNode(testPath); + assertTrue("isSame(Item item) must return true for the same " + + "item retrieved through different sessions.", + testRootNode.isSame(otherTestNode)); + } finally { + s.logout(); + } } =20 /** Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/ap= i/NodeRemoveMixinTest.java URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/= apache/jackrabbit/test/api/NodeRemoveMixinTest.java?rev=3D164811&r1=3D16481= 0&r2=3D164811&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Node= RemoveMixinTest.java (original) +++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Node= RemoveMixinTest.java Tue Apr 26 09:40:05 2005 @@ -171,20 +171,23 @@ =20 // access node through another session to lock it Session session2 =3D helper.getSuperuserSession(); - Node node2 =3D session2.getRootNode().getNode(pathRelToRoot); - node2.lock(true, true); - try { - node.removeMixin(mixinName); - fail("Node.removeMixin(String mixinName) must throw a " + - "LockException if the node is locked."); - } catch (LockException e) { - // success - } + Node node2 =3D session2.getRootNode().getNode(pathRelToRoot); + node2.lock(true, true); =20 - // unlock to remove node at tearDown() - node2.unlock(); - session2.logout(); + try { + node.removeMixin(mixinName); + fail("Node.removeMixin(String mixinName) must throw a " + + "LockException if the node is locked."); + } catch (LockException e) { + // success + } + + // unlock to remove node at tearDown() + node2.unlock(); + } finally { + session2.logout(); + } } =20 /** Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/ap= i/NodeTest.java URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/= apache/jackrabbit/test/api/NodeTest.java?rev=3D164811&r1=3D164810&r2=3D1648= 11&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Node= Test.java (original) +++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Node= Test.java Tue Apr 26 09:40:05 2005 @@ -545,20 +545,23 @@ =20 // get the node with session 2 Session testSession =3D helper.getReadWriteSession(); - Node defaultTestNodeSession2 =3D (Node) testSession.getItem(defaul= tTestNode.getPath()); + try { + Node defaultTestNodeSession2 =3D (Node) testSession.getItem(de= faultTestNode.getPath()); =20 - // remove node with session 1 - defaultTestNode.remove(); - superuser.save(); + // remove node with session 1 + defaultTestNode.remove(); + superuser.save(); =20 - // try to remove already deleted node with session 2 - try { - defaultTestNodeSession2.remove(); - fail("Removing a node already deleted by other session should = throw an InvalidItemStateException!"); - } catch (InvalidItemStateException e) { - //ok, works as expected + // try to remove already deleted node with session 2 + try { + defaultTestNodeSession2.remove(); + fail("Removing a node already deleted by other session sho= uld throw an InvalidItemStateException!"); + } catch (InvalidItemStateException e) { + //ok, works as expected + } + } finally { + testSession.logout(); } - testSession.logout(); } =20 /** @@ -654,13 +657,16 @@ =20 // access node through another session to lock it Session session2 =3D helper.getSuperuserSession(); - Node node2 =3D session2.getRootNode().getNode(pathRelToRoot); - node2.lock(true, true); + try { + Node node2 =3D session2.getRootNode().getNode(pathRelToRoot); + node2.lock(true, true); =20 - // test fails if a LockException is thrown when removing the node - // (remove must be possible since the parent is not locked) - node.remove(); - session2.logout(); + // test fails if a LockException is thrown when removing the n= ode + // (remove must be possible since the parent is not locked) + node.remove(); + } finally { + session2.logout(); + } } =20 /** @@ -701,20 +707,23 @@ String pathRelToRoot =3D node.getPath().substring(1); // access node through another session to lock it Session session2 =3D helper.getSuperuserSession(); - Node node2 =3D session2.getRootNode().getNode(pathRelToRoot); - node2.lock(true, true); - try { - subNode.remove(); - fail("Node.remove() must throw a LockException if the parent "= + - "of the node is locked"); - } catch (LockException e) { - // success - } + Node node2 =3D session2.getRootNode().getNode(pathRelToRoot); + node2.lock(true, true); + + try { + subNode.remove(); + fail("Node.remove() must throw a LockException if the pare= nt " + + "of the node is locked"); + } catch (LockException e) { + // success + } =20 - // unlock to remove node at tearDown() - node2.unlock(); - session2.logout(); + // unlock to remove node at tearDown() + node2.unlock(); + } finally { + session2.logout(); + } } =20 /** @@ -889,26 +898,30 @@ // get session 2 Session session2 =3D helper.getReadWriteSession(); =20 - // get the second node - Node testNode2Session2 =3D (Node) session2.getItem(testNode2Sessio= n1.getPath()); + try { + // get the second node + Node testNode2Session2 =3D (Node) session2.getItem(testNode2Se= ssion1.getPath()); =20 - // adds a child node - testNode2Session2.addNode(nodeName3, testNodeType); + // adds a child node + testNode2Session2.addNode(nodeName3, testNodeType); =20 - // save the changes - session2.save(); + // save the changes + session2.save(); =20 - // call refresh on session 1 - defaultRootNode.refresh(false); + // call refresh on session 1 + defaultRootNode.refresh(false); =20 - // check if session 1 flag has been cleared - assertFalse("Session should have no pending changes recorded after= Node.refresh(false)!", superuser.hasPendingChanges()); + // check if session 1 flag has been cleared + assertFalse("Session should have no pending changes recorded a= fter Node.refresh(false)!", superuser.hasPendingChanges()); =20 - // check if added child node for node 1 by session 1 has been remo= ved - assertFalse("Node Modifications have not been flushed after Node.r= efresh(false)", testNode1Session1.hasNodes()); + // check if added child node for node 1 by session 1 has been = removed + assertFalse("Node Modifications have not been flushed after No= de.refresh(false)", testNode1Session1.hasNodes()); =20 - // check if added child node for node 2 by session 2 has become vi= sible in session 1 - assertTrue("Node modified by a different session has not been upda= ted after Node.refresh(false)", testNode2Session1.hasNodes()); + // check if added child node for node 2 by session 2 has becom= e visible in session 1 + assertTrue("Node modified by a different session has not been = updated after Node.refresh(false)", testNode2Session1.hasNodes()); + } finally { + session2.logout(); + } } =20 /** @@ -942,26 +955,30 @@ // get session 2 Session session2 =3D helper.getReadWriteSession(); =20 - // get the second node - Node testNode2Session2 =3D (Node) session2.getItem(testNode2Sessio= n1.getPath()); + try { + // get the second node + Node testNode2Session2 =3D (Node) session2.getItem(testNode2Se= ssion1.getPath()); =20 - // adds a child node - testNode2Session2.addNode(nodeName3, testNodeType); + // adds a child node + testNode2Session2.addNode(nodeName3, testNodeType); =20 - // save the changes - session2.save(); + // save the changes + session2.save(); =20 - // call refresh on session 1 - defaultRootNode.refresh(true); + // call refresh on session 1 + defaultRootNode.refresh(true); =20 - // check if session 1 flag has been cleared - assertTrue("Session should still have pending changes recorded aft= er Node.refresh(true)!", superuser.hasPendingChanges()); + // check if session 1 flag has been cleared + assertTrue("Session should still have pending changes recorded= after Node.refresh(true)!", superuser.hasPendingChanges()); =20 - // check if added child node for node 1 by session 1 is still there - assertTrue("Node Modifications are lost after Node.refresh(true)",= testNode1Session1.hasNodes()); + // check if added child node for node 1 by session 1 is still = there + assertTrue("Node Modifications are lost after Node.refresh(tru= e)", testNode1Session1.hasNodes()); =20 - // check if added child node for node 2 by session 2 has become vi= sible in session 1 - assertTrue("Node modified by a different session has not been upda= ted after Node.refresh(true)", testNode2Session1.hasNodes()); + // check if added child node for node 2 by session 2 has becom= e visible in session 1 + assertTrue("Node modified by a different session has not been = updated after Node.refresh(true)", testNode2Session1.hasNodes()); + } finally { + session2.logout(); + } } =20 /** @@ -989,20 +1006,24 @@ =20 // get the new node with a different session Session testSession =3D helper.getReadWriteSession(); - Node nodeSession2 =3D (Node) testSession.getItem(nodeSession1.getP= ath()); + try { + Node nodeSession2 =3D (Node) testSession.getItem(nodeSession1.= getPath()); =20 - // delete the node with the new session - nodeSession2.remove(); + // delete the node with the new session + nodeSession2.remove(); =20 - // make node removal persistent - testSession.save(); + // make node removal persistent + testSession.save(); =20 - // save changes made wit superuser session - try { - defaultRootNode.save(); - fail("Saving a modified Node using Node.save() already deleted= by an other session should throw InvalidItemStateException"); - } catch (InvalidItemStateException e) { - // ok, works as expected + // save changes made wit superuser session + try { + defaultRootNode.save(); + fail("Saving a modified Node using Node.save() already del= eted by an other session should throw InvalidItemStateException"); + } catch (InvalidItemStateException e) { + // ok, works as expected + } + } finally { + testSession.logout(); } } =20 @@ -1046,8 +1067,11 @@ =20 // get the new node with a different session Session testSession =3D helper.getReadOnlySession(); - testSession.getItem(testNode.getPath()); - testSession.logout(); + try { + testSession.getItem(testNode.getPath()); + } finally { + testSession.logout(); + } } =20 /** Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/ap= i/NodeUUIDTest.java URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/= apache/jackrabbit/test/api/NodeUUIDTest.java?rev=3D164811&r1=3D164810&r2=3D= 164811&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Node= UUIDTest.java (original) +++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Node= UUIDTest.java Tue Apr 26 09:40:05 2005 @@ -113,21 +113,24 @@ =20 // get the moving node with session 2 Session testSession =3D helper.getReadWriteSession(); - Node refTargetNodeSession2 =3D (Node) testSession.getItem(refTarge= tNode.getPath()); + try { + Node refTargetNodeSession2 =3D (Node) testSession.getItem(refT= argetNode.getPath()); =20 - //move the node with session 1 - superuser.move(refTargetNode.getPath(), newParentNode.getPath() + = "/" + nodeName3); + //move the node with session 1 + superuser.move(refTargetNode.getPath(), newParentNode.getPath(= ) + "/" + nodeName3); =20 - // make the move persistent with session 1 - superuser.save(); + // make the move persistent with session 1 + superuser.save(); =20 - // modify some prop of the moved node with session 2 - refTargetNodeSession2.setProperty(propertyName1, "test"); + // modify some prop of the moved node with session 2 + refTargetNodeSession2.setProperty(propertyName1, "test"); =20 - // save it - refTargetNodeSession2.save(); - // ok, works as expected - testSession.logout(); + // save it + refTargetNodeSession2.save(); + // ok, works as expected + } finally { + testSession.logout(); + } } =20 /** Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/ap= i/SessionTest.java URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/= apache/jackrabbit/test/api/SessionTest.java?rev=3D164811&r1=3D164810&r2=3D1= 64811&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Sess= ionTest.java (original) +++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Sess= ionTest.java Tue Apr 26 09:40:05 2005 @@ -255,9 +255,12 @@ =20 // get moved tree root node with session 2 Session testSession =3D helper.getReadWriteSession(); - testSession.getItem(destParentNode.getPath() + "/" + nodeName2); - // node found - testSession.logout(); + try { + testSession.getItem(destParentNode.getPath() + "/" + nodeName2= ); + // node found + } finally { + testSession.logout(); + } } =20 /** @@ -277,9 +280,13 @@ superuser.save(); =20 // use a different session to verify if the node is there - helper.getReadOnlySession().getItem(newNode.getPath()); - - // throws PathNotFoundException if item was not saved + Session s =3D helper.getReadOnlySession(); + try { + s.getItem(newNode.getPath()); + // throws PathNotFoundException if item was not saved + } finally { + s.logout(); + } } =20 /** @@ -310,9 +317,14 @@ // check if the child node was created properly =20 // get a reference with a second session to the modified node - Node newNodeSession2 =3D (Node) helper.getReadOnlySession().getIte= m(newNode.getPath()); - // check if child is there - assertTrue("Modifications on a node are not save after Session.sa= ve()", newNodeSession2.hasNode(nodeName2)); + Session s =3D helper.getReadOnlySession(); + try { + Node newNodeSession2 =3D (Node) s.getItem(newNode.getPath()); + // check if child is there + assertTrue("Modifications on a node are not save after Sessio= n=2Esave()", newNodeSession2.hasNode(nodeName2)); + } finally { + s.logout(); + } } =20 /** @@ -363,20 +375,24 @@ =20 // get the new node with a different session Session testSession =3D helper.getReadWriteSession(); - Node nodeSession2 =3D (Node) testSession.getItem(nodeSession1.getP= ath()); + try { + Node nodeSession2 =3D (Node) testSession.getItem(nodeSession1.= getPath()); =20 - // delete the node with the new session - nodeSession2.remove(); + // delete the node with the new session + nodeSession2.remove(); =20 - // make node removal persistent - testSession.save(); + // make node removal persistent + testSession.save(); =20 - // save changes made wit superuser session - try { - superuser.save(); - fail("Saving a modified Node using Session.save() already dele= ted by an other session should throw InvalidItemStateException"); - } catch (InvalidItemStateException e) { - // ok, works as expected + // save changes made wit superuser session + try { + superuser.save(); + fail("Saving a modified Node using Session.save() already = deleted by an other session should throw InvalidItemStateException"); + } catch (InvalidItemStateException e) { + // ok, works as expected + } + } finally { + testSession.logout(); } } =20 @@ -411,26 +427,30 @@ // get session 2 Session session2 =3D helper.getReadWriteSession(); =20 - // get the second node - Node testNode2Session2 =3D (Node) session2.getItem(testNode2Sessio= n1.getPath()); + try { + // get the second node + Node testNode2Session2 =3D (Node) session2.getItem(testNode2Se= ssion1.getPath()); =20 - // adds a child node - testNode2Session2.addNode(nodeName3, testNodeType); + // adds a child node + testNode2Session2.addNode(nodeName3, testNodeType); =20 - // save the changes - session2.save(); + // save the changes + session2.save(); =20 - // call refresh on session 1 - superuser.refresh(false); + // call refresh on session 1 + superuser.refresh(false); =20 - // check if session 1 flag has been cleared - assertFalse("Session should have no pending changes recorded after= Session.refresh(false)!", superuser.hasPendingChanges()); + // check if session 1 flag has been cleared + assertFalse("Session should have no pending changes recorded a= fter Session.refresh(false)!", superuser.hasPendingChanges()); =20 - // check if added child node for node 1 by session 1 has been remo= ved - assertFalse("Node Modifications have not been flushed after sessio= n=2Erefresh(false)", testNode1Session1.hasNodes()); + // check if added child node for node 1 by session 1 has been = removed + assertFalse("Node Modifications have not been flushed after se= ssion.refresh(false)", testNode1Session1.hasNodes()); =20 - // check if added child node for node 2 by session 2 has become vi= sible in session 1 - assertTrue("Node modified by a different session has not been upda= ted after Session.refresh(false)", testNode2Session1.hasNodes()); + // check if added child node for node 2 by session 2 has becom= e visible in session 1 + assertTrue("Node modified by a different session has not been = updated after Session.refresh(false)", testNode2Session1.hasNodes()); + } finally { + session2.logout(); + } } =20 /** @@ -464,26 +484,30 @@ // get session 2 Session session2 =3D helper.getReadWriteSession(); =20 - // get the second node - Node testNode2Session2 =3D (Node) session2.getItem(testNode2Sessio= n1.getPath()); + try { + // get the second node + Node testNode2Session2 =3D (Node) session2.getItem(testNode2Se= ssion1.getPath()); =20 - // adds a child node - testNode2Session2.addNode(nodeName3, testNodeType); + // adds a child node + testNode2Session2.addNode(nodeName3, testNodeType); =20 - // save the changes - session2.save(); + // save the changes + session2.save(); =20 - // call refresh on session 1 - superuser.refresh(true); + // call refresh on session 1 + superuser.refresh(true); =20 - // check if session 1 flag has been cleared - assertTrue("Session should still have pending changes recorded aft= er Session.refresh(true)!", superuser.hasPendingChanges()); + // check if session 1 flag has been cleared + assertTrue("Session should still have pending changes recorded= after Session.refresh(true)!", superuser.hasPendingChanges()); =20 - // check if added child node for node 1 by session 1 is still there - assertTrue("Node Modifications are lost after session.refresh(true= )", testNode1Session1.hasNodes()); + // check if added child node for node 1 by session 1 is still = there + assertTrue("Node Modifications are lost after session.refresh(= true)", testNode1Session1.hasNodes()); =20 - // check if added child node for node 2 by session 2 has become vi= sible in session 1 - assertTrue("Node modified by a different session has not been upda= ted after Session.refresh(true)", testNode2Session1.hasNodes()); + // check if added child node for node 2 by session 2 has becom= e visible in session 1 + assertTrue("Node modified by a different session has not been = updated after Session.refresh(true)", testNode2Session1.hasNodes()); + } finally { + session2.logout(); + } } =20 /** Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/ap= i/SessionUUIDTest.java URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/= apache/jackrabbit/test/api/SessionUUIDTest.java?rev=3D164811&r1=3D164810&r2= =3D164811&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Sess= ionUUIDTest.java (original) +++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Sess= ionUUIDTest.java Tue Apr 26 09:40:05 2005 @@ -22,7 +22,6 @@ import javax.jcr.RepositoryException; import javax.jcr.ReferentialIntegrityException; import javax.jcr.Session; -import javax.jcr.InvalidItemStateException; =20 /** * SessionUUIDTest contains all tests for the {@link javax.jc= r=2ESession} @@ -114,20 +113,24 @@ // get the moving node with session 2 Session testSession =3D helper.getReadWriteSession(); =20 - Node refTargetNodeSession2 =3D (Node) testSession.getItem(refTarge= tNode.getPath()); + try { + Node refTargetNodeSession2 =3D (Node) testSession.getItem(refT= argetNode.getPath()); =20 - // move the node with session 1 - superuser.move(refTargetNode.getPath(), newParentNode.getPath() + = "/" + nodeName2); + // move the node with session 1 + superuser.move(refTargetNode.getPath(), newParentNode.getPath(= ) + "/" + nodeName2); =20 - // make the move persistent with session 1 - superuser.save(); + // make the move persistent with session 1 + superuser.save(); =20 - // modify some prop of the moved node with session 2 - refTargetNodeSession2.setProperty(propertyName1, "test"); + // modify some prop of the moved node with session 2 + refTargetNodeSession2.setProperty(propertyName1, "test"); =20 - // save it - testSession.save(); + // save it + testSession.save(); =20 - // ok, works as expected + // ok, works as expected + } finally { + testSession.logout(); + } } } Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/ap= i/SetPropertyConstraintViolationExceptionTest.java URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/= apache/jackrabbit/test/api/SetPropertyConstraintViolationExceptionTest.java= ?rev=3D164811&r1=3D164810&r2=3D164811&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/SetP= ropertyConstraintViolationExceptionTest.java (original) +++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/SetP= ropertyConstraintViolationExceptionTest.java Tue Apr 26 09:40:05 2005 @@ -21,7 +21,6 @@ import org.apache.jackrabbit.test.api.nodetype.NodeTypeUtil; =20 import javax.jcr.RepositoryException; -import javax.jcr.Session; import javax.jcr.PropertyType; import javax.jcr.Value; import javax.jcr.Node; @@ -54,9 +53,8 @@ throws NotExecutableException, RepositoryException { =20 // locate a PropertyDefinition with ValueConstraints - Session session =3D helper.getReadWriteSession(); PropertyDefinition propDef =3D - NodeTypeUtil.locatePropertyDef(session, PropertyType.BOOLE= AN, false, false, true, false); + NodeTypeUtil.locatePropertyDef(superuser, PropertyType.BOO= LEAN, false, false, true, false); =20 if (propDef =3D=3D null) { throw new NotExecutableException("No boolean property def with= " + @@ -114,9 +112,8 @@ throws NotExecutableException, RepositoryException { =20 // locate a PropertyDefinition with ValueConstraints - Session session =3D helper.getReadWriteSession(); PropertyDefinition propDef =3D - NodeTypeUtil.locatePropertyDef(session, PropertyType.DATE,= false, false, true, false); + NodeTypeUtil.locatePropertyDef(superuser, PropertyType.DAT= E, false, false, true, false); =20 if (propDef =3D=3D null) { throw new NotExecutableException("No date property def with " + @@ -174,9 +171,8 @@ throws NotExecutableException, RepositoryException { =20 // locate a PropertyDefinition with ValueConstraints - Session session =3D helper.getReadWriteSession(); PropertyDefinition propDef =3D - NodeTypeUtil.locatePropertyDef(session, PropertyType.DOUBL= E, false, false, true, false); + NodeTypeUtil.locatePropertyDef(superuser, PropertyType.DOU= BLE, false, false, true, false); =20 if (propDef =3D=3D null) { throw new NotExecutableException("No double property def with = " + @@ -234,9 +230,8 @@ throws NotExecutableException, RepositoryException { =20 // locate a PropertyDefinition with ValueConstraints - Session session =3D helper.getReadWriteSession(); PropertyDefinition propDef =3D - NodeTypeUtil.locatePropertyDef(session, PropertyType.BINAR= Y, false, false, true, false); + NodeTypeUtil.locatePropertyDef(superuser, PropertyType.BIN= ARY, false, false, true, false); =20 if (propDef =3D=3D null) { throw new NotExecutableException("No binary property def with = " + @@ -295,9 +290,8 @@ throws NotExecutableException, RepositoryException { =20 // locate a PropertyDefinition with ValueConstraints - Session session =3D helper.getReadWriteSession(); PropertyDefinition propDef =3D - NodeTypeUtil.locatePropertyDef(session, PropertyType.LONG,= false, false, true, false); + NodeTypeUtil.locatePropertyDef(superuser, PropertyType.LON= G, false, false, true, false); =20 if (propDef =3D=3D null) { throw new NotExecutableException("No long property def with " + @@ -355,9 +349,8 @@ throws NotExecutableException, RepositoryException { =20 // locate a PropertyDefinition with ValueConstraints - Session session =3D helper.getReadWriteSession(); PropertyDefinition propDef =3D - NodeTypeUtil.locatePropertyDef(session, PropertyType.REFER= ENCE, false, false, true, false); + NodeTypeUtil.locatePropertyDef(superuser, PropertyType.REF= ERENCE, false, false, true, false); =20 if (propDef =3D=3D null) { throw new NotExecutableException("No reference property def wi= th " + @@ -367,7 +360,7 @@ String constraints[] =3D propDef.getValueConstraints(); String nodeTypeNotSatisfied =3D null; =20 - NodeTypeManager manager =3D session.getWorkspace().getNodeTypeMana= ger(); + NodeTypeManager manager =3D superuser.getWorkspace().getNodeTypeMa= nager(); NodeTypeIterator types =3D manager.getAllNodeTypes(); =20 // find a NodeType which is not satisfying the constraints Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/ap= i/SetValueConstraintViolationExceptionTest.java URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/= apache/jackrabbit/test/api/SetValueConstraintViolationExceptionTest.java?re= v=3D164811&r1=3D164810&r2=3D164811&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/SetV= alueConstraintViolationExceptionTest.java (original) +++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/SetV= alueConstraintViolationExceptionTest.java Tue Apr 26 09:40:05 2005 @@ -21,7 +21,6 @@ import org.apache.jackrabbit.test.api.nodetype.NodeTypeUtil; =20 import javax.jcr.RepositoryException; -import javax.jcr.Session; import javax.jcr.PropertyType; import javax.jcr.Value; import javax.jcr.Node; @@ -54,9 +53,8 @@ throws NotExecutableException, RepositoryException { =20 // locate a PropertyDefinition with ValueConstraints - Session session =3D helper.getReadWriteSession(); PropertyDefinition propDef =3D - NodeTypeUtil.locatePropertyDef(session, PropertyType.BINAR= Y, false, false, true, false); + NodeTypeUtil.locatePropertyDef(superuser, PropertyType.BIN= ARY, false, false, true, false); =20 if (propDef =3D=3D null) { throw new NotExecutableException("No binary property def with = " + @@ -123,9 +121,8 @@ throws NotExecutableException, RepositoryException { =20 // locate a PropertyDefinition with ValueConstraints - Session session =3D helper.getReadWriteSession(); PropertyDefinition propDef =3D - NodeTypeUtil.locatePropertyDef(session, PropertyType.BOOLE= AN, false, false, true, false); + NodeTypeUtil.locatePropertyDef(superuser, PropertyType.BOO= LEAN, false, false, true, false); =20 if (propDef =3D=3D null) { throw new NotExecutableException("No boolean property def with= " + @@ -191,9 +188,8 @@ throws NotExecutableException, RepositoryException { =20 // locate a PropertyDefinition with ValueConstraints - Session session =3D helper.getReadWriteSession(); PropertyDefinition propDef =3D - NodeTypeUtil.locatePropertyDef(session, PropertyType.DATE,= false, false, true, false); + NodeTypeUtil.locatePropertyDef(superuser, PropertyType.DAT= E, false, false, true, false); =20 if (propDef =3D=3D null) { throw new NotExecutableException("No date property def with " + @@ -259,9 +255,8 @@ throws NotExecutableException, RepositoryException { =20 // locate a PropertyDefinition with ValueConstraints - Session session =3D helper.getReadWriteSession(); PropertyDefinition propDef =3D - NodeTypeUtil.locatePropertyDef(session, PropertyType.DOUBL= E, false, false, true, false); + NodeTypeUtil.locatePropertyDef(superuser, PropertyType.DOU= BLE, false, false, true, false); =20 if (propDef =3D=3D null) { throw new NotExecutableException("No double property def with = " + @@ -327,9 +322,8 @@ throws NotExecutableException, RepositoryException { =20 // locate a PropertyDefinition with ValueConstraints - Session session =3D helper.getReadWriteSession(); PropertyDefinition propDef =3D - NodeTypeUtil.locatePropertyDef(session, PropertyType.LONG,= false, false, true, false); + NodeTypeUtil.locatePropertyDef(superuser, PropertyType.LON= G, false, false, true, false); =20 if (propDef =3D=3D null) { throw new NotExecutableException("No long property def with " + @@ -396,9 +390,8 @@ throws NotExecutableException, RepositoryException { =20 // locate a PropertyDefinition with ValueConstraints - Session session =3D helper.getReadWriteSession(); PropertyDefinition propDef =3D - NodeTypeUtil.locatePropertyDef(session, PropertyType.REFER= ENCE, false, false, true, false); + NodeTypeUtil.locatePropertyDef(superuser, PropertyType.REF= ERENCE, false, false, true, false); =20 if (propDef =3D=3D null) { throw new NotExecutableException("No reference property def wi= th " + @@ -409,7 +402,7 @@ String nodeTypeSatisfied =3D constraints[0]; String nodeTypeNotSatisfied =3D null; =20 - NodeTypeManager manager =3D session.getWorkspace().getNodeTypeMana= ger(); + NodeTypeManager manager =3D superuser.getWorkspace().getNodeTypeMa= nager(); NodeTypeIterator types =3D manager.getAllNodeTypes(); =20 // find a NodeType which is not satisfying the constraints @@ -488,9 +481,8 @@ throws NotExecutableException, RepositoryException { =20 // locate a PropertyDefinition with ValueConstraints - Session session =3D helper.getReadWriteSession(); PropertyDefinition propDef =3D - NodeTypeUtil.locatePropertyDef(session, PropertyType.BINAR= Y, true, false, true, false); + NodeTypeUtil.locatePropertyDef(superuser, PropertyType.BIN= ARY, true, false, true, false); =20 if (propDef =3D=3D null) { throw new NotExecutableException("No multiple binary property = def with " + @@ -544,9 +536,8 @@ throws NotExecutableException, RepositoryException { =20 // locate a PropertyDefinition with ValueConstraints - Session session =3D helper.getReadWriteSession(); PropertyDefinition propDef =3D - NodeTypeUtil.locatePropertyDef(session, PropertyType.BOOLE= AN, true, false, true, false); + NodeTypeUtil.locatePropertyDef(superuser, PropertyType.BOO= LEAN, true, false, true, false); =20 if (propDef =3D=3D null) { throw new NotExecutableException("No multiple boolean property= def with " + @@ -601,9 +592,8 @@ throws NotExecutableException, RepositoryException { =20 // locate a PropertyDefinition with ValueConstraints - Session session =3D helper.getReadWriteSession(); PropertyDefinition propDef =3D - NodeTypeUtil.locatePropertyDef(session, PropertyType.DATE,= true, false, true, false); + NodeTypeUtil.locatePropertyDef(superuser, PropertyType.DAT= E, true, false, true, false); =20 if (propDef =3D=3D null) { throw new NotExecutableException("No multiple date property de= f with " + @@ -657,9 +647,8 @@ throws NotExecutableException, RepositoryException { =20 // locate a PropertyDefinition with ValueConstraints - Session session =3D helper.getReadWriteSession(); PropertyDefinition propDef =3D - NodeTypeUtil.locatePropertyDef(session, PropertyType.DOUBL= E, true, false, true, false); + NodeTypeUtil.locatePropertyDef(superuser, PropertyType.DOU= BLE, true, false, true, false); =20 if (propDef =3D=3D null) { throw new NotExecutableException("No multiple double property = def with " + @@ -714,9 +703,8 @@ throws NotExecutableException, RepositoryException { =20 // locate a PropertyDefinition with ValueConstraints - Session session =3D helper.getReadWriteSession(); PropertyDefinition propDef =3D - NodeTypeUtil.locatePropertyDef(session, PropertyType.LONG,= true, false, true, false); + NodeTypeUtil.locatePropertyDef(superuser, PropertyType.LON= G, true, false, true, false); =20 if (propDef =3D=3D null) { throw new NotExecutableException("No multiple long property de= f with " + @@ -771,9 +759,8 @@ throws NotExecutableException, RepositoryException { =20 // locate a PropertyDefinition with ValueConstraints - Session session =3D helper.getReadWriteSession(); PropertyDefinition propDef =3D - NodeTypeUtil.locatePropertyDef(session, PropertyType.REFER= ENCE, true, false, true, false); + NodeTypeUtil.locatePropertyDef(superuser, PropertyType.REF= ERENCE, true, false, true, false); =20 if (propDef =3D=3D null) { throw new NotExecutableException("No multiple reference proper= ty def with " + @@ -784,7 +771,7 @@ String nodeTypeSatisfied =3D constraints[0]; String nodeTypeNotSatisfied =3D null; =20 - NodeTypeManager manager =3D session.getWorkspace().getNodeTypeMana= ger(); + NodeTypeManager manager =3D superuser.getWorkspace().getNodeTypeMa= nager(); NodeTypeIterator types =3D manager.getAllNodeTypes(); =20 // find a NodeType which is not satisfying the constraints Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/ap= i/WorkspaceCloneTest.java URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/= apache/jackrabbit/test/api/WorkspaceCloneTest.java?rev=3D164811&r1=3D164810= &r2=3D164811&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Work= spaceCloneTest.java (original) +++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Work= spaceCloneTest.java Tue Apr 26 09:40:05 2005 @@ -105,16 +105,18 @@ * sufficient access permissions to complete the operation. */ public void testCloneNodesAccessDenied() throws RepositoryException { - // logout and get read only session - //superuser.logout(); + // get read only session Session readOnlySuperuser =3D helper.getReadOnlySession(); - - String dstAbsPath =3D node2.getPath() + "/" + node1.getName(); try { - readOnlySuperuser.getWorkspace().clone(workspaceW2.getName(), = node1.getPath(), dstAbsPath, true); - fail("Cloning in a read-only session should throw an AccessDen= iedException."); - } catch (AccessDeniedException e) { - // successful + String dstAbsPath =3D node2.getPath() + "/" + node1.getName(); + try { + readOnlySuperuser.getWorkspace().clone(workspaceW2.getName= (), node1.getPath(), dstAbsPath, true); + fail("Cloning in a read-only session should throw an Acces= sDeniedException."); + } catch (AccessDeniedException e) { + // successful + } + } finally { + readOnlySuperuser.logout(); } } =20 Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/ap= i/WorkspaceCopyBetweenWorkspacesTest.java URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/= apache/jackrabbit/test/api/WorkspaceCopyBetweenWorkspacesTest.java?rev=3D16= 4811&r1=3D164810&r2=3D164811&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Work= spaceCopyBetweenWorkspacesTest.java (original) +++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Work= spaceCopyBetweenWorkspacesTest.java Tue Apr 26 09:40:05 2005 @@ -110,13 +110,16 @@ */ public void testCopyNodesAccessDenied() throws RepositoryException { Session readOnlySuperuser =3D helper.getReadOnlySession(); - - String dstAbsPath =3D node2.getPath() + "/" + node1.getName(); try { - readOnlySuperuser.getWorkspace().copy(workspaceW2.getName(), n= ode1W2.getPath(), dstAbsPath); - fail("Copy in a read-only session should throw an AccessDenied= Exception."); - } catch (AccessDeniedException e) { - // successful + String dstAbsPath =3D node2.getPath() + "/" + node1.getName(); + try { + readOnlySuperuser.getWorkspace().copy(workspaceW2.getName(= ), node1W2.getPath(), dstAbsPath); + fail("Copy in a read-only session should throw an AccessDe= niedException."); + } catch (AccessDeniedException e) { + // successful + } + } finally { + readOnlySuperuser.logout(); } } =20 Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/ap= i/WorkspaceCopyTest.java URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/= apache/jackrabbit/test/api/WorkspaceCopyTest.java?rev=3D164811&r1=3D164810&= r2=3D164811&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Work= spaceCopyTest.java (original) +++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Work= spaceCopyTest.java Tue Apr 26 09:40:05 2005 @@ -91,13 +91,16 @@ */ public void testCopyNodesAccessDenied() throws RepositoryException { Session readOnlySuperuser =3D helper.getReadOnlySession(); - - String dstAbsPath =3D node2.getPath() + "/" + node1.getName(); try { - readOnlySuperuser.getWorkspace().copy(node1.getPath(), dstAbsP= ath); - fail("Copy in a read-only session should throw an AccessDenied= Exception."); - } catch (AccessDeniedException e) { - // successful + String dstAbsPath =3D node2.getPath() + "/" + node1.getName(); + try { + readOnlySuperuser.getWorkspace().copy(node1.getPath(), dst= AbsPath); + fail("Copy in a read-only session should throw an AccessDe= niedException."); + } catch (AccessDeniedException e) { + // successful + } + } finally { + readOnlySuperuser.logout(); } } =20 @@ -139,25 +142,29 @@ // get other session Session otherSession =3D helper.getReadWriteSession(); =20 - // get lock target node in destination wsp through other session - Node lockTarget =3D (Node) otherSession.getItem(node2.getPath()); - - // add mixin "lockable" to be able to lock the node - if (!lockTarget.getPrimaryNodeType().isNodeType(mixLockable)) { - lockTarget.addMixin(mixLockable); - lockTarget.getParent().save(); - } - - // lock dst parent node using other session - lockTarget.lock(true, true); - try { - workspace.copy(node1.getPath(), dstAbsPath); - fail("LockException was expected."); - } catch (LockException e) { - // successful + // get lock target node in destination wsp through other sessi= on + Node lockTarget =3D (Node) otherSession.getItem(node2.getPath(= )); + + // add mixin "lockable" to be able to lock the node + if (!lockTarget.getPrimaryNodeType().isNodeType(mixLockable)) { + lockTarget.addMixin(mixLockable); + lockTarget.getParent().save(); + } + + // lock dst parent node using other session + lockTarget.lock(true, true); + + try { + workspace.copy(node1.getPath(), dstAbsPath); + fail("LockException was expected."); + } catch (LockException e) { + // successful + } finally { + lockTarget.unlock(); + } } finally { - lockTarget.unlock(); + otherSession.logout(); } } } Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/ap= i/WorkspaceMoveTest.java URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/= apache/jackrabbit/test/api/WorkspaceMoveTest.java?rev=3D164811&r1=3D164810&= r2=3D164811&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Work= spaceMoveTest.java (original) +++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Work= spaceMoveTest.java Tue Apr 26 09:40:05 2005 @@ -91,13 +91,16 @@ */ public void testMoveNodesAccessDenied() throws RepositoryException { Session readOnlySuperuser =3D helper.getReadOnlySession(); - - String dstAbsPath =3D node2.getPath() + "/" + node1.getName(); try { - readOnlySuperuser.getWorkspace().move(node1.getPath(), dstAbsP= ath); - fail("Copy in a read-only session should throw an AccessDenied= Exception."); - } catch (AccessDeniedException e) { - // successful + String dstAbsPath =3D node2.getPath() + "/" + node1.getName(); + try { + readOnlySuperuser.getWorkspace().move(node1.getPath(), dst= AbsPath); + fail("Copy in a read-only session should throw an AccessDe= niedException."); + } catch (AccessDeniedException e) { + // successful + } + } finally { + readOnlySuperuser.logout(); } } =20 @@ -140,25 +143,29 @@ // get other session Session otherSession =3D helper.getReadWriteSession(); =20 - // get lock target node in destination wsp through other session - Node lockTarget =3D (Node) otherSession.getItem(node2.getPath()); - - // add mixin "lockable" to be able to lock the node - if (!lockTarget.getPrimaryNodeType().isNodeType(mixLockable)) { - lockTarget.addMixin(mixLockable); - lockTarget.getParent().save(); - } - - // lock dst parent node using other session - lockTarget.lock(true, true); - try { - workspace.move(node1.getPath(), dstAbsPath); - fail("LockException was expected."); - } catch (LockException e) { - // successful + // get lock target node in destination wsp through other sessi= on + Node lockTarget =3D (Node) otherSession.getItem(node2.getPath(= )); + + // add mixin "lockable" to be able to lock the node + if (!lockTarget.getPrimaryNodeType().isNodeType(mixLockable)) { + lockTarget.addMixin(mixLockable); + lockTarget.getParent().save(); + } + + // lock dst parent node using other session + lockTarget.lock(true, true); + + try { + workspace.move(node1.getPath(), dstAbsPath); + fail("LockException was expected."); + } catch (LockException e) { + // successful + } finally { + lockTarget.unlock(); + } } finally { - lockTarget.unlock(); + otherSession.logout(); } } } Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/ap= i/WorkspaceReadMethodsTest.java URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/= apache/jackrabbit/test/api/WorkspaceReadMethodsTest.java?rev=3D164811&r1=3D= 164810&r2=3D164811&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Work= spaceReadMethodsTest.java (original) +++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/Work= spaceReadMethodsTest.java Tue Apr 26 09:40:05 2005 @@ -46,10 +46,13 @@ */ public void testGetSession() throws RepositoryException { Session session =3D helper.getReadOnlySession(); - Session otherSession =3D session.getWorkspace().getSession(); - assertSame("Workspace.getSession() returns not the same session ob= ject.", - session, otherSession); - session.logout(); + try { + Session otherSession =3D session.getWorkspace().getSession(); + assertSame("Workspace.getSession() returns not the same sessio= n object.", + session, otherSession); + } finally { + session.logout(); + } } =20 /** @@ -58,12 +61,15 @@ */ public void testGetName() throws RepositoryException { Session session =3D helper.getReadOnlySession(workspaceName); - String name =3D session.getWorkspace().getName(); - if (workspaceName !=3D null) { - assertEquals("Workspace.getName() returns wrong name.", - workspaceName, name); + try { + String name =3D session.getWorkspace().getName(); + if (workspaceName !=3D null) { + assertEquals("Workspace.getName() returns wrong name.", + workspaceName, name); + } + } finally { + session.logout(); } - session.logout(); } =20 /** @@ -72,8 +78,11 @@ */ public void testGetQueryManager() throws RepositoryException { Workspace ws =3D helper.getReadOnlySession().getWorkspace(); - assertNotNull("Workspace does not return a QueryManager object.", = ws.getQueryManager()); - ws.getSession().logout(); + try { + assertNotNull("Workspace does not return a QueryManager object= .", ws.getQueryManager()); + } finally { + ws.getSession().logout(); + } } =20 /** @@ -83,12 +92,15 @@ */ public void testGetAccessibleWorkspaceNames() throws RepositoryExcepti= on { Session session =3D helper.getReadOnlySession(); - String[] wsNames =3D session.getWorkspace().getAccessibleWorkspace= Names(); - for (int i =3D 0; i < wsNames.length; i++) { - // login - Session s =3D helper.getReadOnlySession(wsNames[i]); - s.logout(); + try { + String[] wsNames =3D session.getWorkspace().getAccessibleWorks= paceNames(); + for (int i =3D 0; i < wsNames.length; i++) { + // login + Session s =3D helper.getReadOnlySession(wsNames[i]); + s.logout(); + } + } finally { + session.logout(); } - session.logout(); } } Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/ap= i/lock/LockTest.java URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/= apache/jackrabbit/test/api/lock/LockTest.java?rev=3D164811&r1=3D164810&r2= =3D164811&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- 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 Tue Apr 26 09:40:05 2005 @@ -116,23 +116,24 @@ // create new session Session otherSuperuser =3D helper.getSuperuserSession(); =20 - // get same node - Node n2 =3D (Node) otherSuperuser.getItem(n1.getPath()); - - // assert: lock token must be null for other session - assertNull("Lock token must be null for other session", - n2.getLock().getLockToken()); - - // assert: modifying same node in other session must fail try { - n2.addNode(nodeName2, testNodeType); - fail("modifying same node in other session must fail"); - } catch (LockException e) { - // expected - } + // get same node + Node n2 =3D (Node) otherSuperuser.getItem(n1.getPath()); =20 - // logout - otherSuperuser.logout(); + // assert: lock token must be null for other session + assertNull("Lock token must be null for other session", + n2.getLock().getLockToken()); + + // assert: modifying same node in other session must fail + try { + n2.addNode(nodeName2, testNodeType); + fail("modifying same node in other session must fail"); + } catch (LockException e) { + // expected + } + } finally { + otherSuperuser.logout(); + } } =20 /** @@ -371,20 +372,24 @@ // create new session Session otherSuperuser =3D helper.getSuperuserSession(); =20 - // get node created above - Node n2 =3D (Node) otherSuperuser.getItem(n1.getPath()); + Lock lock; + try { + // get node created above + Node n2 =3D (Node) otherSuperuser.getItem(n1.getPath()); =20 - // lock node - Lock lock =3D n2.lock(false, true); + // lock node + lock =3D n2.lock(false, true); =20 - // assert: lock must be alive - assertTrue("lock must be alive", lock.isLive()); + // assert: lock must be alive + assertTrue("lock must be alive", lock.isLive()); =20 - // assert: node must be locked - assertTrue("node must be locked", n1.isLocked()); + // assert: node must be locked + assertTrue("node must be locked", n1.isLocked()); + } finally { + // log out + otherSuperuser.logout(); + } =20 - // log out - otherSuperuser.logout(); =20 // assert: lock must not be alive assertFalse("lock must not be alive", lock.isLive()); @@ -405,29 +410,31 @@ // create new session Session otherSuperuser =3D helper.getSuperuserSession(); =20 - // get node created above - Node n2 =3D (Node) otherSuperuser.getItem(n1.getPath()); - - // lock node - Lock lock =3D n2.lock(false, true); - - // assert: user must get non-null token - assertNotNull("user must get non-null token", lock.getLockToken()); - - // transfer to standard session - String lockToken =3D lock.getLockToken(); - otherSuperuser.removeLockToken(lockToken); - superuser.addLockToken(lockToken); + try { + // get node created above + Node n2 =3D (Node) otherSuperuser.getItem(n1.getPath()); =20 - // assert: user must get null token - assertNull("user must get null token", lock.getLockToken()); + // lock node + Lock lock =3D n2.lock(false, true); =20 - // assert: user must get non-null token - assertNotNull("user must get non-null token", - n1.getLock().getLockToken()); + // assert: user must get non-null token + assertNotNull("user must get non-null token", lock.getLockToke= n()); =20 - // log out - otherSuperuser.logout(); + // transfer to standard session + String lockToken =3D lock.getLockToken(); + otherSuperuser.removeLockToken(lockToken); + superuser.addLockToken(lockToken); + + // assert: user must get null token + assertNull("user must get null token", lock.getLockToken()); + + // assert: user must get non-null token + assertNotNull("user must get non-null token", + n1.getLock().getLockToken()); + } finally { + // log out + otherSuperuser.logout(); + } } =20 /** @@ -442,19 +449,21 @@ // create new session Session otherSuperuser =3D helper.getSuperuserSession(); =20 - // get node created above - Node n2 =3D (Node) otherSuperuser.getItem(n1.getPath()); - - // lock node - Lock lock =3D n2.lock(false, false); + try { + // get node created above + Node n2 =3D (Node) otherSuperuser.getItem(n1.getPath()); =20 - // transfer to standard session - String lockToken =3D lock.getLockToken(); - otherSuperuser.removeLockToken(lockToken); - superuser.addLockToken(lockToken); + // lock node + Lock lock =3D n2.lock(false, false); =20 - // log out - otherSuperuser.logout(); + // transfer to standard session + String lockToken =3D lock.getLockToken(); + otherSuperuser.removeLockToken(lockToken); + superuser.addLockToken(lockToken); + } finally { + // log out + otherSuperuser.logout(); + } =20 // assert: node still locked assertTrue(n1.isLocked()); Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/ap= i/query/SaveTest.java URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/= apache/jackrabbit/test/api/query/SaveTest.java?rev=3D164811&r1=3D164810&r2= =3D164811&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/quer= y/SaveTest.java (original) +++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/quer= y/SaveTest.java Tue Apr 26 09:40:05 2005 @@ -182,8 +182,8 @@ lockable.lock(false, true); =20 Session readWrite =3D helper.getReadWriteSession(); - Query query =3D readWrite.getWorkspace().getQueryManager().createQ= uery(statement, Query.XPATH); try { + Query query =3D readWrite.getWorkspace().getQueryManager().cre= ateQuery(statement, Query.XPATH); query.storeAsNode(testRoot + "/" + nodeName1 + "/" + nodeName2= ); fail("Query.storeAsNode() must throw LockException, parent nod= e is locked."); } catch (LockException e) { Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/ap= i/version/MergeNodeTest.java URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/= apache/jackrabbit/test/api/version/MergeNodeTest.java?rev=3D164811&r1=3D164= 810&r2=3D164811&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/vers= ion/MergeNodeTest.java (original) +++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/vers= ion/MergeNodeTest.java Tue Apr 26 09:40:05 2005 @@ -276,19 +276,22 @@ String pathRelToRoot =3D nodeToMerge.getPath().substring(1); // access node through another session to lock it Session session2 =3D helper.getSuperuserSession(); - Node node2 =3D session2.getRootNode().getNode(pathRelToRoot); - node2.lock(false, false); - try { - nodeToMerge.merge(workspace.getName(), false); - fail("merge must throw a LockException if applied on a " + - "locked node"); - } catch (LockException e) { - // success - } + Node node2 =3D session2.getRootNode().getNode(pathRelToRoot); + node2.lock(false, false); =20 - node2.unlock(); - session2.logout(); + try { + nodeToMerge.merge(workspace.getName(), false); + fail("merge must throw a LockException if applied on a " + + "locked node"); + } catch (LockException e) { + // success + } + + node2.unlock(); + } finally { + session2.logout(); + } } =20 /** Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/ap= i/version/VersionStorageTest.java URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/= apache/jackrabbit/test/api/version/VersionStorageTest.java?rev=3D164811&r1= =3D164810&r2=3D164811&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/vers= ion/VersionStorageTest.java (original) +++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/vers= ion/VersionStorageTest.java Tue Apr 26 09:40:05 2005 @@ -65,17 +65,21 @@ // The superuser session for the second workspace Session superuserW2 =3D helper.getSuperuserSession(workspaceName); =20 - // check path to version storage - assertTrue("Version strorage must be reflected as a subtree below = the node '" + versionStoragePath + "'", superuserW2.getRootNode().hasNode(v= ersionStoragePath)); - - // check if subnodes in versionStorage are protected try { - // try to create a version node - Node versionStorageNodeW2 =3D superuserW2.getRootNode().getNod= e(versionStoragePath); - versionStorageNodeW2.addNode(nodeName1, ntVersion); - fail("It should not be possible to add a subnode/version in ve= rsion storage."); - } catch (ConstraintViolationException e) { - // success + // check path to version storage + assertTrue("Version strorage must be reflected as a subtree be= low the node '" + versionStoragePath + "'", superuserW2.getRootNode().hasNo= de(versionStoragePath)); + + // check if subnodes in versionStorage are protected + try { + // try to create a version node + Node versionStorageNodeW2 =3D superuserW2.getRootNode().ge= tNode(versionStoragePath); + versionStorageNodeW2.addNode(nodeName1, ntVersion); + fail("It should not be possible to add a subnode/version i= n version storage."); + } catch (ConstraintViolationException e) { + // success + } + } finally { + superuserW2.logout(); } } =20 Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/ap= i/version/WorkspaceRestoreTest.java URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/= apache/jackrabbit/test/api/version/WorkspaceRestoreTest.java?rev=3D164811&r= 1=3D164810&r2=3D164811&view=3Ddiff =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D --- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/vers= ion/WorkspaceRestoreTest.java (original) +++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/vers= ion/WorkspaceRestoreTest.java Tue Apr 26 09:40:05 2005 @@ -115,6 +115,9 @@ wVersionableNode.remove(); wVersionableNode2.remove(); wTestRoot.save(); + if (wSuperuser !=3D null) { + wSuperuser.logout(); + } } finally { super.tearDown(); }