jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1510460 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionableState.java oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/version/VersionableTest.java
Date Mon, 05 Aug 2013 12:55:27 GMT
Author: mreutegg
Date: Mon Aug  5 12:55:26 2013
New Revision: 1510460

URL: http://svn.apache.org/r1510460
Log:
OAK-940: Manually specified jcr:frozenUuid overwriting the one assigned by the VersionManager
when versioning node 

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionableState.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/version/VersionableTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionableState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionableState.java?rev=1510460&r1=1510459&r2=1510460&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionableState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/version/VersionableState.java
Mon Aug  5 12:55:26 2013
@@ -429,6 +429,10 @@ class VersionableState {
                                  NodeBuilder dest,
                                  PropertyState prop)
                     throws RepositoryException {
+                if (BASIC_FROZEN_PROPERTIES.contains(prop.getName())) {
+                    // OAK-940: do not overwrite basic frozen properties
+                    return IGNORE;
+                }
                 return getOPV(src, prop);
             }
         }, true);

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/version/VersionableTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/version/VersionableTest.java?rev=1510460&r1=1510459&r2=1510460&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/version/VersionableTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/version/VersionableTest.java
Mon Aug  5 12:55:26 2013
@@ -17,11 +17,14 @@
 package org.apache.jackrabbit.oak.jcr.version;
 
 import javax.jcr.Node;
+import javax.jcr.Property;
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
+import javax.jcr.version.Version;
 import javax.jcr.version.VersionException;
 import javax.jcr.version.VersionManager;
 
+import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.test.AbstractJCRTest;
 
 /**
@@ -63,4 +66,38 @@ public class VersionableTest extends Abs
         VersionManager vMgr = superuser.getWorkspace().getVersionManager();
         vMgr.checkin(node.getPath());
     }
-}
+
+    /**
+     * Test from Jackrabbit: JCR-3635 (OAK-940)
+     *
+     * Tests the case when a node already has a manual set
+     * JcrConstants.JCR_FROZENUUID property and is versioned. The manual set
+     * frozenUuid will overwrite the one that is automatically assigned by the
+     * VersionManager, which should not happen
+     */
+    public void testCopyFrozenUuidProperty() throws Exception {
+        Node firstNode = testRootNode.addNode(nodeName1);
+        firstNode.setPrimaryType(JcrConstants.NT_UNSTRUCTURED);
+        firstNode.addMixin(JcrConstants.MIX_VERSIONABLE);
+        firstNode.getSession().save();
+
+        // create version for the node
+        Version firstNodeVersion = firstNode.checkin();
+        firstNode.checkout();
+
+        Node secondNode = testRootNode.addNode(nodeName2);
+        secondNode.setPrimaryType(JcrConstants.NT_UNSTRUCTURED);
+        secondNode.addMixin(JcrConstants.MIX_VERSIONABLE);
+        Property firstNodeVersionFrozenUuid = firstNodeVersion.getFrozenNode().getProperty(JcrConstants.JCR_FROZENUUID);
+        secondNode.setProperty(JcrConstants.JCR_FROZENUUID, firstNodeVersionFrozenUuid.getValue());
+        secondNode.getSession().save();
+
+        // create version of the second node
+        Version secondNodeVersion = secondNode.checkin();
+        secondNode.checkout();
+
+        // frozenUuid from the second node version node should not be the same as the one
from the first node version
+        Property secondBodeVersionFrozenUuid = secondNodeVersion.getFrozenNode().getProperty(JcrConstants.JCR_FROZENUUID);
+        assertFalse(JcrConstants.JCR_FROZENUUID + " should not be the same for two different
versions of different nodes! ",
+                secondBodeVersionFrozenUuid.getValue().equals(firstNodeVersionFrozenUuid.getValue()));
+    }}



Mime
View raw message