db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bra...@apache.org
Subject svn commit: r351768 [1/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/
Date Fri, 02 Dec 2005 16:20:55 GMT
Author: brazil
Date: Fri Dec  2 08:19:42 2005
New Revision: 351768

URL: http://svn.apache.org/viewcvs?rev=351768&view=rev
Log:
JDO-147: Remove pm.deletePersistent from query tests.

Modified:
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/QueryTest.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/ChangeQuery.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/Close.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/CloseAll.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/CompileQuery.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/DeclareImports.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/DeclareParameters.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/ExecuteQuery.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/ExecuteQueryWithArray.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/ExecuteQueryWithMap.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/GetFetchPlan.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/MetadataSearchOrder.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewNamedQuery.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryFromExistingQueryBoundToPMFromSameVendor.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryFromRestoredSerializedQuery.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQuerySingleString.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClass.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassAndCollection.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassAndExtent.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassAndFilter.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassCollectionFilter.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithExtent.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithExtentAndFilter.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithSpecifiedLanguageAndQuery.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/QueryExtentions.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetCandidateCollection.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetCandidateExtent.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetFilter.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetGrouping.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetOrdering.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetRange.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetResult.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetResultClass.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetUnique.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetterReplacePreviousValues.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SingleStringQuery.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/UnmodifiableQuery.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/delete/DeleteCallback.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/delete/DeletePersistentAll.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/delete/DeleteQueryElements.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/AssignmentPrePostIncrementDecrementNotSupported.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/Cast.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/CharacterAndStringLiterals.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/ComparingCollectionFieldToNull.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/ComparingPersistentAndNonPersistentInstance.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/DenoteUniquenessInFilter.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/ExecutingMultipleQueriesSimultaneouslyIsThreadSafe.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/ExecutingQueryWhenNoTransactionNoNontransactionalRead.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/IdentifiersEqualFieldNames.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/IgnoreCacheFalse.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/MultipleActiveQueryInstanceInSamePersistenceManager.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/MultipleIdenticalImports.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/NamespaceOfIdentifiers.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/NavigationThroughACollectionField.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/NavigationThroughANullValuedField.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/NavigationThroughReferencesUsesDotOperator.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/NegativeRange.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/NullCollectionsAndContainsMethod.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/NullCollectionsAndIsEmpty.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/OrderingSpecification.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/ParenthesesMarkOperatorPrecedence.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/PositiveRange.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/QueryIsSerializable.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/QueryResultPassedToAnotherQuery.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/QueryWithNoFilter.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/RangeAsString.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/SeparateNamespaceForTypeNames.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/WhiteSpaceIsACharacterAndIgnored.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/SingleString.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/ThisIsReservedWordForElementOfCollection.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/keywords/UseOfThisToAcessHiddenField.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/MethodsAndObjectConstructionNotSupported.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/StartsWithAndEndsWith.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/SupportedCollectionMethods.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/SupportedJDOHelperMethods.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/SupportedMapMethods.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/SupportedMathMethods.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/methods/SupportedStringMethods.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/BinaryAddition.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/BinarySubtraction.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/BitwiseComplement.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/BooleanLogicalAND.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/BooleanLogicalOR.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/ConditionalAND.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/ConditionalOR.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/Division.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/EqualityAndComparisonsBetweenDateFieldsAndParameters.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/EqualityAndComparisonsBetweenPrimitivesAndWrapperInstances.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/EqualityAndComparisonsBetweenStringFieldsAndParameters.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/Instanceof.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/LogicalComplement.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/Modulo.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/Multiplication.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/PromotionOfNumericOperands.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/SignInversion.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/StringConcatenation.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/operators/UnaryPlus.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/parameters/ImplicitParameters.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/parameters/OrderOfParameters.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/parameters/ParameterBoundToDifferentPM.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/parameters/ParameterDeclaredWithSameNameAsFieldOfCandidateClass.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/parameters/PrimitiveParameterPassedAsNull.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/variables/MixedVariables.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/variables/UnconstrainedVariable.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/variables/VariablesAndFields.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/variables/VariablesWithoutExtent.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/AggregateResult.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/DefaultResult.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/DefaultUnique.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/DistinctCandidateInstances.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/DistinctQuery.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/Grouping.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/Having.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/ImmutableQueryResult.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/NPEInResultExpr.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/NullResults.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/ResultClassRequirements.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/ResultExpressions.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/ShapeOfResult.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/Unique.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/VariableInResult.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/sql/AllowedAPIMethods.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/sql/NewQuery.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/sql/NoCandidateClass.java
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/sql/ShapeOfResult.java

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/QueryTest.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/QueryTest.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/QueryTest.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/QueryTest.java Fri Dec  2 08:19:42 2005
@@ -27,8 +27,6 @@
 import java.util.List;
 import java.util.Map;
 
-import javax.jdo.Extent;
-import javax.jdo.JDOFatalInternalException;
 import javax.jdo.JDOUserException;
 import javax.jdo.PersistenceManager;
 import javax.jdo.Query;
@@ -37,12 +35,7 @@
 import junit.framework.AssertionFailedError;
 
 import org.apache.jdo.tck.JDO_Test;
-import org.apache.jdo.tck.pc.company.Company;
 import org.apache.jdo.tck.pc.company.CompanyModelReader;
-import org.apache.jdo.tck.pc.company.Department;
-import org.apache.jdo.tck.pc.company.Insurance;
-import org.apache.jdo.tck.pc.company.Person;
-import org.apache.jdo.tck.pc.company.Project;
 import org.apache.jdo.tck.pc.mylib.MylibReader;
 import org.apache.jdo.tck.pc.mylib.PCPoint;
 import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
@@ -71,32 +64,36 @@
     /**
      * The company model reader is used 
      * to read company model instances from an XML file.
+     * Instances refered by this reader are made persistent by
+     * {@link QueryTest#loadAndPersistCompanyModel(PersistenceManager)}.
      */
-    private CompanyModelReader companyModelReader = 
-        new CompanyModelReader(COMPANY_TESTDATA);
+    private CompanyModelReader companyModelReaderForPersistentInstances;
+
+    /**
+     * The company model reader is used 
+     * to read company model instances from an XML file.
+     * Instances refered by this reader remain transient.
+     */
+    private CompanyModelReader companyModelReaderForTransientInstances;
 
     /**
      * The mylib reader is used to read mylib instances from an XML file.
+     * Instances refered by this reader are made persistent by
+     * {@link QueryTest#loadAndPersistMylib(PersistenceManager)}.
      */
-    private MylibReader mylibReader = new MylibReader(MYLIB_TESTDATA);
+    private MylibReader mylibReaderForPersistentInstances;
 
-    // Helper methods to create persistent PCPoint instances
-    
     /**
-     * @see JDO_Test#localSetUp()
+     * The mylib reader is used to read mylib instances from an XML file.
+     * Instances refered by this reader are made persistent by
      */
-    protected void localSetUp() {
-        addTearDownClass(PCPoint.class);
-    }
+    private MylibReader mylibReaderForTransientInstances;
+
+    // Helper methods to create persistent PCPoint instances
     
     /** */
-    public void initDatabase(PersistenceManager pm, Class cls){
-        cleanupDatabase(pm, cls);
-        if (cls == PCPoint.class)
-            insertPCPoints(pm, 5);
-        else
-            throw new JDOFatalInternalException(
-                "Unsupported pc class for initDatabase " + cls);
+    public void loadAndPersistPCPoints(PersistenceManager pm) {
+        insertPCPoints(pm, 5);
     }
 
     /** */
@@ -138,139 +135,247 @@
         return result;
     }
     
-    // Company model helper methods
+    // Company model and mylib helper methods
+    
+    /**
+     * Initializes and returns the company model reader 
+     * for persistent instances.
+     * @return the company model reader for persistent instances.
+     */
+    private CompanyModelReader 
+    getCompanyModelReaderForPersistentInstances() {
+        if (companyModelReaderForPersistentInstances == null) {
+            companyModelReaderForPersistentInstances = 
+                new CompanyModelReader(COMPANY_TESTDATA);
+        }
+        return companyModelReaderForPersistentInstances;
+    }
+    
+    /**
+     * Initializes and returns the company model reader 
+     * for transient instances.
+     * @return the company model reader for transient instances.
+     */
+    private CompanyModelReader 
+    getCompanyModelReaderForTransientInstances() {
+        if (companyModelReaderForTransientInstances == null) {
+            companyModelReaderForTransientInstances = 
+                new CompanyModelReader(COMPANY_TESTDATA);
+        }
+        return companyModelReaderForTransientInstances;
+    }
+    
+    /**
+     * Initializes and returns the mylib reader 
+     * for persistent instances.
+     * @return the mylib reader for persistent instances.
+     */
+    private MylibReader getMylibReaderForPersistentInstances() {
+        if (mylibReaderForPersistentInstances == null) {
+            mylibReaderForPersistentInstances = 
+                new MylibReader(MYLIB_TESTDATA);
+        }
+        return mylibReaderForPersistentInstances;
+    }
+    
+    /**
+     * Initializes and returns the mylib reader 
+     * for transient instances.
+     * @return the mylib reader for transient instances.
+     */
+    private MylibReader getMylibReaderForTransientInstances() {
+        if (mylibReaderForTransientInstances == null) {
+            mylibReaderForTransientInstances = 
+                new MylibReader(MYLIB_TESTDATA);
+        }
+        return mylibReaderForTransientInstances;
+    }
     
     /** 
-     * Reads a graph of company model objects from the specified xml file. This 
+     * Reads a graph of company model objects from the internal reader. This 
      * methods explictly calls makePersistent for all named instances using the
      * specified PersistenceManager. The method returns the CompanyModelReader 
      * instance allowing to access a compay model instance by name.
      */
-    public CompanyModelReader loadCompanyModel(PersistenceManager pm, 
-                                               String filename) {
-        CompanyModelReader reader = new CompanyModelReader(filename);
-        Transaction tx = pm.currentTransaction();
-        tx.begin();
-        List rootList = (List)reader.getRootList();
-        pm.makePersistentAll(rootList);
-        if (debug) logger.debug("inserted " + rootList);
-        tx.commit();
-        tx = null;
-        return reader;
+    public CompanyModelReader loadAndPersistCompanyModel(PersistenceManager pm) {
+        makePersistentAll(
+                getCompanyModelReaderForPersistentInstances().getRootList());
+        return getCompanyModelReaderForPersistentInstances();
     }
     
     /** 
-     * Reads a graph of company model objects from the specified xml file. This 
+     * Reads a graph of mylib objects from the internal reader. This 
      * methods explictly calls makePersistent for all named instances using the
      * specified PersistenceManager. The method returns the CompanyModelReader 
      * instance allowing to access a compay model instance by name.
      */
-    public MylibReader loadMylib(PersistenceManager pm, String filename) {
-        MylibReader reader = new MylibReader(filename);
-        Transaction tx = pm.currentTransaction();
-        tx.begin();
-        List rootList = (List)reader.getRootList();
-        pm.makePersistentAll(rootList);
-        if (debug) logger.debug("inserted " + rootList);
-        tx.commit();
-        tx = null;
-        return reader;
+    public MylibReader loadAndPersistMylib(PersistenceManager pm) {
+        makePersistentAll(getMylibReaderForPersistentInstances().getRootList());
+        return getMylibReaderForPersistentInstances();
     }
-    
-    /** */
-    public void cleanupCompanyModel(PersistenceManager pm) {
+
+    /**
+     * Persists the given pc instances.
+     * @param pcInstances the pc instances to persist
+     */
+    private void makePersistentAll(List pcInstances) {
         Transaction tx = pm.currentTransaction();
-        if (tx.isActive()) tx.rollback();
+        tx.begin();
         try {
-            tx.begin();
-            cleanupDatabaseInternal(pm, Company.class);
-            cleanupDatabaseInternal(pm, Department.class);
-            cleanupDatabaseInternal(pm, Person.class);
-            cleanupDatabaseInternal(pm, Insurance.class);
-            cleanupDatabaseInternal(pm, Project.class);
+            pm.makePersistentAll(pcInstances);
+            if (debug) logger.debug("inserted " + pcInstances);
             tx.commit();
-            tx = null;
-        }
-        finally {
-            if ((tx != null) && tx.isActive())
+        } finally {
+            if (tx.isActive()) {
                 tx.rollback();
+            }
         }
     }
     
     /**
-     * Returns a company model instance for the given bean name.
+     * Returns a persistent company model instance for the given bean name.
      * @param beanName the bean name.
-     * @return the company model instance. 
+     * @return the persistent company model instance. 
      */
-    protected Object getCompanyModelInstance(String beanName) {
-        return beanName == null ? 
-                null : companyModelReader.getBean(beanName);
+    protected Object getPersistentCompanyModelInstance(String beanName) {
+        return beanName == null ? null :
+            getCompanyModelReaderForPersistentInstances().getBean(beanName);
     }
     
     /**
-     * Returns an array of company model instances for bean names 
+     * Returns a transient company model instance for the given bean name.
+     * @param beanName the bean name.
+     * @return the transient company model instance. 
+     */
+    protected Object getTransientCompanyModelInstance(String beanName) {
+        return beanName == null ? null :
+            getCompanyModelReaderForTransientInstances().getBean(beanName);
+    }
+    
+    /**
+     * Returns an array of persistent company model instances for bean names 
      * in the given argument.
      * @param beanNames the bean names of company mode instances.
-     * @return the array of company model instances. 
+     * @return the array of persistent company model instances. 
      */
-    protected Object[] getCompanyModelInstances(String[] beanNames) {
+    protected Object[] getPersistentCompanyModelInstances(String[] beanNames) {
         Object[] result = new Object[beanNames.length];
         for (int i = 0; i < beanNames.length; i++) {
-            result[i] = getCompanyModelInstance(beanNames[i]);
+            result[i] = getPersistentCompanyModelInstance(beanNames[i]);
         }
         return result;
     }
     
     /**
-     * Returns a list of company model instances instances for beans names 
+     * Returns an array of transient company model instances for bean names 
      * in the given argument.
+     * @param beanNames the bean names of company mode instances.
+     * @return the array of transient company model instances. 
+     */
+    protected Object[] getTransientCompanyModelInstances(String[] beanNames) {
+        Object[] result = new Object[beanNames.length];
+        for (int i = 0; i < beanNames.length; i++) {
+            result[i] = getTransientCompanyModelInstance(beanNames[i]);
+        }
+        return result;
+    }
+    
+    /**
+     * Returns a list of persistent company model instances instances 
+     * for beans names in the given argument.
+     * @param beanNames the bean names of company model instances.
+     * @return the list of persistent company model instances. 
+     */
+    protected List getPersistentCompanyModelInstancesAsList(
+            String[] beanNames) {
+        return new ArrayList(
+                Arrays.asList(getPersistentCompanyModelInstances(beanNames)));
+    }
+    
+    /**
+     * Returns a list of transient company model instances instances 
+     * for beans names in the given argument.
      * @param beanNames the bean names of company model instances.
-     * @return the list of company model instances. 
+     * @return the list of transient company model instances. 
      */
-    protected List getCompanyModelInstancesAsList(String[] beanNames) {
+    protected List getTransientCompanyModelInstancesAsList(
+            String[] beanNames) {
         return new ArrayList(
-                Arrays.asList(getCompanyModelInstances(beanNames)));
+                Arrays.asList(getTransientCompanyModelInstances(beanNames)));
     }
     
     /**
-     * Returns a mylib instance for the given bean name.
+     * Returns a persistent mylib instance for the given bean name.
      * @param beanName the bean name.
-     * @return the mylib instance. 
+     * @return the persistent mylib instance. 
      */
-    protected Object getMylibInstance(String beanName) {
+    protected Object getPersistentMylibInstance(String beanName) {
         return beanName == null ? 
-                null : mylibReader.getBean(beanName);
+                null : getMylibReaderForPersistentInstances().getBean(beanName);
     }
     
     /**
-     * Returns an array of mylib instances for beans names 
+     * Returns a transient mylib instance for the given bean name.
+     * @param beanName the bean name.
+     * @return the transient mylib instance. 
+     */
+    protected Object getTransientMylibInstance(String beanName) {
+        return beanName == null ? 
+                null : getMylibReaderForTransientInstances().getBean(beanName);
+    }
+    
+    /**
+     * Returns an array of persistent mylib instances for beans names 
      * in the given argument.
      * @param beanNames the bean names of mylib instances.
-     * @return the array of mylib instances. 
+     * @return the array of persistent mylib instances. 
      */
-    protected Object[] getMylibInstances(String[] beanNames) {
+    protected Object[] getPersistentMylibInstances(String[] beanNames) {
         Object[] result = new Object[beanNames.length];
         for (int i = 0; i < beanNames.length; i++) {
-            result[i] = getMylibInstance(beanNames[i]);
+            result[i] = getPersistentMylibInstance(beanNames[i]);
         }
         return result;
     }
     
     /**
-     * Returns a list of mylib instances for beans names 
+     * Returns an array of transient mylib instances for beans names 
      * in the given argument.
      * @param beanNames the bean names of mylib instances.
-     * @return the list of mylib instances. 
+     * @return the array of transient mylib instances. 
      */
-    protected List getMylibInstancesAsList(String[] beanNames) {
-        return Arrays.asList(getMylibInstances(beanNames));
+    protected Object[] getTransientMylibInstances(String[] beanNames) {
+        Object[] result = new Object[beanNames.length];
+        for (int i = 0; i < beanNames.length; i++) {
+            result[i] = getTransientMylibInstance(beanNames[i]);
+        }
+        return result;
+    }
+    
+    /**
+     * Returns a list of persistent mylib instances for beans names 
+     * in the given argument.
+     * @param beanNames the bean names of mylib instances.
+     * @return the list of persistent mylib instances. 
+     */
+    protected List getPersistentMylibInstancesAsList(String[] beanNames) {
+        return Arrays.asList(getPersistentMylibInstances(beanNames));
+    }
+    
+    /**
+     * Returns a list of transient mylib instances for beans names 
+     * in the given argument.
+     * @param beanNames the bean names of mylib instances.
+     * @return the list of transient mylib instances. 
+     */
+    protected List getTransientMylibInstancesAsList(String[] beanNames) {
+        return Arrays.asList(getTransientMylibInstances(beanNames));
     }
     
     // PrimitiveTypes helper methods (creation and query)
 
     /** */
-    public void loadPrimitiveTypes(PersistenceManager pm) {
-        cleanupDatabase(pm, PrimitiveTypes.class);
+    public void loadAndPersistPrimitiveTypes(PersistenceManager pm) {
         insertPrimitiveTypes(pm);
     }
 
@@ -356,36 +461,6 @@
         checkQueryResultWithoutOrder(assertion, results, expected);
     }
 
-    // Helper methods to cleanup the datastore
-    
-    /** */
-    public void cleanupDatabase(PersistenceManager pm, Class cls) {
-        Transaction tx = pm.currentTransaction();
-        if (tx.isActive()) tx.rollback();
-        try {
-            tx.begin();
-            cleanupDatabaseInternal(pm, cls);
-            tx.commit();
-            tx = null;
-        }
-        finally {
-            if ((tx != null) && tx.isActive())
-                tx.rollback();
-        }
-    }
-    
-    /** */
-    protected void cleanupDatabaseInternal(PersistenceManager pm, Class cls) {
-        Extent e = pm.getExtent(cls, true);
-        for (Iterator i = e.iterator(); i.hasNext();) {
-            Object pc = i.next();
-            if (debug) 
-                logger.debug("Deleted the existing " + cls.getName() +
-                             " object " + pc);
-            pm.deletePersistent(pc);
-        }
-    }
-    
     // Helper methods to check query result
     
     /** */
@@ -461,7 +536,7 @@
             result = closeEnough(((Double)o1).floatValue(), 
                     ((Double)o2).floatValue());
         } else if ((o1 instanceof BigDecimal) && (o2 instanceof BigDecimal)) {
-            result = ((BigDecimal)o1).compareTo(o2) == 0;
+            result = ((BigDecimal)o1).compareTo((BigDecimal)o2) == 0;
         } else if (o1 != null) {
             result = o1.equals(o2);
         } else {
@@ -1026,9 +1101,16 @@
 
     /**
      * Executes the given query instance.
-     * Argument <code>parameters</code> is passed as an argument
+     * If argument <code>parameters</code> is an object array,
+     * then it is passed as an argument
      * to the method {@link Query#executeWithArray(java.lang.Object[])}.
-     * If <code>parameters</code> are <code>null</code>,
+     * If argument <code>parameters</code> is a map,
+     * then it is passed as an argument
+     * to the method {@link Query#executeWithMap(java.util.Map)}.
+     * If argument <code>parameters</code> is a list,
+     * then the list elements are passed as arguments
+     * to the execute methods taking actual parameter values.
+     * If argument <code>parameters</code> is <code>null</code>,
      * then method {@link Query#execute()} is called 
      * on the given query instance instead.<p>
      * 
@@ -1071,9 +1153,27 @@
                     result = query.executeWithArray((Object[])parameters);
                 } else if (parameters instanceof Map) {
                     result = query.executeWithMap((Map)parameters);
+                } else if (parameters instanceof List) {
+                    List list = (List) parameters;
+                    switch (list.size()) {
+                        case 1:
+                            result = query.execute(list.get(0));
+                            break;
+                        case 2:
+                            result = query.execute(list.get(0), list.get(1));
+                            break;
+                        case 3:
+                            result = query.execute(
+                                    list.get(0), list.get(1), list.get(2));
+                            break;
+                        default:
+                            throw new IllegalArgumentException(
+                                "Argument parameters is a list " +
+                                "and must have 1, 2, or 3 elements.");
+                    }
                 } else {
                     throw new IllegalArgumentException("Argument parameters " +
-                            "must be instance of Object[], Map, or null.");
+                            "must be instance of List, Map, Object[], or null.");
                 }
                 
                 if (logger.isDebugEnabled()) {

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/ChangeQuery.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/ChangeQuery.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/ChangeQuery.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/ChangeQuery.java Fri Dec  2 08:19:42 2005
@@ -98,7 +98,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/api/Close.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/Close.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/Close.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/Close.java Fri Dec  2 08:19:42 2005
@@ -26,6 +26,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;
@@ -63,19 +64,9 @@
     }
 
     /** */
-    public void test() {
-        pm = getPM();
-
-        initDatabase(pm, PCPoint.class);
-        runTestClose(pm);
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         
-        pm.close();
-        pm = null;
-    }
-
-    /** */
-    void runTestClose(PersistenceManager pm) {
-
         if (debug) logger.debug("\nExecuting test Close()...");
         Transaction tx = pm.currentTransaction();
         try {
@@ -131,6 +122,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/api/CloseAll.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/CloseAll.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/CloseAll.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/CloseAll.java Fri Dec  2 08:19:42 2005
@@ -25,6 +25,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;
@@ -55,18 +56,9 @@
     }
 
     /** */
-    public void test() {
-        pm = getPM();
+    public void testPositive() {
+        PersistenceManager pm = getPM();
 
-        initDatabase(pm, PCPoint.class);
-        runTestCloseAll(pm);
-
-        pm.close();
-        pm = null;
-    }
-
-    /** */
-    void runTestCloseAll(PersistenceManager pm) {
         if (debug) logger.debug("\nExecuting test CloseAll()...");
         Transaction tx = pm.currentTransaction();
         try {
@@ -100,6 +92,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/api/CompileQuery.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/CompileQuery.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/CompileQuery.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/CompileQuery.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;
@@ -54,18 +55,9 @@
     }
 
     /** */
-    public void test() {
-        pm = getPM();
+    public void testPositive() {
+        PersistenceManager pm = getPM();
 
-        initDatabase(pm, PCPoint.class);
-        runTestCompileQuery(pm);
-
-        pm.close();
-        pm = null;
-    }
-
-    /** */
-    private void runTestCompileQuery(PersistenceManager pm) {
         Transaction tx = pm.currentTransaction();
         try {
             tx.begin();
@@ -94,5 +86,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/api/DeclareImports.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/DeclareImports.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/DeclareImports.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/DeclareImports.java Fri Dec  2 08:19:42 2005
@@ -24,11 +24,13 @@
 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.pc.company.Department;
 import org.apache.jdo.tck.pc.company.Company;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
+import org.apache.jdo.tck.util.ConversionHelper;
 
 /**
  *<B>Title:</B> Declare Imports
@@ -145,5 +147,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/api/DeclareParameters.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/DeclareParameters.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/DeclareParameters.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/DeclareParameters.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;
@@ -54,16 +55,12 @@
     }
 
     /** */
-    public void test() {
-        pm = getPM();
+    public void testPositive() {
+        PersistenceManager pm = getPM();
 
-        initDatabase(pm, PCPoint.class);
         runTestDeclareParameters01(pm);
         runTestDeclareParameters02(pm);
         runTestDeclareParameters03(pm);
-        
-        pm.close();
-        pm = null;
     }
 
     /** */
@@ -152,6 +149,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/api/ExecuteQuery.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/ExecuteQuery.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/ExecuteQuery.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/ExecuteQuery.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;
@@ -58,16 +59,12 @@
     }
 
     /** */
-    public void test() {
-        pm = getPM();
+    public void testPositive() {
+        PersistenceManager pm = getPM();
 
-        initDatabase(pm, PCPoint.class);
         runTestExecuteQuery01(pm);
         runTestExecuteQuery02(pm);
         runTestExecuteQuery03(pm);
-        
-        pm.close();
-        pm = null;
     }
 
     /** */
@@ -157,6 +154,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/api/ExecuteQueryWithArray.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/ExecuteQueryWithArray.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/ExecuteQueryWithArray.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/ExecuteQueryWithArray.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;
@@ -59,15 +60,11 @@
     }
 
     /** */
-    public void test() {
-        pm = getPM();
+    public void testPositive() {
+        PersistenceManager pm = getPM();
 
-        initDatabase(pm, PCPoint.class);
         runTestExecuteQueryWithArray01(pm);
         runTestExecuteQueryWithArray02(pm);
-        
-        pm.close();
-        pm = null;
     }
 
     /** */
@@ -134,6 +131,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/api/ExecuteQueryWithMap.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/ExecuteQueryWithMap.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/ExecuteQueryWithMap.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/ExecuteQueryWithMap.java Fri Dec  2 08:19:42 2005
@@ -25,6 +25,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;
@@ -60,15 +61,11 @@
     }
 
     /** */
-    public void test() {
-        pm = getPM();
+    public void testPositive() {
+        PersistenceManager pm = getPM();
 
-        initDatabase(pm, PCPoint.class);
         runTestExecuteQueryWithMap01(pm);
         runTestExecuteQueryWithMap02(pm);
-        
-        pm.close();
-        pm = null;
     }
 
     /** */
@@ -136,6 +133,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/api/GetFetchPlan.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/GetFetchPlan.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/GetFetchPlan.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/GetFetchPlan.java Fri Dec  2 08:19:42 2005
@@ -158,7 +158,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/api/MetadataSearchOrder.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/MetadataSearchOrder.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/MetadataSearchOrder.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/MetadataSearchOrder.java Fri Dec  2 08:19:42 2005
@@ -50,15 +50,15 @@
      * The expected results of valid queries.
      */
     private Object[] expectedResult = {
-        getCompanyModelInstancesAsList(new String[]{
+        getTransientCompanyModelInstancesAsList(new String[]{
                 "emp1", "emp2", "emp3", "emp4", "emp5"}),
-        getCompanyModelInstancesAsList(new String[]{
+        getTransientCompanyModelInstancesAsList(new String[]{
                 "emp2", "emp3", "emp4", "emp5"}),
-        getMylibInstancesAsList(new String[]{
+        getTransientMylibInstancesAsList(new String[]{
                 "pcClass1", "pcClass2"}),
-        getCompanyModelInstancesAsList(new String[]{
+        getTransientCompanyModelInstancesAsList(new String[]{
                 "emp3", "emp4", "emp5"}),
-        getCompanyModelInstancesAsList(new String[]{
+        getTransientCompanyModelInstancesAsList(new String[]{
                 "emp4", "emp5"})
     };
             
@@ -117,9 +117,9 @@
      * @see JDO_Test#localSetUp()
      */
     protected void localSetUp() {
-        loadCompanyModel(getPM(), COMPANY_TESTDATA);
+        loadAndPersistCompanyModel(getPM());
         addTearDownClass(CompanyModelReader.getTearDownClasses());
-        loadMylib(getPM(), MYLIB_TESTDATA);
+        loadAndPersistMylib(getPM());
         addTearDownClass(MylibReader.getTearDownClasses());
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewNamedQuery.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewNamedQuery.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewNamedQuery.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewNamedQuery.java Fri Dec  2 08:19:42 2005
@@ -93,7 +93,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/api/NewQueryFromExistingQueryBoundToPMFromSameVendor.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryFromExistingQueryBoundToPMFromSameVendor.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryFromExistingQueryBoundToPMFromSameVendor.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryFromExistingQueryBoundToPMFromSameVendor.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;
@@ -56,15 +57,11 @@
 
 
     /** */
-    public void test() {
-        pm = getPM();
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         
-        initDatabase(pm, PCPoint.class);
         runTestNewQueryFromExistingQueryBoundToPMFromSameVendor01(pm);
         runTestNewQueryFromExistingQueryBoundToPMFromSameVendor02(pm);
-
-        pm.close();
-        pm = null;
     }
 
     /** */
@@ -153,6 +150,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/api/NewQueryFromRestoredSerializedQuery.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryFromRestoredSerializedQuery.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryFromRestoredSerializedQuery.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryFromRestoredSerializedQuery.java Fri Dec  2 08:19:42 2005
@@ -28,6 +28,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;
@@ -58,18 +59,8 @@
     }
 
     /** */
-    public void test() throws Exception {
-        pm = getPM();
-
-        initDatabase(pm, PCPoint.class);
-        runTestNewQueryFromRestoredSerializedQuery01(pm);
-
-        pm.close();
-        pm = null;
-    }
-
-    /** */
-    void runTestNewQueryFromRestoredSerializedQuery01(PersistenceManager pm) throws Exception {
+    public void testPositive() throws Exception {
+        PersistenceManager pm = getPM();
         if (debug)
             logger.debug("\nExecuting test NewQueryFromRestoredSerializedQuery01() ...");
 
@@ -124,6 +115,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/api/NewQuerySingleString.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQuerySingleString.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQuerySingleString.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQuerySingleString.java Fri Dec  2 08:19:42 2005
@@ -65,7 +65,7 @@
      * The expected results of valid queries.
      */
     private Object[] expectedResult = {
-        getCompanyModelInstancesAsList(new String[]{
+        getTransientCompanyModelInstancesAsList(new String[]{
                 "emp1", "emp2", "emp3", "emp4", "emp5"})
     };
             
@@ -90,7 +90,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/api/NewQueryWithCandidateClass.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClass.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClass.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClass.java Fri Dec  2 08:19:42 2005
@@ -21,6 +21,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;
@@ -51,18 +52,8 @@
     }
 
     /** */
-    public void test() {
-        pm = getPM();
-
-        initDatabase(pm, PCPoint.class);
-        runTestNewQuery(pm);
-
-        pm.close();
-        pm = null;
-    }
-
-    /** */
-    void runTestNewQuery(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         Transaction tx = pm.currentTransaction();
         try {
             tx.begin();
@@ -82,6 +73,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/api/NewQueryWithCandidateClassAndCollection.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassAndCollection.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassAndCollection.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassAndCollection.java Fri Dec  2 08:19:42 2005
@@ -21,6 +21,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;
@@ -51,18 +52,8 @@
     }
 
     /** */
-    public void test() {
-        pm = getPM();
-
-        initDatabase(pm, PCPoint.class);
-        runTestNewQuery(pm);
-
-        pm.close();
-        pm = null;
-    }
-
-    /** */
-    void runTestNewQuery(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         Transaction tx = pm.currentTransaction();
         try {
             tx.begin();
@@ -81,6 +72,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/api/NewQueryWithCandidateClassAndExtent.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassAndExtent.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassAndExtent.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassAndExtent.java Fri Dec  2 08:19:42 2005
@@ -22,6 +22,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,17 +57,8 @@
     }
 
     /** */
-    public void test() {
-        pm = getPM();
-
-        initDatabase(pm, PCPoint.class);
-        runTestNewQuery(pm);
-        pm.close();
-        pm = null;
-    }
-
-    /** */
-    void runTestNewQuery(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         Transaction tx = pm.currentTransaction();
         Class clazz = PCPoint.class;
         try {
@@ -89,5 +81,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/api/NewQueryWithCandidateClassAndFilter.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassAndFilter.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassAndFilter.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassAndFilter.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;
@@ -54,18 +55,8 @@
     }
 
     /** */
-    public void test() {
-        pm = getPM();
-
-        initDatabase(pm, PCPoint.class);
-        runTestNewQuery(pm);
-        
-        pm.close();
-        pm = null;
-    }
-
-    /** */
-    void runTestNewQuery(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         Transaction tx = pm.currentTransaction();
         try {
             tx.begin();
@@ -90,6 +81,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/api/NewQueryWithCandidateClassCollectionFilter.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassCollectionFilter.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassCollectionFilter.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithCandidateClassCollectionFilter.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;
@@ -54,18 +55,8 @@
     }
 
     /** */
-    public void test() {
-        pm = getPM();
-
-        initDatabase(pm, PCPoint.class);
-        runTestNewQuery(pm);
-        
-        pm.close();
-        pm = null;
-    }
-
-    /** */
-    void runTestNewQuery(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         Transaction tx = pm.currentTransaction();
         try {
             tx.begin();
@@ -88,6 +79,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/api/NewQueryWithExtent.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithExtent.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithExtent.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithExtent.java Fri Dec  2 08:19:42 2005
@@ -21,6 +21,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;
@@ -53,18 +54,8 @@
     }
 
     /** */
-    public void test() {
-        pm = getPM();
-
-        initDatabase(pm, PCPoint.class);
-        runTestNewQuery(pm);
-
-        pm.close();
-        pm = null;
-    }
-    
-    /** */
-    void runTestNewQuery(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         Transaction tx = pm.currentTransaction();
         try {
             tx.begin();
@@ -84,5 +75,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/api/NewQueryWithExtentAndFilter.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithExtentAndFilter.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithExtentAndFilter.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithExtentAndFilter.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,18 +57,8 @@
     }
 
     /** */
-    public void test() {
-        pm = getPM();
-        
-        initDatabase(pm, PCPoint.class);
-        runTestNewQuery(pm);
-
-        pm.close();
-        pm = null;
-    }
-
-    /** */
-    void runTestNewQuery(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         Transaction tx = pm.currentTransaction();
         tx.begin();
         try {
@@ -89,6 +80,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/api/NewQueryWithSpecifiedLanguageAndQuery.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithSpecifiedLanguageAndQuery.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithSpecifiedLanguageAndQuery.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/NewQueryWithSpecifiedLanguageAndQuery.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;
@@ -54,19 +55,8 @@
     }
 
     /** */
-    public void test() {
-        pm = getPM();
-
-        initDatabase(pm, PCPoint.class);
-        runTestNewQueryWithSpecifiedLanguageAndQuery(pm);
-        //runTestNewQueryWithSpecifiedLanguageAndQuery(pm);
-
-        pm.close();
-        pm = null;
-    }
-
-    /** */
-    void runTestNewQueryWithSpecifiedLanguageAndQuery(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         if (debug)
             logger.debug("\nExecuting test NewQueryWithSpecifiedLanguageAndQuery()...");
 
@@ -108,5 +98,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/api/QueryExtentions.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/QueryExtentions.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/QueryExtentions.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/QueryExtentions.java Fri Dec  2 08:19:42 2005
@@ -51,7 +51,7 @@
      * The expected results of valid queries.
      */
     private Object[] expectedResult = {
-        getCompanyModelInstancesAsList(
+        getTransientCompanyModelInstancesAsList(
                 new String[]{"emp1", "emp2", "emp3", "emp4", "emp5"})
     };
             
@@ -80,7 +80,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/api/SetCandidateCollection.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetCandidateCollection.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetCandidateCollection.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetCandidateCollection.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,18 +57,8 @@
     }
 
     /** */
-    public void test() {
-        pm = getPM();
-
-        initDatabase(pm, PCPoint.class);
-        runTestSetCandidateCollection(pm);
-
-        pm.close();
-        pm = null;
-    }
-
-    /** */
-    void runTestSetCandidateCollection(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         if (debug) logger.debug("\nExecuting test SetCandidateCollection()...");
 
         Transaction tx = pm.currentTransaction();
@@ -103,6 +94,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/api/SetCandidateExtent.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetCandidateExtent.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetCandidateExtent.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetCandidateExtent.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,18 +57,8 @@
     }
 
     /** */
-    public void test() {
-        pm = getPM();
-
-        initDatabase(pm, PCPoint.class);
-        runTestSetCandidateExtent(pm);
-
-        pm.close();
-        pm = null;
-    }
-
-    /** */
-    void runTestSetCandidateExtent(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         if (debug) logger.debug("\nExecuting test SetCandidateExtent()...");
 
         Transaction tx = pm.currentTransaction();
@@ -102,5 +93,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/api/SetFilter.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetFilter.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetFilter.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetFilter.java Fri Dec  2 08:19:42 2005
@@ -25,6 +25,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;
@@ -58,17 +59,8 @@
     }
 
     /** */
-    public void test() {
-        pm = getPM();
-
-        initDatabase(pm, PCPoint.class);
-        runTestNewQuery(pm);
-        pm.close();
-        pm = null;
-    }
-
-    /** */
-    void runTestNewQuery(PersistenceManager pm) {
+    public void testPositive() {
+        PersistenceManager pm = getPM();
         Transaction tx = pm.currentTransaction();
         Class clazz = PCPoint.class;
         try {
@@ -94,6 +86,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/api/SetGrouping.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetGrouping.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetGrouping.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetGrouping.java Fri Dec  2 08:19:42 2005
@@ -75,7 +75,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/api/SetOrdering.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetOrdering.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetOrdering.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetOrdering.java Fri Dec  2 08:19:42 2005
@@ -21,13 +21,12 @@
 import java.util.List;
 import java.util.ListIterator;
 
-import javax.jdo.Extent;
 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.pc.fieldtypes.AllTypes;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
 
@@ -60,15 +59,11 @@
     }
 
     /** */
-    public void test() {
-        pm = getPM();
+    public void testPositive() {
+        PersistenceManager pm = getPM();
 
-        initDatabase(pm, PCPoint.class);
         runTestAscending(pm);
         runTestDescending(pm);
-
-        pm.close();
-        pm = null;
     }
 
     /** */
@@ -133,4 +128,11 @@
         }
     }
 
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistPCPoints(getPM());
+        addTearDownClass(PCPoint.class);
+    }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetRange.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetRange.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetRange.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetRange.java Fri Dec  2 08:19:42 2005
@@ -46,7 +46,7 @@
      * The expected results of valid queries.
      */
     private Object[] expectedResult = {
-        getCompanyModelInstancesAsList(
+        getTransientCompanyModelInstancesAsList(
                 new String[]{"emp1", "emp2", "emp3", "emp4", "emp5"})
     };
             
@@ -74,7 +74,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/api/SetResult.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetResult.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetResult.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetResult.java Fri Dec  2 08:19:42 2005
@@ -88,7 +88,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/api/SetResultClass.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetResultClass.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetResultClass.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetResultClass.java Fri Dec  2 08:19:42 2005
@@ -81,7 +81,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/api/SetUnique.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetUnique.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetUnique.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetUnique.java Fri Dec  2 08:19:42 2005
@@ -45,8 +45,8 @@
      * The expected results of valid queries.
      */
     private Object[] expectedResult = {
-        getCompanyModelInstance("emp1"),
-        getCompanyModelInstancesAsList(
+        getTransientCompanyModelInstance("emp1"),
+        getTransientCompanyModelInstancesAsList(
                 new String[]{"emp1", "emp2", "emp3", "emp4", "emp5"})
     };
             
@@ -82,7 +82,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/api/SetterReplacePreviousValues.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetterReplacePreviousValues.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetterReplacePreviousValues.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SetterReplacePreviousValues.java Fri Dec  2 08:19:42 2005
@@ -16,16 +16,13 @@
 
 package org.apache.jdo.tck.query.api;
 
-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.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;
+import org.apache.jdo.tck.query.QueryElementHolder;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
 
@@ -47,6 +44,70 @@
     private static final String ASSERTION_FAILED = 
         "Assertion A14.6.15 (SetterReplacePreviousValues) failed: ";
     
+    /** 
+     * The array of valid queries which may be executed as 
+     * single string queries and as API queries.
+     */
+    private static final QueryElementHolder[] VALID_QUERIES = {
+        // replace parameter declaration
+        new QueryElementHolder(
+        /*UNIQUE*/      null,
+        /*RESULT*/      null,
+        /*INTO*/        null, 
+        /*FROM*/        Department.class,
+        /*EXCLUDE*/     null,
+        /*WHERE*/       "deptid == param",
+        /*VARIABLES*/   null,
+        /*PARAMETERS*/  "String x",
+        /*IMPORTS*/     null,
+        /*GROUP BY*/    null,
+        /*ORDER BY*/    null,
+        /*FROM*/        null,
+        /*TO*/          null),
+        // replace filter setting
+        new QueryElementHolder(
+        /*UNIQUE*/      null,
+        /*RESULT*/      null,
+        /*INTO*/        null, 
+        /*FROM*/        Employee.class,
+        /*EXCLUDE*/     null,
+        /*WHERE*/       "personid == 1L",
+        /*VARIABLES*/   null,
+        /*PARAMETERS*/  "String x",
+        /*IMPORTS*/     null,
+        /*GROUP BY*/    null,
+        /*ORDER BY*/    null,
+        /*FROM*/        null,
+        /*TO*/          null),
+        // replace variable declaration
+        new QueryElementHolder(
+        /*UNIQUE*/      null,
+        /*RESULT*/      null,
+        /*INTO*/        null, 
+        /*FROM*/        Department.class,
+        /*EXCLUDE*/     null,
+        /*WHERE*/       "employees.contains(e) && e.personid == 1",
+        /*VARIABLES*/   "Employee e1; Employee e2",
+        /*PARAMETERS*/  null,
+        /*IMPORTS*/     null,
+        /*GROUP BY*/    null,
+        /*ORDER BY*/    null,
+        /*FROM*/        null,
+        /*TO*/          null)
+    };
+        
+    /** 
+     * The expected results of valid queries.
+     */
+    private Object[] expectedResult = {
+        // replace parameter declaration
+        getTransientCompanyModelInstancesAsList(new String[]{"dept1"}),
+        // replace filter setting
+        getTransientCompanyModelInstancesAsList(new String[]{"emp2"}),
+        // replace variable declaration
+        getTransientCompanyModelInstancesAsList(new String[]{"dept1"})
+    };
+    
     /**
      * The <code>main</code> is called when the class
      * is directly executed from the command line.
@@ -57,57 +118,47 @@
     }
     
     /** */
-    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) {
-        Query q;
-        Collection result;
-        Collection expected;
-        
-        Transaction tx = pm.currentTransaction();
-        tx.begin();
-        
+    public void testPositive() {
         // replace parameter declaration
-        q = pm.newQuery(Department.class, "deptid == param");
-        q.declareParameters("String x");
-        q.declareParameters("long param");
-        result = (Collection)q.execute(new Long(1));
-        expected = new HashSet();
-        expected.add(reader.getDepartment("dept1"));
-        checkQueryResultWithoutOrder(ASSERTION_FAILED, result, expected);
-       
-        // replace filter setting
-        q = pm.newQuery(Employee.class, "personid == 1L");
-        q.setFilter("personid == 2L");
-        result = (Collection)q.execute();
-        expected = new HashSet();
-        expected.add(reader.getFullTimeEmployee("emp2"));
-        checkQueryResultWithoutOrder(ASSERTION_FAILED, result, expected);
+        int index = 0;
+        Query query = VALID_QUERIES[index].getAPIQuery(getPM());
+        query.declareParameters("long param");
+        Object[] parameters = new Object[] {new Long(1)};
+        executeJDOQuery(ASSERTION_FAILED, query, VALID_QUERIES[index].toString(), false, 
+                parameters, expectedResult[index], true);
+        query = VALID_QUERIES[index].getSingleStringQuery(getPM());
+        query.declareParameters("long param");
+        executeJDOQuery(ASSERTION_FAILED, query, VALID_QUERIES[index].toString(), false, 
+                parameters, expectedResult[index], true);
         
-        // repalce variable declaration
-        q = pm.newQuery(Department.class);
-        q.declareVariables("Employee e1; Employee e2");
-        q.declareVariables("Employee e");
-        q.setFilter("employees.contains(e) && e.personid == 1");
-        result = (Collection)q.execute();
-        expected = new HashSet();
-        expected.add(reader.getDepartment("dept1"));
-        checkQueryResultWithoutOrder(ASSERTION_FAILED, result, expected);
+        // replace filter setting
+        index++;
+        query = VALID_QUERIES[index].getAPIQuery(getPM());
+        query.setFilter("personid == 2L");
+        executeJDOQuery(ASSERTION_FAILED, query, VALID_QUERIES[index].toString(), false, 
+                parameters, expectedResult[index], true);
+        query = VALID_QUERIES[index].getSingleStringQuery(getPM());
+        query.setFilter("personid == 2L");
+        executeJDOQuery(ASSERTION_FAILED, query, VALID_QUERIES[index].toString(), false, 
+                parameters, expectedResult[index], true);
         
-        tx.rollback();
+        // replace variable declaration
+        index++;
+        query = VALID_QUERIES[index].getAPIQuery(getPM());
+        query.declareVariables("Employee e");
+        executeJDOQuery(ASSERTION_FAILED, query, VALID_QUERIES[index].toString(), false, 
+                parameters, expectedResult[index], true);
+        query = VALID_QUERIES[index].getSingleStringQuery(getPM());
+        query.declareVariables("Employee e");
+        executeJDOQuery(ASSERTION_FAILED, query, VALID_QUERIES[index].toString(), false, 
+                parameters, expectedResult[index], true);
+    }
+    
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        loadAndPersistCompanyModel(getPM());
+        addTearDownClass(CompanyModelReader.getTearDownClasses());
     }
 }

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SingleStringQuery.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SingleStringQuery.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SingleStringQuery.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/SingleStringQuery.java Fri Dec  2 08:19:42 2005
@@ -71,11 +71,11 @@
      */
     private Object[] expectedResult = {
         new FullName("emp1First", "emp1Last"),
-        getCompanyModelInstancesAsList(new String[]{"emp1", "emp2", "emp5"}) 
+        getTransientCompanyModelInstancesAsList(new String[]{"emp1", "emp2", "emp5"}) 
     };
             
     /** Parameters of valid queries. */
-    private static Object[][] parameters = {
+    private Object[][] parameters = {
         {new BigDecimal("2000")}
     };
             
@@ -116,7 +116,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/api/UnmodifiableQuery.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/UnmodifiableQuery.java?rev=351768&r1=351767&r2=351768&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/UnmodifiableQuery.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/api/UnmodifiableQuery.java Fri Dec  2 08:19:42 2005
@@ -185,7 +185,7 @@
      * @see JDO_Test#localSetUp()
      */
     protected void localSetUp() {
-        loadCompanyModel(getPM(), COMPANY_TESTDATA);
+        loadAndPersistCompanyModel(getPM());
         addTearDownClass(CompanyModelReader.getTearDownClasses());
     }
 }



Mime
View raw message