db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c..@apache.org
Subject svn commit: r190448 - in /incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/lifecycle: MultiplePMsReturnInstancesRepresentingSamePC.java ObjectIdNotModifiedWhenObjectIdInstanceModified.java PMReturnsIdenticalInstancesForEqualObjIds.java
Date Mon, 13 Jun 2005 17:56:10 GMT
Author: clr
Date: Mon Jun 13 10:56:09 2005
New Revision: 190448

URL: http://svn.apache.org/viewcvs?rev=190448&view=rev
Log:
JDO-47 fixed by Michael Watzek.

Modified:
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/lifecycle/MultiplePMsReturnInstancesRepresentingSamePC.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/lifecycle/ObjectIdNotModifiedWhenObjectIdInstanceModified.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/lifecycle/PMReturnsIdenticalInstancesForEqualObjIds.java

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/lifecycle/MultiplePMsReturnInstancesRepresentingSamePC.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/lifecycle/MultiplePMsReturnInstancesRepresentingSamePC.java?rev=190448&r1=190447&r2=190448&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/lifecycle/MultiplePMsReturnInstancesRepresentingSamePC.java
(original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/lifecycle/MultiplePMsReturnInstancesRepresentingSamePC.java
Mon Jun 13 10:56:09 2005
@@ -78,7 +78,9 @@
 			pm2 = pmf.getPersistenceManager();
 			pm3 = pmf.getPersistenceManager();
 
-			Extent extent = pm.getExtent(StateTransitionObj.class, false);
+            pm.currentTransaction().begin();
+
+            Extent extent = pm.getExtent(StateTransitionObj.class, false);
 			Iterator iter = extent.iterator();
 			if( !iter.hasNext() ){
 				fail(ASSERTION_FAILED,
@@ -110,8 +112,14 @@
 						 "Object Ids are not equal. objId1=" + objId1 + " objId2= " + objId2 + " objId3= "
+ objId3);
 				}
 			}
+            
+            pm.currentTransaction().commit();
 	    }
 	    finally {
+            if (pm!=null && pm.currentTransaction().isActive())
+            {
+                pm.currentTransaction().rollback();
+            }
 	    	if (pm2!=null && !pm2.isClosed())
 	    	{
 	    	    pm2.close();

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/lifecycle/ObjectIdNotModifiedWhenObjectIdInstanceModified.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/lifecycle/ObjectIdNotModifiedWhenObjectIdInstanceModified.java?rev=190448&r1=190447&r2=190448&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/lifecycle/ObjectIdNotModifiedWhenObjectIdInstanceModified.java
(original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/lifecycle/ObjectIdNotModifiedWhenObjectIdInstanceModified.java
Mon Jun 13 10:56:09 2005
@@ -67,23 +67,31 @@
     }
     
 	public void test() throws Exception {
-		Extent extent = pm.getExtent(StateTransitionObj.class, false);
-		Iterator iter = extent.iterator();
-		if( !iter.hasNext() ){
-			fail(ASSERTION_FAILED,
-				 "Extent for StateTransitionObj should not be empty");
-		}
-		extent.close(iter);
-
-		for (int i=0; i<NUM_OBJECTS; i++)
-		{
-			Object objId=pm.getObjectId(obj[i]);
-			mangleObject(objId);
-			Object objId2 = pm.getObjectId(obj[i]); // get another ObjectId copy
-			if (objId.equals(objId2))
-				fail(ASSERTION_FAILED,
-					 "object Id has been changed");
-		}
+        pm.currentTransaction().begin();
+        try {
+    		Extent extent = pm.getExtent(StateTransitionObj.class, false);
+    		Iterator iter = extent.iterator();
+    		if( !iter.hasNext() ){
+    			fail(ASSERTION_FAILED,
+    				 "Extent for StateTransitionObj should not be empty");
+    		}
+    		extent.close(iter);
+    
+    		for (int i=0; i<NUM_OBJECTS; i++)
+    		{
+    			Object objId=pm.getObjectId(obj[i]);
+    			mangleObject(objId);
+    			Object objId2 = pm.getObjectId(obj[i]); // get another ObjectId copy
+    			if (objId.equals(objId2))
+    				fail(ASSERTION_FAILED,
+    					 "object Id has been changed");
+    		}
+            pm.currentTransaction().commit();
+        } finally {
+            if (pm!=null && pm.currentTransaction().isActive()) {
+                pm.currentTransaction().rollback();
+            }
+        }
 	}
 
 	private Object[] generatePersistentInstances()

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/lifecycle/PMReturnsIdenticalInstancesForEqualObjIds.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/lifecycle/PMReturnsIdenticalInstancesForEqualObjIds.java?rev=190448&r1=190447&r2=190448&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/lifecycle/PMReturnsIdenticalInstancesForEqualObjIds.java
(original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/lifecycle/PMReturnsIdenticalInstancesForEqualObjIds.java
Mon Jun 13 10:56:09 2005
@@ -67,25 +67,33 @@
     }
     
 	public void test() {
-    	Extent extent = pm.getExtent(StateTransitionObj.class, false);
-    	Iterator iter = extent.iterator();
-    	if( !iter.hasNext() ){
-    		fail(ASSERTION_FAILED,
-				 "Extent for StateTransitionObj should not be empty");
-    	}
-		extent.close(iter);
-
-		for (int i=0; i<NUM_OBJECTS; i++)
-		{
-			Object objId=pm.getObjectId(obj[i]);
-			// check that getObjectById returns identical instance
-			Object obj2 = pm.getObjectById(objId, true);
-			if (!(obj2==obj[i]))
-			{
-				fail(ASSERTION_FAILED,
-					 "objects with OId = " + objId + " are not identical");
-			}
-		}
+        pm.currentTransaction().begin();
+        try {
+        	Extent extent = pm.getExtent(StateTransitionObj.class, false);
+        	Iterator iter = extent.iterator();
+        	if( !iter.hasNext() ){
+        		fail(ASSERTION_FAILED,
+    				 "Extent for StateTransitionObj should not be empty");
+        	}
+    		extent.close(iter);
+    
+    		for (int i=0; i<NUM_OBJECTS; i++)
+    		{
+    			Object objId=pm.getObjectId(obj[i]);
+    			// check that getObjectById returns identical instance
+    			Object obj2 = pm.getObjectById(objId, true);
+    			if (!(obj2==obj[i]))
+    			{
+    				fail(ASSERTION_FAILED,
+    					 "objects with OId = " + objId + " are not identical");
+    			}
+    		}
+            pm.currentTransaction().commit();
+        } finally {
+            if (pm!=null && pm.currentTransaction().isActive()) {
+                pm.currentTransaction().rollback();
+            }
+        }
 	}
 
 	private Object[] generatePersistentInstances()



Mime
View raw message