geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lin...@apache.org
Subject svn commit: r725403 - in /geronimo/components/txmanager/trunk/geronimo-transaction/src: main/java/org/apache/geronimo/transaction/manager/ test/java/org/apache/geronimo/transaction/manager/
Date Wed, 10 Dec 2008 19:46:18 GMT
Author: linsun
Date: Wed Dec 10 11:46:17 2008
New Revision: 725403

URL: http://svn.apache.org/viewvc?rev=725403&view=rev
Log:
Transaction.rollback method also calls beforeCompletion - GERONIMO-4449, pull from branch
2.1

Modified:
    geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionImpl.java
    geronimo/components/txmanager/trunk/geronimo-transaction/src/test/java/org/apache/geronimo/transaction/manager/TestTransactionManager.java
    geronimo/components/txmanager/trunk/geronimo-transaction/src/test/java/org/apache/geronimo/transaction/manager/TransactionSynchronizationRegistryTest.java

Modified: geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionImpl.java
URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionImpl.java?rev=725403&r1=725402&r2=725403&view=diff
==============================================================================
--- geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionImpl.java
(original)
+++ geronimo/components/txmanager/trunk/geronimo-transaction/src/main/java/org/apache/geronimo/transaction/manager/TransactionImpl.java
Wed Dec 10 11:46:17 2008
@@ -470,7 +470,6 @@
             rms = resourceManagers;
         }
 
-        beforeCompletion();
         endResources();
         try {
             rollbackResources(rms);

Modified: geronimo/components/txmanager/trunk/geronimo-transaction/src/test/java/org/apache/geronimo/transaction/manager/TestTransactionManager.java
URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-transaction/src/test/java/org/apache/geronimo/transaction/manager/TestTransactionManager.java?rev=725403&r1=725402&r2=725403&view=diff
==============================================================================
--- geronimo/components/txmanager/trunk/geronimo-transaction/src/test/java/org/apache/geronimo/transaction/manager/TestTransactionManager.java
(original)
+++ geronimo/components/txmanager/trunk/geronimo-transaction/src/test/java/org/apache/geronimo/transaction/manager/TestTransactionManager.java
Wed Dec 10 11:46:17 2008
@@ -18,7 +18,6 @@
 package org.apache.geronimo.transaction.manager;
 
 import javax.transaction.Status;
-import javax.transaction.InvalidTransactionException;
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
 import javax.transaction.xa.XAResource;

Modified: geronimo/components/txmanager/trunk/geronimo-transaction/src/test/java/org/apache/geronimo/transaction/manager/TransactionSynchronizationRegistryTest.java
URL: http://svn.apache.org/viewvc/geronimo/components/txmanager/trunk/geronimo-transaction/src/test/java/org/apache/geronimo/transaction/manager/TransactionSynchronizationRegistryTest.java?rev=725403&r1=725402&r2=725403&view=diff
==============================================================================
--- geronimo/components/txmanager/trunk/geronimo-transaction/src/test/java/org/apache/geronimo/transaction/manager/TransactionSynchronizationRegistryTest.java
(original)
+++ geronimo/components/txmanager/trunk/geronimo-transaction/src/test/java/org/apache/geronimo/transaction/manager/TransactionSynchronizationRegistryTest.java
Wed Dec 10 11:46:17 2008
@@ -78,20 +78,25 @@
         assertTrue("interposedSync afterCompletion was not called", interposedSync.getAfterCount()
!= -1);
     }
 
+    private void checkInterposedSyncCalledOnRollback() {
+        assertTrue("interposedSync afterCompletion was not called", interposedSync.getAfterCount()
!= -1);
+    }
+    
     public void testInterposedSynchIsCalledOnRollback() throws Exception {
         setUpInterposedSync();
         tm.rollback();
-        checkInterposedSyncCalled();
+        checkInterposedSyncCalledOnRollback();
     }
     
-    /*public void testNormalSynchIsNotCalledOnRollback() throws Exception {
+    // check normal synch before completion is not called on rollback
+    public void testNormalSynchBeforeCompletion() throws Exception {
     	normalSync = new CountingSync();
     	tm.begin();
     	tm.getTransaction().registerSynchronization(normalSync);
         tm.rollback();
         assertFalse(normalSync.beforeCompletionCalled());
         assertTrue(normalSync.afterCompletionCalled());
-    }*/
+    }
 
     public void testInterposedSynchIsCalledOnMarkRollback() throws Exception {
         setUpInterposedSync();
@@ -126,11 +131,16 @@
         assertTrue("interposedSync beforeCompletion was not called after normalSync beforeCompletion",
interposedSync.getBeforeCount() > normalSync.getBeforeCount());
         assertTrue("interposedSync afterCompletion was not called before normalSync beforeCompletion",
interposedSync.getAfterCount() < normalSync.getAfterCount());
     }
+    
+    private void checkSyncCallOrderOnRollback() {
+        checkInterposedSyncCalledOnRollback();
+        assertTrue("interposedSync afterCompletion was not called before normalSync beforeCompletion",
interposedSync.getAfterCount() < normalSync.getAfterCount());
+    }
 
     public void testSynchCallOrderOnRollback() throws Exception {
         setUpSyncs();
         tm.rollback();
-        checkSyncCallOrder();
+        checkSyncCallOrderOnRollback();
     }
 
     public void testSynchCallOrderOnMarkRollback() throws Exception {
@@ -163,12 +173,12 @@
         private boolean afterCalled = false;
 
         public void beforeCompletion() {
-        	beforeCalled = true;
+            beforeCalled = true;
             beforeCount = beforeCounter++;
         }
 
         public void afterCompletion(int i) {
-        	afterCalled = true;
+            afterCalled = true;
             afterCount = afterCounter++;
         }
 



Mime
View raw message