jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r423870 - /jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/version/RemoveVersionTest.java
Date Thu, 20 Jul 2006 10:27:09 GMT
Author: tripod
Date: Thu Jul 20 03:27:08 2006
New Revision: 423870

URL: http://svn.apache.org/viewvc?rev=423870&view=rev
Log:
JCR-272: Removal of versions throws javax.jcr.ReferentialIntegrityException

Modified:
    jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/version/RemoveVersionTest.java

Modified: jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/version/RemoveVersionTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/version/RemoveVersionTest.java?rev=423870&r1=423869&r2=423870&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/version/RemoveVersionTest.java
(original)
+++ jackrabbit/trunk/jackrabbit/src/test/java/org/apache/jackrabbit/test/api/version/RemoveVersionTest.java
Thu Jul 20 03:27:08 2006
@@ -25,6 +25,7 @@
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionException;
 import javax.jcr.version.VersionHistory;
+import javax.jcr.version.VersionIterator;
 import java.util.Arrays;
 import java.util.ArrayList;
 import java.util.List;
@@ -191,4 +192,45 @@
         catch (ReferentialIntegrityException e) {
             // success
         }
-    }}
\ No newline at end of file
+    }
+
+    /**
+     * Checks if all versions but the base and root one can be removed.
+     */
+    public void testRemoveAllBut2() throws RepositoryException {
+        String baseVersion = versionableNode.getBaseVersion().getName();
+        VersionHistory vh = versionableNode.getVersionHistory();
+        VersionIterator vi = vh.getAllVersions();
+        while (vi.hasNext()) {
+            Version currenVersion = vi.nextVersion();
+            String versionName = currenVersion.getName();
+            if (!versionName.equals("jcr:rootVersion") && !versionName.equals(baseVersion))
{
+                vh.removeVersion(versionName);
+            }
+        }
+    }
+
+    /**
+     * Checks if all versions by the base and root one can be removed.
+     */
+    public void testRemoveRootVersion() throws RepositoryException {
+        try {
+            versionableNode.getVersionHistory().getRootVersion().remove();
+            fail("Removal of root version should throw an exception.");
+        } catch (RepositoryException e) {
+            // ignore
+        }
+    }
+
+    /**
+     * Checks if all versions by the base and root one can be removed.
+     */
+    public void testRemoveBaseVersion() throws RepositoryException {
+        try {
+            versionableNode.getBaseVersion().remove();
+            fail("Removal of base version should throw an exception.");
+        } catch (RepositoryException e) {
+            // ignore
+        }
+    }
+}
\ No newline at end of file



Mime
View raw message