db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r357680 - in /db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators: ComparisonTests.java Equality.java GreaterThan.java GreaterThanOrEqual.java LessThan.java LessThanOrEqual.java NotEquals.java
Date Mon, 19 Dec 2005 11:07:34 GMT
Author: mbo
Date: Mon Dec 19 03:07:23 2005
New Revision: 357680

URL: http://svn.apache.org/viewcvs?rev=357680&view=rev
Log:
JDO-147: add localSetUp method making sure the database gets cleaned up after test execution.

Modified:
    db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/ComparisonTests.java
    db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/Equality.java
    db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/GreaterThan.java
    db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/GreaterThanOrEqual.java
    db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/LessThan.java
    db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/LessThanOrEqual.java
    db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/NotEquals.java

Modified: db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/ComparisonTests.java
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/ComparisonTests.java?rev=357680&r1=357679&r2=357680&view=diff
==============================================================================
--- db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/ComparisonTests.java
(original)
+++ db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/ComparisonTests.java
Mon Dec 19 03:07:23 2005
@@ -28,7 +28,6 @@
 import org.apache.jdo.tck.pc.fieldtypes.AllTypes;
 
 public abstract class ComparisonTests extends JDO_Test {    
-    protected   PersistenceManager  pm;
     protected   Query               query;
     protected   Transaction         tx;
     protected   Collection          query_result;
@@ -56,42 +55,6 @@
     protected static    String      DateParameter = "java.util.Date value";
     protected static    String      AllTypesParameter = "org.apache.jdo.tck.pc.fieldtypes.AllTypes
value";
     
-    /** */
-    protected void verifyDataLoaded(PersistenceManager pm)
-    {
-        Transaction tx = pm.currentTransaction();
-        int cnt = 0;
-        try {
-        	tx.begin();
-        	Extent e = pm.getExtent(AllTypes.class, false);
-        	Iterator i = e.iterator();
-        	while(i.hasNext()){
-        		Object o = i.next();
-        		cnt++;
-        	}
-        	e.close(i);
-            tx.rollback();
-        
-        	if (cnt == AllTypes.NUM_VALUES)
-        		return;
-        
-        	tx.begin();
-        	i = e.iterator();
-        	while (i.hasNext()) {
-        		Object o = i.next();
-        		pm.deletePersistent(o);
-        	}
-        	e.close(i);
-        	tx.commit();
-        }
-        finally {
-            if ((tx !=null) && tx.isActive())
-                tx.rollback();
-        }
-        AllTypes.load(pm);
-    }
-
-
     /** */
     protected void fail(String assertion, String message, String filter, String parameter)
     {

Modified: db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/Equality.java
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/Equality.java?rev=357680&r1=357679&r2=357680&view=diff
==============================================================================
--- db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/Equality.java (original)
+++ db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/Equality.java Mon
Dec 19 03:07:23 2005
@@ -180,13 +180,8 @@
     /** */
     public void test() {
         pm = getPM();
-
-        verifyDataLoaded(pm);
         tx = pm.currentTransaction();
         runQueries();
-
-        pm.close();
-        pm = null;
     }
 
     /** */
@@ -1283,5 +1278,11 @@
         tx.rollback();
     }
 
-
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        addTearDownClass(AllTypes.class);
+        AllTypes.load(getPM());
+    }
 }

Modified: db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/GreaterThan.java
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/GreaterThan.java?rev=357680&r1=357679&r2=357680&view=diff
==============================================================================
--- db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/GreaterThan.java
(original)
+++ db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/GreaterThan.java
Mon Dec 19 03:07:23 2005
@@ -170,13 +170,8 @@
     /** */
     public void test() {
         pm = getPM();
-
-        verifyDataLoaded(pm);
         tx = pm.currentTransaction();
         runQueries();
-
-        pm.close();
-        pm = null;
     }
 
     /** */
@@ -1190,5 +1185,13 @@
         }
         query.close(query_result);
         tx.rollback();
+    }
+
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        addTearDownClass(AllTypes.class);
+        AllTypes.load(getPM());
     }
 }

Modified: db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/GreaterThanOrEqual.java
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/GreaterThanOrEqual.java?rev=357680&r1=357679&r2=357680&view=diff
==============================================================================
--- db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/GreaterThanOrEqual.java
(original)
+++ db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/GreaterThanOrEqual.java
Mon Dec 19 03:07:23 2005
@@ -169,13 +169,8 @@
     /** */
     public void test() {
         pm = getPM();
-
-        verifyDataLoaded(pm);
         tx = pm.currentTransaction();
         runQueries();
-
-        pm.close();
-        pm = null;
     }
 
     /** */
@@ -1197,4 +1192,11 @@
         tx.rollback();
     }
 
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        addTearDownClass(AllTypes.class);
+        AllTypes.load(getPM());
+    }
 }

Modified: db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/LessThan.java
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/LessThan.java?rev=357680&r1=357679&r2=357680&view=diff
==============================================================================
--- db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/LessThan.java (original)
+++ db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/LessThan.java Mon
Dec 19 03:07:23 2005
@@ -169,13 +169,8 @@
     /** */
     public void test() {
         pm = getPM();
-
-        verifyDataLoaded(pm);
         tx = pm.currentTransaction();
         runQueries();
-
-        pm.close();
-        pm = null;
     }
 
     /** */
@@ -1197,4 +1192,11 @@
         tx.rollback();
     }
 
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        addTearDownClass(AllTypes.class);
+        AllTypes.load(getPM());
+    }
 }

Modified: db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/LessThanOrEqual.java
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/LessThanOrEqual.java?rev=357680&r1=357679&r2=357680&view=diff
==============================================================================
--- db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/LessThanOrEqual.java
(original)
+++ db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/LessThanOrEqual.java
Mon Dec 19 03:07:23 2005
@@ -170,13 +170,8 @@
     /** */
     public void test() {
         pm = getPM();
-
-        verifyDataLoaded(pm);
         tx = pm.currentTransaction();
         runQueries();
-
-        pm.close();
-        pm = null;
     }
 
     /** */
@@ -1203,4 +1198,11 @@
         tx.rollback();
     }
 
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        addTearDownClass(AllTypes.class);
+        AllTypes.load(getPM());
+    }
 }

Modified: db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/NotEquals.java
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/NotEquals.java?rev=357680&r1=357679&r2=357680&view=diff
==============================================================================
--- db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/NotEquals.java (original)
+++ db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/NotEquals.java Mon
Dec 19 03:07:23 2005
@@ -180,13 +180,8 @@
     /** */
     public void test() {
         pm = getPM();
-
-        verifyDataLoaded(pm);
         tx = pm.currentTransaction();
         runQueries();
-
-        pm.close();
-        pm = null;
     }
 
     /** */
@@ -1278,5 +1273,12 @@
         tx.rollback();
     }
 
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        addTearDownClass(AllTypes.class);
+        AllTypes.load(getPM());
+    }
 
 }



Mime
View raw message