You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by br...@apache.org on 2005/12/02 17:20:55 UTC

svn commit: r351768 [3/4] - in /incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query: ./ api/ delete/ jdoql/ jdoql/keywords/ jdoql/methods/ jdoql/operators/ jdoql/parameters/ jdoql/variables/ result/ sql/

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/WhiteSpaceIsACharacterAndIgnored.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/WhiteSpaceIsACharacterAndIgnored.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/WhiteSpaceIsACharacterAndIgnored.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/WhiteSpaceIsACharacterAndIgnored.java Fri Dec  2 08:19:42 2005
@@ -16,12 +16,14 @@
  
 package org.apache.jdo.tck.query.jdoql;
 
+import java.util.ArrayList;
 import java.util.Collection;
 
 import javax.jdo.PersistenceManager;
 import javax.jdo.Query;
 import javax.jdo.Transaction;
 
+import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.mylib.PCPoint;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
@@ -56,10 +58,9 @@
     Collection expected = null; 
     
     /** */
-    public void test() {
-        pm = getPM();
+    public void testPositive() {
+        PersistenceManager pm = getPM();
 
-        initDatabase(pm, PCPoint.class);
         initExpectedResult(pm, "x == 0");
 
         // Escape Sequence
@@ -94,6 +95,10 @@
             query.setCandidates(pm.getExtent(PCPoint.class, false));
             query.setFilter(filter);
             expected = (Collection) query.execute();
+            // Create a new collection for the expected result.
+            // This ensures that the expected result may be iterated
+            // outside of the scope of the current transaction.
+            expected = new ArrayList(expected);
 
             tx.commit();
             tx = null;
@@ -130,5 +135,13 @@
             if ((tx != null) && tx.isActive())
                 tx.rollback();
         }
+    }
+
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistPCPoints(getPM());
+        addTearDownClass(PCPoint.class);
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/SingleString.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/SingleString.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/SingleString.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/SingleString.java Fri Dec  2 08:19:42 2005
@@ -78,7 +78,7 @@
     };
             
     /** Parameters of valid queries. */
-    private static Object[][] parameters = {
+    private Object[][] parameters = {
         {new BigDecimal("2000")}
     };
             
@@ -105,7 +105,7 @@
      * @see JDO_Test#localSetUp()
      */
     protected void localSetUp() {
-        loadCompanyModel(getPM(), COMPANY_TESTDATA);
+        loadAndPersistCompanyModel(getPM());
         addTearDownClass(CompanyModelReader.getTearDownClasses());
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/ThisIsReservedWordForElementOfCollection.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/ThisIsReservedWordForElementOfCollection.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/ThisIsReservedWordForElementOfCollection.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/ThisIsReservedWordForElementOfCollection.java Fri Dec  2 08:19:42 2005
@@ -17,9 +17,11 @@
 package org.apache.jdo.tck.query.jdoql.keywords;
 
 import java.util.Collection;
+
 import javax.jdo.PersistenceManager;
 import javax.jdo.Transaction;
 
+import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
@@ -52,22 +54,8 @@
     }
     
     /** */
-    public void test() {
-        pm = getPM();
-        
-        try {
-            loadPrimitiveTypes(pm);
-            runTest(pm);
-        }
-        finally {
-            cleanupDatabase(pm, PrimitiveTypes.class);
-            pm.close();
-            pm = null;
-        }
-    }
-    
-    /** */
-    void runTest(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         Transaction tx = pm.currentTransaction();
         tx.begin();
 
@@ -83,5 +71,13 @@
         runParameterPrimitiveTypesQuery(
             "this.intNotNull == intNotNull", "int intNotNull", new Integer(9), 
             pm, instance9, ASSERTION_FAILED);
+    }
+
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistPrimitiveTypes(getPM());
+        addTearDownClass(PrimitiveTypes.class);
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/UseOfThisToAcessHiddenField.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/UseOfThisToAcessHiddenField.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/UseOfThisToAcessHiddenField.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/UseOfThisToAcessHiddenField.java Fri Dec  2 08:19:42 2005
@@ -23,6 +23,7 @@
 import javax.jdo.Query;
 import javax.jdo.Transaction;
 
+import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.mylib.PCPoint;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
@@ -54,15 +55,11 @@
     }
 
     /** */
-    public void test() {
-        pm = getPM();
+    public void testPositve() {
+        PersistenceManager pm = getPM();
 
-        initDatabase(pm, PCPoint.class);
         runTestUseOfThisToAcessHiddenField01(pm);
         runTestUseOfThisToAcessHiddenField02(pm);
-        
-        pm.close();
-        pm = null;
     }
 
     /** */
@@ -133,6 +130,14 @@
             if ((tx != null) && tx.isActive())
                 tx.rollback();
         }
+    }
+
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistPCPoints(getPM());
+        addTearDownClass(PCPoint.class);
     }
 }
 

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/MethodsAndObjectConstructionNotSupported.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/MethodsAndObjectConstructionNotSupported.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/MethodsAndObjectConstructionNotSupported.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/MethodsAndObjectConstructionNotSupported.java Fri Dec  2 08:19:42 2005
@@ -21,6 +21,7 @@
 import javax.jdo.PersistenceManager;
 import javax.jdo.Query;
 
+import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.mylib.PCPoint;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
@@ -52,16 +53,12 @@
     }
 
     /** */
-    public void test() {
-        pm = getPM();
+    public void testNegative() {
+        PersistenceManager pm = getPM();
 
-        initDatabase(pm, PCPoint.class);
         runTestUnsupportedOperators01(pm, "this.getX() == 1");
         runTestUnsupportedOperators01(pm, "y.intValue() == 1");
         runTestUnsupportedOperators01(pm, "y == new Integer(1)");
-        
-        pm.close();
-        pm = null;
     }
 
     /** */

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/StartsWithAndEndsWith.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/StartsWithAndEndsWith.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/StartsWithAndEndsWith.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/StartsWithAndEndsWith.java Fri Dec  2 08:19:42 2005
@@ -16,15 +16,10 @@
 
 package org.apache.jdo.tck.query.jdoql.methods;
 
-import java.util.Collection;
-import java.util.HashSet;
-
-import javax.jdo.PersistenceManager;
-import javax.jdo.Query;
-import javax.jdo.Transaction;
-
-import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.company.CompanyModelReader;
+import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.query.QueryElementHolder;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
 
@@ -49,6 +44,53 @@
     private static final String ASSERTION_FAILED = 
         "Assertion A14.6.2-33 (StartsWithAndEndsWith) failed: ";
     
+    /** 
+     * The array of valid queries which may be executed as 
+     * single string queries and as API queries.
+     */
+    private static final QueryElementHolder[] VALID_QUERIES = {
+        // startsWith
+        new QueryElementHolder(
+        /*UNIQUE*/      null,
+        /*RESULT*/      null,
+        /*INTO*/        null, 
+        /*FROM*/        Employee.class,
+        /*EXCLUDE*/     null,
+        /*WHERE*/       "firstname.startsWith(\"emp1\")",
+        /*VARIABLES*/   null,
+        /*PARAMETERS*/  null,
+        /*IMPORTS*/     null,
+        /*GROUP BY*/    null,
+        /*ORDER BY*/    null,
+        /*FROM*/        null,
+        /*TO*/          null),
+        // endsWith
+        new QueryElementHolder(
+        /*UNIQUE*/      null,
+        /*RESULT*/      null,
+        /*INTO*/        null, 
+        /*FROM*/        Employee.class,
+        /*EXCLUDE*/     null,
+        /*WHERE*/       "firstname.endsWith(\"1First\")",
+        /*VARIABLES*/   null,
+        /*PARAMETERS*/  null,
+        /*IMPORTS*/     null,
+        /*GROUP BY*/    null,
+        /*ORDER BY*/    null,
+        /*FROM*/        null,
+        /*TO*/          null)
+    };
+    
+    /** 
+     * The expected results of valid queries.
+     */
+    private Object[] expectedResult = {
+        // startsWith
+        getTransientCompanyModelInstancesAsList(new String[]{"emp1"}),
+        // endsWith
+        getTransientCompanyModelInstancesAsList(new String[]{"emp1"})
+    };
+    
     /**
      * The <code>main</code> is called when the class
      * is directly executed from the command line.
@@ -59,44 +101,20 @@
     }
     
     /** */
-    public void test() {
-        pm = getPM();
-                
-        try {
-            // read test data
-            CompanyModelReader reader = loadCompanyModel(pm, COMPANY_TESTDATA);
-            runTest(pm, reader);
-        }
-        finally {
-            cleanupCompanyModel(pm);
-            pm.close();
-            pm = null;
+    public void testPositive() {
+        for (int i = 0; i < VALID_QUERIES.length; i++) {
+            executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
+                    expectedResult[i]);
+            executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
+                    expectedResult[i]);
         }
     }
     
-     /** */
-    void runTest(PersistenceManager pm, CompanyModelReader reader) {
-        Query q;
-        Object result;
-        Collection expected;
-        
-        Transaction tx = pm.currentTransaction();
-        tx.begin();
-
-        // startsWith
-        q = pm.newQuery(Employee.class, "firstname.startsWith(\"emp1\")");
-        result = q.execute();
-        expected = new HashSet();
-        expected.add(reader.getFullTimeEmployee("emp1"));
-        checkQueryResultWithoutOrder(ASSERTION_FAILED, result, expected);
-            
-        // endsWith
-        q = pm.newQuery(Employee.class, "firstname.endsWith(\"1First\")");
-        result = q.execute();
-        expected = new HashSet();
-        expected.add(reader.getFullTimeEmployee("emp1"));
-        checkQueryResultWithoutOrder(ASSERTION_FAILED, result, expected);
-            
-        tx.commit();
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistCompanyModel(getPM());
+        addTearDownClass(CompanyModelReader.getTearDownClasses());
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/SupportedCollectionMethods.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/SupportedCollectionMethods.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/SupportedCollectionMethods.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/SupportedCollectionMethods.java Fri Dec  2 08:19:42 2005
@@ -137,16 +137,16 @@
      */
     private Object[] expectedResult = {
         // contains(VARIABLE)
-        getCompanyModelInstancesAsList(new String[]{"dept1"}),
+        getTransientCompanyModelInstancesAsList(new String[]{"dept1"}),
         // contains(PARAMETER)
-        getCompanyModelInstancesAsList(new String[]{"dept1"}),
+        getTransientCompanyModelInstancesAsList(new String[]{"dept1"}),
         // !isEmpty
-        getCompanyModelInstancesAsList(new String[]{"dept1", "dept2"}),
+        getTransientCompanyModelInstancesAsList(new String[]{"dept1", "dept2"}),
         // isEmpty
-        getCompanyModelInstancesAsList(new String[]{
+        getTransientCompanyModelInstancesAsList(new String[]{
                 "emp1", "emp3", "emp4", "emp5"}),
         // size
-        getCompanyModelInstancesAsList(new String[]{"dept1"})
+        getTransientCompanyModelInstancesAsList(new String[]{"dept1"})
     };
             
     /**
@@ -198,7 +198,7 @@
      * @see JDO_Test#localSetUp()
      */
     protected void localSetUp() {
-        loadCompanyModel(getPM(), COMPANY_TESTDATA);
+        loadAndPersistCompanyModel(getPM());
         addTearDownClass(CompanyModelReader.getTearDownClasses());
     }
     

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/SupportedJDOHelperMethods.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/SupportedJDOHelperMethods.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/SupportedJDOHelperMethods.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/SupportedJDOHelperMethods.java Fri Dec  2 08:19:42 2005
@@ -124,7 +124,7 @@
      * @see JDO_Test#localSetUp()
      */
     protected void localSetUp() {
-        loadCompanyModel(getPM(), COMPANY_TESTDATA);
+        loadAndPersistCompanyModel(getPM());
         addTearDownClass(CompanyModelReader.getTearDownClasses());
     }
 

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/SupportedMapMethods.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/SupportedMapMethods.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/SupportedMapMethods.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/SupportedMapMethods.java Fri Dec  2 08:19:42 2005
@@ -135,16 +135,16 @@
      */
     private Object[] expectedResult = {
         // get
-        getCompanyModelInstancesAsList(new String[]{"emp1"}),
+        getTransientCompanyModelInstancesAsList(new String[]{"emp1"}),
         // containsKey
-        getCompanyModelInstancesAsList(new String[]{
+        getTransientCompanyModelInstancesAsList(new String[]{
                 "emp1", "emp2", "emp3", "emp4", "emp5"}),
         // containsValue
-        getCompanyModelInstancesAsList(new String[]{"emp1"}),
+        getTransientCompanyModelInstancesAsList(new String[]{"emp1"}),
         // isEmpty
         new ArrayList(),
         // size
-        getCompanyModelInstancesAsList(new String[]{
+        getTransientCompanyModelInstancesAsList(new String[]{
                 "emp1", "emp2", "emp3", "emp4", "emp5"})
     };
             
@@ -206,7 +206,7 @@
      * @see JDO_Test#localSetUp()
      */
     protected void localSetUp() {
-        loadCompanyModel(getPM(), COMPANY_TESTDATA);
+        loadAndPersistCompanyModel(getPM());
         addTearDownClass(CompanyModelReader.getTearDownClasses());
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/SupportedMathMethods.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/SupportedMathMethods.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/SupportedMathMethods.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/SupportedMathMethods.java Fri Dec  2 08:19:42 2005
@@ -243,41 +243,41 @@
      * The expected results of valid queries testing Math.abs.
      */
     private Object[] expectedResultABS = {
-            getMylibInstancesAsList(new String[]{
+            getTransientMylibInstancesAsList(new String[]{
                     "primitiveTypesPositive", "primitiveTypesNegative"}),
-            getMylibInstancesAsList(new String[]{
+            getTransientMylibInstancesAsList(new String[]{
                     "primitiveTypesPositive", "primitiveTypesNegative"}),
-            getMylibInstancesAsList(new String[]{
+            getTransientMylibInstancesAsList(new String[]{
                     "primitiveTypesPositive", "primitiveTypesNegative"}),
-            getMylibInstancesAsList(new String[]{
+            getTransientMylibInstancesAsList(new String[]{
                     "primitiveTypesPositive", "primitiveTypesNegative"}),
-            getMylibInstancesAsList(new String[]{
+            getTransientMylibInstancesAsList(new String[]{
                     "primitiveTypesPositive", "primitiveTypesNegative"}),
-            getMylibInstancesAsList(new String[]{
+            getTransientMylibInstancesAsList(new String[]{
                     "primitiveTypesPositive", "primitiveTypesNegative"}),
-            getMylibInstancesAsList(new String[]{
+            getTransientMylibInstancesAsList(new String[]{
                     "primitiveTypesPositive", "primitiveTypesNegative"}),
-            getMylibInstancesAsList(new String[]{
+            getTransientMylibInstancesAsList(new String[]{
                     "primitiveTypesPositive", "primitiveTypesNegative"})
     };
         
     /** The expected results of valid queries testing Math.sqrt. */
     private Object[] expectedResultSQRT = {
-            getMylibInstancesAsList(new String[]{
+            getTransientMylibInstancesAsList(new String[]{
                     "primitiveTypesPositive"}),
-            getMylibInstancesAsList(new String[]{
+            getTransientMylibInstancesAsList(new String[]{
                     "primitiveTypesPositive"}),
-            getMylibInstancesAsList(new String[]{
+            getTransientMylibInstancesAsList(new String[]{
                     "primitiveTypesPositive"}),
-            getMylibInstancesAsList(new String[]{
+            getTransientMylibInstancesAsList(new String[]{
                     "primitiveTypesPositive"}),
-            getMylibInstancesAsList(new String[]{
+            getTransientMylibInstancesAsList(new String[]{
                     "primitiveTypesPositive"}),
-            getMylibInstancesAsList(new String[]{
+            getTransientMylibInstancesAsList(new String[]{
                     "primitiveTypesPositive"}),
-            getMylibInstancesAsList(new String[]{
+            getTransientMylibInstancesAsList(new String[]{
                     "primitiveTypesPositive"}),
-            getMylibInstancesAsList(new String[]{
+            getTransientMylibInstancesAsList(new String[]{
                     "primitiveTypesPositive"})
     };
             
@@ -314,7 +314,7 @@
      * @see JDO_Test#localSetUp()
      */
     protected void localSetUp() {
-        loadMylib(getPM(), MYLIB_TESTDATA);
+        loadAndPersistMylib(getPM());
         addTearDownClass(MylibReader.getTearDownClasses());
     }
 

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/SupportedStringMethods.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/SupportedStringMethods.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/SupportedStringMethods.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/SupportedStringMethods.java Fri Dec  2 08:19:42 2005
@@ -216,22 +216,22 @@
      * The expected results of valid queries.
      */
     private Object[] expectedResult = {
-        getCompanyModelInstancesAsList(new String[]{"emp1"}),
-        getCompanyModelInstancesAsList(new String[]{"emp1"}),
-        getCompanyModelInstancesAsList(new String[]{"dept1"}),
-        getCompanyModelInstancesAsList(new String[]{"dept1"}),
-        getCompanyModelInstancesAsList(new String[]{
+        getTransientCompanyModelInstancesAsList(new String[]{"emp1"}),
+        getTransientCompanyModelInstancesAsList(new String[]{"emp1"}),
+        getTransientCompanyModelInstancesAsList(new String[]{"dept1"}),
+        getTransientCompanyModelInstancesAsList(new String[]{"dept1"}),
+        getTransientCompanyModelInstancesAsList(new String[]{
                 "emp1", "emp2", "emp3", "emp4", "emp5"}),
-        getCompanyModelInstancesAsList(new String[]{
+        getTransientCompanyModelInstancesAsList(new String[]{
                 "emp1", "emp2", "emp3", "emp4", "emp5"}),
-        getCompanyModelInstancesAsList(new String[]{"emp1"}),
-        getCompanyModelInstancesAsList(new String[]{
+        getTransientCompanyModelInstancesAsList(new String[]{"emp1"}),
+        getTransientCompanyModelInstancesAsList(new String[]{
                 "emp1", "emp2", "emp3", "emp4", "emp5"}),
-        getCompanyModelInstancesAsList(new String[]{
+        getTransientCompanyModelInstancesAsList(new String[]{
                 "emp1", "emp2", "emp3", "emp4", "emp5"}),
-        getCompanyModelInstancesAsList(new String[]{
+        getTransientCompanyModelInstancesAsList(new String[]{
                 "emp1", "emp2", "emp3", "emp4", "emp5"}),
-        getCompanyModelInstancesAsList(new String[]{
+        getTransientCompanyModelInstancesAsList(new String[]{
                 "emp1", "emp2", "emp3", "emp4", "emp5"})
     };
             
@@ -304,7 +304,7 @@
      * @see JDO_Test#localSetUp()
      */
     protected void localSetUp() {
-        loadCompanyModel(getPM(), COMPANY_TESTDATA);
+        loadAndPersistCompanyModel(getPM());
         addTearDownClass(CompanyModelReader.getTearDownClasses());
     }
 

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/BinaryAddition.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/BinaryAddition.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/BinaryAddition.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/BinaryAddition.java Fri Dec  2 08:19:42 2005
@@ -21,6 +21,7 @@
 import javax.jdo.PersistenceManager;
 import javax.jdo.Transaction;
 
+import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
@@ -57,22 +58,8 @@
     }
 
     /** */
-    public void test() {
-        pm = getPM();
-
-        try {
-            loadPrimitiveTypes(pm);
-            runTest(pm);
-        }
-        finally {
-            cleanupDatabase(pm, PrimitiveTypes.class);
-            pm.close();
-            pm = null;
-        }
-    }
-
-    /** */
-    void runTest(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         if (debug) logger.debug("\nExecuting test BinaryAddition() ...");
 
         Transaction tx = pm.currentTransaction();
@@ -120,6 +107,14 @@
                                      pm, allOddInstances, ASSERTION_FAILED);
 
         tx.commit();
+    }
+
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistPrimitiveTypes(getPM());
+        addTearDownClass(PrimitiveTypes.class);
     }
 }
 

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/BinarySubtraction.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/BinarySubtraction.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/BinarySubtraction.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/BinarySubtraction.java Fri Dec  2 08:19:42 2005
@@ -21,6 +21,7 @@
 import javax.jdo.PersistenceManager;
 import javax.jdo.Transaction;
 
+import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
@@ -63,22 +64,8 @@
     }
     
     /** */
-    public void test() {
-        pm = getPM();
-
-        try {
-            loadPrimitiveTypes(pm);
-            runTest(pm);
-        }
-        finally {
-            cleanupDatabase(pm, PrimitiveTypes.class);
-            pm.close();
-            pm = null;
-        }
-    }
-
-    /** */
-    void runTest(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         if (debug) logger.debug("\nExecuting test BinarySubtraction() ...");
 
         Transaction tx = pm.currentTransaction();
@@ -126,5 +113,13 @@
                                      pm, allOddInstances, ASSERTION_FAILED);
 
         tx.commit();
+    }
+
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistPrimitiveTypes(getPM());
+        addTearDownClass(PrimitiveTypes.class);
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/BitwiseComplement.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/BitwiseComplement.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/BitwiseComplement.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/BitwiseComplement.java Fri Dec  2 08:19:42 2005
@@ -21,6 +21,7 @@
 import javax.jdo.PersistenceManager;
 import javax.jdo.Transaction;
 
+import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
@@ -57,22 +58,8 @@
     }
     
     /** */
-    public void test() {
-        pm = getPM();
-
-        try {
-            loadPrimitiveTypes(pm);
-            runTest(pm);
-        }
-        finally {
-            cleanupDatabase(pm, PrimitiveTypes.class);
-            pm.close();
-            pm = null;
-        }
-    }
-    
-    /** */
-    void runTest(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         Transaction tx = pm.currentTransaction();
         tx.begin();
         
@@ -107,5 +94,13 @@
                                      pm, allOddInstances, ASSERTION_FAILED);
         
         tx.commit();
+    }
+
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistPrimitiveTypes(getPM());
+        addTearDownClass(PrimitiveTypes.class);
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/BooleanLogicalAND.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/BooleanLogicalAND.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/BooleanLogicalAND.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/BooleanLogicalAND.java Fri Dec  2 08:19:42 2005
@@ -24,8 +24,9 @@
 import javax.jdo.Query;
 import javax.jdo.Transaction;
 
-import org.apache.jdo.tck.query.QueryTest;
+import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
+import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
 
 /**
@@ -60,32 +61,8 @@
     }
     
     /** */
-    public void test() {
-        pm = getPM();
-        
-        try {
-            loadPrimitiveTypes(pm);
-            runPositiveTest(pm);
-        }
-        finally {
-            cleanupDatabase(pm, PrimitiveTypes.class);
-            pm.close();
-            pm = null;
-        }
-    }
-
-    /** */
-    public void testBitwiseAND() {
-        pm = getPM();
-        
-        runNegativeTest(pm);
-        
-        pm.close();
-        pm = null;
-    }
-    
-    /** */
-    void runPositiveTest(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         if (debug) logger.debug("\nExecuting positive test BooleanLogicalAND() ...");
 
         Transaction tx = pm.currentTransaction();
@@ -149,7 +126,8 @@
     }
 
     /** */
-    void runNegativeTest(PersistenceManager pm) {
+    public void testNegative() {
+        PersistenceManager pm = getPM();
         if (debug) logger.debug("\nExecuting positive test BooleanLogicalAND() ...");
 
         Transaction tx = pm.currentTransaction();
@@ -170,5 +148,12 @@
         }
         tx.commit();
     }
-    
+
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistPrimitiveTypes(getPM());
+        addTearDownClass(PrimitiveTypes.class);
+    }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/BooleanLogicalOR.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/BooleanLogicalOR.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/BooleanLogicalOR.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/BooleanLogicalOR.java Fri Dec  2 08:19:42 2005
@@ -24,8 +24,9 @@
 import javax.jdo.Query;
 import javax.jdo.Transaction;
 
-import org.apache.jdo.tck.query.QueryTest;
+import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
+import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
 
 /**
@@ -58,34 +59,9 @@
     public static void main(String[] args) {
         BatchTestRunner.run(BooleanLogicalOR.class);
     }
-    
-    /** */
-    public void test() {
-        pm = getPM();
-        
-        try {
-            loadPrimitiveTypes(pm);
-            runPositiveTest(pm);
-        }
-        finally {
-            cleanupDatabase(pm, PrimitiveTypes.class);
-            pm.close();
-            pm = null;
-        }
-    }
-    
-    /** */
-    public void testBitwiseAND() {
-        pm = getPM();
-        
-        runNegativeTest(pm);
-        
-        pm.close();
-        pm = null;
-    }
-    
     /** */
-    void runPositiveTest(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         if (debug) logger.debug("\nExecuting positive test BooleanLogicalOR() ...");
 
         Transaction tx = pm.currentTransaction();
@@ -152,7 +128,8 @@
     }
 
     /** */
-    void runNegativeTest(PersistenceManager pm) {
+    public void testNegative() {
+        PersistenceManager pm = getPM();
         if (debug) logger.debug("\nExecuting positive test BooleanLogicalAND() ...");
 
         Transaction tx = pm.currentTransaction();
@@ -173,6 +150,13 @@
         }
         tx.commit();
     }
-    
+
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistPrimitiveTypes(getPM());
+        addTearDownClass(PrimitiveTypes.class);
+    }
 }
 

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/ConditionalAND.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/ConditionalAND.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/ConditionalAND.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/ConditionalAND.java Fri Dec  2 08:19:42 2005
@@ -22,8 +22,9 @@
 import javax.jdo.PersistenceManager;
 import javax.jdo.Transaction;
 
-import org.apache.jdo.tck.query.QueryTest;
+import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
+import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
 
 /**
@@ -58,23 +59,9 @@
     }
     
     
-    /** */
-    public void test() {
-        pm = getPM();
-        
-        try {
-            loadPrimitiveTypes(pm);
-            runTest(pm);
-        }
-        finally {
-            cleanupDatabase(pm, PrimitiveTypes.class);
-            pm.close();
-            pm = null;
-        }
-    }
-    
    /** */
-    void runTest(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         if (debug) logger.debug("\nExecuting test ConditionalAND() ...");
 
         Transaction tx = pm.currentTransaction();
@@ -135,5 +122,13 @@
                                         pm, empty, ASSERTION_FAILED);
 
         tx.commit();
+    }
+
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistPrimitiveTypes(getPM());
+        addTearDownClass(PrimitiveTypes.class);
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/ConditionalOR.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/ConditionalOR.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/ConditionalOR.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/ConditionalOR.java Fri Dec  2 08:19:42 2005
@@ -18,11 +18,13 @@
 
 import java.util.Collection;
 import java.util.HashSet;
+
 import javax.jdo.PersistenceManager;
 import javax.jdo.Transaction;
 
-import org.apache.jdo.tck.query.QueryTest;
+import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
+import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
 
 /**
@@ -56,22 +58,8 @@
     }
     
     /** */
-    public void test() {
-        pm = getPM();
-        
-        try {
-            loadPrimitiveTypes(pm);
-            runTest(pm);
-        }
-        finally {
-            cleanupDatabase(pm, PrimitiveTypes.class);
-            pm.close();
-            pm = null;
-        }
-    }
-    
-    /** */
-    void runTest(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         if (debug) logger.debug("\nExecuting test ConditionalOR() ...");
 
         Transaction tx = pm.currentTransaction();
@@ -135,5 +123,13 @@
                                         "boolean param", Boolean.FALSE,
                                         pm, instance9, ASSERTION_FAILED);
         tx.commit();
+    }
+
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistPrimitiveTypes(getPM());
+        addTearDownClass(PrimitiveTypes.class);
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/Division.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/Division.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/Division.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/Division.java Fri Dec  2 08:19:42 2005
@@ -22,6 +22,7 @@
 import javax.jdo.PersistenceManager;
 import javax.jdo.Transaction;
 
+import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
@@ -63,22 +64,8 @@
     }
     
     /** */
-    public void test() {
-        pm = getPM();
-
-        try {
-            loadPrimitiveTypes(pm);
-            runTest(pm);
-        }
-        finally {
-            cleanupDatabase(pm, PrimitiveTypes.class);
-            pm.close();
-            pm = null;
-        }
-    }
-
-    /** */
-    void runTest(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         if (debug) logger.debug("\nExecuting test Division() ...");
 
         Transaction tx = pm.currentTransaction();
@@ -127,5 +114,13 @@
                                      pm, instances8And9, ASSERTION_FAILED);
 
         tx.commit();
+    }
+
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistPrimitiveTypes(getPM());
+        addTearDownClass(PrimitiveTypes.class);
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/EqualityAndComparisonsBetweenDateFieldsAndParameters.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/EqualityAndComparisonsBetweenDateFieldsAndParameters.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/EqualityAndComparisonsBetweenDateFieldsAndParameters.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/EqualityAndComparisonsBetweenDateFieldsAndParameters.java Fri Dec  2 08:19:42 2005
@@ -17,19 +17,15 @@
 package org.apache.jdo.tck.query.jdoql.operators;
 
 import java.util.Calendar;
-import java.util.Collection;
 import java.util.Date;
 import java.util.GregorianCalendar;
-import java.util.HashSet;
 import java.util.TimeZone;
 
-import javax.jdo.PersistenceManager;
-import javax.jdo.Query;
-import javax.jdo.Transaction;
-
-import org.apache.jdo.tck.query.QueryTest;
-import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.company.CompanyModelReader;
+import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.query.QueryElementHolder;
+import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
 
 /**
@@ -51,9 +47,73 @@
     private static final String ASSERTION_FAILED = 
         "Assertion A14.6.2-4 (EqualityAndComparisonsBetweenDateFieldsAndParameters) failed: ";
 
+    /** 
+     * The array of valid queries which may be executed as 
+     * single string queries and as API queries.
+     */
+    private static final QueryElementHolder[] VALID_QUERIES = {
+        // date field == date parameter
+        new QueryElementHolder(
+        /*UNIQUE*/      null,
+        /*RESULT*/      null,
+        /*INTO*/        null, 
+        /*FROM*/        Employee.class,
+        /*EXCLUDE*/     null,
+        /*WHERE*/       "hiredate == param",
+        /*VARIABLES*/   null,
+        /*PARAMETERS*/  "java.util.Date param",
+        /*IMPORTS*/     null,
+        /*GROUP BY*/    null,
+        /*ORDER BY*/    null,
+        /*FROM*/        null,
+        /*TO*/          null),
+        // date field >= date parameter
+        new QueryElementHolder(
+        /*UNIQUE*/      null,
+        /*RESULT*/      null,
+        /*INTO*/        null, 
+        /*FROM*/        Employee.class,
+        /*EXCLUDE*/     null,
+        /*WHERE*/       "hiredate >= param",
+        /*VARIABLES*/   null,
+        /*PARAMETERS*/  "java.util.Date param",
+        /*IMPORTS*/     null,
+        /*GROUP BY*/    null,
+        /*ORDER BY*/    null,
+        /*FROM*/        null,
+        /*TO*/          null),
+        // date field >= date parameter
+        new QueryElementHolder(
+        /*UNIQUE*/      null,
+        /*RESULT*/      null,
+        /*INTO*/        null, 
+        /*FROM*/        Employee.class,
+        /*EXCLUDE*/     null,
+        /*WHERE*/       "param < birthdate",
+        /*VARIABLES*/   null,
+        /*PARAMETERS*/  "java.util.Date param",
+        /*IMPORTS*/     null,
+        /*GROUP BY*/    null,
+        /*ORDER BY*/    null,
+        /*FROM*/        null,
+        /*TO*/          null),
+    };
+    
+    /** 
+     * The expected results of valid queries.
+     */
+    private Object[] expectedResult = {
+        // date field == date parameter
+        getTransientCompanyModelInstancesAsList(new String[]{"emp1"}),
+        // date field >= date parameter
+        getTransientCompanyModelInstancesAsList(new String[]{
+                "emp1", "emp2", "emp3", "emp4"}),
+        // date field >= date parameter
+        getTransientCompanyModelInstancesAsList(new String[]{})
+    };
+    
     /** */
     private static final Date FIRST_OF_JAN_1999;
-
     static {
         // initialize static field FIRST_OF_JAN_1999
         Calendar cal = new GregorianCalendar(
@@ -63,6 +123,16 @@
         FIRST_OF_JAN_1999 = cal.getTime();
     }
     
+    /** Parameters of valid queries. */
+    private Object[][] parameters = {
+        // date field == date parameter
+        {FIRST_OF_JAN_1999},
+        // date field >= date parameter
+        {FIRST_OF_JAN_1999},
+        // date field >= date parameter
+        {FIRST_OF_JAN_1999}
+    };
+            
     /**
      * The <code>main</code> is called when the class
      * is directly executed from the command line.
@@ -73,57 +143,20 @@
     }
     
     /** */
-    public void test() {
-        pm = getPM();
-        
-        try {
-            // read test data
-            CompanyModelReader reader = loadCompanyModel(pm, COMPANY_TESTDATA);
-            runTest(pm, reader);
-        }
-        finally {
-            cleanupCompanyModel(pm);
-            pm.close();
-            pm = null;
+    public void testPositive() {
+        for (int i = 0; i < VALID_QUERIES.length; i++) {
+            executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
+                    parameters[i], expectedResult[i]);
+            executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
+                    parameters[i], expectedResult[i]);
         }
     }
     
-    /** */
-    void runTest(PersistenceManager pm, CompanyModelReader reader) {
-        Query q;
-        Object result;
-        Collection expected;
-        
-        Transaction tx = pm.currentTransaction();
-        tx.begin();
-
-        // date field == date parameter
-        q = pm.newQuery(Employee.class, "hiredate == param");
-        q.declareParameters("java.util.Date param");
-        result = q.execute(FIRST_OF_JAN_1999);
-        expected = new HashSet();
-        expected.add(reader.getFullTimeEmployee("emp1"));
-        checkQueryResultWithoutOrder(ASSERTION_FAILED, result, expected);
-            
-        // date field >= date parameter
-        q = pm.newQuery(Employee.class, "hiredate >= param");
-        q.declareParameters("java.util.Date param");
-        result = q.execute(FIRST_OF_JAN_1999);
-        expected = new HashSet();
-        expected.add(reader.getFullTimeEmployee("emp1"));
-        expected.add(reader.getFullTimeEmployee("emp2"));
-        expected.add(reader.getPartTimeEmployee("emp3"));
-        expected.add(reader.getPartTimeEmployee("emp4"));
-        checkQueryResultWithoutOrder(ASSERTION_FAILED, result, expected);
-            
-        // date parameter < date field
-        q = pm.newQuery(Employee.class, "param < birthdate");
-        q.declareParameters("java.util.Date param");
-        result = q.execute(FIRST_OF_JAN_1999);
-        expected = new HashSet();
-        checkQueryResultWithoutOrder(ASSERTION_FAILED, result, expected);
-
-        tx.commit();
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistCompanyModel(getPM());
+        addTearDownClass(CompanyModelReader.getTearDownClasses());
     }
-        
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/EqualityAndComparisonsBetweenPrimitivesAndWrapperInstances.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/EqualityAndComparisonsBetweenPrimitivesAndWrapperInstances.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/EqualityAndComparisonsBetweenPrimitivesAndWrapperInstances.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/EqualityAndComparisonsBetweenPrimitivesAndWrapperInstances.java Fri Dec  2 08:19:42 2005
@@ -22,8 +22,9 @@
 import javax.jdo.PersistenceManager;
 import javax.jdo.Transaction;
 
-import org.apache.jdo.tck.query.QueryTest;
+import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
+import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
 
 /**
@@ -56,22 +57,8 @@
     }
 
     /** */
-    public void test() {
-        pm = getPM();
-
-        try {
-            loadPrimitiveTypes(pm);
-            runTest(pm);
-        }
-        finally {
-            cleanupDatabase(pm, PrimitiveTypes.class);
-            pm.close();
-            pm = null;
-        }
-    }
-    
-    /** */
-    void runTest(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         Transaction tx = pm.currentTransaction();
         tx.begin();
 
@@ -107,5 +94,13 @@
                                      pm, allInstances, ASSERTION_FAILED); 
         
         tx.commit();
+    }
+
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistPrimitiveTypes(getPM());
+        addTearDownClass(PrimitiveTypes.class);
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/EqualityAndComparisonsBetweenStringFieldsAndParameters.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/EqualityAndComparisonsBetweenStringFieldsAndParameters.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/EqualityAndComparisonsBetweenStringFieldsAndParameters.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/EqualityAndComparisonsBetweenStringFieldsAndParameters.java Fri Dec  2 08:19:42 2005
@@ -16,16 +16,11 @@
 
 package org.apache.jdo.tck.query.jdoql.operators;
 
-import java.util.Collection;
-import java.util.HashSet;
-
-import javax.jdo.PersistenceManager;
-import javax.jdo.Query;
-import javax.jdo.Transaction;
-
-import org.apache.jdo.tck.query.QueryTest;
-import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.company.CompanyModelReader;
+import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.query.QueryElementHolder;
+import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
 
 /**
@@ -48,6 +43,82 @@
     private static final String ASSERTION_FAILED = 
         "Assertion A14.6.2-5 (EqualityAndComparisonsBetweenStringFieldsAndParameters) failed: ";
     
+    /** 
+     * The array of valid queries which may be executed as 
+     * single string queries and as API queries.
+     */
+    private static final QueryElementHolder[] VALID_QUERIES = {
+        // string field == string parameter
+        new QueryElementHolder(
+        /*UNIQUE*/      null,
+        /*RESULT*/      null,
+        /*INTO*/        null, 
+        /*FROM*/        Employee.class,
+        /*EXCLUDE*/     null,
+        /*WHERE*/       "firstname == param",
+        /*VARIABLES*/   null,
+        /*PARAMETERS*/  "java.lang.String param",
+        /*IMPORTS*/     null,
+        /*GROUP BY*/    null,
+        /*ORDER BY*/    null,
+        /*FROM*/        null,
+        /*TO*/          null),
+        // string field >= string parameter
+        new QueryElementHolder(
+        /*UNIQUE*/      null,
+        /*RESULT*/      null,
+        /*INTO*/        null, 
+        /*FROM*/        Employee.class,
+        /*EXCLUDE*/     null,
+        /*WHERE*/       "firstname >= param",
+        /*VARIABLES*/   null,
+        /*PARAMETERS*/  "java.lang.String param",
+        /*IMPORTS*/     null,
+        /*GROUP BY*/    null,
+        /*ORDER BY*/    null,
+        /*FROM*/        null,
+        /*TO*/          null),
+        // string parameter < string field
+        new QueryElementHolder(
+        /*UNIQUE*/      null,
+        /*RESULT*/      null,
+        /*INTO*/        null, 
+        /*FROM*/        Employee.class,
+        /*EXCLUDE*/     null,
+        /*WHERE*/       "param < firstname",
+        /*VARIABLES*/   null,
+        /*PARAMETERS*/  "java.lang.String param",
+        /*IMPORTS*/     null,
+        /*GROUP BY*/    null,
+        /*ORDER BY*/    null,
+        /*FROM*/        null,
+        /*TO*/          null),
+    };
+    
+    /** 
+     * The expected results of valid queries.
+     */
+    private Object[] expectedResult = {
+        // string field == string parameter
+        getTransientCompanyModelInstancesAsList(new String[]{"emp1"}),
+        // string field >= string parameter
+        getTransientCompanyModelInstancesAsList(new String[]{
+                "emp1", "emp2", "emp3", "emp4", "emp5"}),
+        // string parameter < string field
+        getTransientCompanyModelInstancesAsList(new String[]{
+                "emp3", "emp4", "emp5"}),
+    };
+    
+    /** Parameters of valid queries. */
+    private Object[][] parameters = {
+        // string field == string parameter
+        {"emp1First"},
+        // string field >= string parameter
+        {"emp1First"},
+        // string parameter < string field
+        {"emp2First"}
+    };
+            
     /**
      * The <code>main</code> is called when the class
      * is directly executed from the command line.
@@ -58,60 +129,20 @@
     }
     
     /** */
-    public void test() {
-        pm = getPM();
-                
-        try {
-            // read test data
-            CompanyModelReader reader = loadCompanyModel(pm, COMPANY_TESTDATA);
-            runTest(pm, reader);
-        }
-        finally {
-            cleanupCompanyModel(pm);
-            pm.close();
-            pm = null;
+    public void testPositive() {
+        for (int i = 0; i < VALID_QUERIES.length; i++) {
+            executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
+                    parameters[i], expectedResult[i]);
+            executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
+                    parameters[i], expectedResult[i]);
         }
     }
     
-    /** */
-    void runTest(PersistenceManager pm, CompanyModelReader reader) {
-        Query q;
-        Object result;
-        Collection expected;
-        
-        Transaction tx = pm.currentTransaction();
-        tx.begin();
-
-        // string field == string parameter
-        q = pm.newQuery(Employee.class, "firstname == param");
-        q.declareParameters("java.lang.String param");
-        result = q.execute("emp1First");
-        expected = new HashSet();
-        expected.add(reader.getFullTimeEmployee("emp1"));
-        checkQueryResultWithoutOrder(ASSERTION_FAILED, result, expected);
-            
-        // string field >= string parameter
-        q = pm.newQuery(Employee.class, "firstname >= param");
-        q.declareParameters("java.lang.String param");
-        result = q.execute("emp1First");
-        expected = new HashSet();
-        expected.add(reader.getFullTimeEmployee("emp1"));
-        expected.add(reader.getFullTimeEmployee("emp2"));
-        expected.add(reader.getPartTimeEmployee("emp3"));
-        expected.add(reader.getPartTimeEmployee("emp4"));
-        expected.add(reader.getFullTimeEmployee("emp5"));
-        checkQueryResultWithoutOrder(ASSERTION_FAILED, result, expected);
-            
-        // string parameter < stringe field
-        q = pm.newQuery(Employee.class, "param < firstname");
-        q.declareParameters("java.lang.String param");
-        result = q.execute("emp2First");
-        expected = new HashSet();
-        expected.add(reader.getPartTimeEmployee("emp3"));
-        expected.add(reader.getPartTimeEmployee("emp4"));
-        expected.add(reader.getFullTimeEmployee("emp5"));
-        checkQueryResultWithoutOrder(ASSERTION_FAILED, result, expected);
-
-        tx.commit();
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistCompanyModel(getPM());
+        addTearDownClass(CompanyModelReader.getTearDownClasses());
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/Instanceof.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/Instanceof.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/Instanceof.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/Instanceof.java Fri Dec  2 08:19:42 2005
@@ -79,8 +79,8 @@
      * The expected results of valid queries.
      */
     private Object[] expectedResult = {
-        getCompanyModelInstancesAsList(new String[]{"emp2", "emp3"}),
-        getCompanyModelInstancesAsList(new String[]{"emp2", "emp3"})
+        getTransientCompanyModelInstancesAsList(new String[]{"emp2", "emp3"}),
+        getTransientCompanyModelInstancesAsList(new String[]{"emp2", "emp3"})
     };
             
     /**
@@ -106,7 +106,7 @@
      * @see JDO_Test#localSetUp()
      */
     protected void localSetUp() {
-        loadCompanyModel(getPM(), COMPANY_TESTDATA);
+        loadAndPersistCompanyModel(getPM());
         addTearDownClass(CompanyModelReader.getTearDownClasses());
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/LogicalComplement.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/LogicalComplement.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/LogicalComplement.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/LogicalComplement.java Fri Dec  2 08:19:42 2005
@@ -22,8 +22,9 @@
 import javax.jdo.PersistenceManager;
 import javax.jdo.Transaction;
 
-import org.apache.jdo.tck.query.QueryTest;
+import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
+import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
 
 /**
@@ -57,22 +58,8 @@
     }
     
     /** */
-    public void test() {
-        pm = getPM();
-        
-        try {
-            loadPrimitiveTypes(pm);
-            runTest(pm);
-        }
-        finally {
-            cleanupDatabase(pm, PrimitiveTypes.class);
-            pm.close();
-            pm = null;
-        }
-    }
-    
-    /** */
-    void runTest(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         if (debug) logger.debug("\nExecuting test LogicalComplement() ...");
 
         Transaction tx = pm.currentTransaction();
@@ -104,5 +91,13 @@
                                      pm, allEvenInstances, ASSERTION_FAILED);
 
         tx.commit();
+    }
+
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistPrimitiveTypes(getPM());
+        addTearDownClass(PrimitiveTypes.class);
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/Modulo.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/Modulo.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/Modulo.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/Modulo.java Fri Dec  2 08:19:42 2005
@@ -70,7 +70,7 @@
      * The expected results of valid queries.
      */
     private Object[] expectedResult = {
-        getCompanyModelInstancesAsList(new String[]{"emp2", "emp4"})
+        getTransientCompanyModelInstancesAsList(new String[]{"emp2", "emp4"})
     };
             
     /**
@@ -132,9 +132,9 @@
      */
     protected void localSetUp() {
         PersistenceManager pm = getPM();
-        loadCompanyModel(pm, COMPANY_TESTDATA);
+        loadAndPersistCompanyModel(pm);
         addTearDownClass(CompanyModelReader.getTearDownClasses());
-        loadPrimitiveTypes(pm);
+        loadAndPersistPrimitiveTypes(pm);
         addTearDownClass(PrimitiveTypes.class);
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/Multiplication.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/Multiplication.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/Multiplication.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/Multiplication.java Fri Dec  2 08:19:42 2005
@@ -21,6 +21,7 @@
 import javax.jdo.PersistenceManager;
 import javax.jdo.Transaction;
 
+import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
@@ -62,22 +63,8 @@
     }
     
     /** */
-    public void test() {
-        pm = getPM();
-
-        try {
-            loadPrimitiveTypes(pm);
-            runTest(pm);
-        }
-        finally {
-            cleanupDatabase(pm, PrimitiveTypes.class);
-            pm.close();
-            pm = null;
-        }
-    }
-    
-    /** */
-    void runTest(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         if (debug) logger.debug("\nExecuting test Multiplication() ...");
 
         Transaction tx = pm.currentTransaction();
@@ -118,5 +105,13 @@
                                      pm, instance4, ASSERTION_FAILED);
 
         tx.commit();
+    }
+
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistPrimitiveTypes(getPM());
+        addTearDownClass(PrimitiveTypes.class);
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/PromotionOfNumericOperands.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/PromotionOfNumericOperands.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/PromotionOfNumericOperands.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/PromotionOfNumericOperands.java Fri Dec  2 08:19:42 2005
@@ -21,6 +21,7 @@
 import javax.jdo.PersistenceManager;
 import javax.jdo.Transaction;
 
+import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
@@ -53,22 +54,8 @@
     }
     
     /** */
-    public void test() {
-        pm = getPM();
-
-        try {
-            loadPrimitiveTypes(pm);
-            runTest(pm);
-        }
-        finally {
-            cleanupDatabase(pm, PrimitiveTypes.class);
-            pm.close();
-            pm = null;
-        }
-    }
-    
-    /** */
-    void runTest(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         Transaction tx = pm.currentTransaction();
         tx.begin();
 
@@ -102,5 +89,13 @@
         // promotion in arithmetic operation: long - Integer == int
         runSimplePrimitiveTypesQuery("10L - intNull == 1", 
                                      pm, instance9, ASSERTION_FAILED);
+    }
+
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistPrimitiveTypes(getPM());
+        addTearDownClass(PrimitiveTypes.class);
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/SignInversion.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/SignInversion.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/SignInversion.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/SignInversion.java Fri Dec  2 08:19:42 2005
@@ -21,6 +21,7 @@
 import javax.jdo.PersistenceManager;
 import javax.jdo.Transaction;
 
+import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
@@ -62,22 +63,8 @@
     }
     
     /** */
-    public void test() {
-        pm = getPM();
-
-        try {
-            loadPrimitiveTypes(pm);
-            runTest(pm);
-        }
-        finally {
-            cleanupDatabase(pm, PrimitiveTypes.class);
-            pm.close();
-            pm = null;
-        }
-    }
-    
-    /** */
-    void runTest(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         Transaction tx = pm.currentTransaction();
         tx.begin();
         
@@ -123,5 +110,13 @@
                                      pm, allOddInstances, ASSERTION_FAILED);
 
         tx.commit();
+    }
+
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistPrimitiveTypes(getPM());
+        addTearDownClass(PrimitiveTypes.class);
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/StringConcatenation.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/StringConcatenation.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/StringConcatenation.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/StringConcatenation.java Fri Dec  2 08:19:42 2005
@@ -16,16 +16,11 @@
 
 package org.apache.jdo.tck.query.jdoql.operators;
 
-import java.util.Collection;
-import java.util.HashSet;
-
-import javax.jdo.PersistenceManager;
-import javax.jdo.Query;
-import javax.jdo.Transaction;
-
-import org.apache.jdo.tck.query.QueryTest;
-import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.company.CompanyModelReader;
+import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.query.QueryElementHolder;
+import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
 
 /**
@@ -47,6 +42,61 @@
     private static final String ASSERTION_FAILED = 
         "Assertion A14.6.2-27 (StringConcatenation) failed: ";
     
+    /** 
+     * The array of valid queries which may be executed as 
+     * single string queries and as API queries.
+     */
+    private static final QueryElementHolder[] VALID_QUERIES = {
+        // string literal + string literal 
+        new QueryElementHolder(
+        /*UNIQUE*/      null,
+        /*RESULT*/      null,
+        /*INTO*/        null, 
+        /*FROM*/        Employee.class,
+        /*EXCLUDE*/     null,
+        /*WHERE*/       "firstname == \"emp1\" + \"First\"",
+        /*VARIABLES*/   null,
+        /*PARAMETERS*/  null,
+        /*IMPORTS*/     null,
+        /*GROUP BY*/    null,
+        /*ORDER BY*/    null,
+        /*FROM*/        null,
+        /*TO*/          null),
+        // string field + string literal 
+        new QueryElementHolder(
+        /*UNIQUE*/      null,
+        /*RESULT*/      null,
+        /*INTO*/        null, 
+        /*FROM*/        Employee.class,
+        /*EXCLUDE*/     null,
+        /*WHERE*/       "firstname + \"Ext\" == param",
+        /*VARIABLES*/   null,
+        /*PARAMETERS*/  "String param",
+        /*IMPORTS*/     null,
+        /*GROUP BY*/    null,
+        /*ORDER BY*/    null,
+        /*FROM*/        null,
+        /*TO*/          null)
+    };
+    
+    /** 
+     * The expected results of valid queries.
+     */
+    private Object[] expectedResult = {
+        // string literal + string literal 
+        getTransientCompanyModelInstancesAsList(new String[]{"emp1"}),
+        // string field + string literal 
+        getTransientCompanyModelInstancesAsList(new String[]{"emp1"})
+    };
+    
+    /** Parameters of valid queries. */
+    private Object[][] parameters = {
+        // string literal + string literal 
+        null,
+        // string field + string literal 
+        {"emp1FirstExt"}
+    };
+            
     /**
      * The <code>main</code> is called when the class
      * is directly executed from the command line.
@@ -57,47 +107,20 @@
     }
     
     /** */
-    public void test() {
-        pm = getPM();
-                
-        try {
-            // read test data
-            CompanyModelReader reader = loadCompanyModel(pm, COMPANY_TESTDATA);
-            runTest(pm, reader);
-        }
-        finally {
-            cleanupCompanyModel(pm);
-            pm.close();
-            pm = null;
+    public void testPositive() {
+        for (int i = 0; i < VALID_QUERIES.length; i++) {
+            executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
+                    parameters[i], expectedResult[i]);
+            executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
+                    parameters[i], expectedResult[i]);
         }
     }
     
-    /** */
-    void runTest(PersistenceManager pm, CompanyModelReader reader) {
-        Query q;
-        Object result;
-        Collection expected;
-        
-        Transaction tx = pm.currentTransaction();
-        tx.begin();
-
-        // string literal + string literal 
-        q = pm.newQuery(Employee.class);
-        q.setFilter("firstname == \"emp1\" + \"First\"");
-        result = q.execute();
-        expected = new HashSet();
-        expected.add(reader.getFullTimeEmployee("emp1"));
-        checkQueryResultWithoutOrder(ASSERTION_FAILED, result, expected);
-        
-        // string field + string literal 
-        q = pm.newQuery(Employee.class);
-        q.declareParameters("String param");
-        q.setFilter("firstname + \"Ext\" == param");
-        result = q.execute("emp1FirstExt");
-        expected = new HashSet();
-        expected.add(reader.getFullTimeEmployee("emp1"));
-        checkQueryResultWithoutOrder(ASSERTION_FAILED, result, expected);
-        
-        tx.commit();
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistCompanyModel(getPM());
+        addTearDownClass(CompanyModelReader.getTearDownClasses());
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/UnaryPlus.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/UnaryPlus.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/UnaryPlus.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/UnaryPlus.java Fri Dec  2 08:19:42 2005
@@ -21,6 +21,7 @@
 import javax.jdo.PersistenceManager;
 import javax.jdo.Transaction;
 
+import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
@@ -62,22 +63,8 @@
     }
     
     /** */
-    public void test() {
-        pm = getPM();
-
-        try {
-            loadPrimitiveTypes(pm);
-            runTestBinaryAddition(pm);
-        }
-        finally {
-            cleanupDatabase(pm, PrimitiveTypes.class);
-            pm.close();
-            pm = null;
-        }
-    }
-
-    /** */
-    void runTestBinaryAddition(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         if (debug) logger.debug("\nExecuting test BinaryAddition() ...");
 
         Transaction tx = pm.currentTransaction();
@@ -89,5 +76,13 @@
         runSimplePrimitiveTypesQuery("+id == 9", 
                                      pm, instance9, ASSERTION_FAILED);
         tx.commit();
+    }
+
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistPrimitiveTypes(getPM());
+        addTearDownClass(PrimitiveTypes.class);
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/parameters/ImplicitParameters.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/parameters/ImplicitParameters.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/parameters/ImplicitParameters.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/parameters/ImplicitParameters.java Fri Dec  2 08:19:42 2005
@@ -116,12 +116,12 @@
      */
     private Object[] expectedResult = {
         getExpectedResultOfFirstQuery(
-                getCompanyModelInstancesAsList(new String[] {
+                getTransientCompanyModelInstancesAsList(new String[] {
                 "emp1", "emp2", "emp3", "emp4", "emp5"})),
-        getCompanyModelInstancesAsList(new String[]{"emp1"}),
+        getTransientCompanyModelInstancesAsList(new String[]{"emp1"}),
         /* Note: "Development" is not a bean name! */
         Arrays.asList(new Object[]{"Development"}),
-        getCompanyModelInstancesAsList(new String[] {
+        getTransientCompanyModelInstancesAsList(new String[] {
                 "emp1", "emp2", "emp3", "emp4", "emp5"})
     };
             
@@ -163,7 +163,7 @@
      * @see JDO_Test#localSetUp()
      */
     protected void localSetUp() {
-        loadCompanyModel(getPM(), COMPANY_TESTDATA);
+        loadAndPersistCompanyModel(getPM());
         addTearDownClass(CompanyModelReader.getTearDownClasses());
     }
 

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/parameters/OrderOfParameters.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/parameters/OrderOfParameters.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/parameters/OrderOfParameters.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/parameters/OrderOfParameters.java Fri Dec  2 08:19:42 2005
@@ -65,11 +65,11 @@
      * The expected results of valid queries.
      */
     private Object[] expectedResult = {
-        getCompanyModelInstancesAsList(new String[]{"emp1"})
+        getTransientCompanyModelInstancesAsList(new String[]{"emp1"})
     };
             
     /** Parameters of valid queries. */
-    private static Object[][] parameters = {
+    private Object[][] parameters = {
         {"emp1First", "emp1Last"}
     };
             
@@ -96,7 +96,7 @@
      * @see JDO_Test#localSetUp()
      */
     protected void localSetUp() {
-        loadCompanyModel(getPM(), COMPANY_TESTDATA);
+        loadAndPersistCompanyModel(getPM());
         addTearDownClass(CompanyModelReader.getTearDownClasses());
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/parameters/ParameterBoundToDifferentPM.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/parameters/ParameterBoundToDifferentPM.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/parameters/ParameterBoundToDifferentPM.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/parameters/ParameterBoundToDifferentPM.java Fri Dec  2 08:19:42 2005
@@ -16,13 +16,11 @@
 
 package org.apache.jdo.tck.query.jdoql.parameters;
 
-import java.util.Collection;
 import javax.jdo.JDOUserException;
-
 import javax.jdo.PersistenceManager;
 import javax.jdo.Query;
-import javax.jdo.Transaction;
 
+import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.company.CompanyModelReader;
 import org.apache.jdo.tck.pc.company.Department;
 import org.apache.jdo.tck.pc.company.Employee;
@@ -57,34 +55,23 @@
     }
     
     /** */
-    public void test() {
-        pm = getPM();
-        
-        try {
-            // read test data
-            CompanyModelReader reader = loadCompanyModel(pm, COMPANY_TESTDATA);
-            runTest(pm, reader);
-        }
-        finally {
-            cleanupCompanyModel(pm);
-            pm.close();
-            pm = null;
-        }
-    }
-    
-    /** */
-    void runTest(PersistenceManager pm, CompanyModelReader reader) {
-        Transaction tx = pm.currentTransaction();
-        tx.begin();
-        Department dept1 = reader.getDepartment("dept1");
-        tx.commit();
+    public void testNegative() {
+        // get parameter dept1
+        getPM().currentTransaction().begin();
+        Department dept1 = (Department) getPersistentCompanyModelInstance("dept1");
+        getPM().currentTransaction().commit();
         
+        // pass parameter dept1 to query of different pm
         PersistenceManager pm2 = pmf.getPersistenceManager();
+        pm2.currentTransaction().begin();
         try {
-            pm2.currentTransaction().begin();
             Query q = pm2.newQuery(Employee.class, "department == d");
-            q.declareParameters("Department d");  
-            Collection result = (Collection)q.execute(dept1);
+            q.declareParameters("Department d"); 
+            try {
+                q.execute(dept1);
+            } finally {
+                q.closeAll();
+            }
             fail(ASSERTION_FAILED,
                  "Query.execute should throw a JDOUserException if a query " + 
                  "parameter is bound to a different PersistenceManager");
@@ -101,5 +88,13 @@
                 pm2.close();
             }
         }
+    }
+    
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistCompanyModel(getPM());
+        addTearDownClass(CompanyModelReader.getTearDownClasses());
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/parameters/ParameterDeclaredWithSameNameAsFieldOfCandidateClass.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/parameters/ParameterDeclaredWithSameNameAsFieldOfCandidateClass.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/parameters/ParameterDeclaredWithSameNameAsFieldOfCandidateClass.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/parameters/ParameterDeclaredWithSameNameAsFieldOfCandidateClass.java Fri Dec  2 08:19:42 2005
@@ -24,6 +24,7 @@
 import javax.jdo.Query;
 import javax.jdo.Transaction;
 
+import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.mylib.PCPoint;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
@@ -56,15 +57,11 @@
     }
 
     /** */
-    public void test() {
-        pm = getPM();
+    public void testPositve() {
+        PersistenceManager pm = getPM();
 
-        initDatabase(pm, PCPoint.class);
         runTestParameterDeclaredWithSameNameAsFieldOfCandidateClass01(pm);
         runTestParameterDeclaredWithSameNameAsFieldOfCandidateClass02(pm);
-
-        pm.close();
-        pm = null;
     }
 
     /** */
@@ -147,6 +144,14 @@
             if ((tx != null) && tx.isActive())
                 tx.rollback();
         }
+    }
+
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistPCPoints(getPM());
+        addTearDownClass(PCPoint.class);
     }
 }
 

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/parameters/PrimitiveParameterPassedAsNull.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/parameters/PrimitiveParameterPassedAsNull.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/parameters/PrimitiveParameterPassedAsNull.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/parameters/PrimitiveParameterPassedAsNull.java Fri Dec  2 08:19:42 2005
@@ -16,14 +16,12 @@
 
 package org.apache.jdo.tck.query.jdoql.parameters;
 
-import java.util.Collection;
-import java.util.HashSet;
-
 import javax.jdo.JDOUserException;
 import javax.jdo.PersistenceManager;
 import javax.jdo.Query;
 import javax.jdo.Transaction;
 
+import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
@@ -55,23 +53,9 @@
         BatchTestRunner.run(PrimitiveParameterPassedAsNull.class);
     }
     
-   /** */
-    public void test() {
-        pm = getPM();
-
-        try {
-            loadPrimitiveTypes(pm);
-            runTest(pm);
-        }
-        finally {
-            cleanupDatabase(pm, PrimitiveTypes.class);
-            pm.close();
-            pm = null;
-        }
-    }
-    
     /** */
-    void runTest(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         Transaction tx = pm.currentTransaction();
         tx.begin();
 
@@ -90,6 +74,12 @@
         tx.commit();
         
     }
-    
-    
+
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistPrimitiveTypes(getPM());
+        addTearDownClass(PrimitiveTypes.class);
+    }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/variables/MixedVariables.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/variables/MixedVariables.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/variables/MixedVariables.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/variables/MixedVariables.java Fri Dec  2 08:19:42 2005
@@ -103,8 +103,8 @@
      * The expected results of valid queries.
      */
     private Object[] expectedResult = {
-        getCompanyModelInstancesAsList(new String[]{"emp2"}),
-        getCompanyModelInstancesAsList(new String[]{"emp2"})
+        getTransientCompanyModelInstancesAsList(new String[]{"emp2"}),
+        getTransientCompanyModelInstancesAsList(new String[]{"emp2"})
     };
             
     /**
@@ -138,7 +138,7 @@
      * @see JDO_Test#localSetUp()
      */
     protected void localSetUp() {
-        loadCompanyModel(getPM(), COMPANY_TESTDATA);
+        loadAndPersistCompanyModel(getPM());
         addTearDownClass(CompanyModelReader.getTearDownClasses());
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/variables/UnconstrainedVariable.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/variables/UnconstrainedVariable.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/variables/UnconstrainedVariable.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/variables/UnconstrainedVariable.java Fri Dec  2 08:19:42 2005
@@ -66,12 +66,12 @@
      * The expected results of valid queries.
      */
     private Object[] expectedResult = {
-        getCompanyModelInstancesAsList(new String[]{
+        getTransientCompanyModelInstancesAsList(new String[]{
                 "emp2", "emp3", "emp4"})
     };
             
     /** Parameters of valid queries. */
-    private static Object[][] parameters = {
+    private Object[][] parameters = {
         {new Integer(1)},
     };
             
@@ -100,7 +100,7 @@
      * @see JDO_Test#localSetUp()
      */
     protected void localSetUp() {
-        loadCompanyModel(getPM(), COMPANY_TESTDATA);
+        loadAndPersistCompanyModel(getPM());
         addTearDownClass(CompanyModelReader.getTearDownClasses());
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/variables/VariablesAndFields.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/variables/VariablesAndFields.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/variables/VariablesAndFields.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/variables/VariablesAndFields.java Fri Dec  2 08:19:42 2005
@@ -130,10 +130,10 @@
      * The expected results of valid queries.
      */
     private Object[] expectedResult = {
-        getCompanyModelInstancesAsList(new String[]{"emp2"}),
-        getCompanyModelInstancesAsList(new String[]{"emp2"}),
-        getCompanyModelInstancesAsList(new String[]{"emp1"}),
-        getCompanyModelInstancesAsList(new String[]{"emp2"}),
+        getTransientCompanyModelInstancesAsList(new String[]{"emp2"}),
+        getTransientCompanyModelInstancesAsList(new String[]{"emp2"}),
+        getTransientCompanyModelInstancesAsList(new String[]{"emp1"}),
+        getTransientCompanyModelInstancesAsList(new String[]{"emp2"}),
         new LinkedList()
     };
             
@@ -160,7 +160,7 @@
      * @see JDO_Test#localSetUp()
      */
     protected void localSetUp() {
-        loadCompanyModel(getPM(), COMPANY_TESTDATA);
+        loadAndPersistCompanyModel(getPM());
         addTearDownClass(CompanyModelReader.getTearDownClasses());
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/variables/VariablesWithoutExtent.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/variables/VariablesWithoutExtent.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/variables/VariablesWithoutExtent.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/variables/VariablesWithoutExtent.java Fri Dec  2 08:19:42 2005
@@ -99,7 +99,7 @@
      * @see JDO_Test#localSetUp()
      */
     protected void localSetUp() {
-        loadCompanyModel(getPM(), COMPANY_TESTDATA);
+        loadAndPersistCompanyModel(getPM());
         addTearDownClass(CompanyModelReader.getTearDownClasses());
         NoExtent noExtent = new NoExtent(1);
         makePersistent(noExtent);

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/AggregateResult.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/AggregateResult.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/AggregateResult.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/AggregateResult.java Fri Dec  2 08:19:42 2005
@@ -634,7 +634,7 @@
      * @see JDO_Test#localSetUp()
      */
     protected void localSetUp() {
-        loadCompanyModel(getPM(), COMPANY_TESTDATA);
+        loadAndPersistCompanyModel(getPM());
         addTearDownClass(CompanyModelReader.getTearDownClasses());
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/DefaultResult.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/DefaultResult.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/DefaultResult.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/DefaultResult.java Fri Dec  2 08:19:42 2005
@@ -64,7 +64,7 @@
      * The expected results of valid queries.
      */
     private Object[] expectedResult = {
-        getCompanyModelInstancesAsList(new String[]{
+        getTransientCompanyModelInstancesAsList(new String[]{
                 "emp1", "emp2", "emp3", "emp4", "emp5"}) 
     };
             
@@ -91,7 +91,7 @@
      * @see JDO_Test#localSetUp()
      */
     protected void localSetUp() {
-        loadCompanyModel(getPM(), COMPANY_TESTDATA);
+        loadAndPersistCompanyModel(getPM());
         addTearDownClass(CompanyModelReader.getTearDownClasses());
     }
 }