jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r1239642 - in /jackrabbit/sandbox/microkernel/src: main/java/org/apache/jackrabbit/mk/model/CommitBuilder.java test/java/org/apache/jackrabbit/mk/api/MicroKernelTest.java
Date Thu, 02 Feb 2012 14:25:13 GMT
Author: stefan
Date: Thu Feb  2 14:25:13 2012
New Revision: 1239642

URL: http://svn.apache.org/viewvc?rev=1239642&view=rev
Log:
fix 'move modified node'

Modified:
    jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/CommitBuilder.java
    jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/api/MicroKernelTest.java

Modified: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/CommitBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/CommitBuilder.java?rev=1239642&r1=1239641&r2=1239642&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/CommitBuilder.java
(original)
+++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/model/CommitBuilder.java
Thu Feb  2 14:25:13 2012
@@ -106,18 +106,18 @@ public class CommitBuilder {
             if (srcParent.rename(srcNodeName, destNodeName) == null) {
                 throw new NotFoundException(srcPath);
             }
-            return;
-        }
-        ChildNodeEntry srcCNE = srcParent.remove(srcNodeName);
-        if (srcCNE == null) {
-            throw new NotFoundException(srcPath);
-        }
+        } else {
+            ChildNodeEntry srcCNE = srcParent.remove(srcNodeName);
+            if (srcCNE == null) {
+                throw new NotFoundException(srcPath);
+            }
 
-        MutableNode destParent = getOrCreateStagedNode(destParentPath);
-        if (destParent.getChildNodeEntry(destNodeName) != null) {
-            throw new Exception("node already exists at move destination path: " + destPath);
+            MutableNode destParent = getOrCreateStagedNode(destParentPath);
+            if (destParent.getChildNodeEntry(destNodeName) != null) {
+                throw new Exception("node already exists at move destination path: " + destPath);
+            }
+            destParent.add(new ChildNodeEntry(destNodeName, srcCNE.getId()));
         }
-        destParent.add(new ChildNodeEntry(destNodeName, srcCNE.getId()));
 
         // update staging area
         moveStagedNodes(srcPath, destPath);

Modified: jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/api/MicroKernelTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/api/MicroKernelTest.java?rev=1239642&r1=1239641&r2=1239642&view=diff
==============================================================================
--- jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/api/MicroKernelTest.java
(original)
+++ jackrabbit/sandbox/microkernel/src/test/java/org/apache/jackrabbit/mk/api/MicroKernelTest.java
Thu Feb  2 14:25:13 2012
@@ -48,6 +48,26 @@ public class MicroKernelTest extends Mul
     }
 
     @Test
+    public void addAndMove() {
+        String head = mk.getHeadRevision();
+        head = mk.commit("",
+                "+\"/root\":{}\n" +
+                "+\"/root/a\":{}\n" +
+                "",
+                head, "");
+
+        head = mk.commit("",
+                "+\"/root/a/b\":{}\n" +
+                ">\"/root/a\":\"/root/c\"\n" +
+                "",
+                head, "");
+
+        System.out.println(mk.getNodes("/root", head, 999, 0, -1));
+        assertFalse(mk.nodeExists("/root/a", head));
+    }
+
+
+    @Test
     public void getNodes() {
         String head = mk.getHeadRevision();
 



Mime
View raw message