openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mik...@apache.org
Subject svn commit: r998196 - /openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestTimeoutException.java
Date Fri, 17 Sep 2010 16:48:49 GMT
Author: mikedd
Date: Fri Sep 17 16:48:49 2010
New Revision: 998196

URL: http://svn.apache.org/viewvc?rev=998196&view=rev
Log:
Recover from failed assertion in TestTimeoutException

Modified:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestTimeoutException.java

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestTimeoutException.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestTimeoutException.java?rev=998196&r1=998195&r2=998196&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestTimeoutException.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestTimeoutException.java
Fri Sep 17 16:48:49 2010
@@ -87,11 +87,14 @@ public class TestTimeoutException extend
             fail("Expected " + QueryTimeoutException.class.getName());
         } catch (Throwable t) {
             assertError(t, QueryTimeoutException.class);
+            assertTrue(em2.getTransaction().isActive());
+        }
+        finally { 
+            em1.getTransaction().rollback();
+            em1.close();
+            em2.getTransaction().rollback();
+            em2.close();
         }
-        
-        assertTrue(em2.getTransaction().isActive());
-        em2.getTransaction().rollback();
-        em1.getTransaction().rollback();
     }
     
     public void testLockTimeOutExceptionWhileLockingAlreadyLockedEntities() {
@@ -118,11 +121,13 @@ public class TestTimeoutException extend
             fail("Expected " + PessimisticLockException.class.getName());
         } catch (Throwable t) {
            assertError(t, PessimisticLockException.class);
+           assertTrue(em2.getTransaction().isActive());
+        } finally {
+            em1.getTransaction().rollback();
+            em1.close();
+            em2.getTransaction().rollback();
+            em2.close();
         }
-        assertTrue(em2.getTransaction().isActive());
-        em2.getTransaction().rollback();
-        
-        em1.getTransaction().rollback();
     }
 
     public void testQueryTimeOutExceptionWhileFindWithLocksOnAlreadyLockedEntities() {
@@ -150,11 +155,13 @@ public class TestTimeoutException extend
             fail("Expected " + LockTimeoutException.class.getName());
         } catch (Throwable t) {
             assertError(t, LockTimeoutException.class);
+            assertTrue(em2.getTransaction().isActive());
+        } finally {
+            em1.getTransaction().rollback();
+            em1.close();
+            em2.getTransaction().rollback();
+            em2.close();
         }
-        
-        assertTrue(em2.getTransaction().isActive());
-        em2.getTransaction().rollback();
-        em1.getTransaction().rollback();
     }
     
     public Object createEntity(EntityManager em) {



Mime
View raw message