You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by re...@apache.org on 2022/11/09 11:30:11 UTC

svn commit: r1905195 - in /jackrabbit/branches/2.16: ./ jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/VersionLabelTest.java

Author: reschke
Date: Wed Nov  9 11:30:11 2022
New Revision: 1905195

URL: http://svn.apache.org/viewvc?rev=1905195&view=rev
Log:
JCR-4837: add test for 'Removal of version of a node should remove associated labels' (merged r1903895 into 2.16)

Modified:
    jackrabbit/branches/2.16/   (props changed)
    jackrabbit/branches/2.16/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/VersionLabelTest.java

Propchange: jackrabbit/branches/2.16/
------------------------------------------------------------------------------
  Merged /jackrabbit/trunk:r1903895

Modified: jackrabbit/branches/2.16/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/VersionLabelTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.16/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/VersionLabelTest.java?rev=1905195&r1=1905194&r2=1905195&view=diff
==============================================================================
--- jackrabbit/branches/2.16/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/VersionLabelTest.java (original)
+++ jackrabbit/branches/2.16/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/VersionLabelTest.java Wed Nov  9 11:30:11 2022
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.test.api.v
 
 import java.util.Arrays;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
 
 import javax.jcr.Node;
@@ -460,6 +461,36 @@ public class VersionLabelTest extends Ab
     }
 
     /**
+     * Test VersionHistory.removeVersion(String) should remove all associated labels
+     * with removal of version
+     *
+     * @throws RepositoryException
+     * @see VersionHistory#removeVersion(String)
+     */
+    public void testVersionLabelsAfterRemovingVersion() throws RepositoryException {
+        String vpath = versionableNode.getPath();
+        VersionManager versionManager = versionableNode.getSession().getWorkspace().getVersionManager();
+
+        versionManager.checkout(vpath);
+        Version v = versionManager.checkin(vpath);
+        vHistory.addVersionLabel(v.getName(), versionLabel2, false);
+        vHistory.addVersionLabel(version.getName(), versionLabel, false);
+        versionManager.checkout(vpath);
+
+        // removing version version
+        vHistory.removeVersion(version.getName());
+
+        List<String> list = Arrays.asList(vHistory.getVersionLabels());
+
+        assertFalse(
+                "VersionHistory.hasVersionLabel(versionLabel) must return false if version corresponding to label has been removed",
+                vHistory.hasVersionLabel(versionLabel));
+
+        assertFalse("VersionHistory.getVersionLabels() should not return the labels whose version is removed",
+                list.contains(versionLabel));
+    }
+
+    /**
      * Test calling Node.restoreByLabel(String, boolean) on a non-versionable node.
      *
      * @throws javax.jcr.RepositoryException