From commits-return-3794-apmail-jackrabbit-commits-archive=jackrabbit.apache.org@jackrabbit.apache.org Fri Mar 16 08:01:46 2007 Return-Path: Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: (qmail 21310 invoked from network); 16 Mar 2007 08:01:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 16 Mar 2007 08:01:43 -0000 Received: (qmail 59368 invoked by uid 500); 16 Mar 2007 08:01:37 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 59279 invoked by uid 500); 16 Mar 2007 08:01:36 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 59235 invoked by uid 99); 16 Mar 2007 08:01:36 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Mar 2007 01:01:36 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Mar 2007 01:01:26 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id CD0791A9838; Fri, 16 Mar 2007 01:01:05 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r518882 - in /jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit: jcr2spi/ jcr2spi/lock/ jcr2spi/name/ jcr2spi/nodetype/ jcr2spi/query/ jcr2spi/version/ test/ Date: Fri, 16 Mar 2007 08:01:04 -0000 To: commits@jackrabbit.apache.org From: angela@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070316080105.CD0791A9838@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: angela Date: Fri Mar 16 01:01:00 2007 New Revision: 518882 URL: http://svn.apache.org/viewvc?view=rev&rev=518882 Log: - missing session.logout - rename RefreshTrue to RefreshTrueTest - add TestAll classes Added: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/RefreshTrueTest.java (with props) jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/TestAll.java (with props) jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/lock/TestAll.java (with props) jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/name/TestAll.java (with props) jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/TestAll.java (with props) jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/query/TestAll.java (with props) jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/version/TestAll.java (with props) Removed: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/RefreshTrue.java Modified: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/MoveMultipleTest.java jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderTest.java jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/SNSIndexTest.java jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/UpdateTest.java jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/lock/AbstractLockTest.java jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/lock/OpenScopedLockTest.java jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/lock/SessionScopedLockTest.java jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryTest.java jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/test/TestAll.java Modified: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/MoveMultipleTest.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/MoveMultipleTest.java?view=diff&rev=518882&r1=518881&r2=518882 ============================================================================== --- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/MoveMultipleTest.java (original) +++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/MoveMultipleTest.java Fri Mar 16 01:01:00 2007 @@ -253,11 +253,15 @@ testRootNode.save(); Session otherSession = helper.getReadWriteSession(); - otherSession.move(originalPath, destinationPath); + try { + otherSession.move(originalPath, destinationPath); + Node mv = (Node) otherSession.getItem(destinationPath); - Node mv = (Node) otherSession.getItem(destinationPath); - - assertTrue(childNode.isSame(mv.getNode(nodeName2))); - assertTrue(childProperty.isSame(mv.getProperty(propertyName2))); + testRootNode.refresh(false); + assertTrue(childNode.isSame(mv.getNode(nodeName2))); + assertTrue(childProperty.isSame(mv.getProperty(propertyName2))); + } finally { + otherSession.logout(); + } } } Added: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/RefreshTrueTest.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/RefreshTrueTest.java?view=auto&rev=518882 ============================================================================== --- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/RefreshTrueTest.java (added) +++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/RefreshTrueTest.java Fri Mar 16 01:01:00 2007 @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.jcr2spi; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.apache.jackrabbit.test.NotExecutableException; +import org.apache.jackrabbit.test.AbstractJCRTest; + +import javax.jcr.Value; +import javax.jcr.Property; +import javax.jcr.RepositoryException; +import javax.jcr.InvalidItemStateException; +import javax.jcr.version.VersionException; +import javax.jcr.nodetype.ConstraintViolationException; +import javax.jcr.lock.LockException; + +/** + * RefreshTrue... + */ +public class RefreshTrueTest extends AbstractJCRTest { + + private static Logger log = LoggerFactory.getLogger(RefreshTrueTest.class); + + private Value testValue; + + protected void setUp() throws Exception { + super.setUp(); + + testValue = testRootNode.getSession().getValueFactory().createValue("anyString"); + if (!testRootNode.getPrimaryNodeType().canSetProperty(propertyName1, testValue)) { + throw new NotExecutableException(""); + } + } + + public void testNewProperty() throws RepositoryException { + Property p = testRootNode.setProperty(propertyName1, testValue); + testRootNode.refresh(true); + + // p must still be accessible + p.getString(); + assertTrue("Refresh 'true' must not affect a new Property.", testRootNode.hasProperty(propertyName1)); + Property pAgain = testRootNode.getProperty(propertyName1); + assertTrue("Refresh 'true' must not affect a new Property.", p.isSame(pAgain)); + } + + public void testRemovedProperty() throws RepositoryException, LockException, ConstraintViolationException, VersionException { + Property p = testRootNode.setProperty(propertyName1, testValue); + testRootNode.save(); + + p.remove(); + testRootNode.refresh(true); + + // Property p must remain removed + try { + p.getString(); + fail("Refresh 'true' must not revert removal of an item."); + } catch (InvalidItemStateException e) { + //ok + } + assertFalse("Refresh 'true' must not revert removal of an item.", testRootNode.hasProperty(propertyName1)); + } +} \ No newline at end of file Propchange: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/RefreshTrueTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/RefreshTrueTest.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Modified: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderTest.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderTest.java?view=diff&rev=518882&r1=518881&r2=518882 ============================================================================== --- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderTest.java (original) +++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderTest.java Fri Mar 16 01:01:00 2007 @@ -104,7 +104,11 @@ testRootNode.save(); Session otherSession = helper.getReadOnlySession(); - testOrder((Node) otherSession.getItem(testRootNode.getPath()), new Node[] {child3, child1, child2, child4}); + try { + testOrder((Node) otherSession.getItem(testRootNode.getPath()), new Node[] {child3, child1, child2, child4}); + } finally { + otherSession.logout(); + } } public void testReorderTwice() throws RepositoryException { Modified: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/SNSIndexTest.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/SNSIndexTest.java?view=diff&rev=518882&r1=518881&r2=518882 ============================================================================== --- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/SNSIndexTest.java (original) +++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/SNSIndexTest.java Fri Mar 16 01:01:00 2007 @@ -78,9 +78,13 @@ */ public void testIndexByOtherSession() throws RepositoryException { Session otherSession = helper.getReadOnlySession(); - for (int index = Path.INDEX_DEFAULT; index < 4; index++) { - Node sns = (Node) otherSession.getItem(buildPath(index)); - checkIndex(sns, index); + try { + for (int index = Path.INDEX_DEFAULT; index < 4; index++) { + Node sns = (Node) otherSession.getItem(buildPath(index)); + checkIndex(sns, index); + } + } finally { + otherSession.logout(); } } @@ -111,22 +115,26 @@ */ public void testNodeEntriesFilledCorrectly() throws RepositoryException { Session otherSession = helper.getReadOnlySession(); - Node sns = (Node) otherSession.getItem(buildPath(3)); - checkIndex(sns, 3); + try { + Node sns = (Node) otherSession.getItem(buildPath(3)); + checkIndex(sns, 3); - sns = (Node) otherSession.getItem(buildPath(2)); - checkIndex(sns, 2); + sns = (Node) otherSession.getItem(buildPath(2)); + checkIndex(sns, 2); - sns = (Node) otherSession.getItem(buildPath(4)); - checkIndex(sns, 4); + sns = (Node) otherSession.getItem(buildPath(4)); + checkIndex(sns, 4); - // check 3 again - sns = (Node) otherSession.getItem(buildPath(3)); - checkIndex(sns, 3); - - // check default - sns = (Node) otherSession.getItem(buildPath(1)); - checkIndex(sns, 1); + // check 3 again + sns = (Node) otherSession.getItem(buildPath(3)); + checkIndex(sns, 3); + + // check default + sns = (Node) otherSession.getItem(buildPath(1)); + checkIndex(sns, 1); + } finally { + otherSession.logout(); + } } /** @@ -152,18 +160,22 @@ */ public void testGetNodesByNameByOtherSession() throws RepositoryException { Session otherSession = helper.getReadOnlySession(); - NodeIterator it = ((Node) otherSession.getItem(parent.getPath())).getNodes(snsName); - long size = it.getSize(); - if (size != -1) { + try { + NodeIterator it = ((Node) otherSession.getItem(parent.getPath())).getNodes(snsName); + long size = it.getSize(); + if (size != -1) { + assertTrue("4 SNSs have been added -> but iterator size is " + size + ".", size == 4); + } + int expectedIndex = 1; + while (it.hasNext()) { + Node sns = it.nextNode(); + checkIndex(sns, expectedIndex); + expectedIndex++; + } assertTrue("4 SNSs have been added -> but iterator size is " + size + ".", size == 4); + } finally { + otherSession.logout(); } - int expectedIndex = 1; - while (it.hasNext()) { - Node sns = it.nextNode(); - checkIndex(sns, expectedIndex); - expectedIndex++; - } - assertTrue("4 SNSs have been added -> but iterator size is " + size + ".", size == 4); } Added: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/TestAll.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/TestAll.java?view=auto&rev=518882 ============================================================================== --- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/TestAll.java (added) +++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/TestAll.java Fri Mar 16 01:01:00 2007 @@ -0,0 +1,82 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.jcr2spi; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import junit.framework.Test; +import junit.framework.TestSuite; +import junit.framework.TestCase; + +/** + * TestAll... + */ +public class TestAll extends TestCase { + + private static Logger log = LoggerFactory.getLogger(TestAll.class); + + public static Test suite() { + + TestSuite suite = new TestSuite("jcr2spi tests"); + + suite.addTestSuite(AccessByRelativePathTest.class); + suite.addTestSuite(SNSIndexTest.class); + + // set/add property + suite.addTestSuite(AddNewPropertyTest.class); + suite.addTestSuite(SingleValuedPropertyTest.class); + suite.addTestSuite(MultiValuedPropertyTest.class); + + // move + suite.addTestSuite(MoveTest.class); + suite.addTestSuite(MoveReferenceableTest.class); + suite.addTestSuite(MoveSNSTest.class); + suite.addTestSuite(MoveTreeTest.class); + suite.addTestSuite(MoveNewTreeTest.class); + suite.addTestSuite(MoveMultipleTest.class); + suite.addTestSuite(WorkspaceMoveTest.class); + + // refresh + suite.addTestSuite(RefreshFalseTest.class); + suite.addTestSuite(RefreshTrueTest.class); + + // remove + suite.addTestSuite(RemoveNodeTest.class); + suite.addTestSuite(RemovePropertyTest.class); + suite.addTestSuite(RemoveReferenceableNodeTest.class); + suite.addTestSuite(RemoveReferenceableTest.class); + suite.addTestSuite(RemoveSNSTest.class); + + // rename + suite.addTestSuite(RenameTest.class); + + // reorder + suite.addTestSuite(ReorderTest.class); + suite.addTestSuite(ReorderReferenceableSNSTest.class); + suite.addTestSuite(ReorderSNSTest.class); + suite.addTestSuite(ReorderNewSNSTest.class); + suite.addTestSuite(ReorderNewTest.class); + suite.addTestSuite(ReorderNewAndSavedTest.class); + suite.addTestSuite(ReorderMixedTest.class); + suite.addTestSuite(ReorderMoveTest.class); + + // update + suite.addTestSuite(UpdateTest.class); + + return suite; + } +} \ No newline at end of file Propchange: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/TestAll.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/TestAll.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Modified: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/UpdateTest.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/UpdateTest.java?view=diff&rev=518882&r1=518881&r2=518882 ============================================================================== --- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/UpdateTest.java (original) +++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/UpdateTest.java Fri Mar 16 01:01:00 2007 @@ -158,42 +158,50 @@ String srcWorkspace = getAnotherWorkspace(); // get the root node in the second workspace Session session2 = helper.getSuperuserSession(srcWorkspace); - // make sure the source-session has the corresponding node. - Node testRootW2 = (Node) session2.getItem(testRootNode.getCorrespondingNodePath(srcWorkspace)); - if (testRootW2.hasProperty(propertyName2)) { - throw new NotExecutableException(); + try { + // make sure the source-session has the corresponding node. + Node testRootW2 = (Node) session2.getItem(testRootNode.getCorrespondingNodePath(srcWorkspace)); + if (testRootW2.hasProperty(propertyName2)) { + throw new NotExecutableException(); + } + + // call the update method on test node in default workspace + testRootNode.update(srcWorkspace); + + // ok first check if node has no longer propertis + assertFalse("Node updated with Node.update() should have property removed", testRootNode.hasProperty(propertyName2)); + } finally { + session2.logout(); } - - // call the update method on test node in default workspace - testRootNode.update(srcWorkspace); - - // ok first check if node has no longer propertis - assertFalse("Node updated with Node.update() should have property removed", testRootNode.hasProperty(propertyName2)); } public void testUpdateAddsMissingSubtree() throws RepositoryException, NotExecutableException { String srcWorkspace = getAnotherWorkspace(); // get the root node in the second workspace Session session2 = helper.getSuperuserSession(srcWorkspace); - // make sure the source-session has the corresponding node. - Node testRootW2 = (Node) session2.getItem(testRootNode.getCorrespondingNodePath(srcWorkspace)); - - // create test node in second workspace - Node aNode2 = testRootW2.addNode(nodeName1, testNodeType); - aNode2.addNode(nodeName2, testNodeType); - aNode2.setProperty(propertyName2, "test"); - Property p2 = testRootW2.setProperty(propertyName1, "test"); - testRootW2.save(); - - // call the update method on test node in default workspace - testRootNode.update(srcWorkspace); - - // ok check if the child has been added - boolean allPresent = testRootNode.hasNode(nodeName1) && - testRootNode.hasNode(nodeName1+"/"+nodeName2) && - testRootNode.hasProperty(nodeName1+"/"+propertyName2) && - testRootNode.hasProperty(propertyName1); - assertTrue("Node updated with Node.update() should have received childrens", allPresent); + try { + // make sure the source-session has the corresponding node. + Node testRootW2 = (Node) session2.getItem(testRootNode.getCorrespondingNodePath(srcWorkspace)); + + // create test node in second workspace + Node aNode2 = testRootW2.addNode(nodeName1, testNodeType); + aNode2.addNode(nodeName2, testNodeType); + aNode2.setProperty(propertyName2, "test"); + Property p2 = testRootW2.setProperty(propertyName1, "test"); + testRootW2.save(); + + // call the update method on test node in default workspace + testRootNode.update(srcWorkspace); + + // ok check if the child has been added + boolean allPresent = testRootNode.hasNode(nodeName1) && + testRootNode.hasNode(nodeName1+"/"+nodeName2) && + testRootNode.hasProperty(nodeName1+"/"+propertyName2) && + testRootNode.hasProperty(propertyName1); + assertTrue("Node updated with Node.update() should have received childrens", allPresent); + } finally { + session2.logout(); + } } private String getAnotherWorkspace() throws NotExecutableException { Modified: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/lock/AbstractLockTest.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/lock/AbstractLockTest.java?view=diff&rev=518882&r1=518881&r2=518882 ============================================================================== --- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/lock/AbstractLockTest.java (original) +++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/lock/AbstractLockTest.java Fri Mar 16 01:01:00 2007 @@ -39,11 +39,15 @@ Node childNode; Lock lock; + Session otherSession; + abstract boolean isSessionScoped(); protected void setUp() throws Exception { super.setUp(); + otherSession = helper.getSuperuserSession(); + lockedNode = testRootNode.addNode(nodeName1, testNodeType); lockedNode.addMixin(mixLockable); childNode = lockedNode.addNode(nodeName2, testNodeType); @@ -59,6 +63,9 @@ } catch (RepositoryException e) { // ignore } + if (otherSession.isLive()) { + otherSession.logout(); + } super.tearDown(); } @@ -263,7 +270,6 @@ * A locked node must also be locked if accessed by some other session. */ public void testLockVisibility() throws RepositoryException { - Session otherSession = helper.getReadOnlySession(); Node ln2 = (Node) otherSession.getItem(lockedNode.getPath()); assertTrue("Locked node must also be locked for another session", ln2.isLocked()); assertTrue("Locked node must also be locked for another session", ln2.holdsLock()); @@ -275,7 +281,6 @@ * locked node must not be marked locked any more. */ public void testUnlockByOtherSession() throws RepositoryException { - Session otherSession = helper.getReadOnlySession(); Node ln2 = (Node) otherSession.getItem(lockedNode.getPath()); Lock l2 = ln2.getLock(); @@ -290,7 +295,6 @@ * locked node must not be marked locked any more. */ public void testUnlockByOtherSession2() throws RepositoryException { - Session otherSession = helper.getReadOnlySession(); Node ln2 = (Node) otherSession.getItem(lockedNode.getPath()); lockedNode.unlock(); Modified: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/lock/OpenScopedLockTest.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/lock/OpenScopedLockTest.java?view=diff&rev=518882&r1=518881&r2=518882 ============================================================================== --- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/lock/OpenScopedLockTest.java (original) +++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/lock/OpenScopedLockTest.java Fri Mar 16 01:01:00 2007 @@ -31,7 +31,7 @@ public class OpenScopedLockTest extends AbstractLockTest { private static Logger log = LoggerFactory.getLogger(OpenScopedLockTest.class); - + boolean isSessionScoped() { return false; } @@ -39,7 +39,6 @@ public void testLogoutHasNoEffect() throws Exception { // create a second session session. since loggin-out the 'superuser' // will cause all inherited tear-down to fail - Session otherSession = helper.getSuperuserSession(); Node testRoot2 = (Node) otherSession.getItem(testRootNode.getPath()); Node lockedNode2 = testRoot2.addNode(nodeName2, testNodeType); @@ -89,7 +88,6 @@ public void testRefreshAfterTokenTransfer2() throws Exception { String lockToken = lock.getLockToken(); - Session otherSession = helper.getSuperuserSession(); Node n2 = (Node) otherSession.getItem(lockedNode.getPath()); try { superuser.removeLockToken(lockToken); @@ -105,7 +103,6 @@ public void testLockHolderAfterTokenTransfer() throws Exception { String lockToken = lock.getLockToken(); - Session otherSession = helper.getSuperuserSession(); Node n2 = (Node) otherSession.getItem(lockedNode.getPath()); try { superuser.removeLockToken(lockToken); @@ -136,7 +133,6 @@ public void testUnlockAfterTokenTransfer2() throws Exception { String lockToken = lock.getLockToken(); - Session otherSession = helper.getSuperuserSession(); try { superuser.removeLockToken(lockToken); otherSession.addLockToken(lockToken); @@ -163,7 +159,6 @@ */ public void testUnlockAfterTokenTransfer3() throws Exception { String lockToken = lock.getLockToken(); - Session otherSession = helper.getSuperuserSession(); try { superuser.removeLockToken(lockToken); otherSession.addLockToken(lockToken); Modified: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/lock/SessionScopedLockTest.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/lock/SessionScopedLockTest.java?view=diff&rev=518882&r1=518881&r2=518882 ============================================================================== --- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/lock/SessionScopedLockTest.java (original) +++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/lock/SessionScopedLockTest.java Fri Mar 16 01:01:00 2007 @@ -20,7 +20,6 @@ import org.slf4j.LoggerFactory; import javax.jcr.Node; -import javax.jcr.Session; import javax.jcr.RepositoryException; import javax.jcr.lock.LockException; import javax.jcr.lock.Lock; @@ -40,7 +39,6 @@ * Test locks are released when session logs out */ public void testLockNotLiveAfterLogout() throws RepositoryException { - Session otherSession = helper.getSuperuserSession(); Node testRoot2 = (Node) otherSession.getItem(testRootNode.getPath()); Node lockedNode2 = testRoot2.addNode(nodeName2, testNodeType); @@ -57,7 +55,6 @@ * Test locks are released when session logs out */ public void testNotLockedAfterLogout() throws RepositoryException { - Session otherSession = helper.getSuperuserSession(); Node testRoot2 = (Node) otherSession.getItem(testRootNode.getPath()); Node lockedNode2 = testRoot2.addNode(nodeName2, testNodeType); Added: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/lock/TestAll.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/lock/TestAll.java?view=auto&rev=518882 ============================================================================== --- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/lock/TestAll.java (added) +++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/lock/TestAll.java Fri Mar 16 01:01:00 2007 @@ -0,0 +1,42 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jackrabbit.jcr2spi.lock; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.apache.jackrabbit.test.AbstractJCRTest; +import org.apache.jackrabbit.test.NotExecutableException; +import org.apache.jackrabbit.jcr2spi.AccessByRelativePathTest; +import junit.framework.Test; +import junit.framework.TestSuite; +import junit.framework.TestCase; + +/** + * TestAll... + */ +public class TestAll extends TestCase { + + public static Test suite() { + TestSuite suite = new TestSuite("jcr2spi lock tests"); + + suite.addTestSuite(SessionScopedLockTest.class); + suite.addTestSuite(OpenScopedLockTest.class); + suite.addTestSuite(DeepLockTest.class); + + return suite; + } +} \ No newline at end of file Propchange: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/lock/TestAll.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/lock/TestAll.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Modified: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryTest.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryTest.java?view=diff&rev=518882&r1=518881&r2=518882 ============================================================================== --- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryTest.java (original) +++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/name/NamespaceRegistryTest.java Fri Mar 16 01:01:00 2007 @@ -48,17 +48,16 @@ private String testURI; protected void setUp() throws Exception { - Session superuser = helper.getSuperuserSession(); + super.setUp(); nsRegistry = superuser.getWorkspace().getNamespaceRegistry(); testPrefix = getUnusedPrefix(); testURI = getUnusedURI(); - boolean level2 = Boolean.valueOf((String) superuser.getRepository().getDescriptor(Repository.LEVEL_2_SUPPORTED)).booleanValue(); + boolean level2 = Boolean.valueOf(superuser.getRepository().getDescriptor(Repository.LEVEL_2_SUPPORTED)).booleanValue(); if (!level2) { throw new NotExecutableException("Cannot test namespace registration/unregistration. Repository is a Level 1 only."); } - } /** @@ -68,12 +67,17 @@ * @throws RepositoryException */ public void testRegisteredNamespaceVisibility() throws RepositoryException { - NamespaceRegistry other = helper.getReadOnlySession().getWorkspace().getNamespaceRegistry(); + Session otherSession = helper.getReadOnlySession(); + try { + NamespaceRegistry other = otherSession.getWorkspace().getNamespaceRegistry(); - nsRegistry.registerNamespace(testPrefix, testURI); - String otherUri = other.getURI(testPrefix); - String otherPrefix = other.getPrefix(testURI); - assertTrue("Namespace registered must be immediately visible to any other session.", testURI.equals(otherUri) && testPrefix.equals(otherPrefix)); + nsRegistry.registerNamespace(testPrefix, testURI); + String otherUri = other.getURI(testPrefix); + String otherPrefix = other.getPrefix(testURI); + assertTrue("Namespace registered must be immediately visible to any other session.", testURI.equals(otherUri) && testPrefix.equals(otherPrefix)); + } finally { + otherSession.logout(); + } } /** @@ -102,16 +106,21 @@ * @throws RepositoryException */ public void testReRegisteredNamespace2() throws RepositoryException { - NamespaceRegistry other = helper.getReadOnlySession().getWorkspace().getNamespaceRegistry(); + Session otherSession = helper.getReadOnlySession(); + try { + NamespaceRegistry other = otherSession.getWorkspace().getNamespaceRegistry(); - nsRegistry.registerNamespace(testPrefix, testURI); - other.getPrefix(testURI); + nsRegistry.registerNamespace(testPrefix, testURI); + other.getPrefix(testURI); - String replacePrefix = getUnusedPrefix(); - nsRegistry.registerNamespace(replacePrefix, testURI); + String replacePrefix = getUnusedPrefix(); + nsRegistry.registerNamespace(replacePrefix, testURI); - String otherPrefix = other.getPrefix(testURI); - assertEquals("Namespace with prefix " + testPrefix + " has been reregistered with new prefix " + replacePrefix, replacePrefix, otherPrefix); + String otherPrefix = other.getPrefix(testURI); + assertEquals("Namespace with prefix " + testPrefix + " has been reregistered with new prefix " + replacePrefix, replacePrefix, otherPrefix); + } finally { + otherSession.logout(); + } } /** @@ -121,23 +130,28 @@ * @throws RepositoryException */ public void testReRegisteredNamespaceVisibility() throws RepositoryException { - NamespaceRegistry other = helper.getReadOnlySession().getWorkspace().getNamespaceRegistry(); - - nsRegistry.registerNamespace(testPrefix, testURI); - other.getPrefix(testURI); + Session otherSession = helper.getReadOnlySession(); + try { + NamespaceRegistry other = otherSession.getWorkspace().getNamespaceRegistry(); - String replacePrefix = getUnusedPrefix(); - nsRegistry.registerNamespace(replacePrefix, testURI); + nsRegistry.registerNamespace(testPrefix, testURI); + other.getPrefix(testURI); - String otherUri = other.getURI(replacePrefix); - String otherPrefix = other.getPrefix(testURI); - assertTrue("Namespace registered must be immediately visible to any other session.", testURI.equals(otherUri) && replacePrefix.equals(otherPrefix)); + String replacePrefix = getUnusedPrefix(); + nsRegistry.registerNamespace(replacePrefix, testURI); - try { - other.getURI(testPrefix); - fail("Namespace with prefix " + testPrefix + " has been reregistered with new prefix " + replacePrefix); - } catch (NamespaceException e) { - // OK + String otherUri = other.getURI(replacePrefix); + String otherPrefix = other.getPrefix(testURI); + assertTrue("Namespace registered must be immediately visible to any other session.", testURI.equals(otherUri) && replacePrefix.equals(otherPrefix)); + + try { + other.getURI(testPrefix); + fail("Namespace with prefix " + testPrefix + " has been reregistered with new prefix " + replacePrefix); + } catch (NamespaceException e) { + // OK + } + } finally { + otherSession.logout(); } } @@ -150,18 +164,23 @@ String prefix = getUnusedPrefix(); String uri = getUnusedURI(); - NamespaceRegistry other = helper.getReadOnlySession().getWorkspace().getNamespaceRegistry(); - - nsRegistry.registerNamespace(prefix, uri); + Session otherSession = helper.getReadOnlySession(); try { - nsRegistry.unregisterNamespace(prefix); - } catch (NamespaceException e) { - throw new NotExecutableException("Repository does not support unregistration of namespaces."); - } + NamespaceRegistry other = otherSession.getWorkspace().getNamespaceRegistry(); - String otherUri = other.getURI(prefix); - String otherPrefix = other.getPrefix(uri); - assertTrue("Namespace registered must be immediately visible to any other session.", uri.equals(otherUri) && prefix.equals(otherPrefix)); + nsRegistry.registerNamespace(prefix, uri); + try { + nsRegistry.unregisterNamespace(prefix); + } catch (NamespaceException e) { + throw new NotExecutableException("Repository does not support unregistration of namespaces."); + } + + String otherUri = other.getURI(prefix); + String otherPrefix = other.getPrefix(uri); + assertTrue("Namespace registered must be immediately visible to any other session.", uri.equals(otherUri) && prefix.equals(otherPrefix)); + } finally { + otherSession.logout(); + } } /** Added: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/name/TestAll.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/name/TestAll.java?view=auto&rev=518882 ============================================================================== --- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/name/TestAll.java (added) +++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/name/TestAll.java Fri Mar 16 01:01:00 2007 @@ -0,0 +1,35 @@ +/* + * $Id$ + * + * Copyright 1997-2005 Day Management AG + * Barfuesserplatz 6, 4001 Basel, Switzerland + * All Rights Reserved. + * + * This software is the confidential and proprietary information of + * Day Management AG, ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Day. + */ +package org.apache.jackrabbit.jcr2spi.name; + +import junit.framework.TestCase; +import junit.framework.Test; +import junit.framework.TestSuite; +import org.apache.jackrabbit.jcr2spi.lock.SessionScopedLockTest; +import org.apache.jackrabbit.jcr2spi.lock.OpenScopedLockTest; +import org.apache.jackrabbit.jcr2spi.lock.DeepLockTest; + +/** + * TestAll... + */ +public class TestAll extends TestCase { + + public static Test suite() { + TestSuite suite = new TestSuite("jcr2spi name tests"); + + suite.addTestSuite(NamespaceRegistryTest.class); + + return suite; + } +} Propchange: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/name/TestAll.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/name/TestAll.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/TestAll.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/TestAll.java?view=auto&rev=518882 ============================================================================== --- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/TestAll.java (added) +++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/TestAll.java Fri Mar 16 01:01:00 2007 @@ -0,0 +1,34 @@ +/* + * $Id$ + * + * Copyright 1997-2005 Day Management AG + * Barfuesserplatz 6, 4001 Basel, Switzerland + * All Rights Reserved. + * + * This software is the confidential and proprietary information of + * Day Management AG, ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Day. + */ +package org.apache.jackrabbit.jcr2spi.nodetype; + +import junit.framework.TestCase; +import junit.framework.Test; +import junit.framework.TestSuite; +import org.apache.jackrabbit.jcr2spi.name.NamespaceRegistryTest; + +/** + * TestAll... + */ +public class TestAll extends TestCase { + + public static Test suite() { + TestSuite suite = new TestSuite("jcr2spi nodetype tests"); + + suite.addTestSuite(AddMixinTest.class); + suite.addTestSuite(RemoveMixinTest.class); + + return suite; + } +} Propchange: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/TestAll.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/TestAll.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/query/TestAll.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/query/TestAll.java?view=auto&rev=518882 ============================================================================== --- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/query/TestAll.java (added) +++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/query/TestAll.java Fri Mar 16 01:01:00 2007 @@ -0,0 +1,34 @@ +/* + * $Id$ + * + * Copyright 1997-2005 Day Management AG + * Barfuesserplatz 6, 4001 Basel, Switzerland + * All Rights Reserved. + * + * This software is the confidential and proprietary information of + * Day Management AG, ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Day. + */ +package org.apache.jackrabbit.jcr2spi.query; + +import junit.framework.TestCase; +import junit.framework.Test; +import junit.framework.TestSuite; +import org.apache.jackrabbit.jcr2spi.nodetype.AddMixinTest; +import org.apache.jackrabbit.jcr2spi.nodetype.RemoveMixinTest; + +/** + * TestAll... + */ +public class TestAll extends TestCase { + + public static Test suite() { + TestSuite suite = new TestSuite("jcr2spi query tests"); + + suite.addTestSuite(QueryTest.class); + + return suite; + } +} Propchange: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/query/TestAll.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/query/TestAll.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Added: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/version/TestAll.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/version/TestAll.java?view=auto&rev=518882 ============================================================================== --- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/version/TestAll.java (added) +++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/version/TestAll.java Fri Mar 16 01:01:00 2007 @@ -0,0 +1,33 @@ +/* + * $Id$ + * + * Copyright 1997-2005 Day Management AG + * Barfuesserplatz 6, 4001 Basel, Switzerland + * All Rights Reserved. + * + * This software is the confidential and proprietary information of + * Day Management AG, ("Confidential Information"). You shall not + * disclose such Confidential Information and shall use it only in + * accordance with the terms of the license agreement you entered into + * with Day. + */ +package org.apache.jackrabbit.jcr2spi.version; + +import junit.framework.TestCase; +import junit.framework.Test; +import junit.framework.TestSuite; +import org.apache.jackrabbit.jcr2spi.query.QueryTest; + +/** + * TestAll... + */ +public class TestAll extends TestCase { + + public static Test suite() { + TestSuite suite = new TestSuite("jcr2spi version tests"); + + suite.addTestSuite(LabelTest.class); + + return suite; + } +} Propchange: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/version/TestAll.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/version/TestAll.java ------------------------------------------------------------------------------ svn:keywords = author date id revision url Modified: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/test/TestAll.java URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/test/TestAll.java?view=diff&rev=518882&r1=518881&r2=518882 ============================================================================== --- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/test/TestAll.java (original) +++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/test/TestAll.java Fri Mar 16 01:01:00 2007 @@ -18,7 +18,7 @@ import junit.framework.Test; import junit.framework.TestCase; -import org.apache.jackrabbit.test.JCRTestSuite; +import junit.framework.TestSuite; /** * Test suite that includes all test suites from jackrabbit-jcr-tests. @@ -29,4 +29,17 @@ return new JCRTestSuite(); } + private static class JCRTestSuite extends TestSuite { + + private JCRTestSuite() { + super("JCR API tests"); + addTest(org.apache.jackrabbit.test.api.TestAll.suite()); + addTest(org.apache.jackrabbit.test.api.query.TestAll.suite()); + addTest(org.apache.jackrabbit.test.api.nodetype.TestAll.suite()); + addTest(org.apache.jackrabbit.test.api.util.TestAll.suite()); + addTest(org.apache.jackrabbit.test.api.lock.TestAll.suite()); + addTest(org.apache.jackrabbit.test.api.version.TestAll.suite()); + addTest(org.apache.jackrabbit.test.api.observation.TestAll.suite()); + } + } }