jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r618599 - in /jackrabbit/branches/1.4: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/MergeNonVersionableSubNodeTest.java
Date Tue, 05 Feb 2008 10:12:56 GMT
Author: jukka
Date: Tue Feb  5 02:12:55 2008
New Revision: 618599

URL: http://svn.apache.org/viewvc?rev=618599&view=rev
Log:
1.4: Merged revisions 612604 and 612772 (JCR-1046)

Modified:
    jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
    jackrabbit/branches/1.4/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/MergeNonVersionableSubNodeTest.java

Modified: jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java?rev=618599&r1=618598&r2=618599&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
Tue Feb  5 02:12:55 2008
@@ -3680,11 +3680,14 @@
 
         NodeImpl srcNode = doMergeTest(srcSession, failedIds, bestEffort);
         if (srcNode == null) {
-            // leave, iterate over children
+            // leave, iterate over children, but ignore non-versionable child
+            // nodes (see JCR-1046)
             NodeIterator iter = getNodes();
             while (iter.hasNext()) {
                 NodeImpl n = (NodeImpl) iter.nextNode();
-                n.internalMerge(srcSession, failedIds, bestEffort, removeExisting, replaceExisting);
+                if (n.isNodeType(NameConstants.MIX_VERSIONABLE)) {
+                    n.internalMerge(srcSession, failedIds, bestEffort, removeExisting, replaceExisting);
+                }
             }
             return;
         }

Modified: jackrabbit/branches/1.4/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/MergeNonVersionableSubNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.4/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/MergeNonVersionableSubNodeTest.java?rev=618599&r1=618598&r2=618599&view=diff
==============================================================================
--- jackrabbit/branches/1.4/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/MergeNonVersionableSubNodeTest.java
(original)
+++ jackrabbit/branches/1.4/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/MergeNonVersionableSubNodeTest.java
Tue Feb  5 02:12:55 2008
@@ -64,52 +64,62 @@
      */
     public void testMergeNodeNonVersionableSubNodeUpdate() throws RepositoryException {
         // modify non versionable subnode so we can check if it's updated after merge
-        String nvSubNodePath = nodeName1 + "/" + nodeName2 + "/" + nodeName3;
-        Node nvSubNode = testRootNodeW2.getNode(nvSubNodePath);
-        nvSubNode.setProperty(propertyName1, CHANGED_STRING);
-        superuserW2.save();
-
-        // versionable ancestor to merge in second workspace
-        Node nodeToMerge = testRootNodeW2.getNode(nodeName1);
-
-        // make sure the ancestor will get status 'update' on merge: V is predeccessor of
V'
-        nodeToMerge.checkout();
-        nodeToMerge.checkin();
+        String changedString = CHANGED_STRING + System.currentTimeMillis();
+        String nvSubNodePath = nodeName2 + "/" + nodeName3;
 
-        nodeToMerge.checkout();
-        nodeToMerge.merge(workspace.getName(), true);
+        // versionable ancestor to merge in first workspace (N)
+        Node n = testRootNodeW2.getNode(nodeName1);
 
-        // corresponding node to nvSubNode in default workspace
-        Node correspondingSubNode = testRootNode.getNode(nvSubNodePath);
+        // versionable ancestor to merge in second workspace (N')
+        Node np = testRootNodeW2.getNode(nodeName1);
 
-        // test if modification on non-v node is done according to corresponding node.
-        assertTrue(nvSubNode.getProperty(propertyName1).getString().equals(correspondingSubNode.getName()));
+        // checkout N and make change
+        n.checkout();
+        Node nvSubNode = n.getNode(nvSubNodePath);
+        nvSubNode.setProperty(propertyName1, changedString);
+        n.save();
+        n.checkin();
+
+        // merge change into N'
+        np.merge(workspaceW2.getName(), true);
+
+        // corresponding node to nvSubNode in 2nd workspace
+        Node nvSubNodeP = np.getNode(nvSubNodePath);
+
+        // test if modification on N was merged into N' subnode
+        assertTrue(nvSubNodeP.getProperty(propertyName1).getString().equals(changedString));
     }
 
     /**
      * Node.merge(): nonversionable subNode N: is left unchanged if the nearest
      * versionable ancestor has state leave.<br>
      */
-    public void disable_testMergeNodeNonVersionableSubNodeLeave() throws RepositoryException
{
+    public void testMergeNodeNonVersionableSubNodeLeave() throws RepositoryException {
         // modify non versionable subnode so we can check if it's updated after merge
-        String nvSubNodePath = nodeName1 + "/" + nodeName2 + "/" + nodeName3;
-        Node nvSubNode = testRootNodeW2.getNode(nvSubNodePath);
-        nvSubNode.setProperty(propertyName1, CHANGED_STRING);
-        superuserW2.save();
-
-        // versionable ancestor to merge in second workspace
-        Node nodeToMerge = testRootNodeW2.getNode(nodeName1);
-
-        // make sure the ancestor will get status 'leave' on merge: V is successor of V'
-        Node correspondingNodeToMerge = testRootNode.getNode(nodeName1);
-        correspondingNodeToMerge.checkout();
-        correspondingNodeToMerge.checkin();
+        String changedString = CHANGED_STRING + System.currentTimeMillis();
+        String nvSubNodePath = nodeName2 + "/" + nodeName3;
+
+        // versionable ancestor to merge in first workspace (N)
+        Node n = testRootNodeW2.getNode(nodeName1);
+
+        // versionable ancestor to merge in second workspace (N')
+        Node np = testRootNodeW2.getNode(nodeName1);
+
+        // checkout N' and make change
+        np.checkout();
+        Node nvSubNodeP = np.getNode(nvSubNodePath);
+        nvSubNodeP.setProperty(propertyName1, changedString);
+        np.save();
+        np.checkin();
+
+        // merge into N'
+        np.merge(workspaceW2.getName(), true);
 
-        nodeToMerge.checkout();
-        nodeToMerge.merge(workspace.getName(), true);
+        // corresponding node to nvSubNode in 2nd workspace
+        Node nvSubNode = np.getNode(nvSubNodePath);
 
-        // test if modification on non-v node is unchanged.
-        assertTrue(nvSubNode.getProperty(propertyName1).getString().equals(CHANGED_STRING));
+        // test if modification on N' was not modified
+        assertTrue(nvSubNode.getProperty(propertyName1).getString().equals(changedString));
     }
 
     /**



Mime
View raw message