svn commit: r160090 [41/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:12:01 -0000

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/company.xml
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/company.xml?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/company.xml 
(added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/company.xml 
Mon Apr  4 12:41:23 2005
@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" 
"http://www.springframework.org/dtd/spring-beans.dtd";>
+
+<beans>
+    <description>Company instances for query testing</description>
+
+    <bean id="dept1" class="org.apache.jdo.tck.pc.company.Department">
+        <constructor-arg index="0" 
type="long"><value>1</value></constructor-arg>
+        <constructor-arg index="1" type="java.lang.String" 
><value>Development</value></constructor-arg>
+        <property name="employees">
+            <set>
+                <ref local="emp1"/>
+                <ref local="emp2"/>
+                <ref local="emp3"/>
+            </set>
+        </property>
+    </bean>
+
+    <bean id="emp1" class="org.apache.jdo.tck.pc.company.FullTimeEmployee">
+        <constructor-arg index="0" 
type="long"><value>1</value></constructor-arg>
+        <constructor-arg index="1" 
type="java.lang.String"><value>emp1First</value></constructor-arg>
+        <constructor-arg index="2" 
type="java.lang.String"><value>emp1Last</value></constructor-arg>
+        <constructor-arg index="3" 
type="java.lang.String"><value>emp1Middle</value></constructor-arg>
+        <constructor-arg index="4" 
type="java.util.Date"><value>10/Jun/1970</value></constructor-arg>
+        <constructor-arg index="5" 
type="org.apache.jdo.tck.pc.company.Address"><ref 
local="addr1"/></constructor-arg>
+        <constructor-arg index="6" 
type="java.util.Date"><value>1/Jan/1999</value></constructor-arg>
+        <constructor-arg index="7" 
type="double"><value>20000</value></constructor-arg>
+        <property name="department"><ref bean="dept1"/></property>
+        <property name="medicalInsurance"><ref bean="medicalIns1"/></property>
+        <property name="phoneNumbers">
+           <map>
+                <entry key="home"><value>1111</value></entry>
+                <entry key="work"><value>123456-1</value></entry>
+            </map>
+       </property>
+    </bean>
+    <bean id="emp2" class="org.apache.jdo.tck.pc.company.FullTimeEmployee">
+        <constructor-arg index="0" 
type="long"><value>2</value></constructor-arg>
+        <constructor-arg index="1" 
type="java.lang.String"><value>emp2First</value></constructor-arg>
+        <constructor-arg index="2" 
type="java.lang.String"><value>emp2Last</value></constructor-arg>
+        <constructor-arg index="3" 
type="java.lang.String"><value>emp2Middle</value></constructor-arg>
+        <constructor-arg index="4" 
type="java.util.Date"><value>22/Dec/1975</value></constructor-arg>
+        <constructor-arg index="5" 
type="org.apache.jdo.tck.pc.company.Address"><ref 
local="addr2"/></constructor-arg>
+        <constructor-arg index="6" 
type="java.util.Date"><value>1/Jul/2003</value></constructor-arg>
+        <constructor-arg index="7" 
type="double"><value>10000</value></constructor-arg>
+        <property name="department"><ref bean="dept1"/></property>
+        <property name="phoneNumbers">
+           <map>
+                <entry key="home"><value>2222</value></entry>
+                <entry key="work"><value>123456-2</value></entry>
+            </map>
+       </property>
+    </bean>
+    <bean id="emp3" class="org.apache.jdo.tck.pc.company.PartTimeEmployee">
+        <constructor-arg index="0" 
type="long"><value>3</value></constructor-arg>
+        <constructor-arg index="1" 
type="java.lang.String"><value>emp3First</value></constructor-arg>
+        <constructor-arg index="2" 
type="java.lang.String"><value>emp3Last</value></constructor-arg>
+        <constructor-arg index="3" 
type="java.lang.String"><value>emp3Middle</value></constructor-arg>
+        <constructor-arg index="4" 
type="java.util.Date"><value>5/Sep/1972</value></constructor-arg>
+        <constructor-arg index="5" 
type="org.apache.jdo.tck.pc.company.Address"><ref 
local="addr3"/></constructor-arg>
+        <constructor-arg index="6" 
type="java.util.Date"><value>15/Aug/2002</value></constructor-arg>
+        <constructor-arg index="7" 
type="double"><value>15000</value></constructor-arg>
+        <property name="department"><ref bean="dept1"/></property>
+        <property name="phoneNumbers">
+           <map>
+                <entry key="home"><value>3333</value></entry>
+                <entry key="work"><value>123456-3</value></entry>
+            </map>
+       </property>
+    </bean>
+
+    <bean id="addr1" class="org.apache.jdo.tck.pc.company.Address">
+        <constructor-arg index="0" 
type="long"><value>1</value></constructor-arg>
+        <constructor-arg index="1" type="java.lang.String"><value>Unter den 
Linden 1</value></constructor-arg>
+        <constructor-arg index="2" 
type="java.lang.String"><value>Berlin</value></constructor-arg>
+        <constructor-arg index="3" 
type="java.lang.String"><value></value></constructor-arg>
+        <constructor-arg index="4" 
type="java.lang.String"><value>12345</value></constructor-arg>
+        <constructor-arg index="5" 
type="java.lang.String"><value>Germany</value></constructor-arg>
+    </bean>
+    <bean id="addr2" class="org.apache.jdo.tck.pc.company.Address">
+        <constructor-arg index="0" 
type="long"><value>2</value></constructor-arg>
+        <constructor-arg index="1" type="java.lang.String"><value>Broadway 
1</value></constructor-arg>
+        <constructor-arg index="2" type="java.lang.String"><value>New 
York</value></constructor-arg>
+        <constructor-arg index="3" 
type="java.lang.String"><value></value></constructor-arg>
+        <constructor-arg index="4" 
type="java.lang.String"><value>10000</value></constructor-arg>
+        <constructor-arg index="5" 
type="java.lang.String"><value>USA</value></constructor-arg>
+    </bean>
+    <bean id="addr3" class="org.apache.jdo.tck.pc.company.Address">
+        <constructor-arg index="0" 
type="long"><value>3</value></constructor-arg>
+        <constructor-arg index="1" type="java.lang.String"><value>Market 
St.</value></constructor-arg>
+        <constructor-arg index="2" type="java.lang.String"><value>San 
Francisco</value></constructor-arg>
+        <constructor-arg index="3" 
type="java.lang.String"><value></value></constructor-arg>
+        <constructor-arg index="4" 
type="java.lang.String"><value>94102</value></constructor-arg>
+        <constructor-arg index="5" 
type="java.lang.String"><value>USA</value></constructor-arg>
+    </bean>
+
+    <bean id="medicalIns1" 
class="org.apache.jdo.tck.pc.company.MedicalInsurance">
+        <constructor-arg index="0" 
type="long"><value>1</value></constructor-arg>
+        <constructor-arg index="1" 
type="java.lang.String"><value>Carrier1</value></constructor-arg>
+        <constructor-arg index="2" 
type="java.lang.String"><value>PPO</value></constructor-arg>
+        <property name="employee"><ref bean="emp1"/></property>
+    </bean>
+</beans>

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

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/BinaryAddition.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/BinaryAddition.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/BinaryAddition.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/BinaryAddition.java
 Mon Apr  4 12:41:23 2005
@@ -0,0 +1,125 @@
+/*
+ * 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.operators;
+
+import java.util.Collection;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
+import org.apache.jdo.tck.query.QueryTest;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Binary Addition Query Operator
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.6.2-26.
+ *<BR>
+ *<B>Assertion Description: </B> The binary addition operator (<code>+</code>) 
is supported for all types as they are defined in the Java language. This 
includes the following types:
+<UL>
+<LI><code>byte, short, int, long, char, Byte, Short Integer, Long, 
Character</code></LI>
+<LI><code>float, double, Float, Double</code></LI>
+<LI><code>BigDecimal, BigInteger</code></LI>
+</UL>
+The operation on object-valued fields of wrapper types (<code>Boolean, Byte, 
Short, Integer, Long, Float</code>, and <code>Double</code>), and numeric types 
(<code>BigDecimal</code> and <code>BigInteger</code>) use the wrapped values as 
operands.
+ */
+
+public class BinaryAddition extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.6.2-26 (BinaryAddition) 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(BinaryAddition.class);
+    }
+
+    /** */
+    public void test() {
+        pm = getPM();
+
+        try {
+            loadPrimitiveTypes(pm);
+            runTest(pm);
+        }
+        finally {
+            cleanupDatabase(pm, PrimitiveTypes.class);
+            pm.close();
+            pm = null;
+        }
+    }
+
+    /** */
+    void runTest(PersistenceManager pm) {
+        if (debug) logger.debug("\nExecuting test BinaryAddition() ...");
+
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+        
+        Collection instance9 = (Collection)pm.newQuery(
+            PrimitiveTypes.class, "id == 9").execute();
+        Collection allOddInstances = (Collection)pm.newQuery(
+            PrimitiveTypes.class, "booleanNull").execute();
+        
+        runSimplePrimitiveTypesQuery("id + 1 == 10", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("byteNotNull + 1 == 10",
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("shortNotNull + 1 == 10", 
+                                     pm, instance9, ASSERTION_FAILED);         
   
+        runSimplePrimitiveTypesQuery("intNotNull + 1 == 10", 
+                                     pm, instance9, ASSERTION_FAILED);         
   
+        runSimplePrimitiveTypesQuery("longNotNull + 1 == 10", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("floatNotNull + 1 == 10", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("doubleNotNull + 1 == 10", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("byteNull + 1 == 10", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("shortNull + 1 == 10", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("intNull + 1 == 10", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("longNull + 1 == 10", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("floatNull + 1 == 10", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("doubleNull + 1 == 10", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("bigDecimal + 1 == 10", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("bigInteger + 1 == 10", 
+                                     pm, instance9, ASSERTION_FAILED);
+
+        runSimplePrimitiveTypesQuery("charNull + 1 == 'P'", 
+                                     pm, allOddInstances, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("charNotNull + 1 == 'P'", 
+                                     pm, allOddInstances, ASSERTION_FAILED);
+
+        tx.commit();
+    }
+}
+

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

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/BinarySubtraction.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/BinarySubtraction.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/BinarySubtraction.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/BinarySubtraction.java
 Mon Apr  4 12:41:23 2005
@@ -0,0 +1,130 @@
+/*
+ * 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.operators;
+
+import java.util.Collection;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
+import org.apache.jdo.tck.query.QueryTest;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Binary Subtraction Query Operator
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.6.2-28.
+ *<BR>
+ *<B>Assertion Description: </B>
+The binary subtraction operator (<code>-</code>) is supported for all types as
+they are defined in the Java language. This includes the following types:
+<UL>
+<LI><code>byte, short, int, long, char, Byte, Short Integer, Long, 
Character</code></LI>
+<LI><code>float, double, Float, Double</code></LI>
+<LI><code>BigDecimal, BigInteger</code></LI>
+</UL>
+The operation on object-valued fields of wrapper types (<code>Boolean, Byte,
+Short, Integer, Long, Float</code>, and <code>Double</code>), and numeric types
+(<code>BigDecimal</code> and <code>BigInteger</code>)
+use the wrapped values as operands.
+
+ */
+
+public class BinarySubtraction extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.6.2-28 (BinarySubtraction) 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(BinarySubtraction.class);
+    }
+    
+    /** */
+    public void test() {
+        pm = getPM();
+
+        try {
+            loadPrimitiveTypes(pm);
+            runTest(pm);
+        }
+        finally {
+            cleanupDatabase(pm, PrimitiveTypes.class);
+            pm.close();
+            pm = null;
+        }
+    }
+
+    /** */
+    void runTest(PersistenceManager pm) {
+        if (debug) logger.debug("\nExecuting test BinarySubtraction() ...");
+
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+        
+        Collection instance9 = (Collection)pm.newQuery(
+            PrimitiveTypes.class, "id == 9").execute();
+        Collection allOddInstances = (Collection)pm.newQuery(
+            PrimitiveTypes.class, "booleanNull").execute();
+        
+        runSimplePrimitiveTypesQuery("id - 1 == 8", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("byteNotNull - 1 == 8",
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("shortNotNull - 1 == 8", 
+                                     pm, instance9, ASSERTION_FAILED);         
   
+        runSimplePrimitiveTypesQuery("intNotNull - 1 == 8", 
+                                     pm, instance9, ASSERTION_FAILED);         
   
+        runSimplePrimitiveTypesQuery("longNotNull - 1 == 8", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("floatNotNull - 1 == 8", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("doubleNotNull - 1 == 8", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("byteNull - 1 == 8", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("shortNull - 1 == 8", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("intNull - 1 == 8", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("longNull - 1 == 8", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("floatNull - 1 == 8", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("doubleNull - 1 == 8", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("bigDecimal - 1 == 8", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("bigInteger - 1 == 8", 
+                                     pm, instance9, ASSERTION_FAILED);
+
+        runSimplePrimitiveTypesQuery("charNull - 1 == 'N'", 
+                                     pm, allOddInstances, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("charNotNull - 1 == 'N'", 
+                                     pm, allOddInstances, ASSERTION_FAILED);
+
+        tx.commit();
+    }
+}

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

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/BitwiseComplement.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/BitwiseComplement.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/BitwiseComplement.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/BitwiseComplement.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.operators;
+
+import java.util.Collection;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
+import org.apache.jdo.tck.query.QueryTest;
+import org.apache.jdo.tck.util.BatchTestRunner;
+/**
+ *<B>Title:</B> Bitwise Complement Query Operator
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.6.2-24.
+ *<BR>
+ *<B>Assertion Description: </B>
+The integral unary bitwise complement operator (<code>~</code>) is supported
+for all types as they are defined in the Java language.
+This includes the following types:
+<UL>
+<LI><code>byte, short, int, long, char, Byte, Short Integer, Long, 
Character</code></LI>
+</UL>
+
+ */
+
+public class BitwiseComplement extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.6.2-24 (BitwiseComplement) 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(BitwiseComplement.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();
+        
+        Collection instance9 = (Collection)pm.newQuery(
+            PrimitiveTypes.class, "id == 9").execute();
+        Collection allOddInstances = (Collection)pm.newQuery(
+            PrimitiveTypes.class, "booleanNull").execute();
+        
+        runSimplePrimitiveTypesQuery("~id == -10", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("~byteNotNull == -10",
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("~shortNotNull == -10", 
+                                     pm, instance9, ASSERTION_FAILED);         
   
+        runSimplePrimitiveTypesQuery("~intNotNull == -10", 
+                                     pm, instance9, ASSERTION_FAILED);         
   
+        runSimplePrimitiveTypesQuery("~longNotNull == -10", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("~byteNull == -10", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("~shortNull == -10", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("~intNull == -10", 
+                                     pm, instance9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("~longNull == -10", 
+                                     pm, instance9, ASSERTION_FAILED);
+  
+
+        runSimplePrimitiveTypesQuery("~charNull == -80", 
+                                     pm, allOddInstances, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("~charNotNull == -80", 
+                                     pm, allOddInstances, ASSERTION_FAILED);
+        
+        tx.commit();
+    }
+}

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

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/BooleanLogicalAND.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/BooleanLogicalAND.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/BooleanLogicalAND.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/BooleanLogicalAND.java
 Mon Apr  4 12:41:23 2005
@@ -0,0 +1,174 @@
+/*
+ * 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.operators;
+
+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.query.QueryTest;
+import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Boolean Logical AND Query Operator
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.6.2-20.
+ *<BR>
+ *<B>Assertion Description: </B>
+The Boolean logical AND (not bitwise) operator (<code>&amp;</code>) is 
supported
+for all types as they are defined in the Java language.
+This includes the following types:
+<UL>
+<LI><code>Boolean, boolean</code></LI>
+</UL>
+ */
+
+public class BooleanLogicalAND extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.6.2-20 (BooleanLogicalAND) 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(BooleanLogicalAND.class);
+    }
+    
+    /** */
+    public void test() {
+        pm = getPM();
+        
+        try {
+            loadPrimitiveTypes(pm);
+            runPositiveTest(pm);
+        }
+        finally {
+            cleanupDatabase(pm, PrimitiveTypes.class);
+            pm.close();
+            pm = null;
+        }
+    }
+
+    /** */
+    public void testBitwiseAND() {
+        pm = getPM();
+        
+        runNegativeTest(pm);
+        
+        pm.close();
+        pm = null;
+    }
+    
+    /** */
+    void runPositiveTest(PersistenceManager pm) {
+        if (debug) logger.debug("\nExecuting positive test BooleanLogicalAND() 
...");
+
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+
+        Collection instance9 = (Collection)pm.newQuery(
+            PrimitiveTypes.class, "id == 9").execute();
+        Collection allOddInstances = (Collection)pm.newQuery(
+            PrimitiveTypes.class, "booleanNull").execute();
+        Collection allInstances = (Collection)pm.newQuery(
+            PrimitiveTypes.class, "true").execute();
+        Collection empty = new HashSet();
+        
+        // case true & true
+        runSimplePrimitiveTypesQuery("true & true", 
+                                     pm, allInstances, ASSERTION_FAILED);
+
+        // case true & false
+        runSimplePrimitiveTypesQuery("true & false", 
+                                     pm, empty, ASSERTION_FAILED);
+
+        // case false & true
+        runSimplePrimitiveTypesQuery("false & true", 
+                                     pm, empty, ASSERTION_FAILED);
+
+        // case false & false
+        runSimplePrimitiveTypesQuery("false & false", 
+                                     pm, empty, ASSERTION_FAILED);
+
+        // case boolean & boolean
+        runSimplePrimitiveTypesQuery("intNotNull == 9 & booleanNotNull", 
+                                     pm, instance9, ASSERTION_FAILED);
+
+        // case boolean & Boolean
+        runSimplePrimitiveTypesQuery("intNotNull == 9 & booleanNull", 
+                                     pm, instance9, ASSERTION_FAILED);
+        // case Boolean & boolean
+        runSimplePrimitiveTypesQuery("booleanNull & intNotNull == 9", 
+                                     pm, instance9, ASSERTION_FAILED);
+        // case Boolean & Boolean
+        runSimplePrimitiveTypesQuery("booleanNull & booleanNull", 
+                                     pm, allOddInstances, ASSERTION_FAILED);
+
+        // case Boolean parameter
+        runParameterPrimitiveTypesQuery("param & id == 9", 
+                                        "Boolean param", Boolean.TRUE,
+                                        pm, instance9, ASSERTION_FAILED);
+        runParameterPrimitiveTypesQuery("param & id == 9", 
+                                        "Boolean param", Boolean.FALSE,
+                                        pm, empty, ASSERTION_FAILED);
+
+        // case boolean parameter
+        runParameterPrimitiveTypesQuery("param & id == 9", 
+                                        "boolean param", Boolean.TRUE,
+                                        pm, instance9, ASSERTION_FAILED);
+        runParameterPrimitiveTypesQuery("param & id == 9", 
+                                        "boolean param", Boolean.FALSE,
+                                        pm, empty, ASSERTION_FAILED);
+
+        tx.commit();
+    }
+
+    /** */
+    void runNegativeTest(PersistenceManager pm) {
+        if (debug) logger.debug("\nExecuting positive test BooleanLogicalAND() 
...");
+
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+        
+        try {
+            Query q = pm.newQuery(PrimitiveTypes.class, 
+                                  "intNotNull & intNotNull");
+            Object result = q.execute();
+            fail(ASSERTION_FAILED,
+                 "Query uisng bitwise & operator should throw 
JDOUserException.");
+        }
+        catch (JDOUserException ex) {
+            // expected exception
+            if (debug) {
+                logger.debug("expected exception: " + ex);
+            }
+        }
+        tx.commit();
+    }
+    
+}

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

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/BooleanLogicalOR.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/BooleanLogicalOR.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/BooleanLogicalOR.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/BooleanLogicalOR.java
 Mon Apr  4 12:41:23 2005
@@ -0,0 +1,178 @@
+/*
+ * 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.operators;
+
+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.query.QueryTest;
+import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Boolean Logical OR Query Operator
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.6.2-22.
+ *<BR>
+ *<B>Assertion Description: </B>
+The Boolean logical OR (not bitwise) operator (<code>|</code>) is supported for
+all types as they are defined in the Java language.
+This includes the following types:
+<UL>
+<LI><code>Boolean, boolean</code></LI>
+</UL>
+ */
+
+public class BooleanLogicalOR extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.6.2-22 (BooleanLogicalOR) 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(BooleanLogicalOR.class);
+    }
+    
+    /** */
+    public void test() {
+        pm = getPM();
+        
+        try {
+            loadPrimitiveTypes(pm);
+            runPositiveTest(pm);
+        }
+        finally {
+            cleanupDatabase(pm, PrimitiveTypes.class);
+            pm.close();
+            pm = null;
+        }
+    }
+    
+    /** */
+    public void testBitwiseAND() {
+        pm = getPM();
+        
+        runNegativeTest(pm);
+        
+        pm.close();
+        pm = null;
+    }
+    
+    /** */
+    void runPositiveTest(PersistenceManager pm) {
+        if (debug) logger.debug("\nExecuting positive test BooleanLogicalOR() 
...");
+
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+
+        Collection instance9 = (Collection)pm.newQuery(
+            PrimitiveTypes.class, "id == 9").execute();
+        Collection instancesLess3 = (Collection)pm.newQuery(
+            PrimitiveTypes.class, "id < 3").execute();
+        Collection allOddInstances = (Collection)pm.newQuery(
+            PrimitiveTypes.class, "booleanNull").execute();
+        Collection allInstances = (Collection)pm.newQuery(
+            PrimitiveTypes.class, "true").execute();
+        Collection empty = new HashSet();
+        
+        // case true | true
+        runSimplePrimitiveTypesQuery("true | true", 
+                                     pm, allInstances, ASSERTION_FAILED);
+
+        // case true | false
+        runSimplePrimitiveTypesQuery("true | false", 
+                                     pm, allInstances, ASSERTION_FAILED);
+
+        // case false | true
+        runSimplePrimitiveTypesQuery("false | true", 
+                                     pm, allInstances, ASSERTION_FAILED);
+
+        // case false | false
+        runSimplePrimitiveTypesQuery("false | false", 
+                                     pm, empty, ASSERTION_FAILED);
+
+        // case boolean | boolean
+        runSimplePrimitiveTypesQuery("intNotNull == 9 | booleanNotNull", 
+                                     pm, allOddInstances, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("id == 1 | id == 2", 
+                                     pm, instancesLess3, ASSERTION_FAILED);
+
+        // case boolean | Boolean
+        runSimplePrimitiveTypesQuery("intNotNull == 9 | booleanNull", 
+                                     pm, allOddInstances, ASSERTION_FAILED);
+        // case Boolean | boolean
+        runSimplePrimitiveTypesQuery("booleanNull | intNotNull == 9", 
+                                     pm, allOddInstances, ASSERTION_FAILED);
+        // case Boolean | Boolean
+        runSimplePrimitiveTypesQuery("booleanNull | booleanNull", 
+                                     pm, allOddInstances, ASSERTION_FAILED);
+
+        // case Boolean parameter
+        runParameterPrimitiveTypesQuery("param | id == 9", 
+                                        "Boolean param", Boolean.TRUE,
+                                        pm, allInstances, ASSERTION_FAILED);
+        runParameterPrimitiveTypesQuery("param | id == 9", 
+                                        "Boolean param", Boolean.FALSE,
+                                        pm, instance9, ASSERTION_FAILED);
+
+        // case boolean parameter
+        runParameterPrimitiveTypesQuery("param | id == 9", 
+                                        "boolean param", Boolean.TRUE,
+                                        pm, allInstances, ASSERTION_FAILED);
+        runParameterPrimitiveTypesQuery("param | id == 9", 
+                                        "boolean param", Boolean.FALSE,
+                                        pm, instance9, ASSERTION_FAILED);
+        tx.commit();
+    }
+
+    /** */
+    void runNegativeTest(PersistenceManager pm) {
+        if (debug) logger.debug("\nExecuting positive test BooleanLogicalAND() 
...");
+
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+        
+        try {
+            Query q = pm.newQuery(PrimitiveTypes.class, 
+                                  "intNotNull | intNotNull");
+            Object result = q.execute();
+            fail(ASSERTION_FAILED,
+                 "Query uisng bitwise | operator should throw 
JDOUserException.");
+        }
+        catch (JDOUserException ex) {
+            // expected exception
+            if (debug) {
+                logger.debug("expected exception: " + ex);
+            }
+        }
+        tx.commit();
+    }
+    
+}
+

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

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/ComparisonTests.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/ComparisonTests.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/ComparisonTests.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/ComparisonTests.java
 Mon Apr  4 12:41:23 2005
@@ -0,0 +1,143 @@
+/*
+ * 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.operators;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+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.fieldtypes.AllTypes;
+
+public abstract class ComparisonTests extends JDO_Test {    
+    protected   PersistenceManager  pm;
+    protected   Query               query;
+    protected   Transaction         tx;
+    protected   Collection          query_result;
+        
+    protected static    String      BooleanParameter = "Boolean value";
+    protected static    String      booleanParameter = "boolean value";
+    protected static    String      ByteParameter = "Byte value";
+    protected static    String      byteParameter = "byte value";
+    protected static    String      CharacterParameter = "Character value";
+    protected static    String      charParameter = "char value";
+    protected static    String      DoubleParameter = "Double value";
+    protected static    String      doubleParameter = "double value";
+    protected static    String      FloatParameter = "Float value";
+    protected static    String      floatParameter = "float value";
+    protected static    String      IntegerParameter = "Integer value";
+    protected static    String      intParameter = "int value";
+    protected static    String      LongParameter = "Long value";
+    protected static    String      longParameter = "long value";
+    protected static    String      ShortParameter = "Short value";
+    protected static    String      shortParameter = "short value";
+    protected static    String      StringParameter = "String value";
+    protected static    String      LocaleParameter = "java.util.Locale value";
+    protected static    String      BigDecimalParameter = 
"java.math.BigDecimal value";
+    protected static    String      BigIntegerParameter = 
"java.math.BigInteger value";
+    protected static    String      DateParameter = "java.util.Date value";
+    protected static    String      AllTypesParameter = 
"org.apache.jdo.tck.pc.fieldtypes.AllTypes value";
+    
+    /** */
+    protected void verifyDataLoaded(PersistenceManager pm)
+    {
+        Transaction tx = pm.currentTransaction();
+        int cnt = 0;
+        try {
+               tx.begin();
+               Extent e = pm.getExtent(AllTypes.class, false);
+               Iterator i = e.iterator();
+               while(i.hasNext()){
+                       Object o = i.next();
+                       cnt++;
+               }
+               e.close(i);
+            tx.rollback();
+        
+               if (cnt == AllTypes.NUM_VALUES)
+                       return;
+        
+               tx.begin();
+               i = e.iterator();
+               while (i.hasNext()) {
+                       Object o = i.next();
+                       pm.deletePersistent(o);
+               }
+               e.close(i);
+               tx.commit();
+        }
+        finally {
+            if ((tx !=null) && tx.isActive())
+                tx.rollback();
+        }
+        AllTypes.load(pm);
+    }
+
+
+    /** */
+    protected void fail(String assertion, String message, String filter, 
String parameter)
+    {
+        StringBuffer buf = new StringBuffer();
+        buf.append(message);
+        buf.append("(");
+        buf.append(" filter \"").append(filter).append("\"");
+        if (parameter != null) {
+            buf.append(" , parameter \"").append(parameter).append("\"");
+        }
+        buf.append(")");
+        
+        fail(assertion, buf.toString());
+    }
+    
+    /** */
+    protected void runQuery(PersistenceManager pm, 
+                            String filter, String parameter, Object 
parameterValue, 
+                            String assertion)
+    {
+        Extent e = pm.getExtent(AllTypes.class, false);
+        query = pm.newQuery(e, filter);
+        query_result = null;
+        try {
+            if (parameter != null) {
+                query.declareParameters(parameter);
+                query_result = (Collection) query.execute(parameterValue);
+            } 
+            else {
+                query_result = (Collection) query.execute();
+            }
+        } 
+        catch (Throwable throwable) {
+            if (debug)
+                throwable.printStackTrace();
+            fail(assertion, "Exception on Query.execute " + throwable, filter, 
parameter);
+            query_result = null;
+            if (tx.isActive()) 
+                tx.rollback();
+            return;
+        }
+        if (query_result == null) {
+            fail(assertion, "Query.execute returned a null", filter, 
parameter);
+            if (tx.isActive()) 
+                tx.rollback();
+        }
+    }    
+}
+

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

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/ConditionalAND.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/ConditionalAND.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/ConditionalAND.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/ConditionalAND.java
 Mon Apr  4 12:41:23 2005
@@ -0,0 +1,139 @@
+/*
+ * 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.operators;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.query.QueryTest;
+import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Conditional AND Query Operator
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.6.2-21.
+ *<BR>
+ *<B>Assertion Description: </B>
+The conditional AND operator (<code>&amp;&amp;</code>) is supported for all
+types as they are defined in the Java language.
+This includes the following types:
+<UL>
+<LI><code>Boolean, boolean</code></LI>
+</UL>
+*/
+
+public class ConditionalAND extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.6.2-21 (ConditionalAND) 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(ConditionalAND.class);
+    }
+    
+    
+    /** */
+    public void test() {
+        pm = getPM();
+        
+        try {
+            loadPrimitiveTypes(pm);
+            runTest(pm);
+        }
+        finally {
+            cleanupDatabase(pm, PrimitiveTypes.class);
+            pm.close();
+            pm = null;
+        }
+    }
+    
+   /** */
+    void runTest(PersistenceManager pm) {
+        if (debug) logger.debug("\nExecuting test ConditionalAND() ...");
+
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+
+        Collection instance9 = (Collection)pm.newQuery(
+            PrimitiveTypes.class, "id == 9").execute();
+        Collection allOddInstances = (Collection)pm.newQuery(
+            PrimitiveTypes.class, "booleanNull").execute();
+        Collection allInstances = (Collection)pm.newQuery(
+            PrimitiveTypes.class, "true").execute();
+        Collection empty = new HashSet();
+        
+        // case true && true
+        runSimplePrimitiveTypesQuery("true && true", 
+                                     pm, allInstances, ASSERTION_FAILED);
+
+        // case true && false
+        runSimplePrimitiveTypesQuery("true && false", 
+                                     pm, empty, ASSERTION_FAILED);
+
+        // case false && true
+        runSimplePrimitiveTypesQuery("false && true", 
+                                     pm, empty, ASSERTION_FAILED);
+
+        // case false && false
+        runSimplePrimitiveTypesQuery("false && false", 
+                                     pm, empty, ASSERTION_FAILED);
+
+        // case boolean && boolean
+        runSimplePrimitiveTypesQuery("intNotNull == 9 && booleanNotNull", 
+                                     pm, instance9, ASSERTION_FAILED);
+
+        // case boolean && Boolean
+        runSimplePrimitiveTypesQuery("intNotNull == 9 && booleanNull", 
+                                     pm, instance9, ASSERTION_FAILED);
+        // case Boolean && boolean
+        runSimplePrimitiveTypesQuery("booleanNull && intNotNull == 9", 
+                                     pm, instance9, ASSERTION_FAILED);
+        // case Boolean && Boolean
+        runSimplePrimitiveTypesQuery("booleanNull && booleanNull", 
+                                     pm, allOddInstances, ASSERTION_FAILED);
+
+        // case Boolean parameter
+        runParameterPrimitiveTypesQuery("param && id == 9", 
+                                        "Boolean param", Boolean.TRUE,
+                                        pm, instance9, ASSERTION_FAILED);
+        runParameterPrimitiveTypesQuery("param && id == 9", 
+                                        "Boolean param", Boolean.FALSE,
+                                        pm, empty, ASSERTION_FAILED);
+
+        // case boolean parameter
+        runParameterPrimitiveTypesQuery("param && id == 9", 
+                                        "boolean param", Boolean.TRUE,
+                                        pm, instance9, ASSERTION_FAILED);
+        runParameterPrimitiveTypesQuery("param && id == 9", 
+                                        "boolean param", Boolean.FALSE,
+                                        pm, empty, ASSERTION_FAILED);
+
+        tx.commit();
+    }
+}

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

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/ConditionalOR.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/ConditionalOR.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/ConditionalOR.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/ConditionalOR.java
 Mon Apr  4 12:41:23 2005
@@ -0,0 +1,139 @@
+/*
+ * 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.operators;
+
+import java.util.Collection;
+import java.util.HashSet;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.query.QueryTest;
+import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Conditional OR Query Operator
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.6.2-23.
+ *<BR>
+ *<B>Assertion Description: </B>
+The conditional OR operator (<code>||</code>) is supported for all types
+as they are defined in the Java language. This includes the following types:
+<UL>
+<LI><code>Boolean, boolean</code></LI>
+</UL>
+ */
+
+public class ConditionalOR extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.6.2-23 (ConditionalOR) 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(ConditionalOR.class);
+    }
+    
+    /** */
+    public void test() {
+        pm = getPM();
+        
+        try {
+            loadPrimitiveTypes(pm);
+            runTest(pm);
+        }
+        finally {
+            cleanupDatabase(pm, PrimitiveTypes.class);
+            pm.close();
+            pm = null;
+        }
+    }
+    
+    /** */
+    void runTest(PersistenceManager pm) {
+        if (debug) logger.debug("\nExecuting test ConditionalOR() ...");
+
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+
+        Collection instance9 = (Collection)pm.newQuery(
+            PrimitiveTypes.class, "id == 9").execute();
+        Collection instancesLess3 = (Collection)pm.newQuery(
+            PrimitiveTypes.class, "id < 3").execute();
+        Collection allOddInstances = (Collection)pm.newQuery(
+            PrimitiveTypes.class, "booleanNull").execute();
+        Collection allInstances = (Collection)pm.newQuery(
+            PrimitiveTypes.class, "true").execute();
+        Collection empty = new HashSet();
+        
+        // case true || true
+        runSimplePrimitiveTypesQuery("true || true", 
+                                     pm, allInstances, ASSERTION_FAILED);
+
+        // case true || false
+        runSimplePrimitiveTypesQuery("true || false", 
+                                     pm, allInstances, ASSERTION_FAILED);
+
+        // case false || true
+        runSimplePrimitiveTypesQuery("false || true", 
+                                     pm, allInstances, ASSERTION_FAILED);
+
+        // case false || false
+        runSimplePrimitiveTypesQuery("false || false", 
+                                     pm, empty, ASSERTION_FAILED);
+
+        // case boolean || boolean
+        runSimplePrimitiveTypesQuery("intNotNull == 9 || booleanNotNull", 
+                                     pm, allOddInstances, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("id == 1 || id == 2", 
+                                     pm, instancesLess3, ASSERTION_FAILED);
+
+        // case boolean || Boolean
+        runSimplePrimitiveTypesQuery("intNotNull == 9 || booleanNull", 
+                                     pm, allOddInstances, ASSERTION_FAILED);
+        // case Boolean || boolean
+        runSimplePrimitiveTypesQuery("booleanNull || intNotNull == 9", 
+                                     pm, allOddInstances, ASSERTION_FAILED);
+        // case Boolean || Boolean
+        runSimplePrimitiveTypesQuery("booleanNull || booleanNull", 
+                                     pm, allOddInstances, ASSERTION_FAILED);
+
+        // case Boolean parameter
+        runParameterPrimitiveTypesQuery("param || id == 9", 
+                                        "Boolean param", Boolean.TRUE,
+                                        pm, allInstances, ASSERTION_FAILED);
+        runParameterPrimitiveTypesQuery("param || id == 9", 
+                                        "Boolean param", Boolean.FALSE,
+                                        pm, instance9, ASSERTION_FAILED);
+
+        // case boolean parameter
+        runParameterPrimitiveTypesQuery("param || id == 9", 
+                                        "boolean param", Boolean.TRUE,
+                                        pm, allInstances, ASSERTION_FAILED);
+        runParameterPrimitiveTypesQuery("param || id == 9", 
+                                        "boolean param", Boolean.FALSE,
+                                        pm, instance9, ASSERTION_FAILED);
+        tx.commit();
+    }
+}

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

Added: 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/Division.java
URL: 
http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/Division.java?view=auto&rev=160090
==============================================================================
--- 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/Division.java
 (added)
+++ 
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/operators/Division.java
 Mon Apr  4 12:41:23 2005
@@ -0,0 +1,131 @@
+/*
+ * 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.operators;
+
+import java.util.Collection;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
+import org.apache.jdo.tck.query.QueryTest;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Division Query Operator
+ *<BR>
+ *<B>Keywords:</B> query
+ *<BR>
+ *<B>Assertion ID:</B> A14.6.2-31.
+ *<BR>
+ *<B>Assertion Description: </B>
+The division operator (<code>/</code>) is supported for all types as they are
+defined in the Java language. This includes the following types:
+<UL>
+<LI><code>byte, short, int, long, char, Byte, Short Integer, Long, 
Character</code></LI>
+<LI><code>float, double, Float, Double</code></LI>
+<LI><code>BigDecimal, BigInteger</code></LI>
+</UL>
+The operation on object-valued fields of wrapper types (<code>Boolean, Byte,
+Short, Integer, Long, Float</code>, and <code>Double</code>), and numeric types
+(<code>BigDecimal</code> and <code>BigInteger</code>)
+use the wrapped values as operands.
+ */
+
+public class Division extends QueryTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A14.6.2-31 (Division) 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(Division.class);
+    }
+    
+    /** */
+    public void test() {
+        pm = getPM();
+
+        try {
+            loadPrimitiveTypes(pm);
+            runTest(pm);
+        }
+        finally {
+            cleanupDatabase(pm, PrimitiveTypes.class);
+            pm.close();
+            pm = null;
+        }
+    }
+
+    /** */
+    void runTest(PersistenceManager pm) {
+        if (debug) logger.debug("\nExecuting test Division() ...");
+
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+        
+        Collection instance8 = (Collection)pm.newQuery(
+            PrimitiveTypes.class, "id == 8").execute();
+        
+        Collection instances8And9 = (Collection)pm.newQuery(
+            PrimitiveTypes.class, "id == 8 || id == 9").execute();
+                
+        runSimplePrimitiveTypesQuery("id / 2 == 4", 
+                                     pm, instances8And9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("byteNotNull / 2 == 4",
+                                     pm, instances8And9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("shortNotNull / 2 == 4", 
+                                     pm, instances8And9, ASSERTION_FAILED);    
        
+        runSimplePrimitiveTypesQuery("intNotNull / 2 == 4", 
+                                     pm, instances8And9, ASSERTION_FAILED);    
        
+        runSimplePrimitiveTypesQuery("longNotNull / 2 == 4", 
+                                     pm, instances8And9, ASSERTION_FAILED);
+        /* testing float division?
+        runSimplePrimitiveTypesQuery("floatNotNull / 2 == 4", 
+                                     pm, instance8, ASSERTION_FAILED);*/
+        /* testing double division?
+        runSimplePrimitiveTypesQuery("doubleNotNull / 2 == 4", 
+                                     pm, instance8, ASSERTION_FAILED);*/
+        runSimplePrimitiveTypesQuery("byteNull / 2 == 4", 
+                                     pm, instances8And9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("shortNull / 2 == 4", 
+                                     pm, instances8And9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("intNull / 2 == 4", 
+                                     pm, instances8And9, ASSERTION_FAILED);
+        runSimplePrimitiveTypesQuery("longNull / 2 == 4", 
+                                     pm, instances8And9, ASSERTION_FAILED);
+        /* testing float division?
+        runSimplePrimitiveTypesQuery("floatNull / 2 == 4", 
+                                     pm, instance8, ASSERTION_FAILED);*/
+        /* testing double division?
+        runSimplePrimitiveTypesQuery("doubleNull / 2 == 4", 
+                                     pm, instance8, ASSERTION_FAILED);*/
+        /* testing BigDecimal division? Scaling issue!
+        runSimplePrimitiveTypesQuery("bigDecimal / 2 == 4", 
+                                     pm, instances8And9, ASSERTION_FAILED);*/
+        runSimplePrimitiveTypesQuery("bigInteger / 2 == 4", 
+                                     pm, instances8And9, ASSERTION_FAILED);
+
+        tx.commit();
+    }
+}

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


Reply via email to