You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by st...@apache.org on 2005/04/08 14:39:39 UTC

svn commit: r160549 - incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api

Author: stefan
Date: Fri Apr  8 05:39:38 2005
New Revision: 160549

URL: http://svn.apache.org/viewcvs?view=rev&rev=160549
Log:
erm...

Modified:
    incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/WorkspaceCloneTest.java
    incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/WorkspaceCopyBetweenWorkspacesTest.java
    incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/WorkspaceMoveTest.java

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/WorkspaceCloneTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/WorkspaceCloneTest.java?view=diff&r1=160548&r2=160549
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/WorkspaceCloneTest.java (original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/WorkspaceCloneTest.java Fri Apr  8 05:39:38 2005
@@ -52,12 +52,12 @@
     /**
      * A NoSuchWorkspaceException is thrown if srcWorkspace does not exist.
      */
-    public void testCloneNodesUnvalidWorkspace() throws RepositoryException {
+    public void testCloneNodesInvalidWorkspace() throws RepositoryException {
         // clone a node to a non-existing workspace
         String dstAbsPath = node2W2.getPath() + "/" + node1.getName();
         try {
             workspaceW2.clone(getNonExistingWorkspaceName(superuser), node1.getPath(), dstAbsPath, true);
-            fail("Unvalid Source Workspace should throw NoSuchWorkspaceException.");
+            fail("Invalid Source Workspace should throw NoSuchWorkspaceException.");
         } catch (NoSuchWorkspaceException e) {
             // successful
         }
@@ -128,19 +128,19 @@
         String dstAbsPath = node2W2.getPath() + "/" + node1.getName();
 
         // srcAbsPath is not existing
-        String unvalidSrcPath = srcAbsPath + "unvalid";
+        String invalidSrcPath = srcAbsPath + "invalid";
         try {
-            workspaceW2.clone(workspace.getName(), unvalidSrcPath, dstAbsPath, true);
-            fail("Not existing source path '" + unvalidSrcPath + "' should throw PathNotFoundException.");
+            workspaceW2.clone(workspace.getName(), invalidSrcPath, dstAbsPath, true);
+            fail("Not existing source path '" + invalidSrcPath + "' should throw PathNotFoundException.");
         } catch (PathNotFoundException e) {
             // successful
         }
 
         // dstAbsPath parent is not existing
-        String unvalidDstParentPath = node2W2.getPath() + "unvalid/" + node1.getName();
+        String invalidDstParentPath = node2W2.getPath() + "invalid/" + node1.getName();
         try {
-            workspaceW2.clone(workspace.getName(), srcAbsPath, unvalidDstParentPath, true);
-            fail("Not existing destination parent path '" + unvalidDstParentPath + "' should throw PathNotFoundException.");
+            workspaceW2.clone(workspace.getName(), srcAbsPath, invalidDstParentPath, true);
+            fail("Not existing destination parent path '" + invalidDstParentPath + "' should throw PathNotFoundException.");
         } catch (PathNotFoundException e) {
             // successful
         }
@@ -153,20 +153,25 @@
         // we assume repository supports locking
         String dstAbsPath = node2W2.getPath() + "/" + node1.getName();
 
+        // get lock target node in destination wsp through other session
+        Node lockTarget = (Node) rwSessionW2.getItem(node2W2.getPath());
+
         // add mixin "lockable" to be able to lock the node
-        if (!node2W2.getPrimaryNodeType().isNodeType(mixLockable)) {
-            node2W2.addMixin(mixLockable);
-            testRootNodeW2.save();
+        if (!lockTarget.getPrimaryNodeType().isNodeType(mixLockable)) {
+            lockTarget.addMixin(mixLockable);
+            lockTarget.getParent().save();
         }
 
-        // lock dst parent node
-        node2W2.lock(true, true);
+        // lock dst parent node using other session
+        lockTarget.lock(true, true);
 
         try {
             workspaceW2.clone(workspace.getName(), node1.getPath(), dstAbsPath, true);
             fail("LockException was expected.");
         } catch (LockException e) {
             // successful
+        } finally {
+            lockTarget.unlock();
         }
     }
 }

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/WorkspaceCopyBetweenWorkspacesTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/WorkspaceCopyBetweenWorkspacesTest.java?view=diff&r1=160548&r2=160549
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/WorkspaceCopyBetweenWorkspacesTest.java (original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/WorkspaceCopyBetweenWorkspacesTest.java Fri Apr  8 05:39:38 2005
@@ -55,12 +55,12 @@
     /**
      * A NoSuchWorkspaceException is thrown if srcWorkspace does not exist.
      */
-    public void testCopyNodesUnvalidWorkspace() throws RepositoryException {
+    public void testCopyNodesInvalidWorkspace() throws RepositoryException {
         // copy referenceable node below non-referenceable node to a non-existing workspace
         String dstAbsPath = node2W2.getPath() + "/" + node1.getName();
         try {
             superuserW2.getWorkspace().copy(getNonExistingWorkspaceName(superuser), node1.getPath(), dstAbsPath);
-            fail("Unvalid Source Workspace should throw NoSuchWorkspaceException.");
+            fail("Invalid Source Workspace should throw NoSuchWorkspaceException.");
         } catch (NoSuchWorkspaceException e) {
             // successful
         }
@@ -132,19 +132,19 @@
         String dstAbsPath = node2W2.getPath() + "/" + node1.getName();
 
         // srcAbsPath is not existing
-        String unvalidSrcPath = srcAbsPath + "unvalid";
+        String invalidSrcPath = srcAbsPath + "invalid";
         try {
-            workspaceW2.copy(workspace.getName(), unvalidSrcPath, dstAbsPath);
-            fail("Not existing source path '" + unvalidSrcPath + "' should throw PathNotFoundException.");
+            workspaceW2.copy(workspace.getName(), invalidSrcPath, dstAbsPath);
+            fail("Not existing source path '" + invalidSrcPath + "' should throw PathNotFoundException.");
         } catch (PathNotFoundException e) {
             // successful
         }
 
         // dstAbsPath parent is not existing
-        String unvalidDstParentPath = node2W2.getPath() + "unvalid/" + node1.getName();
+        String invalidDstParentPath = node2W2.getPath() + "invalid/" + node1.getName();
         try {
-            workspaceW2.copy(workspace.getName(), srcAbsPath, unvalidDstParentPath);
-            fail("Not existing destination parent path '" + unvalidDstParentPath + "' should throw PathNotFoundException.");
+            workspaceW2.copy(workspace.getName(), srcAbsPath, invalidDstParentPath);
+            fail("Not existing destination parent path '" + invalidDstParentPath + "' should throw PathNotFoundException.");
         } catch (PathNotFoundException e) {
             // successful
         }

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/WorkspaceMoveTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/WorkspaceMoveTest.java?view=diff&r1=160548&r2=160549
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/WorkspaceMoveTest.java (original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/WorkspaceMoveTest.java Fri Apr  8 05:39:38 2005
@@ -113,19 +113,19 @@
         String dstAbsPath = node2.getPath() + "/" + node1.getName();
 
         // srcAbsPath is not existing
-        String unvalidSrcPath = srcAbsPath + "unvalid";
+        String invalidSrcPath = srcAbsPath + "invalid";
         try {
-            workspace.move(unvalidSrcPath, dstAbsPath);
-            fail("Not existing source path '" + unvalidSrcPath + "' should throw PathNotFoundException.");
+            workspace.move(invalidSrcPath, dstAbsPath);
+            fail("Not existing source path '" + invalidSrcPath + "' should throw PathNotFoundException.");
         } catch (PathNotFoundException e) {
             // successful
         }
 
         // dstAbsPath parent is not existing
-        String unvalidDstParentPath = node2.getPath() + "unvalid/" + node1.getName();
+        String invalidDstParentPath = node2.getPath() + "invalid/" + node1.getName();
         try {
-            workspace.move(srcAbsPath, unvalidDstParentPath);
-            fail("Not existing destination parent path '" + unvalidDstParentPath + "' should throw PathNotFoundException.");
+            workspace.move(srcAbsPath, invalidDstParentPath);
+            fail("Not existing destination parent path '" + invalidDstParentPath + "' should throw PathNotFoundException.");
         } catch (PathNotFoundException e) {
             // successful
         }