jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r423873 - /jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/core/XATest.java
Date Thu, 20 Jul 2006 10:30:34 GMT
Author: tripod
Date: Thu Jul 20 03:30:33 2006
New Revision: 423873

URL: http://svn.apache.org/viewvc?rev=423873&view=rev
Log:
JCR-485: TCK does not clean 2nd workspace during AbstractJCRTest.setUp()

Modified:
    jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/core/XATest.java

Modified: jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/core/XATest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/core/XATest.java?rev=423873&r1=423872&r2=423873&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/core/XATest.java (original)
+++ jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/core/XATest.java Thu Jul
20 03:30:33 2006
@@ -24,6 +24,7 @@
 import javax.jcr.Session;
 import javax.jcr.RepositoryException;
 import javax.jcr.SimpleCredentials;
+import javax.jcr.NodeIterator;
 import javax.jcr.observation.Event;
 import javax.jcr.version.VersionException;
 import javax.jcr.version.Version;
@@ -32,6 +33,7 @@
 import javax.transaction.RollbackException;
 import java.io.PrintWriter;
 import java.io.PrintStream;
+import java.util.StringTokenizer;
 
 /**
  * <code>XATest</code> contains the test cases for the methods
@@ -51,6 +53,31 @@
         super.setUp();
 
         otherSuperuser = helper.getSuperuserSession();
+
+        // clean testroot on second workspace
+        Session s2 = helper.getSuperuserSession(workspaceName);
+        Node root = s2.getRootNode();
+        if (root.hasNode(testPath)) {
+            // clean test root
+            Node testRootNode = root.getNode(testPath);
+            for (NodeIterator children = testRootNode.getNodes(); children.hasNext();) {
+                children.nextNode().remove();
+            }
+        } else {
+            // create nodes to testPath
+            StringTokenizer names = new StringTokenizer(testPath, "/");
+            Node currentNode = root;
+            while (names.hasMoreTokens()) {
+                String name = names.nextToken();
+                if (currentNode.hasNode(name)) {
+                    currentNode = currentNode.getNode(name);
+                } else {
+                    currentNode = currentNode.addNode(name, testNodeType);
+                }
+            }
+        }
+        root.save();
+
     }
 
     /**



Mime
View raw message