jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cko...@apache.org
Subject svn commit: r785492 - /jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/XATest.java
Date Wed, 17 Jun 2009 07:31:35 GMT
Author: ckoell
Date: Wed Jun 17 07:31:34 2009
New Revision: 785492

URL: http://svn.apache.org/viewvc?rev=785492&view=rev
Log:
JCR-1666 After transaction rollback session may become 'corrupt'

Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/XATest.java

Modified: jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/XATest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/XATest.java?rev=785492&r1=785491&r2=785492&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/XATest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/XATest.java
Wed Jun 17 07:31:34 2009
@@ -1545,6 +1545,55 @@
         s2.logout();
 
     }
+    
+    /**
+     * Tests JCR-1666 After transaction rollback session may become 'corrupt'
+     * 
+     * @throws Exception
+     */
+    public void testRollbackRefreshSave() throws Exception {
+        // get user transaction object
+        UserTransaction utx = new UserTransactionImpl(superuser);
+
+        // start transaction
+        utx.begin();
+
+        // add node and save
+        Node n = testRootNode.addNode("n");
+        n.addMixin(mixVersionable);
+        superuser.save();
+
+        // assertion: node exists in this session
+        String uuid = n.getUUID();
+
+        try {
+            superuser.getNodeByUUID(uuid);
+        } catch (ItemNotFoundException e) {
+            fail("New node not visible after save()");
+        }
+
+        // rollback
+        utx.rollback();
+
+        superuser.refresh(false);
+
+        // assertion: node does not exist in this session
+        try {
+            superuser.getNodeByUUID(uuid);
+            fail("Node still visible after rollback()");
+        } catch (ItemNotFoundException e) {
+            /* expected */
+        }
+
+        utx = new UserTransactionImpl(superuser);
+        utx.begin();
+        Node m = superuser.getRootNode().addNode("m");
+        m.addMixin(mixVersionable);
+        superuser.save();
+        utx.commit();
+        
+        superuser.logout();
+    }
 
     /**
      * helper method for {@link #testXAVersionsThoroughly()}



Mime
View raw message