svn commit: r160090 [39/63] - in incubator/jdo/trunk: ./ tck20/ tck20/assertions/ tck20/iut_jars/ tck20/test/ tck20/test/conf/ tck20/test/java/ tck20/test/java/org/ tck20/test/java/org/apache/ tck20/test/java/org/apache/jdo/ tck20/test/java/org/apache/jdo/tck/ tck20/test/java/org/apache/jdo/tck/api/ tck20/test/java/org/apache/jdo/tck/api/instancecallbacks/ tck20/test/java/org/apache/jdo/tck/api/jdohelper/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/close/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/extent/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/ tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/ tck20/test/java/org/apache/jdo/tck/enhancement/ tck20/test/java/org/apache/jdo/tck/extents/ tck20/test/java/org/apache/jdo/tck/lifecycle/ tck20/test/java/org/apache/jdo/tck/lifecycle/nontransactional/ tck20/test/java/org/apache/jdo/tck/models/ tck20/test/java/org/apache/jdo/tck/models/embedded/ tck20/test/java/org/apache/jdo/tck/models/fieldtypes/ tck20/test/java/org/apache/jdo/tck/models/inheritance/ tck20/test/java/org/apache/jdo/tck/pc/ tck20/test/java/org/apache/jdo/tck/pc/company/ tck20/test/java/org/apache/jdo/tck/pc/fieldtypes/ tck20/test/java/org/apache/jdo/tck/pc/inheritance/ tck20/test/java/org/apache/jdo/tck/pc/instancecallbacks/ tck20/test/java/org/apache/jdo/tck/pc/lifecycle/ tck20/test/java/org/apache/jdo/tck/pc/mylib/ tck20/test/java/org/apache/jdo/tck/query/ tck20/test/java/org/apache/jdo/tck/query/operators/ tck20/test/java/org/apache/jdo/tck/transactions/ tck20/test/java/org/apache/jdo/tck/util/ tck20/test/jdo/ tck20/test/jdo/applicationidentity/ tck20/test/jdo/applicationidentity/org/ tck20/test/jdo/applicationidentity/org/apache/ tck20/test/jdo/applicationidentity/org/apache/jdo/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/company/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/fieldtypes/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/inheritance/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/instancecallbacks/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/lifecycle/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/mylib/ tck20/test/jdo/datastoreidentity/ tck20/test/jdo/datastoreidentity/org/ tck20/test/jdo/datastoreidentity/org/apache/ tck20/test/jdo/datastoreidentity/org/apache/jdo/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/company/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/fieldtypes/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/inheritance/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/instancecallbacks/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/lifecycle/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/mylib/ tck20/test/orm/ tck20/test/orm/applicationidentity/ tck20/test/orm/applicationidentity/org/ tck20/test/orm/applicationidentity/org/apache/ tck20/test/orm/applicationidentity/org/apache/jdo/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/company/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/fieldtypes/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/inheritance/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/instancecallbacks/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/lifecycle/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/mylib/ tck20/test/orm/datastoreidentity/ tck20/test/orm/datastoreidentity/org/ tck20/test/orm/datastoreidentity/org/apache/ tck20/test/orm/datastoreidentity/org/apache/jdo/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/company/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/fieldtypes/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/inheritance/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/instancecallbacks/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/lifecycle/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/mylib/ tck20/test/sql/ tck20/test/sql/derby/

4 Apr 2005 20:10:40 -0000

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryFromRestoredSerializedQuery.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryFromRestoredSerializedQuery.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryFromRestoredSerializedQuery.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryFromRestoredSerializedQuery.java
 Mon Apr  4 12:41:23 2005
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.query;
+
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> New Query From Existing Serialized Query
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.5-2.
+ *<BR>
+ *<B>Assertion Description: </B> <code>PersistenceManager.newQuery(Object 
query)</code> constructs a <code>Query</code> instance from another query, 
where the parameter is a serialized/re-stored <code>Query</code> instance from 
the same JDO vendor but a different execution environment.  Any of the elements 
Class, Filter, Import declarations, Variable declarations, Parameter 
declarations, and Ordering from the parameter <code>Query</code> are copied to 
the new <code>Query</code> instance, but a candidate <code>Collection</code> or 
<code>Extent</code> element is discarded.
+ */
+
+public class NewQueryFromRestoredSerializedQuery extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.5-2 (NewQueryFromRestoredSerializedQuery) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(NewQueryFromRestoredSerializedQuery.class);
+    }
+
+    /** */
+    public void test() throws Exception {
+        pm = getPM();
+
+        initDatabase(pm, PCPoint.class);
+        runTestNewQueryFromRestoredSerializedQuery01(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTestNewQueryFromRestoredSerializedQuery01(PersistenceManager pm) 
throws Exception {
+        if (debug)
+            logger.debug("\nExecuting test 
NewQueryFromRestoredSerializedQuery01() ...");
+
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Query query = pm.newQuery();
+            query.setClass(PCPoint.class);
+            query.setCandidates(pm.getExtent(PCPoint.class, false));
+            query.setFilter("x == 3");
+            query.compile();
+
+            ObjectOutputStream oos = null;
+            try {
+                if (debug) 
+                    logger.debug("Attempting to serialize Query object.");
+                oos = new ObjectOutputStream( new 
FileOutputStream(SERIALZED_QUERY));
+                oos.writeObject(query);
+                if (debug) logger.debug("Query object serialized.");
+            } 
+            finally {
+                if (oos != null) {
+                    try { oos.flush();} catch(Exception ex) {}
+                    try { oos.close();} catch(Exception ex) {}
+                }
+            }
+
+            ObjectInputStream in = 
+                new ObjectInputStream(new FileInputStream(SERIALZED_QUERY));
+            Query query1 = (Query)in.readObject();
+            
+            // init and execute query
+            query = pm.newQuery(query1);
+            query.setCandidates(pm.getExtent(PCPoint.class, false));
+            Object results = query.execute();
+
+            // check query result
+            List expected = new ArrayList();
+            Object p4 = new PCPoint(3, 3);
+            expected.add(p4);
+            expected = getFromInserted(expected);
+            printOutput(results, expected);
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, results, expected);
+            if (debug)
+                logger.debug("Test NewQueryFromRestoredSerializedQuery01(): 
Passed");
+
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+}
+

Propchange: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryFromRestoredSerializedQuery.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithCandidateClass.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithCandidateClass.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithCandidateClass.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithCandidateClass.java
 Mon Apr  4 12:41:23 2005
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.query;
+
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> New Query with Candidate Class
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.5-5.
+ *<BR>
+ *<B>Assertion Description: </B> <code>PersistenceManager.newQuery(Class 
cls)</code> constructs a query instance with the candidate class specified.
+ */
+
+public class NewQueryWithCandidateClass extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.5-5 (NewQueryWithCandidateClass) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(NewQueryWithCandidateClass.class);
+    }
+
+    /** */
+    public void test() {
+        pm = getPM();
+
+        initDatabase(pm, PCPoint.class);
+        runTestNewQuery(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTestNewQuery(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Query query = pm.newQuery(PCPoint.class);
+            query.setCandidates(pm.getExtent(PCPoint.class, false));
+            Object results = query.execute();
+
+            // check query result
+            printOutput(results, inserted);
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, results, inserted);
+
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+}
+

Propchange: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithCandidateClass.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithCandidateClassAndCollection.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithCandidateClassAndCollection.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithCandidateClassAndCollection.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithCandidateClassAndCollection.java
 Mon Apr  4 12:41:23 2005
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.query;
+
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> New Query with Candidate Class and Collection
+ *<BR>
+ *<B>Keywords:</B> query extent
+ *<BR>
+ *<B>Assertion ID:</B> A14.5-7.
+ *<BR>
+ *<B>Assertion Description: </B> <code>PersistenceManager.newQuery(Class cls, 
Collection cln)</code> constructs a query instance with the candidate class and 
candidate <code>Collection</code> specified.
+ */
+
+public class NewQueryWithCandidateClassAndCollection extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.5-7 (NewQueryWithCandidateClassAndCollection) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(NewQueryWithCandidateClassAndCollection.class);
+    }
+
+    /** */
+    public void test() {
+        pm = getPM();
+
+        initDatabase(pm, PCPoint.class);
+        runTestNewQuery(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTestNewQuery(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Query query = pm.newQuery(PCPoint.class, inserted);
+            Object results = query.execute();
+
+            // check query result
+            printOutput(results, inserted);
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, results, inserted);
+            
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+}
+

Propchange: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithCandidateClassAndCollection.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithCandidateClassAndExtent.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithCandidateClassAndExtent.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithCandidateClassAndExtent.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithCandidateClassAndExtent.java
 Mon Apr  4 12:41:23 2005
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+
+package org.apache.jdo.tck.query;
+
+import javax.jdo.Extent;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> New Query with Candidate Class and Extent
+ *<BR>
+ *<B>Keywords:</B> query extent
+ *<BR>
+ *<B>Assertion ID:</B> A14.5-6.
+ *<BR>
+ *<B>Assertion Description: </B>
+<code>PersistenceManager.newQuery(Class cls, Extent cln)</code>
+constructs a query instance with the candidate class and candidate
+<code>Extent</code> specified.
+
+ */
+
+public class NewQueryWithCandidateClassAndExtent extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.5-6 (NewQueryWithCandidateClassAndExtent) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(NewQueryWithCandidateClassAndExtent.class);
+    }
+
+    /** */
+    public void test() {
+        pm = getPM();
+
+        initDatabase(pm, PCPoint.class);
+        runTestNewQuery(pm);
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTestNewQuery(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        Class clazz = PCPoint.class;
+        try {
+            Extent extent = pm.getExtent(clazz, true);
+            tx.begin();
+
+            Query query = pm.newQuery();
+            query.setClass(clazz);
+            query.setCandidates(extent);
+            Object results = query.execute();
+
+            // check query result
+            printOutput(results, inserted);
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, results, inserted);
+
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+}

Propchange: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithCandidateClassAndExtent.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithCandidateClassAndFilter.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithCandidateClassAndFilter.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithCandidateClassAndFilter.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithCandidateClassAndFilter.java
 Mon Apr  4 12:41:23 2005
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.query;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> New Query with Candidate Class and Filter
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.5-8.
+ *<BR>
+ *<B>Assertion Description: </B> <code>PersistenceManager.newQuery(Class cls, 
String filter)</code> constructs a query instance with the candidate class and 
filter specified.
+ */
+
+public class NewQueryWithCandidateClassAndFilter extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.5-8 (NewQueryWithCandidateClassAndFilter) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(NewQueryWithCandidateClassAndFilter.class);
+    }
+
+    /** */
+    public void test() {
+        pm = getPM();
+
+        initDatabase(pm, PCPoint.class);
+        runTestNewQuery(pm);
+        
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTestNewQuery(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Query query = pm.newQuery(PCPoint.class, "x == 1");
+            query.setClass(PCPoint.class);
+            query.setCandidates(pm.getExtent(PCPoint.class, false));
+            Object results = query.execute();
+
+            // check query result
+            List expected = new ArrayList();
+            Object pcp1 = new PCPoint(1, 1);
+            expected.add(pcp1);
+            expected = getFromInserted(expected);
+            printOutput(results, expected);
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, results, expected);
+
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+}
+

Propchange: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithCandidateClassAndFilter.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithCandidateClassCollectionFilter.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithCandidateClassCollectionFilter.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithCandidateClassCollectionFilter.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithCandidateClassCollectionFilter.java
 Mon Apr  4 12:41:23 2005
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.query;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> New Query with Candidate Class, Collection, and Filter
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.5-9.
+ *<BR>
+ *<B>Assertion Description: </B> <code>PersistenceManager.newQuery(Class cls, 
Collection cln, String filter)</code> constructs a query instance with the 
candidate class, the candidate <code>Collection</code>, and filter specified.
+ */
+
+public class NewQueryWithCandidateClassCollectionFilter extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.5-9 (NewQueryWithCandidateClassCollectionFilter) 
failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(NewQueryWithCandidateClassCollectionFilter.class);
+    }
+
+    /** */
+    public void test() {
+        pm = getPM();
+
+        initDatabase(pm, PCPoint.class);
+        runTestNewQuery(pm);
+        
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTestNewQuery(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Query query = pm.newQuery(PCPoint.class, inserted, "x ==2");
+            Object results = query.execute();
+
+            // check query result
+            List expected = new ArrayList();
+            PCPoint pc1 = new PCPoint(2, 2);
+            expected.add(pc1);
+            expected = getFromInserted(expected);
+            printOutput(results, expected);
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, results, expected);
+            
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+}
+

Propchange: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithCandidateClassCollectionFilter.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithExtent.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithExtent.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithExtent.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithExtent.java
 Mon Apr  4 12:41:23 2005
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.query;
+
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> New Query
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion IDs:</B> A14.5-1.
+ *<BR>
+ *<B>Assertion Description: </B>
+  PersistenceManagerFactory.newQuery() constructs and empty Query instance.
+
+ */
+
+public class NewQueryWithExtent extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.5-1 (NewQueryWithExtent) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(NewQueryWithExtent.class);
+    }
+
+    /** */
+    public void test() {
+        pm = getPM();
+
+        initDatabase(pm, PCPoint.class);
+        runTestNewQuery(pm);
+
+        pm.close();
+        pm = null;
+    }
+    
+    /** */
+    void runTestNewQuery(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Query query = pm.newQuery(pm.getExtent(PCPoint.class, false));
+            query.setClass(PCPoint.class);
+            Object results = query.execute();
+
+            // check query result
+            printOutput(results, inserted);
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, results, inserted);
+
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+}

Propchange: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithExtent.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithExtentAndFilter.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithExtentAndFilter.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithExtentAndFilter.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithExtentAndFilter.java
 Mon Apr  4 12:41:23 2005
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.query;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> New Query
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion IDs:</B> A14.5-10.
+ *<BR>
+ *<B>Assertion Description: </B>
+Construct a new query instance with the candidate Extent and filter 
+specified; the candidate class is taken from the Extent.
+ */
+
+public class NewQueryWithExtentAndFilter extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.5-1 (NewQueryWithExtentAndFilter) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(NewQueryWithExtentAndFilter.class);
+    }
+
+    /** */
+    public void test() {
+        pm = getPM();
+        
+        initDatabase(pm, PCPoint.class);
+        runTestNewQuery(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTestNewQuery(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+        try {
+            Query query = pm.newQuery(pm.getExtent(PCPoint.class, false), "x 
== 1");
+            Object results = query.execute();
+
+            // check query result
+            List expected = new ArrayList();
+            Object pcp1 = new PCPoint(1, 1);
+            expected.add(pcp1);
+            expected = getFromInserted(expected);
+            printOutput(results, expected);
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, results, expected);
+
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+}
+

Propchange: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithExtentAndFilter.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithSpecifiedLanguageAndQuery.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithSpecifiedLanguageAndQuery.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithSpecifiedLanguageAndQuery.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithSpecifiedLanguageAndQuery.java
 Mon Apr  4 12:41:23 2005
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.query;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> New Query With Specified Language and Query
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.5-4.
+ *<BR>
+ *<B>Assertion Description: </B> <code>PersistenceManager.newQuery(String 
language, Object query)</code> constructs a query instance using the specified 
language and the specified query .  The query instance returned will be of a 
class defined by the query language.  The language parameter for the JDO Query 
language as herein documented is &quot;javax.jdo.query.JDOQL&quot;.
+ */
+
+public class NewQueryWithSpecifiedLanguageAndQuery extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.5-4 (NewQueryWithSpecifiedLanguageAndQuery) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(NewQueryWithSpecifiedLanguageAndQuery.class);
+    }
+
+    /** */
+    public void test() {
+        pm = getPM();
+
+        initDatabase(pm, PCPoint.class);
+        runTestNewQueryWithSpecifiedLanguageAndQuery(pm);
+        //runTestNewQueryWithSpecifiedLanguageAndQuery(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTestNewQueryWithSpecifiedLanguageAndQuery(PersistenceManager pm) {
+        if (debug)
+            logger.debug("\nExecuting test 
NewQueryWithSpecifiedLanguageAndQuery()...");
+
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Query query = pm.newQuery();
+            query.setClass(PCPoint.class);
+            query.setCandidates(pm.getExtent(PCPoint.class, false));
+
+            Query query1 = pm.newQuery("javax.jdo.query.JDOQL", query);
+            query1.setCandidates(pm.getExtent(PCPoint.class, false));
+            query1.compile();
+            Object results = query1.execute();
+
+            // check query result
+            List expected = new ArrayList();
+            Object p1 = new PCPoint(0, 0);
+            Object p2 = new PCPoint(1, 1);
+            Object p3 = new PCPoint(2, 2);
+            Object p4 = new PCPoint(3, 3);
+            Object p5 = new PCPoint(4, 4);
+            expected.add(p1);
+            expected.add(p2);
+            expected.add(p3);
+            expected.add(p4);
+            expected.add(p5);
+            expected = getFromInserted(expected);
+            printOutput(results, expected);
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, results, expected);
+            if (debug)
+                logger.debug("Test NewQueryWithSpecifiedLanguageAndQuery() - 
Passed\n");
+
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+}

Propchange: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NewQueryWithSpecifiedLanguageAndQuery.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NullCollectionsAndContainsMethod.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NullCollectionsAndContainsMethod.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NullCollectionsAndContainsMethod.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NullCollectionsAndContainsMethod.java
 Mon Apr  4 12:41:23 2005
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.query;
+
+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.pc.company.Project;
+import org.apache.jdo.tck.pc.company.CompanyModelReader;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Null Collections and Contains Method
+ *<BR>
+ *<B>Keywords:</B> query nullcollection
+ *<BR>
+ *<B>Assertion ID:</B> A14.6.2-35.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * <code>null</code>-valued fields of <code>Collection</code> types are treated
+ * as if they were empty and all <code>contains</code> methods return
+ * <code>false</code>.
+ */
+
+public class NullCollectionsAndContainsMethod extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.6.2-35 (NullCollectionsAndContainsMethod) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(NullCollectionsAndContainsMethod.class);
+    }
+    
+    /** */
+    public void test() {
+        pm = getPM();
+                
+        try {
+            // read test data
+            CompanyModelReader reader = 
+                loadCompanyModel(pm, "org/apache/jdo/tck/query/company.xml");
+            runTest(pm, reader);
+        }
+        finally {
+            cleanupCompanyModel(pm);
+            pm.close();
+            pm = null;
+        }
+    }
+    
+    /** */
+    void runTest(PersistenceManager pm, CompanyModelReader reader) {
+        Query q;
+        Object result;
+        Collection expected;
+        
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+        Employee emp1 = reader.getFullTimeEmployee("emp1");
+        emp1.setProjects(null);
+        tx.commit();
+        
+        tx = pm.currentTransaction();
+        tx.begin();
+        
+        // contains 
+        q = pm.newQuery(Employee.class, "personid == 1 && 
projects.contains(p)");
+        q.declareParameters("org.apache.jdo.tck.pc.company.Project p");
+        result = q.execute(new Project(999l, "TestProject", null));
+        expected = new HashSet();
+        checkQueryResultWithoutOrder(ASSERTION_FAILED, result, expected);
+                
+        // contains 
+        q = pm.newQuery(Employee.class, "!team.contains(null)");
+        result = q.execute();
+        expected = new HashSet();
+        expected.add(reader.getFullTimeEmployee("emp1"));
+        expected.add(reader.getFullTimeEmployee("emp2"));
+        expected.add(reader.getPartTimeEmployee("emp3"));
+        checkQueryResultWithoutOrder(ASSERTION_FAILED, result, expected);
+            
+        tx.commit();
+    }
+}

Propchange: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NullCollectionsAndContainsMethod.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NullCollectionsAndIsEmpty.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NullCollectionsAndIsEmpty.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NullCollectionsAndIsEmpty.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NullCollectionsAndIsEmpty.java
 Mon Apr  4 12:41:23 2005
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.query;
+
+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.pc.company.CompanyModelReader;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Handling of Null Collections and isEmpty in Queries
+ *<BR>
+ *<B>Keywords:</B> query nullcollection
+ *<BR>
+ *<B>Assertion ID:</B> A14.6.2-34.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * <code>null</code>-valued fields of <code>Collection</code> types are treated
+ * as if they were empty and <code>isEmpty</code> returns <code>true</code>.
+ */
+
+public class NullCollectionsAndIsEmpty extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.6.2-34 (NullCollectionsAndIsEmpty) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(NullCollectionsAndIsEmpty.class);
+    }
+    
+    /** */
+    public void test() {
+        pm = getPM();
+                
+        try {
+            // read test data
+            CompanyModelReader reader = 
+                loadCompanyModel(pm, "org/apache/jdo/tck/query/company.xml");
+            runTest(pm, reader);
+        }
+        finally {
+            cleanupCompanyModel(pm);
+            pm.close();
+            pm = null;
+        }
+    }
+    
+    /** */
+    void runTest(PersistenceManager pm, CompanyModelReader reader) {
+        Query q;
+        Object result;
+        Collection expected;
+        
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+        Employee emp1 = reader.getFullTimeEmployee("emp1");
+        emp1.setProjects(null);
+        tx.commit();
+        
+        tx = pm.currentTransaction();
+        tx.begin();
+        
+        // isEmpty
+        q = pm.newQuery(Employee.class, "personid == 1 && projects.isEmpty()");
+        result = q.execute();
+        expected = new HashSet();
+        expected.add(emp1);
+        checkQueryResultWithoutOrder(ASSERTION_FAILED, result, expected);
+            
+        tx.commit();
+    }
+}

Propchange: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/NullCollectionsAndIsEmpty.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/OrderingSpecification.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/OrderingSpecification.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/OrderingSpecification.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/OrderingSpecification.java
 Mon Apr  4 12:41:23 2005
@@ -0,0 +1,191 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.query;
+
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.ListIterator;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.fieldtypes.AllTypes;
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Ordering Specification
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.6.6-1.
+ *<BR>
+ *<B>Assertion Description: </B> The <code>Query</code> ordering specification 
includes a list of one or more ordering declarations separated by commas. Each 
ordering declaration includes an expression whose type is one of:
+<UL>
+<LI>primitive types except <code>boolean</code></LI>
+<LI>wrapper types except <code>Boolean</code></LI>
+<LI><code>BigDecimal</code></LI>
+<LI><code>BigInteger</code></LI>
+<LI><code>String</code></LI>
+<LI><code>Date</code></LI>
+</UL>
+followed by one of the following words: <code>&quot;ascending</code>&quot; or
+ *<code>&quot;descending</code>&quot; which indicates the ordering of the 
values for that expression.  Ordering might be specified including navigation. 
The name of the field to be used in ordering via navigation through 
single-valued fields is specified by the Java language syntax of 
<code>field_name.field_name....field_name</code>.
+ */
+
+public class OrderingSpecification extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.6.6-1 (OrderingSpecification) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(OrderingSpecification.class);
+    }
+
+    /** */
+    public void test() {
+        pm = getPM();
+
+        initDatabase(pm, PCPoint.class);
+        runTestOrderingSpecification01(pm);
+        runTestOrderingSpecification02(pm);
+        checkOrderingTypes(pm);
+        
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTestOrderingSpecification01(PersistenceManager pm) {
+        if (debug) 
+            logger.debug("\nExecuting test OrderingSpecification01() ...");
+
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Query query = pm.newQuery();
+            query.setClass(PCPoint.class);
+            query.setCandidates(pm.getExtent(PCPoint.class, false));
+            query.setOrdering("x ascending");
+            Object results = query.execute();
+
+            // check query result
+            printOutput(results, inserted);
+            checkQueryResultWithOrder(ASSERTION_FAILED, results, inserted);
+            if(debug) 
+                logger.debug("Test OrderingSpecification01(): Passed");
+            
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    void runTestOrderingSpecification02(PersistenceManager pm) {
+        if(debug) 
+            logger.debug("\nExecuting test OrderingSpecification02() ...");
+
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Query query = pm.newQuery();
+            query.setClass(PCPoint.class);
+            query.setCandidates(pm.getExtent(PCPoint.class, false));
+            query.setOrdering("x descending");
+            Object results = query.execute();
+
+            // check query result
+            List expected = new ArrayList();
+            ListIterator li = inserted.listIterator(inserted.size());
+            // construct expected results by iterating inserted objects 
backwards
+            while (li.hasPrevious()) {
+                Object obj = li.previous();
+                expected.add(obj);
+            }
+            expected = getFromInserted(expected);
+            printOutput(results, expected);
+            checkQueryResultWithOrder(ASSERTION_FAILED, results, expected);
+            if(debug) 
+                logger.debug("Test OrderingSpecification02(): Passed");
+
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    void checkOrderingTypes(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        Class clazz = PCPoint.class;
+        try {
+            tx.begin();
+
+            Query query = pm.newQuery();
+            query.setClass(AllTypes.class);
+            query.setCandidates(pm.getExtent(AllTypes.class, false));
+            
+            StringBuffer buffer = new StringBuffer();
+            buffer.append("  fld_byte ascending");
+            buffer.append(", fld_char ascending");
+            buffer.append(", fld_double ascending");
+            buffer.append(", fld_float ascending");
+            buffer.append(", fld_int ascending");
+            buffer.append(", fld_long ascending");
+            buffer.append(", fld_short ascending");
+            buffer.append(", fld_Byte descending");
+            buffer.append(", fld_Character descending");
+            buffer.append(", fld_Double descending");
+            buffer.append(", fld_Float ascending");
+            buffer.append(", fld_Integer descending");
+            buffer.append(", fld_Long descending");
+            buffer.append(", fld_Short descending");
+            buffer.append(", fld_String descending");
+            buffer.append(", fld_Date descending");
+            buffer.append(", fld_BigDecimal descending");
+            buffer.append(", fld_BigInteger ascending");
+            query.setOrdering(buffer.toString());
+            Object results = query.execute();
+
+            // Just check whether query compiles
+
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+}

Propchange: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/OrderingSpecification.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/ParameterBoundToDifferentPM.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/ParameterBoundToDifferentPM.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/ParameterBoundToDifferentPM.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/ParameterBoundToDifferentPM.java
 Mon Apr  4 12:41:23 2005
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.query;
+
+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.pc.company.CompanyModelReader;
+import org.apache.jdo.tck.pc.company.Department;
+import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Element Returned in Query Result
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.6.1-8.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * If a persistent instance associated with another PersistenceManager is 
+ * passed as a parameter, JDOUserException is thrown during execute().
+ */
+
+public class ParameterBoundToDifferentPM extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.6.1-8 (ParameterBoundToDifferentPM) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(ParameterBoundToDifferentPM.class);
+    }
+    
+    /** */
+    public void test() {
+        pm = getPM();
+        
+        try {
+            // read test data
+            CompanyModelReader reader = 
+                loadCompanyModel(pm, "org/apache/jdo/tck/query/company.xml");
+            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();
+        
+        PersistenceManager pm2 = pmf.getPersistenceManager();
+        try {
+            pm2.currentTransaction().begin();
+            Query q = pm2.newQuery(Employee.class, "department == d");
+            q.declareParameters("Department d");  
+            Collection result = (Collection)q.execute(dept1);
+            fail(ASSERTION_FAILED,
+                 "Query.execute should throw a JDOUserException if a query " + 
+                 "parameter is bound to a different PersistenceManager");
+        }
+        catch (JDOUserException ex) {
+            // expected exception
+            if (debug) logger.debug("caught expected exception " + ex);
+        }
+        finally {
+            if ((pm2 != null) && !pm2.isClosed()) {
+                if (pm2.currentTransaction().isActive()) {
+                    pm2.currentTransaction().rollback();
+                }
+                pm2.close();
+            }
+        }
+    }
+}

Propchange: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/ParameterBoundToDifferentPM.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/ParameterDeclaredWithSameNameAsFieldOfCandidateClass.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/ParameterDeclaredWithSameNameAsFieldOfCandidateClass.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/ParameterDeclaredWithSameNameAsFieldOfCandidateClass.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/ParameterDeclaredWithSameNameAsFieldOfCandidateClass.java
 Mon Apr  4 12:41:23 2005
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.query;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Parameter Declared with Same Name as Field of Candidate
+ Class
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.4-2.
+ *<BR>
+ *<B>Assertion Description: </B> A field of the candidate class of a
+ *<code>Query</code> can be hidden if a parameter is declared with the same 
name.
+ */
+
+public class ParameterDeclaredWithSameNameAsFieldOfCandidateClass extends 
QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.4-2 
(ParameterDeclaredWithSameNameAsFieldOfCandidateClass) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        
BatchTestRunner.run(ParameterDeclaredWithSameNameAsFieldOfCandidateClass.class);
+    }
+
+    /** */
+    public void test() {
+        pm = getPM();
+
+        initDatabase(pm, PCPoint.class);
+        runTestParameterDeclaredWithSameNameAsFieldOfCandidateClass01(pm);
+        runTestParameterDeclaredWithSameNameAsFieldOfCandidateClass02(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTestParameterDeclaredWithSameNameAsFieldOfCandidateClass01(
+        PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Query query = pm.newQuery();
+            query.setClass(PCPoint.class);
+            query.setCandidates(pm.getExtent(PCPoint.class, false));
+            query.declareParameters("Integer x");
+            query.setFilter("x == x");
+            Object results = query.execute(new java.lang.Integer(2));
+
+            // check query result
+            List expected = new ArrayList();
+            Object p1 = new PCPoint(0, 0);
+            Object p2 = new PCPoint(1, 1);
+            Object p3 = new PCPoint(2, 2);
+            Object p4 = new PCPoint(3, 3);
+            Object p5 = new PCPoint(4, 4);
+            expected.add(p1);
+            expected.add(p2);
+            expected.add(p3);
+            expected.add(p4);
+            expected.add(p5);
+            expected = getFromInserted(expected);
+            printOutput(results, expected);
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, results, expected);
+            if (debug) 
+                logger.debug("\nTest 
ParameterDeclaredWithSameNameAsFieldOfCandidateClass - Passed");
+
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    void runTestParameterDeclaredWithSameNameAsFieldOfCandidateClass02(
+        PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Query query = pm.newQuery();
+            query.setClass(PCPoint.class);
+            query.setCandidates(pm.getExtent(PCPoint.class, false));
+            query.declareParameters("Integer y");
+            query.setFilter("y == y");
+            Object results = query.execute(new java.lang.Integer(2));
+
+            // check query result
+            List expected = new ArrayList();
+            Object p1 = new PCPoint(0, 0);
+            Object p2 = new PCPoint(1, 1);
+            Object p3 = new PCPoint(2, 2);
+            Object p4 = new PCPoint(3, 3);
+            Object p5 = new PCPoint(4, 4);
+            expected.add(p1);
+            expected.add(p2);
+            expected.add(p3);
+            expected.add(p4);
+            expected.add(p5);
+            expected = getFromInserted(expected);
+            printOutput(results, expected);
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, results, expected);
+            if (debug) 
+                logger.debug("\nTest 
ParameterDeclaredWithSameNameAsFieldOfCandidateClass - Passed");
+            
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+}
+

Propchange: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/ParameterDeclaredWithSameNameAsFieldOfCandidateClass.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/ParenthesesMarkOperatorPrecedence.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/ParenthesesMarkOperatorPrecedence.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/ParenthesesMarkOperatorPrecedence.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/ParenthesesMarkOperatorPrecedence.java
 Mon Apr  4 12:41:23 2005
@@ -0,0 +1,379 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.query;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Parentheses Mark Operator Precedence
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.6.2-37.
+ *<BR>
+ *<B>Assertion Description: </B> Parentheses can be used to explicitly mark 
operator precedence.
+
+ */
+
+public class ParenthesesMarkOperatorPrecedence extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.6.2-37 (ParenthesesMarkOperatorPrecedence) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(ParenthesesMarkOperatorPrecedence.class);
+    }
+
+    /** */
+    public void test() {
+        pm = getPM();
+
+        initDatabase(pm, PCPoint.class);
+        runTestParenthesesMarkOperatorPrecedence01(pm);
+        runTestParenthesesMarkOperatorPrecedence02(pm);
+        runTestParenthesesMarkOperatorPrecedence03(pm);
+        runTestParenthesesMarkOperatorPrecedence04(pm);
+        runTestParenthesesMarkOperatorPrecedence05(pm);
+        runTestParenthesesMarkOperatorPrecedence06(pm);
+        runTestParenthesesMarkOperatorPrecedence07(pm);
+        runTestParenthesesMarkOperatorPrecedence08(pm);
+        runTestParenthesesMarkOperatorPrecedence09(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTestParenthesesMarkOperatorPrecedence01(PersistenceManager pm) {
+        if(debug) 
+            logger.debug("\nExecuting Test 
ParenthesesMarkOperatorPrecedence01...");
+
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Query query = pm.newQuery();
+            query.setClass(PCPoint.class);
+            query.setCandidates(pm.getExtent(PCPoint.class, false));
+            query.setFilter("x == (1 + 1)");
+            Object results = query.execute();
+
+            // check query result
+            List expected = new ArrayList();
+            Object p3 = new PCPoint(2, 2);
+            expected.add(p3);
+            expected = getFromInserted(expected);
+            printOutput(results, expected);
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, results, expected);
+            if(debug) 
+                logger.debug("Test ParenthesesMarkOperatorPrecedence01 - 
Passed");
+
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    void runTestParenthesesMarkOperatorPrecedence02(PersistenceManager pm) {
+        if(debug) 
+            logger.debug("\nExecuting Test 
ParenthesesMarkOperatorPrecedence01...");
+
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Query query = pm.newQuery();
+            query.setClass(PCPoint.class);
+            query.setCandidates(pm.getExtent(PCPoint.class, false));
+            query.setFilter("x == (1 + 1) * 2");
+            Object results = query.execute();
+
+            // check query result
+            List expected = new ArrayList();
+            Object p5 = new PCPoint(4, 4);
+            expected.add(p5);
+            expected = getFromInserted(expected);
+            printOutput(results, expected);
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, results, expected);
+            if(debug) 
+                logger.debug("Test ParenthesesMarkOperatorPrecedence02 - 
Passed");
+            
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    void runTestParenthesesMarkOperatorPrecedence03(PersistenceManager pm) {
+        if(debug)
+            logger.debug("\nExecuting Test 
ParenthesesMarkOperatorPrecedence03...");
+
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Query query = pm.newQuery();
+            query.setClass(PCPoint.class);
+            query.setCandidates(pm.getExtent(PCPoint.class, false));
+            query.setFilter("x == (9 - 1) * (3 + 5) / 32");
+            Object results = query.execute();
+
+            // check query result
+            List expected = new ArrayList();
+            Object p3 = new PCPoint(2, 2);
+            expected.add(p3);
+            expected = getFromInserted(expected);
+            printOutput(results, expected);
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, results, expected);
+            if(debug)
+                logger.debug("Test ParenthesesMarkOperatorPrecedence03 - 
Passed");
+            
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    void runTestParenthesesMarkOperatorPrecedence04(PersistenceManager pm) {
+        if(debug)
+            logger.debug("\nExecuting Test 
ParenthesesMarkOperatorPrecedence04...");
+
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Query query = pm.newQuery();
+            query.setClass(PCPoint.class);
+            query.setCandidates(pm.getExtent(PCPoint.class, false));
+            query.setFilter("x == 2 && y == 2");
+            Object results = query.execute();
+
+            // check query result
+            List expected = new ArrayList();
+            Object p3 = new PCPoint(2, 2);
+            expected.add(p3);
+            expected = getFromInserted(expected);
+            printOutput(results, expected);
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, results, expected);
+            if(debug)
+                logger.debug("Test ParenthesesMarkOperatorPrecedence04 - 
Passed");
+
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    void runTestParenthesesMarkOperatorPrecedence05(PersistenceManager pm) {
+        if(debug)
+            logger.debug("\nExecuting Test 
ParenthesesMarkOperatorPrecedence05...");
+
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Query query = pm.newQuery();
+            query.setClass(PCPoint.class);
+            query.setCandidates(pm.getExtent(PCPoint.class, false));
+            query.setFilter("x == (1 + 1) || y == (1002 - 1000)");
+        
+            Object results = query.execute();
+
+            // check query result
+            List expected = new ArrayList();
+            Object p3 = new PCPoint(2, 2);
+            expected.add(p3);
+            expected = getFromInserted(expected);
+            printOutput(results, expected);
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, results, expected);
+            if(debug)
+                logger.debug("Test ParenthesesMarkOperatorPrecedence05 - 
Passed");
+
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    void runTestParenthesesMarkOperatorPrecedence06(PersistenceManager pm) {
+        if(debug)
+            logger.debug("\nExecuting Test 
ParenthesesMarkOperatorPrecedence06...");
+
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Query query = pm.newQuery();
+            query.setClass(PCPoint.class);
+            query.setCandidates(pm.getExtent(PCPoint.class, false));
+            query.setFilter("x == (1 * 2) && true");
+            Object results = query.execute();
+
+            // check query result
+            List expected = new ArrayList();
+            Object p3 = new PCPoint(2, 2);
+            expected.add(p3);
+            expected = getFromInserted(expected);
+            printOutput(results, expected);
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, results, expected);
+            if(debug)
+                logger.debug("Test ParenthesesMarkOperatorPrecedence06 - 
Passed");
+
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    void runTestParenthesesMarkOperatorPrecedence07(PersistenceManager pm) {
+        if(debug) logger.debug("\nExecuting Test 
ParenthesesMarkOperatorPrecedence07...");
+
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Query query = pm.newQuery();
+            query.setClass(PCPoint.class);
+            query.setCandidates(pm.getExtent(PCPoint.class, false));
+            query.setFilter("x == (10000 / 5000) || false");
+            Object results = query.execute();
+
+            // check query result
+            List expected = new ArrayList();
+            Object p3 = new PCPoint(2, 2);
+            expected.add(p3);
+            expected = getFromInserted(expected);
+            printOutput(results, expected);
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, results, expected);
+            if(debug) logger.debug("Test ParenthesesMarkOperatorPrecedence07 - 
Passed");
+
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    void runTestParenthesesMarkOperatorPrecedence08(PersistenceManager pm) {
+        if(debug)
+            logger.debug("\nExecuting Test 
ParenthesesMarkOperatorPrecedence08...");
+
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Query query = pm.newQuery();
+            query.setClass(PCPoint.class);
+            query.setCandidates(pm.getExtent(PCPoint.class, false));
+            query.setFilter("(x == 2) == true");
+            Object results = query.execute();
+
+            // check query result
+            List expected = new ArrayList();
+            Object p3 = new PCPoint(2, 2);
+            expected.add(p3);
+            expected = getFromInserted(expected);
+            printOutput(results, expected);
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, results, expected);
+            if(debug) logger.debug("Test ParenthesesMarkOperatorPrecedence08 - 
Passed");
+
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+   }
+
+    /** */
+    void runTestParenthesesMarkOperatorPrecedence09(PersistenceManager pm) {
+        if(debug)
+            logger.debug("\nExecuting Test 
ParenthesesMarkOperatorPrecedence09...");
+
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Query query = pm.newQuery();
+            query.setClass(PCPoint.class);
+            query.setCandidates(pm.getExtent(PCPoint.class, false));
+            query.setFilter("(x == ((21 - 1/1)/10 + 1)) | (false && true)");
+            Object results = query.execute();
+
+            // check query result
+            List expected = new ArrayList();
+            Object p4 = new PCPoint(3, 3);
+            expected.add(p4);
+            expected = getFromInserted(expected);
+            printOutput(results, expected);
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, results, expected);
+            if(debug)
+                logger.debug("Test ParenthesesMarkOperatorPrecedence09 - 
Passed");
+
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+}
+

Propchange: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/ParenthesesMarkOperatorPrecedence.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/PrimitiveParameterPassedAsNull.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/PrimitiveParameterPassedAsNull.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/PrimitiveParameterPassedAsNull.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/PrimitiveParameterPassedAsNull.java
 Mon Apr  4 12:41:23 2005
@@ -0,0 +1,94 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.query;
+
+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.pc.mylib.PrimitiveTypes;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Primtive type parameter executed null value
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.6.3-1.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * If a parameter type is specified as a primitive, the parameter value
+ * passed to execute() must not be null or a JDOUserException is thrown.
+ */
+
+public class PrimitiveParameterPassedAsNull extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.6.3-1 (PrimitiveParameterPassedAsNull) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        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) {
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+
+        Query q = pm.newQuery(PrimitiveTypes.class, "intNotNull == param");
+        q.declareParameters("int param");
+        try {
+            q.execute(null);
+            fail(ASSERTION_FAILED, 
+                 "query.execute should throw JDOUserException if the actual " +
+                 "value of a primitive type parameter is null");
+        }
+        catch (JDOUserException ex) {
+            if(debug) logger.debug("caught expected exception " + ex);
+        }
+
+        tx.commit();
+        
+    }
+    
+    
+}

Propchange: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/PrimitiveParameterPassedAsNull.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/QueryIsSerializable.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/QueryIsSerializable.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/QueryIsSerializable.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/QueryIsSerializable.java
 Mon Apr  4 12:41:23 2005
@@ -0,0 +1,187 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.query;
+
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Query is Serializable
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.3-7 A14.6-1.
+ *<BR>
+ *<B>Assertion Description: </B> The class implementing the <code>Query</code>
+ *interface must be serializable.  The serialized fields include the candidate
+ *class, the filter, parameter declarations, variable declarations, imports,
+ *and ordering specification.
+ */
+
+public class QueryIsSerializable extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.3-7 A14.6-1 (QueryIsSerializable) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(QueryIsSerializable.class);
+    }
+
+    /** */
+    public void test() throws Exception {
+        pm = getPM();
+
+        initDatabase(pm, PCPoint.class);
+        runTestQueryIsSerializable01(pm);
+        runTestQueryIsSerializable02(pm);
+        runTestQueryIsSerializable03(pm);
+        
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTestQueryIsSerializable01(PersistenceManager pm) {
+        if (debug) logger.debug("\nExecuting test QueryIsSerializable01() 
...");
+
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Query query = pm.newQuery();
+            if (query instanceof Serializable) { 
+                if (debug) {
+                    logger.debug("Query extends serializable interface.");
+                }
+            } 
+            else {
+                fail(ASSERTION_FAILED,
+                     "Query does not extends serializable interface.");
+            }
+
+            tx.rollback();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    void runTestQueryIsSerializable02(PersistenceManager pm) throws Exception {
+        if (debug) logger.debug("\nExecuting test QueryIsSerializable02() 
...");
+
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Query query = pm.newQuery();
+            query.setClass(PCPoint.class);
+            query.setCandidates(pm.getExtent(PCPoint.class, false));
+            query.setFilter("x == 3");
+            query.compile();
+        
+            ObjectOutputStream oos = null;
+            try {
+                if (debug) logger.debug("Attempting to serialize Query 
object.");
+                oos = new ObjectOutputStream(
+                        new FileOutputStream(SERIALZED_QUERY));
+                oos.writeObject(query);
+                if (debug) logger.debug("Query object serialized.");
+            } 
+            finally {
+                if (oos != null) {
+                    try { oos.flush();} catch(Exception ex) {}
+                    try { oos.close();} catch(Exception ex) {}
+                }
+            }
+
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    void runTestQueryIsSerializable03(PersistenceManager pm) throws Exception {
+        if (debug) logger.debug("\nExecuting test QueryIsSerializable03() 
...");
+        Object restoredQuery = null;
+        ObjectInputStream ois = null;
+
+        try {
+            if (debug) logger.debug("Attempting to de-serialize Query 
object.");
+            ois = new ObjectInputStream( new FileInputStream("query.ser"));
+            restoredQuery = ois.readObject();
+            if (debug) logger.debug("Query object restored.");
+        } finally {
+            if (ois != null) {
+                try { ois.close();} catch(Exception ex) {}
+            }
+        }
+
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Query query = pm.newQuery(restoredQuery);
+            query.setCandidates(pm.getExtent(PCPoint.class, false));
+            query.compile();
+            Object results = query.execute();
+
+            // check query result
+            List expected = new ArrayList();
+            Object p4 = new PCPoint(3, 3);
+            expected.add(p4);
+            expected = getFromInserted(expected);
+            printOutput(results, expected);
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, results, expected);
+            if (debug) logger.debug("Test QueryIsSerializable03(): Passed");
+            
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+}
+
+

Propchange: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/QueryIsSerializable.java
------------------------------------------------------------------------------
    svn:executable = *


Reply via email to