jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r540940 - in /jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi: ReorderSNSTest.java ReorderTest.java RevertMoveTest.java TestAll.java
Date Wed, 23 May 2007 12:37:08 GMT
Author: angela
Date: Wed May 23 05:37:07 2007
New Revision: 540940

URL: http://svn.apache.org/viewvc?view=rev&rev=540940
Log:
tests
- test index after reordering same name siblings
- improve log output when comparing order of nodes
- add RevertMoveTest

Added:
    jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/RevertMoveTest.java
  (with props)
Modified:
    jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderSNSTest.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/TestAll.java

Modified: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderSNSTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderSNSTest.java?view=diff&rev=540940&r1=540939&r2=540940
==============================================================================
--- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderSNSTest.java
(original)
+++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderSNSTest.java
Wed May 23 05:37:07 2007
@@ -6,7 +6,6 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.ItemExistsException;
 import javax.jcr.Item;
-import javax.jcr.Node;
 import javax.jcr.version.VersionException;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
@@ -28,6 +27,19 @@
         testRootNode.save();
     }
 
+    public void testIndexAfterReorder() throws RepositoryException {
+        testRootNode.orderBefore(getRelPath(child1), getRelPath(child3));
+        assertTrue(child1.getIndex() == 2);
+        assertTrue(child2.getIndex() == 1);
+        assertTrue(child3.getIndex() == 3);
+        assertTrue(child4.getIndex() == 4);
+
+        testRootNode.save();
+        assertTrue(child1.getIndex() == 2);
+        assertTrue(child2.getIndex() == 1);
+        assertTrue(child3.getIndex() == 3);
+        assertTrue(child4.getIndex() == 4);
+    }
 
     public void testReorder3() throws RepositoryException {
         String pathBefore = child3.getPath();

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=540940&r1=540939&r2=540940
==============================================================================
--- 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
Wed May 23 05:37:07 2007
@@ -65,7 +65,7 @@
             if (i >= children.length) {
                 fail("Reorder removed a child node.");
             }
-            assertTrue(child.isSame(children[i]));
+            assertTrue("Wrong order of children: " + child + " is not the same as " + children[i],
child.isSame(children[i]));
             i++;
         }
     }

Added: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/RevertMoveTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/RevertMoveTest.java?view=auto&rev=540940
==============================================================================
--- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/RevertMoveTest.java
(added)
+++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/RevertMoveTest.java
Wed May 23 05:37:07 2007
@@ -0,0 +1,55 @@
+/*
+ * 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;
+import javax.jcr.Node;
+
+/**
+ * <code>RevertMove</code>...
+ */
+public class RevertMoveTest extends AbstractMoveTest {
+
+    private static Logger log = LoggerFactory.getLogger(RevertMoveTest.class);
+
+    protected boolean isSessionMove() {
+        return true;
+    }
+
+    /**
+     * Implementation specific test, that expects that the scope of a refresh(false)
+     * must include all nodes affected by the operations that affected the
+     * subtree to be refreshed.
+     * 
+     * @throws RepositoryException
+     */
+    public void testRevertMovedNode() throws RepositoryException {
+        String srcPath = moveNode.getPath();
+        doMove(srcPath, destinationPath);
+        Node afterMoveNode = (Node) testRootNode.getSession().getItem(destinationPath);
+
+        try {
+            afterMoveNode.refresh(false);
+            fail("Node.refresh() on a transiently moved node should fail such as a 'save'
would fail.");
+        } catch (RepositoryException e) {
+            // ok: works as expected. scope of 'refresh' is not complete
+        }
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/RevertMoveTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

Modified: 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=diff&rev=540940&r1=540939&r2=540940
==============================================================================
--- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/TestAll.java
(original)
+++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/TestAll.java
Wed May 23 05:37:07 2007
@@ -49,6 +49,7 @@
         suite.addTestSuite(MoveNewTreeTest.class);
         suite.addTestSuite(MoveMultipleTest.class);
         suite.addTestSuite(WorkspaceMoveTest.class);
+        suite.addTestSuite(RevertMoveTest.class);
 
         // refresh
         suite.addTestSuite(RefreshFalseTest.class);



Mime
View raw message