jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1502689 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/core/ oak-core/src/test/java/org/apache/jackrabbit/oak/core/ oak-jcr/ oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/
Date Fri, 12 Jul 2013 20:55:56 GMT
Author: mduerig
Date: Fri Jul 12 20:55:56 2013
New Revision: 1502689

URL: http://svn.apache.org/r1502689
Log:
OAK-898: Session#move with a fresh session doesn't work properly
Call update on Root.move and Root.copy to ensure hasPendingChanges returns true

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplTest.java
    jackrabbit/oak/trunk/oak-jcr/pom.xml
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/MoveTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java?rev=1502689&r1=1502688&r2=1502689&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/RootImpl.java
Fri Jul 12 20:55:56 2013
@@ -194,6 +194,7 @@ public class RootImpl implements Root {
             getTree(getParentPath(sourcePath)).updateChildOrder();
             getTree(getParentPath(destPath)).updateChildOrder();
             lastMove = lastMove.setMove(sourcePath, destParent, getName(destPath));
+            updated();
         }
         return success;
     }
@@ -206,6 +207,7 @@ public class RootImpl implements Root {
         reset();
         if (success) {
             getTree(getParentPath(destPath)).updateChildOrder();
+            updated();
         }
         return success;
     }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplTest.java?rev=1502689&r1=1502688&r2=1502689&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/RootImplTest.java
Fri Jul 12 20:55:56 2013
@@ -100,12 +100,15 @@ public class RootImplTest extends OakBas
         Tree x = tree.getChild("x");
         assertTrue(x.exists());
 
+        assertFalse(root.hasPendingChanges());
         root.move("/x", "/y/xx");
+        assertTrue(root.hasPendingChanges());
         assertFalse(tree.hasChild("x"));
         assertTrue(y.hasChild("xx"));
         assertEquals("/y/xx", x.getPath());
 
         root.commit();
+        assertFalse(root.hasPendingChanges());
 
         assertFalse(tree.hasChild("x"));
         assertTrue(tree.hasChild("y"));

Modified: jackrabbit/oak/trunk/oak-jcr/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/pom.xml?rev=1502689&r1=1502688&r2=1502689&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-jcr/pom.xml Fri Jul 12 20:55:56 2013
@@ -334,7 +334,6 @@
       org.apache.jackrabbit.core.query.SelectClauseTest#testSameNameSiblingSQL          
            <!-- OAK-203 -->
       org.apache.jackrabbit.core.query.ShareableNodeTest#testName                       
            <!-- OAK-118 -->
       org.apache.jackrabbit.core.query.ShareableNodeTest#testPathConstraint             
            <!-- OAK-118 -->
-      org.apache.jackrabbit.oak.jcr.MoveTest#testMoveTmp                          <!--
OAK-898 -->
     </known.issues>
   </properties>
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/MoveTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/MoveTest.java?rev=1502689&r1=1502688&r2=1502689&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/MoveTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/MoveTest.java
Fri Jul 12 20:55:56 2013
@@ -21,7 +21,6 @@ import javax.jcr.Session;
 
 import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.test.AbstractJCRTest;
-import org.junit.Ignore;
 import org.junit.Test;
 
 /**
@@ -70,37 +69,34 @@ public class MoveTest extends AbstractJC
     }
 
     /**
-     * Simulate a 'rename' call using 2 sessions:
+     * Simulate a 'rename' call using 3 sessions:
      * - 1st create a node that has a '.tmp' extension 
      * - 2nd remove the '.tmp' by issuing a Session#move call on a new session
      * - 3rd verify the move by issuing a #getNode call on the destination path using a new
session
      */
     @Test
-    @Ignore("OAK-898")
-    public void testMoveTmp() throws Exception {
-        String n = "testMoveTmp";
-
-        Node node1 = testRootNode.addNode(n + ".tmp");
+    public void testOak898() throws Exception {
+        String name = "testMove";
+        Node node = testRootNode.addNode(name + ".tmp");
         superuser.save();
+        String destPath = testRootNode.getPath() + '/' + name;
 
-        String destPath = testRootNode.getPath() + "/" + n;
-
-        Session ts = getHelper().getSuperuserSession();
+        Session session2 = getHelper().getSuperuserSession();
         try {
-            ts.move(node1.getPath(), destPath);
-            if (ts.hasPendingChanges()) {
-                ts.save();
-            }
+            assertFalse(session2.hasPendingChanges());
+            session2.move(node.getPath(), destPath);
+            assertTrue(session2.hasPendingChanges());
+            session2.save();
 
         } finally {
-            ts.logout();
+            session2.logout();
         }
 
-        ts = getHelper().getSuperuserSession();
+        Session session3 = getHelper().getSuperuserSession();
         try {
-            assertNotNull(ts.getNode(destPath));
+            assertNotNull(session3.getNode(destPath));
         } finally {
-            ts.logout();
+            session3.logout();
         }
     }
 



Mime
View raw message