jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r704361 [5/5] - in /jackrabbit/trunk: jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/o...
Date Tue, 14 Oct 2008 07:48:24 GMT
Added: jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveToNewTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveToNewTest.java?rev=704361&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveToNewTest.java
(added)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveToNewTest.java
Tue Oct 14 00:48:22 2008
@@ -0,0 +1,205 @@
+/*
+ * 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.apache.jackrabbit.test.AbstractJCRTest;
+import org.apache.jackrabbit.util.Text;
+
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+/** <code>MoveToNewTest</code>... */
+public class MoveToNewTest extends AbstractJCRTest {
+
+    protected Node srcParentNode;
+    protected Node destParentNode;
+    protected Node moveNode;
+    protected String destinationPath;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        // create parent node
+        srcParentNode = testRootNode.addNode(nodeName1, testNodeType);
+        // create node to be moved
+        moveNode = srcParentNode.addNode(nodeName2, testNodeType);
+        // save the new nodes
+        testRootNode.save();
+
+        // create a NEW node that will serve as destination parent
+        destParentNode = testRootNode.addNode(nodeName3, testNodeType);
+        destinationPath = destParentNode.getPath() + "/" + nodeName2;
+    }
+
+    protected void tearDown() throws Exception {
+        srcParentNode = null;
+        destParentNode = null;
+        moveNode = null;
+        super.tearDown();
+    }
+
+    public void testMove() throws RepositoryException {
+        String srcPath = moveNode.getPath();
+        testRootNode.getSession().move(srcPath, destinationPath);
+
+        assertTrue(destParentNode.isNew());
+        assertTrue(moveNode.isModified());
+
+        assertTrue(testRootNode.getSession().itemExists(destinationPath));
+        assertFalse(testRootNode.getSession().itemExists(srcPath));
+    }
+
+    public void testMoveSaved() throws RepositoryException {
+        String srcPath = moveNode.getPath();
+        testRootNode.getSession().move(srcPath, destinationPath);
+        testRootNode.save();
+
+        assertFalse(destParentNode.isNew());
+        assertFalse(srcParentNode.isModified());
+        assertFalse(moveNode.isModified());
+
+        assertTrue(testRootNode.getSession().itemExists(destinationPath));
+        assertFalse(testRootNode.getSession().itemExists(srcPath));
+    }
+
+    public void testRevertMovedNode() throws RepositoryException {
+        String srcPath = moveNode.getPath();
+        testRootNode.getSession().move(srcPath, destinationPath);
+
+        try {
+            destParentNode.refresh(false);
+            fail("Incomplete 'changelog'");
+        } catch (RepositoryException e) {
+            // ok
+        }
+    }
+
+    public void testRemoveDestParent() throws RepositoryException {
+        String srcPath = moveNode.getPath();
+        testRootNode.getSession().move(srcPath, destinationPath);
+        destParentNode.remove();
+
+        assertFalse(destParentNode.isNew());
+        assertFalse(destParentNode.isModified());
+
+        assertFalse(moveNode.isModified());
+        assertTrue(srcParentNode.isModified());
+        assertFalse(testRootNode.getSession().itemExists(srcPath));
+    }
+
+    public void testRevertRemoveDestParent() throws RepositoryException {
+        String srcPath = moveNode.getPath();
+        testRootNode.getSession().move(srcPath, destinationPath);
+        destParentNode.remove();
+        testRootNode.refresh(false);
+
+        assertFalse(destParentNode.isModified());
+        assertFalse(destParentNode.isNew());
+
+        try {
+            destParentNode.hasNode(nodeName2);
+            fail("The new destParent must have been removed.");
+        } catch (InvalidItemStateException e) {
+            // success
+        }
+        assertTrue(srcParentNode.hasNode(nodeName2));
+        assertFalse(srcParentNode.isModified());
+
+        assertFalse(testRootNode.getSession().itemExists(destinationPath));
+        assertTrue(testRootNode.getSession().itemExists(srcPath));
+    }
+
+    public void testMoveTwice() throws RepositoryException {
+        Session s = testRootNode.getSession();
+
+        String srcPath = moveNode.getPath();
+        s.move(srcPath, destinationPath);
+
+        srcParentNode.remove();
+
+        // create new parent
+        Node newParent = testRootNode.addNode(nodeName1);
+        s.move(destinationPath, srcPath);
+
+        assertTrue(newParent.isNew());
+        assertTrue(newParent.hasNode(nodeName2));
+
+        assertTrue(destParentNode.isNew());
+        assertFalse(destParentNode.hasNode(nodeName2));
+
+        // remove the tmp dest parent node.
+        destParentNode.remove();
+
+        assertTrue(newParent.isNew());
+        assertTrue(newParent.hasNode(nodeName2));
+        assertTrue(moveNode.isModified());
+
+        testRootNode.save();
+
+        assertFalse(s.itemExists(Text.getRelativeParent(destinationPath, 1)));
+        assertTrue(s.itemExists(srcPath));
+
+        assertFalse(moveNode.isModified() || newParent.isNew() || srcParentNode.isModified());
+        try {
+            srcParentNode.getNode(nodeName2);
+            fail("src parent must be removed");
+        } catch (InvalidItemStateException e) {
+            // ok.
+        }
+        assertTrue(moveNode.isSame(newParent.getNode(nodeName2)));
+    }
+
+    public void testMoveTwiceWithSecondSession() throws RepositoryException {
+        Session s = testRootNode.getSession();
+        String srcPath = moveNode.getPath();
+
+        // move away the 'moveNode'
+        s.move(srcPath, destinationPath);
+        // rm the original parent
+        srcParentNode.remove();
+        // create new parent and move the 'moveNode' back
+        Node newParent = testRootNode.addNode(nodeName1);
+        newParent.setProperty(propertyName1, "marker");
+        s.move(destinationPath, srcPath);
+        // remove the tmp. destination parent
+        destParentNode.remove();
+
+        testRootNode.save();
+
+        Session readOnly = helper.getReadOnlySession();
+        try {
+            Node trn = (Node) readOnly.getItem(testRootNode.getPath());
+            NodeIterator it = trn.getNodes(nodeName1);
+
+            String msg = "testRootNode must have a single child node with name " + nodeName1;
+            if (it.hasNext()) {
+                Node parent = it.nextNode();
+                assertTrue(parent.hasProperty(propertyName1));
+                assertEquals("The 'newParent' must have the marker property","marker", parent.getProperty(propertyName1).getString());
+                assertTrue("moveNode must be present below the 'newParent'.", parent.hasNode(Text.getName(srcPath)));
+                assertFalse(msg, it.hasNext());
+            } else {
+                fail(msg);
+            }
+        } finally {
+            readOnly.logout();
+        }
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveToNewTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/MoveToNewTest.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/NodeOrderTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/NodeOrderTest.java?rev=704361&r1=704360&r2=704361&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/NodeOrderTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/NodeOrderTest.java
Tue Oct 14 00:48:22 2008
@@ -109,4 +109,20 @@
             another.logout();
         }
     }
+
+    /**
+     * Test if the order of Nodes is the same when accessed through another
+     * <code>Session</code> after having accessed some of the nodes individually.
+     */
+    public void testOrderAfterIndividualAccess2() throws RepositoryException {
+        Session another = helper.getReadOnlySession();
+        try {
+            Node n2 = (Node) another.getItem(children[3].getPath());
+            Node n3 = (Node) another.getItem(children[1].getPath());
+            NodeIterator it = ((Node) another.getItem(testRootNode.getPath())).getNodes();
+            checkOrder(it, children);
+        } finally {
+            another.logout();
+        }
+    }
 }
\ No newline at end of file

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RefreshMovedTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RefreshMovedTest.java?rev=704361&r1=704360&r2=704361&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RefreshMovedTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RefreshMovedTest.java
Tue Oct 14 00:48:22 2008
@@ -80,19 +80,22 @@
      */
     public void testRefreshOtherSession() throws RepositoryException {
         Session readSession = helper.getReadOnlySession();
-        Node anotherNode = (Node) readSession.getItem(srcPath);
-
-        // workspace move
-        testRootNode.getSession().getWorkspace().move(srcPath, destinationPath);
-
-        readSession.refresh(false);
         try {
-            String p = anotherNode.getPath();
-            // unless InvalidItemStateException is thrown the node must have
-            // been 'moved' to its new position.
-            assertTrue("Upon refresh of a node moved by another session it must be moved
to the new destination (or removed).", p.equals(destinationPath));
-        } catch (InvalidItemStateException e) {
-            // ok as well.
+            Node anotherNode = (Node) readSession.getItem(srcPath);
+            // workspace move
+            testRootNode.getSession().getWorkspace().move(srcPath, destinationPath);
+
+            readSession.refresh(false);
+            try {
+                String p = anotherNode.getPath();
+                // unless InvalidItemStateException is thrown the node must have
+                // been 'moved' to its new position.
+                assertTrue("Upon refresh of a node moved by another session it must be moved
to the new destination (or removed).", p.equals(destinationPath));
+            } catch (InvalidItemStateException e) {
+                // ok as well.
+            }
+        } finally {
+            readSession.logout();
         }
     }
 }
\ No newline at end of file

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RefreshTrueTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RefreshTrueTest.java?rev=704361&r1=704360&r2=704361&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RefreshTrueTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RefreshTrueTest.java
Tue Oct 14 00:48:22 2008
@@ -16,18 +16,16 @@
  */
 package org.apache.jackrabbit.jcr2spi;
 
+import org.apache.jackrabbit.test.AbstractJCRTest;
+import org.apache.jackrabbit.test.NotExecutableException;
 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.InvalidItemStateException;
+import javax.jcr.Node;
 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;
+import javax.jcr.Value;
 
 /**
  * <code>RefreshTrue</code>...
@@ -52,6 +50,22 @@
         super.tearDown();
     }
 
+    public void testNewNode() throws RepositoryException {
+        Node n = testRootNode.addNode(nodeName2);
+        Property p = n.setProperty(propertyName1, testValue);
+        testRootNode.refresh(true);
+
+        // n must still be new and accessible
+        String msg = "Refresh 'true' must not affect the new Node/Property.";
+        assertTrue(msg, testRootNode.hasNode(nodeName2));
+        assertTrue(msg, n.isNew());
+        assertTrue(msg, n.hasProperty(propertyName1));
+
+        // p must still be accessible
+        p.getString();
+        assertTrue(msg, p.isSame(n.getProperty(propertyName1)));
+    }
+
     public void testNewProperty() throws RepositoryException {
         Property p = testRootNode.setProperty(propertyName1, testValue);
         testRootNode.refresh(true);
@@ -63,7 +77,7 @@
         assertTrue("Refresh 'true' must not affect a new Property.", p.isSame(pAgain));
     }
 
-    public void testRemovedProperty() throws RepositoryException, LockException, ConstraintViolationException,
VersionException {
+    public void testRemovedProperty() throws RepositoryException {
         Property p = testRootNode.setProperty(propertyName1, testValue);
         testRootNode.save();
 
@@ -79,4 +93,30 @@
         }
         assertFalse("Refresh 'true' must not revert removal of an item.", testRootNode.hasProperty(propertyName1));
     }
+
+    public void testRemovedNewItem() throws RepositoryException {
+        Node n = testRootNode.addNode(nodeName2);
+        Property p = n.setProperty(propertyName1, testValue);
+        n.remove();
+
+        testRootNode.refresh(true);
+
+        // n must still be new and accessible
+        String msg = "Refresh 'true' must revert the removal of new a Node/Property.";
+        assertFalse(msg, testRootNode.hasNode(nodeName2));
+        assertFalse(msg, n.isNew() && n.isModified());
+        assertFalse(msg, p.isNew() && p.isModified());
+        try {
+            n.hasProperty(propertyName1);
+            fail(msg);
+        } catch (InvalidItemStateException e) {
+            // success
+        }
+        try {
+            p.getString();
+            fail(msg);
+        } catch (InvalidItemStateException e) {
+            // success
+        }
+    }
 }
\ No newline at end of file

Added: jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RemoveMovedNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RemoveMovedNodeTest.java?rev=704361&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RemoveMovedNodeTest.java
(added)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RemoveMovedNodeTest.java
Tue Oct 14 00:48:22 2008
@@ -0,0 +1,116 @@
+/*
+ * 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 javax.jcr.RepositoryException;
+
+/** <code>RemoveMovedNodeTest</code>... */
+public class RemoveMovedNodeTest extends AbstractMoveTest {
+
+    private static Logger log = LoggerFactory.getLogger(RemoveMovedNodeTest.class);
+
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    protected boolean isSessionMove() {
+        return true;
+    }
+
+    public void testRemove() throws RepositoryException {
+        String srcPath = moveNode.getPath();
+        doMove(srcPath, destinationPath);
+
+        // now remove the moved node
+        testRootNode.getSession().getItem(destinationPath).remove();
+        assertFalse(superuser.itemExists(srcPath));
+        assertFalse(superuser.itemExists(destinationPath));
+
+        testRootNode.save();
+
+        assertFalse(superuser.itemExists(srcPath));
+        assertFalse(superuser.itemExists(destinationPath));
+        assertFalse(destParentNode.isModified());
+        assertFalse(srcParentNode.isModified());
+    }
+
+    public void testRevert() throws RepositoryException {
+        String srcPath = moveNode.getPath();
+        doMove(srcPath, destinationPath);
+
+        // now remove the moved node
+        testRootNode.getSession().getItem(destinationPath).remove();
+        testRootNode.refresh(false);
+
+        assertTrue(superuser.itemExists(srcPath));
+        assertFalse(superuser.itemExists(destinationPath));
+
+        assertFalse(moveNode.isModified());
+        assertFalse(destParentNode.isModified());
+        assertFalse(srcParentNode.isModified());
+    }
+
+    public void testRefresh() throws RepositoryException {
+        String srcPath = moveNode.getPath();
+        doMove(srcPath, destinationPath);
+
+        // now remove the moved node
+        testRootNode.getSession().getItem(destinationPath).remove();
+        testRootNode.refresh(true);
+
+        assertFalse(superuser.itemExists(srcPath));
+        assertFalse(superuser.itemExists(destinationPath));
+
+        // after removal the 'modified' flag is removed from the moved node
+        assertFalse(moveNode.isModified());
+        // however: parent states are still modified
+        assertTrue(destParentNode.isModified()); // TODO: check if correct.
+        assertTrue(srcParentNode.isModified());
+    }
+
+    public void testRemoveSrcParent() throws RepositoryException {
+        String srcPath = moveNode.getPath();
+        doMove(srcPath, destinationPath);
+
+        // now remove the moved node
+        srcParentNode.remove();
+
+        assertFalse(superuser.itemExists(srcPath));
+        assertTrue(superuser.itemExists(destinationPath));
+
+        assertTrue(moveNode.isModified());
+        assertTrue(destParentNode.isModified());
+
+        // a removed item is not modified (although it was modified by the move above)
+        assertFalse(srcParentNode.isModified());
+
+        testRootNode.refresh(false);
+        assertTrue(superuser.itemExists(srcPath));
+        assertFalse(superuser.itemExists(destinationPath));
+
+        assertFalse(moveNode.isModified());
+        assertFalse(destParentNode.isModified());
+        assertFalse(srcParentNode.isModified());
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RemoveMovedNodeTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RemoveMovedNodeTest.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RemoveNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RemoveNodeTest.java?rev=704361&r1=704360&r2=704361&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RemoveNodeTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RemoveNodeTest.java
Tue Oct 14 00:48:22 2008
@@ -134,12 +134,12 @@
             childNode.remove();
             superuser.save();
 
-            // try to remove already deleted node with session 2
+            // try to remove already removed node with session 2
             try {
                 childNode2.refresh(false);
                 childNode2.remove();
                 otherSession.save();
-                fail("Removing a node already deleted by other session should throw an InvalidItemStateException!");
+                fail("Removing a node already removed by other session should throw an InvalidItemStateException!");
             } catch (InvalidItemStateException e) {
                 //ok, works as expected
             }

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderMoveTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderMoveTest.java?rev=704361&r1=704360&r2=704361&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderMoveTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderMoveTest.java
Tue Oct 14 00:48:22 2008
@@ -129,11 +129,19 @@
         // reorder
         srcParent.orderBefore(getRelPath(children[0]), null);
         testOrder(srcParent, new Node[] {children[3], children[0]});
+        assertTrue(srcParent.hasNode(snsName+"[1]"));
+        assertTrue(srcParent.hasNode(snsName+"[2]"));
+        assertFalse(srcParent.hasNode(snsName+"[3]"));
         assertFalse(srcParent.hasNode(snsName+"[4]"));
+        assertFalse(srcParent.hasNode(snsName+"[5]"));
 
         testRootNode.save();
         testOrder(srcParent, new Node[] {children[3], children[0]});
+        assertTrue(srcParent.hasNode(snsName+"[1]"));
+        assertTrue(srcParent.hasNode(snsName+"[2]"));
+        assertFalse(srcParent.hasNode(snsName+"[3]"));
         assertFalse(srcParent.hasNode(snsName+"[4]"));
+        assertFalse(srcParent.hasNode(snsName+"[5]"));
 
         // check if move have been successfull
         assertEquals(children[2].getPath(), destPath);

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RevertMoveTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RevertMoveTest.java?rev=704361&r1=704360&r2=704361&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RevertMoveTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/RevertMoveTest.java
Tue Oct 14 00:48:22 2008
@@ -67,5 +67,9 @@
         assertFalse("Reverting the move operation must remove the node at destination path.",
testRootNode.getSession().itemExists(destinationPath));
         assertTrue("Reverting the move operation must re-add the node at its original position.",
testRootNode.getSession().itemExists(srcPath));
         assertTrue("Reverting the move operation must re-add the node at its original position.",
srcPath.equals(moveNode.getPath()));
+
+        assertFalse("The former destination must not be modified.", destParentNode.isModified());
+        assertFalse("The parent must not be modified.", srcParentNode.isModified());
+        assertFalse("The move-node must not be modified.", moveNode.isModified());
     }
 }
\ No newline at end of file

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/TestAll.java?rev=704361&r1=704360&r2=704361&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/TestAll.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/TestAll.java
Tue Oct 14 00:48:22 2008
@@ -34,14 +34,21 @@
         TestSuite suite = new TestSuite("jcr2spi tests");
 
         suite.addTestSuite(AccessByRelativePathTest.class);
+
+        // get node(s)
         suite.addTestSuite(SNSIndexTest.class);
         suite.addTestSuite(NodeOrderTest.class);
 
         // set/add property
+        suite.addTestSuite(GetPropertyTest.class);
+        suite.addTestSuite(AddPropertyTest.class);
         suite.addTestSuite(AddNewPropertyTest.class);
         suite.addTestSuite(SingleValuedPropertyTest.class);
         suite.addTestSuite(MultiValuedPropertyTest.class);
 
+        // change mixin types
+        suite.addTestSuite(MixinModificationTest.class);
+
         // move
         suite.addTestSuite(MoveTest.class);
         suite.addTestSuite(MoveReferenceableTest.class);
@@ -51,6 +58,8 @@
         suite.addTestSuite(MoveMultipleTest.class);
         //suite.addTestSuite(WorkspaceMoveTest.class);  // see JCR-1276
         suite.addTestSuite(RevertMoveTest.class);
+        suite.addTestSuite(MoveToNewTest.class);
+        suite.addTestSuite(MoveCombinedTest.class);
 
         // refresh
         suite.addTestSuite(RefreshFalseTest.class);
@@ -62,6 +71,7 @@
         suite.addTestSuite(RemovePropertyTest.class);
         suite.addTestSuite(RemoveReferenceableNodeTest.class);
         suite.addTestSuite(RemoveSNSTest.class);
+        suite.addTestSuite(RemoveMovedNodeTest.class);
 
         // rename
         suite.addTestSuite(RenameTest.class);
@@ -75,7 +85,7 @@
         suite.addTestSuite(ReorderNewAndSavedTest.class);
         suite.addTestSuite(ReorderMixedTest.class);
         suite.addTestSuite(ReorderMoveTest.class);
-
+        
         // update
         suite.addTestSuite(UpdateTest.class);
 
@@ -83,6 +93,7 @@
         suite.addTestSuite(ReplaceNodeTest.class);
         suite.addTestSuite(HierarchyNodeTest.class);
         suite.addTestSuite(LazyItemIteratorTest.class);
+        suite.addTestSuite(ExternalModificationTest.class);
 
         return suite;
     }

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/AddMixinTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/AddMixinTest.java?rev=704361&r1=704360&r2=704361&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/AddMixinTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/nodetype/AddMixinTest.java
Tue Oct 14 00:48:22 2008
@@ -118,6 +118,26 @@
         }
 
         assertTrue("Adding 2 mixins at once -> both must be present.", node.isNodeType(mixReferenceable)
&& node.isNodeType(mixLockable));
+    }
+
+    /**
+     * Implementation specific test adding a new Node with a nodeType, that has
+     * a mixin-supertype. The mixin must only take effect upon save.
+     *
+     * @throws NotExecutableException
+     * @throws RepositoryException
+     */
+    public void testAddMultipleAtOnce2() throws NotExecutableException, RepositoryException
{
+        Node node;
+        try {
+            node = testRootNode.addNode(nodeName1, testNodeType);
+            node.addMixin(mixReferenceable);
+            node.addMixin(mixLockable);
+            testRootNode.save();
+        } catch (RepositoryException e) {
+            throw new NotExecutableException();
+        }
+
         List mixins = Arrays.asList(node.getMixinNodeTypes());
         assertTrue("Adding 2 mixins at once -> both must be present.", mixins.contains(ntMgr.getNodeType(mixReferenceable))
&& mixins.contains(ntMgr.getNodeType(mixLockable)));
     }

Modified: jackrabbit/trunk/jackrabbit-spi2jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2jcr/pom.xml?rev=704361&r1=704360&r2=704361&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2jcr/pom.xml (original)
+++ jackrabbit/trunk/jackrabbit-spi2jcr/pom.xml Tue Oct 14 00:48:22 2008
@@ -68,7 +68,6 @@
               <value>
                 org.apache.jackrabbit.jcr2spi.name.NamespaceRegistryTest#testReRegisteredNamespaceVisibility
                 org.apache.jackrabbit.jcr2spi.name.NamespaceRegistryTest#testRegisteredNamespaceVisibility
-                org.apache.jackrabbit.jcr2spi.ReorderMoveTest#testRevertMoveAndReorderSNS
                 org.apache.jackrabbit.jcr2spi.ReorderMoveTest#testRevertMoveReorderedSNS
                 org.apache.jackrabbit.value.BinaryValueTest#testBinaryValueEquals
               </value>

Modified: jackrabbit/trunk/jackrabbit-spi2jcr/src/test/java/org/apache/jackrabbit/spi2jcr/RepositoryStubImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2jcr/src/test/java/org/apache/jackrabbit/spi2jcr/RepositoryStubImpl.java?rev=704361&r1=704360&r2=704361&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2jcr/src/test/java/org/apache/jackrabbit/spi2jcr/RepositoryStubImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi2jcr/src/test/java/org/apache/jackrabbit/spi2jcr/RepositoryStubImpl.java
Tue Oct 14 00:48:22 2008
@@ -80,8 +80,7 @@
 
         // TODO: make configurable
         BatchReadConfig brconfig = new BatchReadConfig();
-        brconfig.setDepth(NameConstants.NT_FILE, BatchReadConfig.DEPTH_INFINITE);
-        brconfig.setDepth(NameConstants.NT_RESOURCE, BatchReadConfig.DEPTH_INFINITE);
+        brconfig.setDepth(NameConstants.NT_UNSTRUCTURED, BatchReadConfig.DEPTH_INFINITE);
 
         return new RepositoryServiceImpl(jackrabbitRepo, brconfig);
     }



Mime
View raw message