jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r581634 - in /jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi: ReorderNewAndSavedTest.java ReorderNewSNSTest.java ReorderNewTest.java ReorderTest.java
Date Wed, 03 Oct 2007 15:40:38 GMT
Author: angela
Date: Wed Oct  3 08:40:37 2007
New Revision: 581634

URL: http://svn.apache.org/viewvc?rev=581634&view=rev
Log:
Tests: stronger tests introduced with rev. 581525 must be followed
by correct testing the effect of refresh(false) on NEW nodes. fixing issues introduces with
rev. 581525

Modified:
    jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderNewAndSavedTest.java
    jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderNewSNSTest.java
    jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderNewTest.java
    jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderTest.java

Modified: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderNewAndSavedTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderNewAndSavedTest.java?rev=581634&r1=581633&r2=581634&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderNewAndSavedTest.java
(original)
+++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderNewAndSavedTest.java
Wed Oct  3 08:40:37 2007
@@ -5,6 +5,7 @@
 
 import javax.jcr.RepositoryException;
 import javax.jcr.ItemExistsException;
+import javax.jcr.Node;
 import javax.jcr.version.VersionException;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
@@ -24,5 +25,21 @@
 
         child3 = testRootNode.addNode(nodeName3, testNodeType);
         child4 = testRootNode.addNode(nodeName4, testNodeType);
+    }
+
+    public void testRevertReorder() throws RepositoryException {
+        testRootNode.orderBefore(getRelPath(child4), getRelPath(child2));
+        testOrder(testRootNode, new Node[] { child1, child4, child2, child3});
+
+        testRootNode.refresh(false);
+        testOrder(testRootNode, new Node[] { child1, child2 });
+    }
+
+    public void testRevertReorderToEnd() throws RepositoryException {
+        testRootNode.orderBefore(getRelPath(child1), null);
+        testOrder(testRootNode, new Node[] { child2, child3, child4, child1});
+
+        testRootNode.refresh(false);
+        testOrder(testRootNode, new Node[] { child1, child2 });
     }
 }

Modified: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderNewSNSTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderNewSNSTest.java?rev=581634&r1=581633&r2=581634&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderNewSNSTest.java
(original)
+++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderNewSNSTest.java
Wed Oct  3 08:40:37 2007
@@ -5,6 +5,8 @@
 
 import javax.jcr.RepositoryException;
 import javax.jcr.ItemExistsException;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
 import javax.jcr.version.VersionException;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
@@ -22,5 +24,29 @@
         child2 = testRootNode.addNode(nodeName2, testNodeType);
         child3 = testRootNode.addNode(nodeName2, testNodeType);
         child4 = testRootNode.addNode(nodeName2, testNodeType);
+    }
+
+    public void testRevertReorder() throws RepositoryException {
+        testRootNode.orderBefore(getRelPath(child4), getRelPath(child2));
+        testOrder(testRootNode, new Node[] { child1, child4, child2, child3});
+
+        // NEW child nodes -> must be removed upon refresh
+        testRootNode.refresh(false);
+        NodeIterator it = testRootNode.getNodes(nodeName2);
+        if (it.hasNext()) {
+            fail("Reverting creation and reordering of new SNSs must remove the children
again.");
+        }
+    }
+
+    public void testRevertReorderToEnd() throws RepositoryException {
+        testRootNode.orderBefore(getRelPath(child1), null);
+        testOrder(testRootNode, new Node[] { child2, child3, child4, child1});
+
+        // NEW child nodes -> must be removed upon refresh
+        testRootNode.refresh(false);
+        NodeIterator it = testRootNode.getNodes(nodeName2);
+        if (it.hasNext()) {
+            fail("Reverting creation and reordering of new SNSs must remove the children
again.");
+        }
     }
 }

Modified: jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderNewTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderNewTest.java?rev=581634&r1=581633&r2=581634&view=diff
==============================================================================
--- jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderNewTest.java
(original)
+++ jackrabbit/trunk/contrib/spi/client/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderNewTest.java
Wed Oct  3 08:40:37 2007
@@ -5,6 +5,8 @@
 
 import javax.jcr.RepositoryException;
 import javax.jcr.ItemExistsException;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
 import javax.jcr.version.VersionException;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
@@ -22,5 +24,29 @@
         child2 = testRootNode.addNode(nodeName2, testNodeType);
         child3 = testRootNode.addNode(nodeName3, testNodeType);
         child4 = testRootNode.addNode(nodeName4, testNodeType);
+    }
+
+    public void testRevertReorder() throws RepositoryException {
+        testRootNode.orderBefore(getRelPath(child4), getRelPath(child2));
+        testOrder(testRootNode, new Node[] { child1, child4, child2, child3});
+
+        // NEW child nodes -> must be removed upon refresh
+        testRootNode.refresh(false);
+        NodeIterator it = testRootNode.getNodes();
+        if (it.hasNext()) {
+            fail("Reverting creation and reordering of new children must remove the children
again.");
+        }
+    }
+
+    public void testRevertReorderToEnd() throws RepositoryException {
+        testRootNode.orderBefore(getRelPath(child1), null);
+        testOrder(testRootNode, new Node[] { child2, child3, child4, child1});
+
+        // NEW child nodes -> must be removed upon refresh
+        testRootNode.refresh(false);
+        NodeIterator it = testRootNode.getNodes();
+        if (it.hasNext()) {
+            fail("Reverting creation and reordering of new children must remove the children
again.");
+        }
     }
 }

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?rev=581634&r1=581633&r2=581634&view=diff
==============================================================================
--- 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 Oct  3 08:40:37 2007
@@ -57,7 +57,7 @@
         return path.substring(path.lastIndexOf('/')+1);
     }
 
-    private static void testOrder(Node parent, Node[] children) throws RepositoryException
{
+    protected static void testOrder(Node parent, Node[] children) throws RepositoryException
{
         NodeIterator it = parent.getNodes();
         int i = 0;
         while (it.hasNext()) {



Mime
View raw message