jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r159582 - in incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version: RestoreTest.java VersionHistoryTest.java WorkspaceRestoreTest.java
Date Thu, 31 Mar 2005 11:06:10 GMT
Author: tripod
Date: Thu Mar 31 03:06:07 2005
New Revision: 159582

URL: http://svn.apache.org/viewcvs?view=rev&rev=159582
Log:
- adapting tests

Modified:
    incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/RestoreTest.java
    incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/VersionHistoryTest.java
    incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/WorkspaceRestoreTest.java

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/RestoreTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/RestoreTest.java?view=diff&r1=159581&r2=159582
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/RestoreTest.java
(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/RestoreTest.java
Thu Mar 31 03:06:07 2005
@@ -75,13 +75,27 @@
     }
 
     /**
+     * Test if restoring the root version fails.
+     *
+     * @throws RepositoryException
+     */
+    public void testRestoreRootVersionFail() throws RepositoryException {
+        try {
+            versionableNode.restore(rootVersion, true);
+            fail("Restore of jcr:rootVersion must throw VersionException.");
+        } catch (VersionException e) {
+            // success
+        }
+    }
+
+    /**
      * Test if restoring a node works on checked-in node.
      *
      * @throws RepositoryException
      */
     public void testRestoreOnCheckedInNode() throws RepositoryException {
         versionableNode.checkin();
-        versionableNode.restore(rootVersion, true);
+        versionableNode.restore(version, true);
     }
 
     /**
@@ -90,7 +104,7 @@
      * @throws RepositoryException
      */
     public void testRestoreOnCheckedOutNode() throws RepositoryException {
-        versionableNode.restore(rootVersion, true);
+        versionableNode.restore(version, true);
     }
 
     /**
@@ -99,7 +113,7 @@
      * @throws RepositoryException
      */
     public void testRestoreSetsIsCheckedOutToFalse() throws RepositoryException {
-        versionableNode.restore(rootVersion, true);
+        versionableNode.restore(version, true);
 
         assertFalse("Restoring a node sets the jcr:isCheckedOut property to false", versionableNode.isCheckedOut());
     }
@@ -110,10 +124,9 @@
      * @throws javax.jcr.RepositoryException
      */
     public void testRestoreSetsBaseVersion() throws RepositoryException {
-        versionableNode.restore(rootVersion, true);
+        versionableNode.restore(version, true);
         Version baseV = versionableNode.getBaseVersion();
-
-        assertEquals("Restoring a node must set node's base version in order to point to
the restored version.", baseV, rootVersion);
+        assertTrue("Restoring a node must set node's base version in order to point to the
restored version.", version.isSame(baseV));
     }
 
     /**
@@ -125,7 +138,7 @@
         // modify node without calling save()
         try {
             versionableNode.setProperty(propertyName1, propertyValue);
-            versionableNode.restore(rootVersion, true);
+            versionableNode.restore(version, true);
 
             fail("InvalidItemStateException must be thrown on attempt to restore a node having
any unsaved changes pending.");
         } catch (InvalidItemStateException e) {
@@ -156,7 +169,7 @@
      * @throws RepositoryException
      */
     public void testRestoreInvalidVersion2() throws RepositoryException {
-        String invalidName = null;
+        String invalidName;
         do {
             invalidName = createRandomString(3);
             for (VersionIterator it = versionableNode.getVersionHistory().getAllVersions();
it.hasNext();) {
@@ -198,17 +211,14 @@
      * @see Node#restore(javax.jcr.version.Version, String, boolean)
      */
     public void testRestoreNonVersionableNode2() throws RepositoryException {
-        /*
-        todo: fix test. since 'foo' does not exist, and removeExisting is true,
-        the 'rootVersion' will be restored at location 'foo'.
+        // the 'version' will be restored at location 'foo'.
 
         try {
-            nonVersionableNode.restore(rootVersion, "foo", true);
+            nonVersionableNode.getParent().restore(version, nonVersionableNode.getName(),
true);
             fail("Node.restore(Version, String, boolean) on a non versionable node must throw
UnsupportedRepositoryOperationException");
         } catch (UnsupportedRepositoryOperationException e) {
             //success
         }
-        */
     }
 
     /**
@@ -219,7 +229,7 @@
      */
     public void testRestoreNonVersionableNode3() throws RepositoryException {
         try {
-            nonVersionableNode.restore(rootVersion, true);
+            nonVersionableNode.restore(version, true);
             fail("Node.restore(Version, boolean) on a non versionable node must throw UnsupportedRepositoryOperationException");
         } catch (UnsupportedRepositoryOperationException e) {
             //success

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/VersionHistoryTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/VersionHistoryTest.java?view=diff&r1=159581&r2=159582
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/VersionHistoryTest.java
(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/VersionHistoryTest.java
Thu Mar 31 03:06:07 2005
@@ -671,6 +671,7 @@
         try {
             vHistory.removeMixin(mixReferenceable);
             fail("VersionHistory does not have mixins: VersionHistory.removeMixin(String)
did not throw a NoSuchNodeTypeException.");
+        } catch (ConstraintViolationException success) {
         } catch (NoSuchNodeTypeException success) {
         }
     }

Modified: incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/WorkspaceRestoreTest.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/WorkspaceRestoreTest.java?view=diff&r1=159581&r2=159582
==============================================================================
--- incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/WorkspaceRestoreTest.java
(original)
+++ incubator/jackrabbit/trunk/src/test/org/apache/jackrabbit/test/api/version/WorkspaceRestoreTest.java
Thu Mar 31 03:06:07 2005
@@ -177,19 +177,14 @@
      * Test if the removeExisting-flag removes an existing node in case of uuid conflict.
      */
     public void testWorkspaceRestoreWithRemoveExisting() throws NotExecutableException, RepositoryException
{
-        // assert proper child node definition
-        NodeDef d = wVersionableChildNode.getDefinition();
-        if (d.getOnParentVersion() != OnParentVersionAction.COPY && d.getOnParentVersion()
!= OnParentVersionAction.VERSION) {
-            fail("Childnode must have OPV COPY or VERSION in order to be able to test Node.restore
with uuid conflict");
-        }
-
         // create version for parentNode of childNode
+        superuser.getWorkspace().clone(workspaceName, wVersionableChildNode.getPath(), wVersionableChildNode.getPath(),
false);
         Version parentV = versionableNode.checkin();
 
         // move child node in order to produce the uuid conflict
         String newChildPath = wVersionableNode2.getPath() + "/" + wVersionableChildNode.getName();
         wSuperuser.move(wVersionableChildNode.getPath(), newChildPath);
-        wTestRoot.save();
+        wSuperuser.save();
 
         // restore the parent with removeExisting == true >> moved child node
         // must be removed.



Mime
View raw message