Author: mduerig
Date: Thu Dec 19 09:59:00 2013
New Revision: 1552273

URL: http://svn.apache.org/r1552273
Log:
OAK-1297: MoveDetector does not detect moved nodes that have been moved in an 
earlier commit already
Test case

Modified:
    
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/state/MoveDetectorTest.java

Modified: 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/state/MoveDetectorTest.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/state/MoveDetectorTest.java?rev=1552273&r1=1552272&r2=1552273&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/state/MoveDetectorTest.java
 (original)
+++ 
jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/state/MoveDetectorTest.java
 Thu Dec 19 09:59:00 2013
@@ -32,6 +32,7 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.spi.commit.DefaultMoveValidator;
 import org.apache.jackrabbit.oak.spi.commit.EditorDiff;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 
 public class MoveDetectorTest {
@@ -55,16 +56,28 @@ public class MoveDetectorTest {
      * @throws CommitFailedException
      */
     @Test
+    @Ignore("OAK-1297")  // FIXME OAK-1297
     public void simpleMove() throws CommitFailedException {
-        NodeState moved = move(root.builder(), "/test/x", 
"/test/y/xx").getNodeState();
-        MoveExpectation moveExpectation = new MoveExpectation(
+        NodeState moved1 = move(root.builder(), "/test/x", 
"/test/y/xx").getNodeState();
+        MoveExpectation moveExpectation1 = new MoveExpectation(
                 ImmutableMap.of("/test/x", "/test/y/xx"));
-        MoveDetector moveDetector = new MoveDetector(moveExpectation);
-        CommitFailedException exception = EditorDiff.process(moveDetector, 
root, moved);
-        if (exception != null) {
-            throw exception;
+        MoveDetector moveDetector1 = new MoveDetector(moveExpectation1);
+        CommitFailedException exception1 = EditorDiff.process(moveDetector1, 
root, moved1);
+        if (exception1 != null) {
+            throw exception1;
+        }
+        moveExpectation1.assertAllFound();
+
+        // Test whether we can also detect the move back on top of the 
previous, persisted move
+        NodeState moved2 = move(moved1.builder(), "/test/y/xx", 
"/test/x").getNodeState();
+        MoveExpectation moveExpectation2 = new MoveExpectation(
+                ImmutableMap.of("/test/y/xx", "/test/x"));
+        MoveDetector moveDetector2 = new MoveDetector(moveExpectation2);
+        CommitFailedException exception2 = EditorDiff.process(moveDetector2, 
moved1, moved2);
+        if (exception2 != null) {
+            throw exception2;
         }
-        moveExpectation.assertAllFound();
+        moveExpectation2.assertAllFound();
     }
 
     /**


Reply via email to