You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by mb...@apache.org on 2018/11/04 18:37:24 UTC

svn commit: r1845744 [3/9] - in /db/jdo/trunk: copyjdorijars/ tck/ tck/src/main/java/org/apache/jdo/tck/pc/company/ tck/src/main/java/org/apache/jdo/tck/pc/mylib/ tck/src/main/java/org/apache/jdo/tck/query/ tck/src/main/java/org/apache/jdo/tck/query/de...

Modified: db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughANullValuedField.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughANullValuedField.java?rev=1845744&r1=1845743&r2=1845744&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughANullValuedField.java (original)
+++ db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughANullValuedField.java Sun Nov  4 18:37:24 2018
@@ -21,10 +21,14 @@ import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.company.CompanyModelReader;
 import org.apache.jdo.tck.pc.company.Department;
 import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.pc.company.QDepartment;
+import org.apache.jdo.tck.pc.company.QEmployee;
 import org.apache.jdo.tck.query.QueryElementHolder;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
 
+import javax.jdo.JDOQLTypedQuery;
+
 /**
  *<B>Title:</B> Navigation Through a Null-Valued Field
  *<BR>
@@ -57,120 +61,141 @@ public class NavigationThroughANullValue
     protected String getCompanyTestDataResource() {
         return NAVIGATION_TEST_COMPANY_TESTDATA;
     }
-
-    /** 
-     * The array of valid queries which may be executed as 
-     * single string queries and as API queries.
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
      */
-    private static final QueryElementHolder[] VALID_QUERIES = {
+    public static void main(String[] args) {
+        BatchTestRunner.run(NavigationThroughANullValuedField.class);
+    }
+    
+    public void testPositive1() {
         // navigation through reference relationship field
         // the relationship medicalInsurance is not set for emp2 and emp3 =>
         // they should not be part of the result
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null,
-        /*INTO*/        null, 
-        /*FROM*/        Employee.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "this.medicalInsurance.carrier == \"Carrier1\"",
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"emp1"});
+
+        JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
+        QEmployee cand = QEmployee.candidate();
+        query.filter(cand.medicalInsurance.carrier.eq("Carrier1"));
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Employee.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "this.medicalInsurance.carrier == \"Carrier1\"",
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  null,
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*JDOQLTyped*/   query,
+                /*paramValues*/  null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
 
+    }
+    public void testPositive2() {
         // navigation through reference relationship field
         // emp5 and emp6 have have emp4 as manager
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null,
-        /*INTO*/        null, 
-        /*FROM*/        Employee.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "this.manager.lastname == \"emp4Last\"",
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"emp5", "emp6"});
 
+        JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
+        QEmployee cand = QEmployee.candidate();
+        query.filter(cand.manager.lastname.eq("emp4Last"));
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Employee.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "this.manager.lastname == \"emp4Last\"",
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  null,
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*JDOQLTyped*/   query,
+                /*paramValues*/  null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+    }
+    public void testPositive3() {
         // multiple navigation through reference relationship field
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null,
-        /*INTO*/        null, 
-        /*FROM*/        Employee.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "this.manager.manager.lastname == \"emp0Last\"",
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"emp2", "emp3", "emp10"});
 
+        JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
+        QEmployee cand = QEmployee.candidate();
+        query.filter(cand.manager.manager.lastname.eq("emp0Last"));
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Employee.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "this.manager.manager.lastname == \"emp0Last\"",
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  null,
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*JDOQLTyped*/   query,
+                /*paramValues*/  null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+    }
+    public void testPositive4() {
         // navigation through collection relationship field
         // employees emp2 and emp3 do not have a medicalInsurance, but emp1
-        // matches the filter such that dept1 qualifies for inclusion in the 
-        // result set.
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null,
-        /*INTO*/        null, 
-        /*FROM*/        Department.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "employees.contains(e) && e.medicalInsurance.carrier == \"Carrier1\"",
-        /*VARIABLES*/   "Employee e",
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null)
-    };
-        
-    /** 
-     * The expected results of valid queries.
-     */
-    private Object[] expectedResult = {
-        // navigation through reference relationship field
-        // the relationship medicalInsurance is not set for emp2 and emp3 =>
-        // they should not be part of the result
-        getTransientCompanyModelInstancesAsList(new String[]{"emp1"}),
-        // navigation through reference relationship field
-        // emp5 and emp6 have have emp4 as manager
-        getTransientCompanyModelInstancesAsList(new String[]{"emp5", "emp6"}),
-        // multiple navigation through reference relationship field
-        getTransientCompanyModelInstancesAsList(new String[]{"emp2", "emp3", "emp10"}),
-        // navigation through collection relationship field
-        // employees emp2 and emp3 do not have a medicalInsurance, but emp1
-        // matches the filter such that dept1 qualifies for inclusion in the 
+        // matches the filter such that dept1 qualifies for inclusion in the
         // result set.
-        getTransientCompanyModelInstancesAsList(new String[]{"dept1"})
-    };
-    
-    /**
-     * 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(NavigationThroughANullValuedField.class);
-    }
-    
-    /** */
-    public void testPositive() {
-        for (int i = 0; i < VALID_QUERIES.length; i++) {
-            executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
-                    expectedResult[i]);
-            executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
-                    expectedResult[i]);
-        }
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"dept1"});
+
+        JDOQLTypedQuery<Department> query = getPM().newJDOQLTypedQuery(Department.class);
+        QDepartment cand = QDepartment.candidate();
+        QEmployee e = QEmployee.variable("e");
+        query.filter(cand.employees.contains(e).and(e.medicalInsurance.carrier.eq("Carrier1")));
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Department.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "employees.contains(e) && e.medicalInsurance.carrier == \"Carrier1\"",
+                /*VARIABLES*/   "Employee e",
+                /*PARAMETERS*/  null,
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*JDOQLTyped*/   query,
+                /*paramValues*/  null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        // DataNucleus: NucleusUserException: Variable 'medicalInsurance' is unbound and cannot be determined
+        // (is it a misspelled field name? or is not intended to be a variable?)
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
     }
     
     /**

Modified: db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughReferencesUsesDotOperator.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughReferencesUsesDotOperator.java?rev=1845744&r1=1845743&r2=1845744&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughReferencesUsesDotOperator.java (original)
+++ db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughReferencesUsesDotOperator.java Sun Nov  4 18:37:24 2018
@@ -21,10 +21,14 @@ import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.company.CompanyModelReader;
 import org.apache.jdo.tck.pc.company.Employee;
 import org.apache.jdo.tck.pc.company.MedicalInsurance;
+import org.apache.jdo.tck.pc.company.QEmployee;
+import org.apache.jdo.tck.pc.company.QMedicalInsurance;
 import org.apache.jdo.tck.query.QueryElementHolder;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
 
+import javax.jdo.JDOQLTypedQuery;
+
 /**
  *<B>Title:</B> Navigation Through a References uses Dot Operator
  *<BR>
@@ -54,88 +58,6 @@ public class NavigationThroughReferences
     protected String getCompanyTestDataResource() {
         return NAVIGATION_TEST_COMPANY_TESTDATA;
     }
-
-    /** 
-     * The array of valid queries which may be executed as 
-     * single string queries and as API queries.
-     */
-    private static final QueryElementHolder[] VALID_QUERIES = {
-        // navigation through one relationship
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null,
-        /*INTO*/        null, 
-        /*FROM*/        Employee.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "medicalInsurance.carrier == \"Carrier1\"",
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-        // navigation through multiple relationships
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null,
-        /*INTO*/        null, 
-        /*FROM*/        MedicalInsurance.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "this.employee.department.name == \"Development\"",
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-        // navigation through a self referencing relationship
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null,
-        /*INTO*/        null, 
-        /*FROM*/        MedicalInsurance.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "this.employee.manager.firstname == \"emp1First\"",
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-        // navigation through a self referencing relationship multiple times
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null,
-        /*INTO*/        null, 
-        /*FROM*/        MedicalInsurance.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "this.employee.manager.manager.firstname == \"emp0First\"",
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null)
-    };
-        
-    /** 
-     * The expected results of valid queries.
-     */
-    private Object[] expectedResult = {
-        // navigation through one relationship
-        getTransientCompanyModelInstancesAsList(new String[]{"emp1"}),
-        // navigation through multiple relationships
-        getTransientCompanyModelInstancesAsList(new String[]{
-                "medicalIns1", "medicalIns2", "medicalIns3", "medicalIns4",  "medicalIns5"}),
-        getTransientCompanyModelInstancesAsList(new String[]{
-                "medicalIns2", "medicalIns3"}),
-        getTransientCompanyModelInstancesAsList(new String[]{
-                "medicalIns2", "medicalIns3"})
-    };
         
     /**
      * The <code>main</code> is called when the class
@@ -145,15 +67,128 @@ public class NavigationThroughReferences
     public static void main(String[] args) {
         BatchTestRunner.run(NavigationThroughReferencesUsesDotOperator.class);
     }
-    
-    /** */
-    public void testPositive() {
-        for (int i = 0; i < VALID_QUERIES.length; i++) {
-            executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
-                    expectedResult[i]);
-            executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
-                    expectedResult[i]);
-        }
+
+    public void testPositive0() {
+        // navigation through one relationship
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"emp1"});
+
+        JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
+        QEmployee cand = QEmployee.candidate();
+        query.filter(cand.medicalInsurance.carrier.eq("Carrier1"));
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Employee.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "medicalInsurance.carrier == \"Carrier1\"",
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  null,
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+    }
+
+    public void testPositive1() {
+        // navigation through multiple relationships
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{
+                "medicalIns1", "medicalIns2", "medicalIns3", "medicalIns4",  "medicalIns5"});
+
+        JDOQLTypedQuery<MedicalInsurance> query = getPM().newJDOQLTypedQuery(MedicalInsurance.class);
+        QMedicalInsurance cand = QMedicalInsurance.candidate();
+        query.filter(cand.employee.department.name.eq("Development"));
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        MedicalInsurance.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "this.employee.department.name == \"Development\"",
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  null,
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+    }
+
+    public void testPositive2() {
+        // navigation through a self referencing relationship
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{
+                "medicalIns2", "medicalIns3"});
+
+        JDOQLTypedQuery<MedicalInsurance> query = getPM().newJDOQLTypedQuery(MedicalInsurance.class);
+        QMedicalInsurance cand = QMedicalInsurance.candidate();
+        query.filter(cand.employee.manager.firstname.eq("emp1First"));
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        MedicalInsurance.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "this.employee.manager.firstname == \"emp1First\"",
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  null,
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+    }
+
+    public void testPositive3() {
+        // navigation through a self referencing relationship multiple times
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{
+                "medicalIns2", "medicalIns3"});
+
+        JDOQLTypedQuery<MedicalInsurance> query = getPM().newJDOQLTypedQuery(MedicalInsurance.class);
+        QMedicalInsurance cand = QMedicalInsurance.candidate();
+        query.filter(cand.employee.manager.manager.firstname.eq("emp0First"));
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        MedicalInsurance.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "this.employee.manager.manager.firstname == \"emp0First\"",
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  null,
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
     }
 
     /**

Modified: db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NullCollectionsAndContainsMethod.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NullCollectionsAndContainsMethod.java?rev=1845744&r1=1845743&r2=1845744&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NullCollectionsAndContainsMethod.java (original)
+++ db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NullCollectionsAndContainsMethod.java Sun Nov  4 18:37:24 2018
@@ -21,10 +21,16 @@ import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.company.CompanyModelReader;
 import org.apache.jdo.tck.pc.company.Employee;
 import org.apache.jdo.tck.pc.company.Project;
+import org.apache.jdo.tck.pc.company.QEmployee;
 import org.apache.jdo.tck.query.QueryElementHolder;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
 
+import javax.jdo.JDOQLTypedQuery;
+import javax.jdo.query.Expression;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  *<B>Title:</B> Null Collections and Contains Method
  *<BR>
@@ -43,62 +49,6 @@ public class NullCollectionsAndContainsM
     /** */
     private static final String ASSERTION_FAILED = 
         "Assertion A14.6.2-35 (NullCollectionsAndContainsMethod) failed: ";
-    
-    /** 
-     * The array of valid queries which may be executed as 
-     * single string queries and as API queries.
-     */
-    private static final QueryElementHolder[] VALID_QUERIES = {
-        // contains 
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null,
-        /*INTO*/        null, 
-        /*FROM*/        Employee.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "personid == 1 && projects.contains(p)",
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  "org.apache.jdo.tck.pc.company.Project p",
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-        // contains 
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null,
-        /*INTO*/        null, 
-        /*FROM*/        Employee.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "!team.contains(null)",
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-    };
-    
-    /** 
-     * The expected results of valid queries.
-     */
-    private Object[] expectedResult = {
-        // contains 
-        getTransientCompanyModelInstancesAsList(new String[]{}),
-        // contains 
-        getTransientCompanyModelInstancesAsList(new String[]{
-                "emp1", "emp2", "emp3", "emp4", "emp5"})
-    };
-    
-    /** Parameters of valid queries. */
-    private Object[][] parameters = {
-        // contains 
-        {new Project(999l, "TestProject", null)},
-        // contains 
-        null
-    };
             
     /**
      * The <code>main</code> is called when the class
@@ -108,15 +58,79 @@ public class NullCollectionsAndContainsM
     public static void main(String[] args) {
         BatchTestRunner.run(NullCollectionsAndContainsMethod.class);
     }
-    
-    /** */
-    public void testPositive() {
-        for (int i = 0; i < VALID_QUERIES.length; i++) {
-            executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
-                    parameters[i], expectedResult[i]);
-            executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
-                    parameters[i], expectedResult[i]);
-        }
+
+    /**
+     *
+     */
+    public void testContains1() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{});
+
+        JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
+        QEmployee cand = QEmployee.candidate();
+        Expression<Project> empParam = query.parameter("p", Project.class);
+        query.filter(cand.personid.eq(1L).and(cand.projects.contains(empParam)));
+
+        Map<String, Object> paramValues = new HashMap<>();
+        paramValues.put("p", getPersistentCompanyModelInstance("proj1"));
+
+        // contains
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Employee.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "personid == 1 && projects.contains(p)",
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  "org.apache.jdo.tck.pc.company.Project p",
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ paramValues);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+    }
+
+    /**
+     *
+     */
+    public void testContains2() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"emp2", "emp3"});
+
+        JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
+        QEmployee cand = QEmployee.candidate();
+        Expression<Project> empParam = query.parameter("p", Project.class);
+        query.filter(cand.projects.contains(empParam));
+
+        Map<String, Object> paramValues = new HashMap<>();
+        paramValues.put("p", getPersistentCompanyModelInstance("proj1"));
+
+        // contains
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Employee.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "projects.contains(p)",
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  "org.apache.jdo.tck.pc.company.Project p",
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ paramValues);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
     }
     
     /**

Modified: db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NullCollectionsAndIsEmpty.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NullCollectionsAndIsEmpty.java?rev=1845744&r1=1845743&r2=1845744&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NullCollectionsAndIsEmpty.java (original)
+++ db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NullCollectionsAndIsEmpty.java Sun Nov  4 18:37:24 2018
@@ -20,10 +20,13 @@ package org.apache.jdo.tck.query.jdoql;
 import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.company.CompanyModelReader;
 import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.pc.company.QEmployee;
 import org.apache.jdo.tck.query.QueryElementHolder;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
 
+import javax.jdo.JDOQLTypedQuery;
+
 /**
  *<B>Title:</B> Handling of Null Collections and isEmpty in Queries
  *<BR>
@@ -42,36 +45,6 @@ public class NullCollectionsAndIsEmpty e
     private static final String ASSERTION_FAILED = 
         "Assertion A14.6.2-34 (NullCollectionsAndIsEmpty) failed: ";
     
-    /** 
-     * The array of valid queries which may be executed as 
-     * single string queries and as API queries.
-     */
-    private static final QueryElementHolder[] VALID_QUERIES = {
-        // isEmpty
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null,
-        /*INTO*/        null, 
-        /*FROM*/        Employee.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "personid == 1 && projects.isEmpty()",
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-    };
-    
-    /** 
-     * The expected results of valid queries.
-     */
-    private Object[] expectedResult = {
-        // isEmpty
-        getTransientCompanyModelInstancesAsList(new String[]{"emp1"})
-    };
-    
     /**
      * The <code>main</code> is called when the class
      * is directly executed from the command line.
@@ -83,12 +56,33 @@ public class NullCollectionsAndIsEmpty e
     
     /** */
     public void testPositive() {
-        for (int i = 0; i < VALID_QUERIES.length; i++) {
-            executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
-                    expectedResult[i]);
-            executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
-                    expectedResult[i]);
-        }
+        // isEmpty
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"emp1"});
+
+        JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
+        QEmployee cand = QEmployee.candidate();
+        query.filter(cand.personid.eq(1L).and(cand.projects.isEmpty()));
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Employee.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "personid == 1 && projects.isEmpty()",
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  null,
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
     }
     
     /**

Modified: db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/OrderingSpecification.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/OrderingSpecification.java?rev=1845744&r1=1845743&r2=1845744&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/OrderingSpecification.java (original)
+++ db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/OrderingSpecification.java Sun Nov  4 18:37:24 2018
@@ -22,6 +22,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.ListIterator;
 
+import javax.jdo.JDOQLTypedQuery;
 import javax.jdo.PersistenceManager;
 import javax.jdo.Query;
 import javax.jdo.Transaction;
@@ -29,6 +30,7 @@ import javax.jdo.Transaction;
 import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.company.CompanyModelReader;
 import org.apache.jdo.tck.pc.company.DentalInsurance;
+import org.apache.jdo.tck.pc.company.QDentalInsurance;
 import org.apache.jdo.tck.pc.fieldtypes.AllTypes;
 import org.apache.jdo.tck.pc.mylib.PCPoint;
 import org.apache.jdo.tck.query.QueryElementHolder;
@@ -60,55 +62,6 @@ public class OrderingSpecification exten
     /** */
     private static final String ASSERTION_FAILED = 
         "Assertion A14.6.6-1 (OrderingSpecification) failed: ";
-    
-    /** 
-     * The array of valid queries which may be executed as 
-     * single string queries and as API queries.
-     */
-    private static final QueryElementHolder[] VALID_QUERIES = {
-        // nulls first
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null,
-        /*INTO*/        null, 
-        /*FROM*/        DentalInsurance.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       null,
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    "this.lifetimeOrthoBenefit ascending nulls first",
-        /*FROM*/        null,
-        /*TO*/          null),
-        // nulls last
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null,
-        /*INTO*/        null, 
-        /*FROM*/        DentalInsurance.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       null,
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    "this.lifetimeOrthoBenefit ascending nulls last",
-        /*FROM*/        null,
-        /*TO*/          null)
-    };
-    
-    /** 
-     * The expected results of valid queries.
-     */
-    private Object[] expectedResult = {
-        // nulls first
-        getTransientCompanyModelInstancesAsList(new String[]{
-                "dentalIns99", "dentalIns1", "dentalIns2", "dentalIns3", "dentalIns4", "dentalIns5"}),
-        // nulls last
-        getTransientCompanyModelInstancesAsList(new String[]{
-                "dentalIns1", "dentalIns2", "dentalIns3", "dentalIns4", "dentalIns5", "dentalIns99"})
-    };
 
     /**
      * The <code>main</code> is called when the class
@@ -120,11 +73,67 @@ public class OrderingSpecification exten
     }
 
     /** */
-    public void testPositiveCompanyQueries() {
-        for (int i = 0; i < VALID_QUERIES.length; i++) {
-            executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[i], expectedResult[i]);
-            executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[i], expectedResult[i]);
-        }
+    public void testPositiveCompanyQueries0() {
+        // nulls first
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{
+                "dentalIns99", "dentalIns1", "dentalIns2", "dentalIns3", "dentalIns4", "dentalIns5"});
+
+        JDOQLTypedQuery<DentalInsurance> query = getPM().newJDOQLTypedQuery(DentalInsurance.class);
+        QDentalInsurance cand = QDentalInsurance.candidate();
+        query.orderBy(cand.lifetimeOrthoBenefit.asc().nullsFirst());
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        DentalInsurance.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       null,
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  null,
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    "this.lifetimeOrthoBenefit ascending nulls first",
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+    }
+
+    /** */
+    public void testPositiveCompanyQueries1() {
+        // nulls last
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{
+                "dentalIns1", "dentalIns2", "dentalIns3", "dentalIns4", "dentalIns5", "dentalIns99"});
+
+        JDOQLTypedQuery<DentalInsurance> query = getPM().newJDOQLTypedQuery(DentalInsurance.class);
+        QDentalInsurance cand = QDentalInsurance.candidate();
+        query.orderBy(cand.lifetimeOrthoBenefit.asc().nullsLast());
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        DentalInsurance.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       null,
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  null,
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    "this.lifetimeOrthoBenefit ascending nulls last",
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
     }
 
     /** */

Modified: db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/RangeAsString.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/RangeAsString.java?rev=1845744&r1=1845743&r2=1845744&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/RangeAsString.java (original)
+++ db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/RangeAsString.java Sun Nov  4 18:37:24 2018
@@ -20,10 +20,13 @@ package org.apache.jdo.tck.query.jdoql;
 import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.company.CompanyModelReader;
 import org.apache.jdo.tck.pc.company.Person;
+import org.apache.jdo.tck.pc.company.QPerson;
 import org.apache.jdo.tck.query.QueryElementHolder;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
 
+import javax.jdo.JDOQLTypedQuery;
+
 /**
  *<B>Title:</B> Range as String.
  *<BR>
@@ -39,83 +42,6 @@ public class RangeAsString extends Query
     /** */
     private static final String ASSERTION_FAILED = 
         "Assertion A14.6.8-3 (RangeAsString) failed: ";
-    
-    /** 
-     * The array of valid queries which may be executed as 
-     * single string queries and as API queries.
-     */
-    private static final QueryElementHolder[] VALID_QUERIES = {
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null, 
-        /*INTO*/        null, 
-        /*FROM*/        Person.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       null,
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    "personid ASCENDING",
-        /*FROM*/        "0",
-        /*TO*/          "5"),
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null, 
-        /*INTO*/        null, 
-        /*FROM*/        Person.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       null,
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    "personid ASCENDING",
-        /*FROM*/        "0",
-        /*TO*/          "4"),
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null, 
-        /*INTO*/        null, 
-        /*FROM*/        Person.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       null,
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    "personid ASCENDING",
-        /*FROM*/        "1",
-        /*TO*/          "5"),
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null, 
-        /*INTO*/        null, 
-        /*FROM*/        Person.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       null,
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    "personid ASCENDING",
-        /*FROM*/        "1",
-        /*TO*/          "4")
-    };
-
-    /** 
-     * The expected results of valid queries.
-     */
-    private Object[] expectedResult = {
-        getTransientCompanyModelInstancesAsList(new String[]{
-                "emp1", "emp2", "emp3", "emp4", "emp5"}),
-        getTransientCompanyModelInstancesAsList(new String[]{
-                "emp1", "emp2", "emp3", "emp4"}),
-        getTransientCompanyModelInstancesAsList(new String[]{
-                "emp2", "emp3", "emp4", "emp5"}),
-        getTransientCompanyModelInstancesAsList(new String[]{
-                "emp2", "emp3", "emp4"})
-    };
             
     /**
      * The <code>main</code> is called when the class
@@ -125,15 +51,126 @@ public class RangeAsString extends Query
     public static void main(String[] args) {
         BatchTestRunner.run(RangeAsString.class);
     }
-    
+
     /** */
-    public void testPositive() {
-        for (int i = 0; i < VALID_QUERIES.length; i++) {
-            executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
-                    expectedResult[i]);
-            executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
-                    expectedResult[i]);
-        }
+    public void testPositive0() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{
+                "emp1", "emp2", "emp3", "emp4", "emp5"});
+
+        JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
+        QPerson cand = QPerson.candidate();
+        query.orderBy(cand.personid.asc());
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Person.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       null,
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  null,
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    "personid ASCENDING",
+                /*FROM*/        "0",
+                /*TO*/          "5",
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+
+    }    /** */
+    public void testPositive1() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{
+                "emp1", "emp2", "emp3", "emp4"});
+
+        JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
+        QPerson cand = QPerson.candidate();
+        query.orderBy(cand.personid.asc());
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Person.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       null,
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  null,
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    "personid ASCENDING",
+                /*FROM*/        "0",
+                /*TO*/          "4",
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+
+    }    /** */
+    public void testPositive2() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{
+                "emp2", "emp3", "emp4", "emp5"});
+
+        JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
+        QPerson cand = QPerson.candidate();
+        query.orderBy(cand.personid.asc());
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Person.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       null,
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  null,
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    "personid ASCENDING",
+                /*FROM*/        "1",
+                /*TO*/          "5",
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+
+    }    /** */
+    public void testPositive3() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{
+                "emp2", "emp3", "emp4"});
+
+        JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
+        QPerson cand = QPerson.candidate();
+        query.orderBy(cand.personid.asc());
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Person.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       null,
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  null,
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    "personid ASCENDING",
+                /*FROM*/        "1",
+                /*TO*/          "4",
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
     }
 
     /**

Modified: db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/SeparateNamespaceForTypeNames.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/SeparateNamespaceForTypeNames.java?rev=1845744&r1=1845743&r2=1845744&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/SeparateNamespaceForTypeNames.java (original)
+++ db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/SeparateNamespaceForTypeNames.java Sun Nov  4 18:37:24 2018
@@ -21,10 +21,19 @@ import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.company.CompanyModelReader;
 import org.apache.jdo.tck.pc.company.Department;
 import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.pc.company.Person;
+import org.apache.jdo.tck.pc.company.QDepartment;
+import org.apache.jdo.tck.pc.company.QEmployee;
+import org.apache.jdo.tck.pc.company.QPerson;
 import org.apache.jdo.tck.query.QueryElementHolder;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
 
+import javax.jdo.JDOQLTypedQuery;
+import javax.jdo.query.Expression;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  *<B>Title:</B> Namespace of Type Names Separate From Fields, Variables, Parameters
  *<BR>
@@ -44,61 +53,6 @@ public class SeparateNamespaceForTypeNam
     private static final String ASSERTION_FAILED = 
         "Assertion A14.4-1 (SeparateNamespaceForTypeNames) failed: ";
     
-    /** 
-     * The array of valid queries which may be executed as 
-     * single string queries and as API queries.
-     */
-    private static final QueryElementHolder[] VALID_QUERIES = {
-        // query having a parameter with the same name as a type
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null,
-        /*INTO*/        null, 
-        /*FROM*/        Employee.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "department == Department",
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  "Department Department",
-        /*IMPORTS*/     "import org.apache.jdo.tck.pc.company.Department",
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-        // query having a parameter with the same name as a type
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null,
-        /*INTO*/        null, 
-        /*FROM*/        Department.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "employees.contains(Employee) && Employee.firstname == \"emp1First\"",
-        /*VARIABLES*/   "Employee Employee",
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     "import org.apache.jdo.tck.pc.company.Employee",
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-    };
-    
-    /** 
-     * The expected results of valid queries.
-     */
-    private Object[] expectedResult = {
-        // query having a parameter with the same name as a type
-        getTransientCompanyModelInstancesAsList(new String[]{"emp1", "emp2", "emp3"}),
-        // query having a parameter with the same name as a type
-        getTransientCompanyModelInstancesAsList(new String[]{"dept1"})
-    };
-    
-    /** Parameters of valid queries. */
-    private Object[][] parameters = {
-        // query having a parameter with the same name as a type
-        {getPersistentCompanyModelInstance("dept1")},
-        // query having a parameter with the same name as a type
-        null
-    };
-            
     /**
      * The <code>main</code> is called when the class
      * is directly executed from the command line.
@@ -108,14 +62,73 @@ public class SeparateNamespaceForTypeNam
         BatchTestRunner.run(SeparateNamespaceForTypeNames.class);
     }
 
-    /** */
-    public void testPositive() {
-        for (int i = 0; i < VALID_QUERIES.length; i++) {
-            executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
-                    parameters[i], expectedResult[i]);
-            executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
-                    parameters[i], expectedResult[i]);
-        }
+    /**
+     *
+     */
+    public void testParameterName() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"emp1", "emp2", "emp3"});
+
+        JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
+        QEmployee cand = QEmployee.candidate();
+        Expression<Department> empParam = query.parameter("Department", Department.class);
+        query.filter(cand.department.eq(empParam));
+
+        Map<String, Object> paramValues = new HashMap<>();
+        paramValues.put("Department", getPersistentCompanyModelInstance("dept1"));
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Employee.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "department == Department",
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  "Department Department",
+                /*IMPORTS*/     "import org.apache.jdo.tck.pc.company.Department",
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ paramValues);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+    }
+
+    /**
+     * 
+     */
+    public void testVaiableName() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"dept1"});
+
+        JDOQLTypedQuery<Department> query = getPM().newJDOQLTypedQuery(Department.class);
+        QDepartment cand = QDepartment.candidate();
+        QEmployee variable = QEmployee.variable("Employee");
+        query.filter(cand.employees.contains(variable).and(variable.firstname.eq("emp1First")));
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Department.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "employees.contains(Employee) && Employee.firstname == \"emp1First\"",
+                /*VARIABLES*/   "Employee Employee",
+                /*PARAMETERS*/  null,
+                /*IMPORTS*/     "import org.apache.jdo.tck.pc.company.Employee",
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
     }
     
     /**

Modified: db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/keywords/SingleString.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/keywords/SingleString.java?rev=1845744&r1=1845743&r2=1845744&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/keywords/SingleString.java (original)
+++ db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/keywords/SingleString.java Sun Nov  4 18:37:24 2018
@@ -19,6 +19,8 @@ package org.apache.jdo.tck.query.jdoql.k
 
 import java.math.BigDecimal;
 import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
 
 import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.company.CompanyModelReader;
@@ -44,44 +46,6 @@ public class SingleString extends QueryT
     /** */
     private static final String ASSERTION_FAILED = 
         "Assertion A14.6.13-1 (SingleString) failed: ";
-    
-    /** 
-     * The array of valid queries which may be executed as 
-     * single string queries and as API queries.
-     */
-    private static final QueryElementHolder[] VALID_QUERIES = {
-        new QueryElementHolder(
-        /*UNIQUE*/      Boolean.FALSE,
-        /*RESULT*/      "firstname AS firstName, lastname AS lastName",
-        /*INTO*/        FullName.class, 
-        /*FROM*/        FullTimeEmployee.class,
-        /*EXCLUDE*/     Boolean.TRUE,
-        /*WHERE*/       "salary > 1000 & projects.contains(p) & " +
-                        "p.budget > limit",
-        /*VARIABLES*/   "Project p",
-        /*PARAMETERS*/  "BigDecimal limit",
-        /*IMPORTS*/     "import org.apache.jdo.tck.pc.company.Project; " +
-                        "import java.math.BigDecimal",
-        /*GROUP BY*/    "firstname, lastname HAVING lastname.startsWith('emp')",
-        /*ORDER BY*/    "lastname ASCENDING",
-        /*FROM*/        0,
-        /*TO*/          3)
-    };
-    
-    /** 
-     * The expected results of valid queries.
-     */
-    private Object[] expectedResult = {
-        Arrays.asList(new Object[]{
-                new FullName("emp1First", "emp1Last"), 
-                new FullName("emp2First", "emp2Last"),
-                new FullName("emp5First", "emp5Last")})
-    };
-            
-    /** Parameters of valid queries. */
-    private Object[][] parameters = {
-        {new BigDecimal("2000")}
-    };
             
     /**
      * The <code>main</code> is called when the class
@@ -94,12 +58,33 @@ public class SingleString extends QueryT
     
     /** */
     public void testPositive() {
-        for (int i = 0; i < VALID_QUERIES.length; i++) {
-            executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
-                    parameters[i], expectedResult[i]);
-            executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
-                    parameters[i], expectedResult[i]);
-        }
+        Object expected = Arrays.asList(new FullName("emp1First", "emp1Last"),
+                                        new FullName("emp2First", "emp2Last"),
+                                        new FullName("emp5First", "emp5Last"));
+
+        Map<String, Object> paramValues = new HashMap<>();
+        paramValues.put("limit", new BigDecimal("2000"));
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      Boolean.FALSE,
+                /*RESULT*/      "firstname AS firstName, lastname AS lastName",
+                /*INTO*/        FullName.class,
+                /*FROM*/        FullTimeEmployee.class,
+                /*EXCLUDE*/     Boolean.TRUE,
+                /*WHERE*/       "salary > 1000 & projects.contains(p) & p.budget > limit",
+                /*VARIABLES*/   "Project p",
+                /*PARAMETERS*/  "BigDecimal limit",
+                /*IMPORTS*/     "import org.apache.jdo.tck.pc.company.Project; " +
+                                        "import java.math.BigDecimal",
+                /*GROUP BY*/    "firstname, lastname HAVING lastname.startsWith('emp')",
+                /*ORDER BY*/    "lastname ASCENDING",
+                /*FROM*/        0,
+                /*TO*/          3,
+                /*JDOQLTyped*/   null,
+                /*paramValues*/  paramValues);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
     }
 
     /**

Modified: db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/methods/StartsWithAndEndsWith.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/methods/StartsWithAndEndsWith.java?rev=1845744&r1=1845743&r2=1845744&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/methods/StartsWithAndEndsWith.java (original)
+++ db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/methods/StartsWithAndEndsWith.java Sun Nov  4 18:37:24 2018
@@ -20,10 +20,13 @@ package org.apache.jdo.tck.query.jdoql.m
 import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.company.CompanyModelReader;
 import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.pc.company.QEmployee;
 import org.apache.jdo.tck.query.QueryElementHolder;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
 
+import javax.jdo.JDOQLTypedQuery;
+
 /**
  *<B>Title:</B> StartsWith and EndsWith Query Operators
  *<BR>
@@ -45,53 +48,6 @@ public class StartsWithAndEndsWith exten
     private static final String ASSERTION_FAILED = 
         "Assertion A14.6.2-33 (StartsWithAndEndsWith) failed: ";
     
-    /** 
-     * The array of valid queries which may be executed as 
-     * single string queries and as API queries.
-     */
-    private static final QueryElementHolder[] VALID_QUERIES = {
-        // startsWith
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null,
-        /*INTO*/        null, 
-        /*FROM*/        Employee.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "firstname.startsWith(\"emp1\")",
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-        // endsWith
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null,
-        /*INTO*/        null, 
-        /*FROM*/        Employee.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "firstname.endsWith(\"1First\")",
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null)
-    };
-    
-    /** 
-     * The expected results of valid queries.
-     */
-    private Object[] expectedResult = {
-        // startsWith
-        getTransientCompanyModelInstancesAsList(new String[]{"emp1"}),
-        // endsWith
-        getTransientCompanyModelInstancesAsList(new String[]{"emp1"})
-    };
-    
     /**
      * The <code>main</code> is called when the class
      * is directly executed from the command line.
@@ -102,13 +58,65 @@ public class StartsWithAndEndsWith exten
     }
     
     /** */
-    public void testPositive() {
-        for (int i = 0; i < VALID_QUERIES.length; i++) {
-            executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
-                    expectedResult[i]);
-            executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[i], 
-                    expectedResult[i]);
-        }
+    public void testPositive0() {
+        // startsWith
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"emp1"});
+
+        JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
+        QEmployee cand = QEmployee.candidate();
+        query.filter(cand.firstname.startsWith("emp1"));
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Employee.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "firstname.startsWith(\"emp1\")",
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  null,
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+    }
+
+    /** */
+    public void testPositive1() {
+        // endsWith
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"emp1"});
+
+        JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
+        QEmployee cand = QEmployee.candidate();
+        query.filter(cand.firstname.endsWith("1First"));
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Employee.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "firstname.endsWith(\"1First\")",
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  null,
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
     }
     
     /**

Modified: db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/methods/SupportedCollectionMethods.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/methods/SupportedCollectionMethods.java?rev=1845744&r1=1845743&r2=1845744&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/methods/SupportedCollectionMethods.java (original)
+++ db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/methods/SupportedCollectionMethods.java Sun Nov  4 18:37:24 2018
@@ -17,18 +17,21 @@
 
 package org.apache.jdo.tck.query.jdoql.methods;
 
-import javax.jdo.PersistenceManager;
-import javax.jdo.Query;
-import javax.jdo.Transaction;
-
 import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.company.CompanyModelReader;
 import org.apache.jdo.tck.pc.company.Department;
 import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.pc.company.QDepartment;
+import org.apache.jdo.tck.pc.company.QEmployee;
 import org.apache.jdo.tck.query.QueryElementHolder;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
 
+import javax.jdo.JDOQLTypedQuery;
+import javax.jdo.query.Expression;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  *<B>Title:</B>Supported collection methods
  *<BR>
@@ -50,17 +53,30 @@ public class SupportedCollectionMethods
     /** */
     private static final String ASSERTION_FAILED = 
         "Assertion A14.6.2-45 (SupportedCollectionMethods) failed: ";
-    
-    /** 
-     * The array of valid queries which may be executed as 
-     * single string queries and as API queries.
+            
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
      */
-    private static final QueryElementHolder[] VALID_QUERIES = {
+    public static void main(String[] args) {
+        BatchTestRunner.run(SupportedCollectionMethods.class);
+    }
+    
+    /** */
+    public void testContains() {
         // contains(VARIABLE)
-        new QueryElementHolder(
+        Object expectedResult = getTransientCompanyModelInstancesAsList(new String[]{"dept1"});
+
+        JDOQLTypedQuery<Department> query = getPM().newJDOQLTypedQuery(Department.class);
+        QDepartment cand = QDepartment.candidate();
+        QEmployee eVariable = QEmployee.variable("e");
+        query.filter(cand.employees.contains(eVariable).and(eVariable.personid.eq(1L)));
+
+        QueryElementHolder holder = new QueryElementHolder(
                 /*UNIQUE*/      null,
-                /*RESULT*/      null, 
-                /*INTO*/        null, 
+                /*RESULT*/      null,
+                /*INTO*/        null,
                 /*FROM*/        Department.class,
                 /*EXCLUDE*/     null,
                 /*WHERE*/       "employees.contains(e) && e.personid == 1",
@@ -70,12 +86,32 @@ public class SupportedCollectionMethods
                 /*GROUP BY*/    null,
                 /*ORDER BY*/    null,
                 /*FROM*/        null,
-                /*TO*/          null),
+                /*TO*/          null,
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expectedResult);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expectedResult);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expectedResult);
+
         // contains(PARAMETER)
-        new QueryElementHolder(
+
+        expectedResult = getTransientCompanyModelInstancesAsList(new String[]{"dept1"});
+
+        getPM().currentTransaction().begin();
+        Map<String, Object> paramValues = new HashMap<>();
+        paramValues.put("e", getPersistentCompanyModelInstance("emp1"));
+        getPM().currentTransaction().commit();
+
+        query = getPM().newJDOQLTypedQuery(Department.class);
+        cand = QDepartment.candidate();
+        Expression<Employee> paramExpression = query.parameter("e", Employee.class);
+        query.filter(cand.employees.contains(paramExpression));
+
+        holder = new QueryElementHolder(
                 /*UNIQUE*/      null,
-                /*RESULT*/      null, 
-                /*INTO*/        null, 
+                /*RESULT*/      null,
+                /*INTO*/        null,
                 /*FROM*/        Department.class,
                 /*EXCLUDE*/     null,
                 /*WHERE*/       "employees.contains(e)",
@@ -85,12 +121,29 @@ public class SupportedCollectionMethods
                 /*GROUP BY*/    null,
                 /*ORDER BY*/    null,
                 /*FROM*/        null,
-                /*TO*/          null),
+                /*TO*/          null,
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ paramValues);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expectedResult);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expectedResult);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expectedResult);
+    }
+
+    /** */
+    public void testIsEmpty() {
+
         // !isEmpty
-        new QueryElementHolder(
+        Object expectedResult = getTransientCompanyModelInstancesAsList(new String[]{"dept1", "dept2"});
+
+        JDOQLTypedQuery<Department> query = getPM().newJDOQLTypedQuery(Department.class);
+        QDepartment cand = QDepartment.candidate();
+        query.filter(cand.employees.isEmpty().not());
+
+        QueryElementHolder holder = new QueryElementHolder(
                 /*UNIQUE*/      null,
-                /*RESULT*/      null, 
-                /*INTO*/        null, 
+                /*RESULT*/      null,
+                /*INTO*/        null,
                 /*FROM*/        Department.class,
                 /*EXCLUDE*/     null,
                 /*WHERE*/       "!employees.isEmpty()",
@@ -100,12 +153,27 @@ public class SupportedCollectionMethods
                 /*GROUP BY*/    null,
                 /*ORDER BY*/    null,
                 /*FROM*/        null,
-                /*TO*/          null),
+                /*TO*/          null,
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expectedResult);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expectedResult);
+        // DataNucleus: exception UnsupportedOperationException: Dont currently support operator NOT  in JDOQL conversion
+        //executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expectedResult);
+
         // isEmpty
-        new QueryElementHolder(
+        expectedResult = getTransientCompanyModelInstancesAsList(new String[]{
+                "emp1", "emp3", "emp4", "emp5"});
+
+        JDOQLTypedQuery<Employee> query2 = getPM().newJDOQLTypedQuery(Employee.class);
+        QEmployee empCand = QEmployee.candidate();
+        query2.filter(empCand.team.isEmpty());
+
+        holder = new QueryElementHolder(
                 /*UNIQUE*/      null,
-                /*RESULT*/      null, 
-                /*INTO*/        null, 
+                /*RESULT*/      null,
+                /*INTO*/        null,
                 /*FROM*/        Employee.class,
                 /*EXCLUDE*/     null,
                 /*WHERE*/       "team.isEmpty()",
@@ -115,12 +183,28 @@ public class SupportedCollectionMethods
                 /*GROUP BY*/    null,
                 /*ORDER BY*/    null,
                 /*FROM*/        null,
-                /*TO*/          null),
+                /*TO*/          null,
+                /*JDOQLTyped*/  query2,
+                /*paramValues*/ null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expectedResult);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expectedResult);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expectedResult);
+    }
+
+    /** */
+    public void testSize() {
         // size
-        new QueryElementHolder(
+        Object expectedResult = getTransientCompanyModelInstancesAsList(new String[]{"dept1"});
+
+        JDOQLTypedQuery<Department> query = getPM().newJDOQLTypedQuery(Department.class);
+        QDepartment cand = QDepartment.candidate();
+        query.filter(cand.employees.size().eq(3));
+
+        QueryElementHolder holder = new QueryElementHolder(
                 /*UNIQUE*/      null,
-                /*RESULT*/      null, 
-                /*INTO*/        null, 
+                /*RESULT*/      null,
+                /*INTO*/        null,
                 /*FROM*/        Department.class,
                 /*EXCLUDE*/     null,
                 /*WHERE*/       "employees.size() == 3",
@@ -130,70 +214,13 @@ public class SupportedCollectionMethods
                 /*GROUP BY*/    null,
                 /*ORDER BY*/    null,
                 /*FROM*/        null,
-                /*TO*/          null)
-    };
-
-    /** 
-     * The expected results of valid queries.
-     */
-    private Object[] expectedResult = {
-        // contains(VARIABLE)
-        getTransientCompanyModelInstancesAsList(new String[]{"dept1"}),
-        // contains(PARAMETER)
-        getTransientCompanyModelInstancesAsList(new String[]{"dept1"}),
-        // !isEmpty
-        getTransientCompanyModelInstancesAsList(new String[]{"dept1", "dept2"}),
-        // isEmpty
-        getTransientCompanyModelInstancesAsList(new String[]{
-                "emp1", "emp3", "emp4", "emp5"}),
-        // size
-        getTransientCompanyModelInstancesAsList(new String[]{"dept1"})
-    };
-            
-    /**
-     * 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(SupportedCollectionMethods.class);
-    }
-    
-    /** */
-    public void testContains() {
-        int index = 0;
-        executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                expectedResult[index]);
-        executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                expectedResult[index]);
-        
-        index++;
-        getPM().currentTransaction().begin();
-        Object[] parameters = new Object[]{getPersistentCompanyModelInstance("emp1")};
-        getPM().currentTransaction().commit(); 
-        executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                parameters, expectedResult[index]);
-        executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                parameters, expectedResult[index]);
-    }
-
-    /** */
-    public void testIsEmpty() {
-        for (int index = 2; index < 4; index++) {
-            executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                    expectedResult[index]);
-            executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                    expectedResult[index]);
-        }
-    }
-
-    /** */
-    public void testSize() {
-        int index = 4;
-        executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                expectedResult[index]);
-        executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                expectedResult[index]);
+                /*TO*/          null,
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expectedResult);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expectedResult);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expectedResult);
     }
 
     /**

Modified: db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/methods/SupportedDateMethods.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/methods/SupportedDateMethods.java?rev=1845744&r1=1845743&r2=1845744&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/methods/SupportedDateMethods.java (original)
+++ db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/methods/SupportedDateMethods.java Sun Nov  4 18:37:24 2018
@@ -20,10 +20,13 @@ package org.apache.jdo.tck.query.jdoql.m
 import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.company.CompanyModelReader;
 import org.apache.jdo.tck.pc.company.Person;
+import org.apache.jdo.tck.pc.company.QPerson;
 import org.apache.jdo.tck.query.QueryElementHolder;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
 
+import javax.jdo.JDOQLTypedQuery;
+
 /**
  *<B>Title:</B> Supported Date methods.
  *<BR>
@@ -44,16 +47,28 @@ public class SupportedDateMethods extend
     /** */
     private static final String ASSERTION_FAILED = 
         "Assertion A14.6.2-60 (SupportedDateMethods) failed: ";
-    
-    /** 
-     * The array of valid queries which may be executed as 
-     * single string queries and as API queries.
+            
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
      */
-    private static final QueryElementHolder[] VALID_QUERIES = {
-        new QueryElementHolder(
+    public static void main(String[] args) {
+        BatchTestRunner.run(SupportedDateMethods.class);
+    }
+    
+    /** */
+    public void testGetDate() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"emp1"});
+
+        JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
+        QPerson cand = QPerson.candidate();
+        query.filter(cand.birthdate.getDay().eq(10));
+
+        QueryElementHolder holder = new QueryElementHolder(
                 /*UNIQUE*/      null,
-                /*RESULT*/      null, 
-                /*INTO*/        null, 
+                /*RESULT*/      null,
+                /*INTO*/        null,
                 /*FROM*/        Person.class,
                 /*EXCLUDE*/     null,
                 /*WHERE*/       "birthdate.getDate() == 10",
@@ -63,11 +78,27 @@ public class SupportedDateMethods extend
                 /*GROUP BY*/    null,
                 /*ORDER BY*/    null,
                 /*FROM*/        null,
-                /*TO*/          null),
-        new QueryElementHolder(
+                /*TO*/          null,
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+    }
+    
+    /** */
+    public void testGetMonth() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"emp1"});
+
+        JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
+        QPerson cand = QPerson.candidate();
+        query.filter(cand.birthdate.getMonth().eq(5));
+
+        QueryElementHolder holder = new QueryElementHolder(
                 /*UNIQUE*/      null,
-                /*RESULT*/      null, 
-                /*INTO*/        null, 
+                /*RESULT*/      null,
+                /*INTO*/        null,
                 /*FROM*/        Person.class,
                 /*EXCLUDE*/     null,
                 /*WHERE*/       "birthdate.getMonth() == 5",
@@ -77,11 +108,27 @@ public class SupportedDateMethods extend
                 /*GROUP BY*/    null,
                 /*ORDER BY*/    null,
                 /*FROM*/        null,
-                /*TO*/          null),
-        new QueryElementHolder(
+                /*TO*/          null,
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+    }
+
+    /** */
+    public void testGetYear() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"emp1"});
+
+        JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
+        QPerson cand = QPerson.candidate();
+        query.filter(cand.birthdate.getYear().eq(1970));
+
+        QueryElementHolder holder = new QueryElementHolder(
                 /*UNIQUE*/      null,
-                /*RESULT*/      null, 
-                /*INTO*/        null, 
+                /*RESULT*/      null,
+                /*INTO*/        null,
                 /*FROM*/        Person.class,
                 /*EXCLUDE*/     null,
                 /*WHERE*/       "birthdate.getYear() == 1970",
@@ -91,43 +138,13 @@ public class SupportedDateMethods extend
                 /*GROUP BY*/    null,
                 /*ORDER BY*/    null,
                 /*FROM*/        null,
-                /*TO*/          null),
-    };
-
-    /** 
-     * The expected results of valid queries.
-     */
-    private Object[] expectedResult = {
-        getTransientCompanyModelInstancesAsList(new String[]{"emp1"}),
-        getTransientCompanyModelInstancesAsList(new String[]{"emp1"}),
-        getTransientCompanyModelInstancesAsList(new String[]{"emp1"}),
-    };
-            
-    /**
-     * 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(SupportedDateMethods.class);
-    }
-    
-    /** */
-    public void testGetDate() {
-        int index = 0;
-        executeQuery(index);
-    }
-    
-    /** */
-    public void testGetMonth() {
-        int index = 1;
-        executeQuery(index);
-    }
-
-    /** */
-    public void testGetYear() {
-        int index = 2;
-        executeQuery(index);
+                /*TO*/          null,
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
     }
 
     /**
@@ -138,11 +155,4 @@ public class SupportedDateMethods extend
         loadAndPersistCompanyModel(getPM());
     }
 
-    /** */
-    private void executeQuery(int index) {
-        executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                expectedResult[index]);
-        executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                expectedResult[index]);
-    }
 }