db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r452982 - /db/jdo/branches/2.0.1/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteTest.java
Date Wed, 04 Oct 2006 19:12:50 GMT
Author: mbo
Date: Wed Oct  4 12:12:49 2006
New Revision: 452982

URL: http://svn.apache.org/viewvc?view=rev&rev=452982
Log:
JDO-399, JDO-395: merge changes from trunk into branch 2.0.1

Modified:
    db/jdo/branches/2.0.1/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteTest.java

Modified: db/jdo/branches/2.0.1/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteTest.java
URL: http://svn.apache.org/viewvc/db/jdo/branches/2.0.1/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteTest.java?view=diff&rev=452982&r1=452981&r2=452982
==============================================================================
--- db/jdo/branches/2.0.1/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteTest.java
(original)
+++ db/jdo/branches/2.0.1/tck20/src/java/org/apache/jdo/tck/lifecycle/NontransactionalWriteTest.java
Wed Oct  4 12:12:49 2006
@@ -127,16 +127,19 @@
      */
     protected void checkXValue(String location, int expectedXValue) {
         PersistenceManager pmCheck = pmf.getPersistenceManager();
-        pmCheck.currentTransaction().begin();
-        VersionedPCPoint instance = 
+        try {
+            pmCheck.currentTransaction().begin();
+            VersionedPCPoint instance = 
                 (VersionedPCPoint)pmCheck.getObjectById(oid, true);
-        int actualXValue = instance.getX();
-        pmCheck.currentTransaction().commit();
-        cleanupPM(pmCheck);
-        if (expectedXValue != actualXValue) {
-            appendMessage(location + NL + 
-                    "expected: " + expectedXValue + NL +
-                    "  actual: " + actualXValue);
+            int actualXValue = instance.getX();
+            pmCheck.currentTransaction().commit();
+            if (expectedXValue != actualXValue) {
+                appendMessage(location + NL + 
+                              "expected: " + expectedXValue + NL +
+                              "  actual: " + actualXValue);
+            }
+        } finally {
+            cleanupPM(pmCheck);
         }
     }
 
@@ -148,12 +151,16 @@
      */
     protected void conflictingUpdate() {
         PersistenceManager pmConflict = pmf.getPersistenceManager();
-        pmConflict.currentTransaction().setOptimistic(false);
-        VersionedPCPoint instance = 
+        try {
+            pmConflict.currentTransaction().setOptimistic(false);
+            pmConflict.currentTransaction().begin();
+            VersionedPCPoint instance = 
                 (VersionedPCPoint)pmConflict.getObjectById(oid);
-        instance.setX(conflictXValue);
-        pmConflict.currentTransaction().commit();
-        cleanupPM(pmConflict);
+            instance.setX(conflictXValue);
+            pmConflict.currentTransaction().commit();
+        } finally {
+            cleanupPM(pmConflict);
+        }
     }
 
     /** 



Mime
View raw message