db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r396521 - in /db/jdo: branches/2.0/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/ trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/
Date Mon, 24 Apr 2006 11:39:57 GMT
Author: mbo
Date: Mon Apr 24 04:39:55 2006
New Revision: 396521

URL: http://svn.apache.org/viewcvs?rev=396521&view=rev
Log:
JDO-372: cleanup pm2 instances in test case ConcurrentPersistenceManagersSameClasses

Modified:
    db/jdo/branches/2.0/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/ConcurrentPersistenceManagersSameClasses.java
    db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/ConcurrentPersistenceManagersSameClasses.java

Modified: db/jdo/branches/2.0/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/ConcurrentPersistenceManagersSameClasses.java
URL: http://svn.apache.org/viewcvs/db/jdo/branches/2.0/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/ConcurrentPersistenceManagersSameClasses.java?rev=396521&r1=396520&r2=396521&view=diff
==============================================================================
--- db/jdo/branches/2.0/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/ConcurrentPersistenceManagersSameClasses.java
(original)
+++ db/jdo/branches/2.0/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/ConcurrentPersistenceManagersSameClasses.java
Mon Apr 24 04:39:55 2006
@@ -61,11 +61,20 @@
     
     /** */
     public void test() {
-    	Properties pmfProperties = loadPMF2Properties();
+        if (!isBinaryCompatibilitySupported()) {
+            printUnsupportedOptionalFeatureNotTested(
+                "org.apache.jdo.tck.api.persistencemanager.ConcurrentPersistenceManagersSameClasses",

+                "javax.jdo.option.BinaryCompatibility");
+            return;
+        }
+        Properties pmfProperties = loadPMF2Properties();
         PersistenceManagerFactory pmf2 = JDOHelper.getPersistenceManagerFactory(pmfProperties);
         PersistenceManager pm2 = pmf2.getPersistenceManager();
         Transaction tx2 = pm2.currentTransaction();
-        
+        PCPoint p21 = null;
+        PCPoint p22 = null;
+        PCRect rect2 = null;
+
         pm = getPM();
         Transaction tx = pm.currentTransaction();
         try {
@@ -77,9 +86,9 @@
             PCRect rect1 = new PCRect (0, p11, p12);
             pm.makePersistent (rect1);
             
-            PCPoint p21 = new PCPoint(210, 220);
-            PCPoint p22 = new PCPoint(220, 240);
-            PCRect rect2 = new PCRect (0, p21, p22);
+            p21 = new PCPoint(210, 220);
+            p22 = new PCPoint(220, 240);
+            rect2 = new PCRect (0, p21, p22);
             pm2.makePersistent (rect2);
             
             tx.commit();
@@ -108,9 +117,21 @@
         finally {
             cleanupPM(pm);
             pm = null;
-            cleanupPM(pm2);
-            pm2 = null;
-            pmf2.close();
+            try {
+                // delete pm2 instances
+                if (pm2.currentTransaction().isActive()) {
+                    pm2.currentTransaction().rollback();
+                }
+                pm2.currentTransaction().begin();
+                pm2.deletePersistent(rect2);
+                pm2.deletePersistent(p21);
+                pm2.deletePersistent(p22);
+                pm2.currentTransaction().commit();
+            } finally {
+                cleanupPM(pm2);
+                pm2 = null;
+                pmf2.close();
+            }
         }
     }
 

Modified: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/ConcurrentPersistenceManagersSameClasses.java
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/ConcurrentPersistenceManagersSameClasses.java?rev=396521&r1=396520&r2=396521&view=diff
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/ConcurrentPersistenceManagersSameClasses.java
(original)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/api/persistencemanager/ConcurrentPersistenceManagersSameClasses.java
Mon Apr 24 04:39:55 2006
@@ -61,11 +61,20 @@
     
     /** */
     public void test() {
-    	Properties pmfProperties = loadPMF2Properties();
+        if (!isBinaryCompatibilitySupported()) {
+            printUnsupportedOptionalFeatureNotTested(
+                "org.apache.jdo.tck.api.persistencemanager.ConcurrentPersistenceManagersSameClasses",

+                "javax.jdo.option.BinaryCompatibility");
+            return;
+        }
+        Properties pmfProperties = loadPMF2Properties();
         PersistenceManagerFactory pmf2 = JDOHelper.getPersistenceManagerFactory(pmfProperties);
         PersistenceManager pm2 = pmf2.getPersistenceManager();
         Transaction tx2 = pm2.currentTransaction();
-        
+        PCPoint p21 = null;
+        PCPoint p22 = null;
+        PCRect rect2 = null;
+
         pm = getPM();
         Transaction tx = pm.currentTransaction();
         try {
@@ -77,9 +86,9 @@
             PCRect rect1 = new PCRect (0, p11, p12);
             pm.makePersistent (rect1);
             
-            PCPoint p21 = new PCPoint(210, 220);
-            PCPoint p22 = new PCPoint(220, 240);
-            PCRect rect2 = new PCRect (0, p21, p22);
+            p21 = new PCPoint(210, 220);
+            p22 = new PCPoint(220, 240);
+            rect2 = new PCRect (0, p21, p22);
             pm2.makePersistent (rect2);
             
             tx.commit();
@@ -108,9 +117,21 @@
         finally {
             cleanupPM(pm);
             pm = null;
-            cleanupPM(pm2);
-            pm2 = null;
-            pmf2.close();
+            try {
+                // delete pm2 instances
+                if (pm2.currentTransaction().isActive()) {
+                    pm2.currentTransaction().rollback();
+                }
+                pm2.currentTransaction().begin();
+                pm2.deletePersistent(rect2);
+                pm2.deletePersistent(p21);
+                pm2.deletePersistent(p22);
+                pm2.currentTransaction().commit();
+            } finally {
+                cleanupPM(pm2);
+                pm2 = null;
+                pmf2.close();
+            }
         }
     }
 



Mime
View raw message