You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ju...@apache.org on 2009/06/30 15:10:08 UTC
svn commit: r789701 - in /jackrabbit/branches/1.x: ./
jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/RemoveOrphanVersionHistoryTest.java
Author: jukka
Date: Tue Jun 30 13:10:08 2009
New Revision: 789701
URL: http://svn.apache.org/viewvc?rev=789701&view=rev
Log:
1.x: Merged revision 778720 (JCR-134)
Modified:
jackrabbit/branches/1.x/ (props changed)
jackrabbit/branches/1.x/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/RemoveOrphanVersionHistoryTest.java
Propchange: jackrabbit/branches/1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun 30 13:10:08 2009
@@ -1 +1 @@
-/jackrabbit/trunk:770143-773197,773483,773525-773554,773584,773588,773828,773835-775756,775833,775836,775840,775868,775981,775986,776036,776256,776310,776313,776321-776322,776332,776356-776357,776362,776373,776650-776693,776737,776757,776776-776777,777024,777029,777034,777478,777509,777541,777548,777936,778445,778613,778616,778621,778645
+/jackrabbit/trunk:770143-773197,773483,773525-773554,773584,773588,773828,773835-775756,775833,775836,775840,775868,775981,775986,776036,776256,776310,776313,776321-776322,776332,776356-776357,776362,776373,776650-776693,776737,776757,776776-776777,777024,777029,777034,777478,777509,777541,777548,777936,778445,778613,778616,778621,778645,778720,778802
Modified: jackrabbit/branches/1.x/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/RemoveOrphanVersionHistoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.x/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/RemoveOrphanVersionHistoryTest.java?rev=789701&r1=789700&r2=789701&view=diff
==============================================================================
--- jackrabbit/branches/1.x/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/RemoveOrphanVersionHistoryTest.java (original)
+++ jackrabbit/branches/1.x/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/version/RemoveOrphanVersionHistoryTest.java Tue Jun 30 13:10:08 2009
@@ -18,6 +18,8 @@
import javax.jcr.ItemNotFoundException;
import javax.jcr.Node;
+import javax.jcr.Property;
+import javax.jcr.PropertyType;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.SimpleCredentials;
@@ -138,6 +140,57 @@
}
/**
+ * Test that an emptied version history that is still being referenced
+ * from another workspace does not get removed.
+ *
+ * @throws RepositoryException if an error occurs.
+ */
+ public void testEmptyNonOrphanVersionHistory() throws RepositoryException {
+ Session session = testRootNode.getSession();
+
+ // Create versionable test node
+ Node node = testRootNode.addNode(nodeName1);
+ node.addMixin(mixVersionable);
+ session.save();
+
+ VersionHistory history = node.getVersionHistory();
+ String uuid = history.getUUID();
+
+ // Create version 1.0
+ Version v10 = node.checkin();
+
+ // Remove the test node
+ node.checkout();
+ node.remove();
+ session.save();
+
+ Session otherSession = helper.getReadWriteSession(workspaceName);
+ try {
+ // create a reference to the version history in another workspace
+ Node otherRoot = otherSession.getRootNode();
+ Property reference = otherRoot.setProperty(
+ "RemoveOrphanVersionTest", uuid, PropertyType.REFERENCE);
+ otherSession.save();
+
+ // Now remove the contents of the version history
+ history.removeVersion(v10.getName());
+
+ // Check that the version history still exists!
+ try {
+ session.getNodeByUUID(uuid);
+ } catch (ItemNotFoundException e) {
+ fail("Referenced empty version history must note be removed");
+ }
+
+ // Cleanup
+ reference.remove();
+ otherSession.save();
+ } finally {
+ otherSession.logout();
+ }
+ }
+
+ /**
* Assert that a node exists in a session.
* @param session the session.
* @param uuid the node's UUID.