db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r1845744 [5/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...
Date Sun, 04 Nov 2018 18:37:24 GMT
Modified: db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/methods/SupportedStringMethods.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/methods/SupportedStringMethods.java?rev=1845744&r1=1845743&r2=1845744&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/methods/SupportedStringMethods.java (original)
+++ db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/methods/SupportedStringMethods.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.Person;
+import org.apache.jdo.tck.pc.company.QDepartment;
+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 String methods.
  *<BR>
@@ -56,15 +60,27 @@ public class SupportedStringMethods exte
     private static final String ASSERTION_FAILED = 
         "Assertion A14.6.2-47 (SupportedStringMethods) 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(SupportedStringMethods.class);
+    }
+    
+    /** */
+    public void testToLowerCase() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"emp1"});
+
+        JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
+        QPerson cand = QPerson.candidate();
+        query.filter(cand.firstname.toLowerCase().eq("emp1first"));
+
+        QueryElementHolder holder = new QueryElementHolder(
                 /*UNIQUE*/      null,
-                /*RESULT*/      null, 
-                /*INTO*/        null, 
+                /*RESULT*/      null,
+                /*INTO*/        null,
                 /*FROM*/        Person.class,
                 /*EXCLUDE*/     null,
                 /*WHERE*/       "firstname.toLowerCase() == 'emp1first'",
@@ -74,11 +90,27 @@ public class SupportedStringMethods exte
                 /*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 testToUpperCase() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"emp1"});
+
+        JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
+        QPerson cand = QPerson.candidate();
+        query.filter(cand.firstname.toUpperCase().eq("EMP1FIRST"));
+
+        QueryElementHolder holder = new QueryElementHolder(
                 /*UNIQUE*/      null,
-                /*RESULT*/      null, 
-                /*INTO*/        null, 
+                /*RESULT*/      null,
+                /*INTO*/        null,
                 /*FROM*/        Person.class,
                 /*EXCLUDE*/     null,
                 /*WHERE*/       "firstname.toUpperCase() == 'EMP1FIRST'",
@@ -88,11 +120,27 @@ public class SupportedStringMethods exte
                 /*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 testIndexOfString() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"dept1"});
+
+        JDOQLTypedQuery<Department> query = getPM().newJDOQLTypedQuery(Department.class);
+        QDepartment cand = QDepartment.candidate();
+        query.filter(cand.name.indexOf("e").eq(1));
+
+        QueryElementHolder holder = new QueryElementHolder(
                 /*UNIQUE*/      null,
-                /*RESULT*/      null, 
-                /*INTO*/        null, 
+                /*RESULT*/      null,
+                /*INTO*/        null,
                 /*FROM*/        Department.class,
                 /*EXCLUDE*/     null,
                 /*WHERE*/       "name.indexOf('e') == 1",
@@ -102,11 +150,27 @@ public class SupportedStringMethods exte
                 /*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 testIndexOfStringInt() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"dept1"});
+
+        JDOQLTypedQuery<Department> query = getPM().newJDOQLTypedQuery(Department.class);
+        QDepartment cand = QDepartment.candidate();
+        query.filter(cand.name.indexOf("e", 2).eq(3));
+
+        QueryElementHolder holder = new QueryElementHolder(
                 /*UNIQUE*/      null,
-                /*RESULT*/      null, 
-                /*INTO*/        null, 
+                /*RESULT*/      null,
+                /*INTO*/        null,
                 /*FROM*/        Department.class,
                 /*EXCLUDE*/     null,
                 /*WHERE*/       "name.indexOf('e', 2) == 3",
@@ -116,11 +180,28 @@ public class SupportedStringMethods exte
                 /*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 testMatches1() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{
+                "emp1", "emp2", "emp3", "emp4", "emp5"});
+
+        JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
+        QPerson cand = QPerson.candidate();
+        query.filter(cand.firstname.matches(".*First"));
+
+        QueryElementHolder holder = new QueryElementHolder(
                 /*UNIQUE*/      null,
-                /*RESULT*/      null, 
-                /*INTO*/        null, 
+                /*RESULT*/      null,
+                /*INTO*/        null,
                 /*FROM*/        Person.class,
                 /*EXCLUDE*/     null,
                 /*WHERE*/       "firstname.matches('.*First')",
@@ -130,11 +211,28 @@ public class SupportedStringMethods exte
                 /*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 testMatches2() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{
+                "emp1", "emp2", "emp3", "emp4", "emp5"});
+
+        JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
+        QPerson cand = QPerson.candidate();
+        query.filter(cand.firstname.matches("emp.First"));
+
+        QueryElementHolder holder = new QueryElementHolder(
                 /*UNIQUE*/      null,
-                /*RESULT*/      null, 
-                /*INTO*/        null, 
+                /*RESULT*/      null,
+                /*INTO*/        null,
                 /*FROM*/        Person.class,
                 /*EXCLUDE*/     null,
                 /*WHERE*/       "firstname.matches('emp.First')",
@@ -144,11 +242,26 @@ public class SupportedStringMethods exte
                 /*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 testMatches3() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"emp1"});
+
+        JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
+        QPerson cand = QPerson.candidate();
+        query.filter(cand.firstname.matches("(?i)EMP1FIRST"));
+
+        QueryElementHolder holder = new QueryElementHolder(
                 /*UNIQUE*/      null,
-                /*RESULT*/      null, 
-                /*INTO*/        null, 
+                /*RESULT*/      null,
+                /*INTO*/        null,
                 /*FROM*/        Person.class,
                 /*EXCLUDE*/     null,
                 /*WHERE*/       "firstname.matches('(?i)EMP1FIRST')",
@@ -158,11 +271,28 @@ public class SupportedStringMethods exte
                 /*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 testSubstringInt() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{
+                "emp1", "emp2", "emp3", "emp4", "emp5"});
+
+        JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
+        QPerson cand = QPerson.candidate();
+        query.filter(cand.firstname.substring(4).eq("First"));
+
+        QueryElementHolder holder = new QueryElementHolder(
                 /*UNIQUE*/      null,
-                /*RESULT*/      null, 
-                /*INTO*/        null, 
+                /*RESULT*/      null,
+                /*INTO*/        null,
                 /*FROM*/        Person.class,
                 /*EXCLUDE*/     null,
                 /*WHERE*/       "firstname.substring(4) == 'First'",
@@ -172,11 +302,28 @@ public class SupportedStringMethods exte
                 /*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 testSubstringIntInt() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{
+                "emp1", "emp2", "emp3", "emp4", "emp5"});
+
+        JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
+        QPerson cand = QPerson.candidate();
+        query.filter(cand.firstname.substring(4,9).eq("First"));
+
+        QueryElementHolder holder = new QueryElementHolder(
                 /*UNIQUE*/      null,
-                /*RESULT*/      null, 
-                /*INTO*/        null, 
+                /*RESULT*/      null,
+                /*INTO*/        null,
                 /*FROM*/        Person.class,
                 /*EXCLUDE*/     null,
                 /*WHERE*/       "firstname.substring(4,9) == 'First'",
@@ -186,11 +333,28 @@ public class SupportedStringMethods exte
                 /*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 testStartsWith() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{
+                "emp1", "emp2", "emp3", "emp4", "emp5"});
+
+        JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
+        QPerson cand = QPerson.candidate();
+        query.filter(cand.firstname.startsWith("emp"));
+
+        QueryElementHolder holder = new QueryElementHolder(
                 /*UNIQUE*/      null,
-                /*RESULT*/      null, 
-                /*INTO*/        null, 
+                /*RESULT*/      null,
+                /*INTO*/        null,
                 /*FROM*/        Person.class,
                 /*EXCLUDE*/     null,
                 /*WHERE*/       "firstname.startsWith('emp')",
@@ -200,11 +364,28 @@ public class SupportedStringMethods exte
                 /*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 testEndsWith() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{
+                "emp1", "emp2", "emp3", "emp4", "emp5"});
+
+        JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
+        QPerson cand = QPerson.candidate();
+        query.filter(cand.firstname.endsWith("First"));
+
+        QueryElementHolder holder = new QueryElementHolder(
                 /*UNIQUE*/      null,
-                /*RESULT*/      null, 
-                /*INTO*/        null, 
+                /*RESULT*/      null,
+                /*INTO*/        null,
                 /*FROM*/        Person.class,
                 /*EXCLUDE*/     null,
                 /*WHERE*/       "firstname.endsWith('First')",
@@ -214,53 +395,119 @@ public class SupportedStringMethods exte
                 /*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 testStartsWithIndexed() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{
+                "emp1", "emp2", "emp3", "emp4", "emp5"});
+
+        JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
+        QPerson cand = QPerson.candidate();
+        query.filter(cand.firstname.startsWith("mp", 1));
+
+        QueryElementHolder holder = new QueryElementHolder(
                 /*UNIQUE*/      null,
-                /*RESULT*/      null, 
-                /*INTO*/        null, 
+                /*RESULT*/      null,
+                /*INTO*/        null,
                 /*FROM*/        Person.class,
                 /*EXCLUDE*/     null,
-                /*WHERE*/       "firstname.charAt(3) == '1'",
+                /*WHERE*/       "firstname.startsWith('mp', 1)",
                 /*VARIABLES*/   null,
                 /*PARAMETERS*/  null,
                 /*IMPORTS*/     null,
                 /*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 testLength() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{
+                "emp1", "emp2", "emp3", "emp4", "emp5"});
+
+        JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
+        QPerson cand = QPerson.candidate();
+        query.filter(cand.firstname.length().eq(9));
+
+        QueryElementHolder holder = new QueryElementHolder(
                 /*UNIQUE*/      null,
-                /*RESULT*/      null, 
-                /*INTO*/        null, 
+                /*RESULT*/      null,
+                /*INTO*/        null,
                 /*FROM*/        Person.class,
                 /*EXCLUDE*/     null,
-                /*WHERE*/       "firstname.startsWith('mp', 1)",
+                /*WHERE*/       "firstname.length() == 9",
                 /*VARIABLES*/   null,
                 /*PARAMETERS*/  null,
                 /*IMPORTS*/     null,
                 /*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 testCharAt() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"emp1"});
+
+        JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
+        QPerson cand = QPerson.candidate();
+        query.filter(cand.firstname.charAt(3).eq('1'));
+
+        QueryElementHolder holder = new QueryElementHolder(
                 /*UNIQUE*/      null,
-                /*RESULT*/      null, 
-                /*INTO*/        null, 
+                /*RESULT*/      null,
+                /*INTO*/        null,
                 /*FROM*/        Person.class,
                 /*EXCLUDE*/     null,
-                /*WHERE*/       "firstname.length() == 9",
+                /*WHERE*/       "firstname.charAt(3) == '1'",
                 /*VARIABLES*/   null,
                 /*PARAMETERS*/  null,
                 /*IMPORTS*/     null,
                 /*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 testTrim() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"emp1"});
+
+        JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
+        QPerson cand = QPerson.candidate();
+        query.filter(cand.firstname.trim().eq("emp1First"));
+
+        QueryElementHolder holder = new QueryElementHolder(
                 /*UNIQUE*/      null,
-                /*RESULT*/      null, 
-                /*INTO*/        null, 
+                /*RESULT*/      null,
+                /*INTO*/        null,
                 /*FROM*/        Person.class,
                 /*EXCLUDE*/     null,
                 /*WHERE*/       "firstname.trim() == 'emp1First'",
@@ -270,127 +517,14 @@ public class SupportedStringMethods exte
                 /*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[]{"dept1"}),
-        getTransientCompanyModelInstancesAsList(new String[]{"dept1"}),
-        getTransientCompanyModelInstancesAsList(new String[]{
-                "emp1", "emp2", "emp3", "emp4", "emp5"}),
-        getTransientCompanyModelInstancesAsList(new String[]{
-                "emp1", "emp2", "emp3", "emp4", "emp5"}),
-        getTransientCompanyModelInstancesAsList(new String[]{"emp1"}),
-        getTransientCompanyModelInstancesAsList(new String[]{
-                "emp1", "emp2", "emp3", "emp4", "emp5"}),
-        getTransientCompanyModelInstancesAsList(new String[]{
-                "emp1", "emp2", "emp3", "emp4", "emp5"}),
-        getTransientCompanyModelInstancesAsList(new String[]{
-                "emp1", "emp2", "emp3", "emp4", "emp5"}),
-        getTransientCompanyModelInstancesAsList(new String[]{
-        		"emp1", "emp2", "emp3", "emp4", "emp5"}),
-        getTransientCompanyModelInstancesAsList(new String[]{
-        		"emp1"}),
-        getTransientCompanyModelInstancesAsList(new String[]{
-        		"emp1", "emp2", "emp3", "emp4", "emp5"}),
-        getTransientCompanyModelInstancesAsList(new String[]{
-        		"emp1", "emp2", "emp3", "emp4", "emp5"}),
-        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(SupportedStringMethods.class);
-    }
-    
-    /** */
-    public void testToLowerCase() {
-        int index = 0;
-        executeQuery(index);
-    }
-    
-    /** */
-    public void testToUpperCase() {
-        int index = 1;
-        executeQuery(index);
-    }
-
-    /** */
-    public void testIndexOfString() {
-        int index = 2;
-        executeQuery(index);
-    }
-
-    /** */
-    public void testIndexOfStringInt() {
-        int index = 3;
-        executeQuery(index);
-    }
-
-    /** */
-    public void testMatches() {
-        int index = 4;
-        executeQuery(index);
-        executeQuery(++index);
-        executeQuery(++index);
-    }
-
-    /** */
-    public void testSubstringInt() {
-        int index = 7;
-        executeQuery(index);
-    }
-
-    /** */
-    public void testSubstringIntInt() {
-        int index = 8;
-        executeQuery(index);
-    }
-
-    /** */
-    public void testStartsWith() {
-        int index = 9;
-        executeQuery(index);
-    }
-
-    /** */
-    public void testEndsWith() {
-        int index = 10;
-        executeQuery(index);
-    }
-
-    /** */
-    public void testStartsWithIndexed() {
-        int index = 11;
-        executeQuery(index);
-    }
-
-    /** */
-    public void testLength() {
-        int index = 12;
-        executeQuery(index);
-    }
-
-    /** */
-    public void testCharAt() {
-        int index = 13;
-        executeQuery(index);
-    }
-
-    /** */
-    public void testTrim() {
-        int index = 14;
-        executeQuery(index);
+                /*TO*/          null,
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        // DataNucleus: NullPointerException at org.datanucleus.store.rdbms.sql.method.StringTrim2Method.getExpression(StringTrim2Method.java:48)
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
     }
 
     /**
@@ -400,12 +534,4 @@ public class SupportedStringMethods exte
         addTearDownClass(CompanyModelReader.getTearDownClasses());
         loadAndPersistCompanyModel(getPM());
     }
-
-    /** */
-    private void executeQuery(int index) {
-        executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                expectedResult[index]);
-        executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                expectedResult[index]);
-    }
 }

Modified: db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/operators/EqualityAndComparisonsBetweenDateFieldsAndParameters.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/operators/EqualityAndComparisonsBetweenDateFieldsAndParameters.java?rev=1845744&r1=1845743&r2=1845744&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/operators/EqualityAndComparisonsBetweenDateFieldsAndParameters.java (original)
+++ db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/operators/EqualityAndComparisonsBetweenDateFieldsAndParameters.java Sun Nov  4 18:37:24 2018
@@ -20,15 +20,20 @@ package org.apache.jdo.tck.query.jdoql.o
 import java.util.Calendar;
 import java.util.Date;
 import java.util.GregorianCalendar;
-import java.util.TimeZone;
+import java.util.HashMap;
+import java.util.Map;
 
 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;
+import javax.jdo.query.DateTimeExpression;
+
 /**
  *<B>Title:</B> Equality and Comparisons Between Date Fields and Parameters
  *<BR>
@@ -47,71 +52,6 @@ public class EqualityAndComparisonsBetwe
     /** */
     private static final String ASSERTION_FAILED = 
         "Assertion A14.6.2-4 (EqualityAndComparisonsBetweenDateFieldsAndParameters) failed: ";
-
-    /** 
-     * The array of valid queries which may be executed as 
-     * single string queries and as API queries.
-     */
-    private static final QueryElementHolder[] VALID_QUERIES = {
-        // date field == date parameter
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null,
-        /*INTO*/        null, 
-        /*FROM*/        Employee.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "hiredate == param",
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  "java.util.Date param",
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-        // date field >= date parameter
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null,
-        /*INTO*/        null, 
-        /*FROM*/        Employee.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "hiredate >= param",
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  "java.util.Date param",
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-        // date field >= date parameter
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null,
-        /*INTO*/        null, 
-        /*FROM*/        Employee.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "param < birthdate",
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  "java.util.Date param",
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-    };
-    
-    /** 
-     * The expected results of valid queries.
-     */
-    private Object[] expectedResult = {
-        // date field == date parameter
-        getTransientCompanyModelInstancesAsList(new String[]{"emp1"}),
-        // date field >= date parameter
-        getTransientCompanyModelInstancesAsList(new String[]{
-                "emp1", "emp2", "emp3", "emp4"}),
-        // date field >= date parameter
-        getTransientCompanyModelInstancesAsList(new String[]{})
-    };
     
     /** */
     private static final Date FIRST_OF_JAN_1999;
@@ -141,15 +81,118 @@ public class EqualityAndComparisonsBetwe
     public static void main(String[] args) {
         BatchTestRunner.run(EqualityAndComparisonsBetweenDateFieldsAndParameters.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 testFieldEqualsParameter() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"emp1"});
+
+        JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
+        QEmployee cand = QEmployee.candidate();
+        DateTimeExpression param = query.datetimeParameter("param");
+        query.filter(cand.hiredate.eq(param));
+
+        Map<String, Object> paramValues = new HashMap<>();
+        paramValues.put("param", FIRST_OF_JAN_1999);
+
+        // date field == date parameter
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Employee.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "hiredate == param",
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  "java.util.Date param",
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ paramValues);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+    }
+
+    /**
+     *
+     */
+    public void testFieldGEParameter() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{
+                "emp1", "emp2", "emp3", "emp4"});
+
+        JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
+        QEmployee cand = QEmployee.candidate();
+        DateTimeExpression param = query.datetimeParameter("param");
+        query.filter(cand.hiredate.gteq(param));
+
+        Map<String, Object> paramValues = new HashMap<>();
+        paramValues.put("param", FIRST_OF_JAN_1999);
+
+        // date field >= date parameter
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Employee.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "hiredate >= param",
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  "java.util.Date param",
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ paramValues);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+    }
+
+    /**
+     *
+     */
+    public void testParameterLTField() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{});
+
+        JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
+        QEmployee cand = QEmployee.candidate();
+        DateTimeExpression param = query.datetimeParameter("param");
+        query.filter(param.lt(cand.birthdate));
+
+        Map<String, Object> paramValues = new HashMap<>();
+        paramValues.put("param", FIRST_OF_JAN_1999);
+
+        // Import Department twice
+        QueryElementHolder holder = // date parameter < date field
+                new QueryElementHolder(
+                        /*UNIQUE*/      null,
+                        /*RESULT*/      null,
+                        /*INTO*/        null,
+                        /*FROM*/        Employee.class,
+                        /*EXCLUDE*/     null,
+                        /*WHERE*/       "param < birthdate",
+                        /*VARIABLES*/   null,
+                        /*PARAMETERS*/  "java.util.Date param",
+                        /*IMPORTS*/     null,
+                        /*GROUP BY*/    null,
+                        /*ORDER BY*/    null,
+                        /*FROM*/        null,
+                        /*TO*/          null,
+                /*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/operators/EqualityAndComparisonsBetweenStringFieldsAndParameters.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/operators/EqualityAndComparisonsBetweenStringFieldsAndParameters.java?rev=1845744&r1=1845743&r2=1845744&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/operators/EqualityAndComparisonsBetweenStringFieldsAndParameters.java (original)
+++ db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/operators/EqualityAndComparisonsBetweenStringFieldsAndParameters.java Sun Nov  4 18:37:24 2018
@@ -20,10 +20,16 @@ package org.apache.jdo.tck.query.jdoql.o
 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;
+import javax.jdo.query.StringExpression;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  *<B>Title:</B> Equality and Comparisons Between String Fields and Parameters
  *<BR>
@@ -43,83 +49,7 @@ public class EqualityAndComparisonsBetwe
     /** */
     private static final String ASSERTION_FAILED = 
         "Assertion A14.6.2-5 (EqualityAndComparisonsBetweenStringFieldsAndParameters) failed: ";
-    
-    /** 
-     * The array of valid queries which may be executed as 
-     * single string queries and as API queries.
-     */
-    private static final QueryElementHolder[] VALID_QUERIES = {
-        // string field == string parameter
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null,
-        /*INTO*/        null, 
-        /*FROM*/        Employee.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "firstname == param",
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  "java.lang.String param",
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-        // string field >= string parameter
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null,
-        /*INTO*/        null, 
-        /*FROM*/        Employee.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "firstname >= param",
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  "java.lang.String param",
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-        // string parameter < string field
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null,
-        /*INTO*/        null, 
-        /*FROM*/        Employee.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "param < firstname",
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  "java.lang.String param",
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-    };
-    
-    /** 
-     * The expected results of valid queries.
-     */
-    private Object[] expectedResult = {
-        // string field == string parameter
-        getTransientCompanyModelInstancesAsList(new String[]{"emp1"}),
-        // string field >= string parameter
-        getTransientCompanyModelInstancesAsList(new String[]{
-                "emp1", "emp2", "emp3", "emp4", "emp5"}),
-        // string parameter < string field
-        getTransientCompanyModelInstancesAsList(new String[]{
-                "emp3", "emp4", "emp5"}),
-    };
-    
-    /** Parameters of valid queries. */
-    private Object[][] parameters = {
-        // string field == string parameter
-        {"emp1First"},
-        // string field >= string parameter
-        {"emp1First"},
-        // string parameter < string field
-        {"emp2First"}
-    };
-            
+
     /**
      * The <code>main</code> is called when the class
      * is directly executed from the command line.
@@ -129,14 +59,105 @@ public class EqualityAndComparisonsBetwe
         BatchTestRunner.run(EqualityAndComparisonsBetweenStringFieldsAndParameters.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 testStringFieldEqualsStringParameter() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"emp1"});
+
+        JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
+        QEmployee cand = QEmployee.candidate();
+        StringExpression paramVariable = query.stringParameter("param");
+        query.filter(cand.firstname.eq(paramVariable));
+
+        Map<String, Object> paramValues = new HashMap<>();
+        paramValues.put("param", "emp1First");
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Employee.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "firstname == param",
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  "java.lang.String param",
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ paramValues);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+    }
+
+    public void testStringFieldGEStringParameter() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{
+                "emp1", "emp2", "emp3", "emp4", "emp5"});
+
+        JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
+        QEmployee cand = QEmployee.candidate();
+        StringExpression paramVariable = query.stringParameter("param");
+        query.filter(cand.firstname.gteq(paramVariable));
+
+        Map<String, Object> paramValues = new HashMap<>();
+        paramValues.put("param", "emp1First");
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Employee.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "firstname >= param",
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  "java.lang.String param",
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*JDOQLTyped*/  query,
+                /*paramValues*/ paramValues);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+    }
+
+    public void testStringParameterLTStringField() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{
+                "emp3", "emp4", "emp5"});
+
+        JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
+        QEmployee cand = QEmployee.candidate();
+        StringExpression paramVariable = query.stringParameter("param");
+        query.filter(paramVariable.lt(cand.firstname));
+
+        Map<String, Object> paramValues = new HashMap<>();
+        paramValues.put("param", "emp2First");
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Employee.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "param < firstname",
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  "java.lang.String param",
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*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/operators/Instanceof.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/operators/Instanceof.java?rev=1845744&r1=1845743&r2=1845744&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/operators/Instanceof.java (original)
+++ db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/operators/Instanceof.java Sun Nov  4 18:37:24 2018
@@ -20,10 +20,14 @@ package org.apache.jdo.tck.query.jdoql.o
 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.PartTimeEmployee;
+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> Instanceof operator.
  *<BR>
@@ -39,50 +43,6 @@ public class Instanceof extends QueryTes
     /** */
     private static final String ASSERTION_FAILED = 
         "Assertion A14.6.2-41 (Instanceof) 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*/        Employee.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "mentor instanceof " +
-                        "org.apache.jdo.tck.pc.company.PartTimeEmployee",
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null, 
-        /*INTO*/        null, 
-        /*FROM*/        Employee.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "mentor instanceof PartTimeEmployee",
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     "import org.apache.jdo.tck.pc.company.PartTimeEmployee",
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null)
-    };
-
-    /** 
-     * The expected results of valid queries.
-     */
-    private Object[] expectedResult = {
-        getTransientCompanyModelInstancesAsList(new String[]{"emp2", "emp3"}),
-        getTransientCompanyModelInstancesAsList(new String[]{"emp2", "emp3"})
-    };
             
     /**
      * The <code>main</code> is called when the class
@@ -92,17 +52,70 @@ public class Instanceof extends QueryTes
     public static void main(String[] args) {
         BatchTestRunner.run(Instanceof.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 testPositive1() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"emp2", "emp3"});
+
+        JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
+        QEmployee cand = QEmployee.candidate();
+        // DataNucleus: UnsupportedOperationException: instanceOf not yet supported
+        //query.filter(cand.mentor.instanceOf(PartTimeEmployee.class));
+
+        // Import Department twice
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Employee.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "mentor instanceof org.apache.jdo.tck.pc.company.PartTimeEmployee",
+                /*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);
+        // DataNucleus: UnsupportedOperationException: instanceOf not yet supported
+        //executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
     }
 
+    public void testPositive2() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"emp2", "emp3"});
+
+        JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
+        QEmployee cand = QEmployee.candidate();
+        // DataNucleus: UnsupportedOperationException: instanceOf not yet supported
+        //query.filter(cand.mentor.instanceOf(PartTimeEmployee.class));
+
+        // Import Department twice
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Employee.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "mentor instanceof PartTimeEmployee",
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  null,
+                /*IMPORTS*/     "import org.apache.jdo.tck.pc.company.PartTimeEmployee",
+                /*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: UnsupportedOperationException: instanceOf not yet supported
+        //executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+    }
     /**
      * @see JDO_Test#localSetUp()
      */

Modified: db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/operators/Modulo.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/operators/Modulo.java?rev=1845744&r1=1845743&r2=1845744&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/operators/Modulo.java (original)
+++ db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/operators/Modulo.java Sun Nov  4 18:37:24 2018
@@ -19,12 +19,14 @@ package org.apache.jdo.tck.query.jdoql.o
 
 import java.util.Collection;
 
+import javax.jdo.JDOQLTypedQuery;
 import javax.jdo.PersistenceManager;
 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.Person;
+import org.apache.jdo.tck.pc.company.QPerson;
 import org.apache.jdo.tck.pc.mylib.PrimitiveTypes;
 import org.apache.jdo.tck.query.QueryElementHolder;
 import org.apache.jdo.tck.query.QueryTest;
@@ -45,34 +47,6 @@ public class Modulo extends QueryTest {
     /** */
     private static final String ASSERTION_FAILED = 
         "Assertion A14.6.2-40 (Modulo) 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*/       "personid % 2 == 0",
-        /*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 = {
-        getTransientCompanyModelInstancesAsList(new String[]{"emp2", "emp4"})
-    };
             
     /**
      * The <code>main</code> is called when the class
@@ -82,21 +56,40 @@ public class Modulo extends QueryTest {
     public static void main(String[] args) {
         BatchTestRunner.run(Modulo.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]);
-        }
-        
-        runTestUsingPrimitiveTypes();
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"emp2", "emp4"});
+
+        JDOQLTypedQuery<Person> query = getPM().newJDOQLTypedQuery(Person.class);
+        QPerson cand = QPerson.candidate();
+        query.filter(cand.personid.mod(2).eq(0L));
+
+        // Import Department twice
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Person.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "personid % 2 == 0",
+                /*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);
+        // DataNucleus: UnsupportedOperationException: Dont currently support operator  %  in JDOQL conversion
+        //executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
     }
 
     /** */
-    private void runTestUsingPrimitiveTypes() {
+    public void testPostiveUsingPrimitiveTypes() {
         PersistenceManager pm = getPM();
         Transaction tx = pm.currentTransaction();
         tx.begin();

Modified: db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/operators/StringConcatenation.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/operators/StringConcatenation.java?rev=1845744&r1=1845743&r2=1845744&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/operators/StringConcatenation.java (original)
+++ db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/operators/StringConcatenation.java Sun Nov  4 18:37:24 2018
@@ -20,10 +20,16 @@ package org.apache.jdo.tck.query.jdoql.o
 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;
+import javax.jdo.query.StringExpression;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  *<B>Title:</B> String Concatenation Query Operator
  *<BR>
@@ -43,61 +49,6 @@ public class StringConcatenation extends
     private static final String ASSERTION_FAILED = 
         "Assertion A14.6.2-27 (StringConcatenation) failed: ";
     
-    /** 
-     * The array of valid queries which may be executed as 
-     * single string queries and as API queries.
-     */
-    private static final QueryElementHolder[] VALID_QUERIES = {
-        // string literal + string literal 
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null,
-        /*INTO*/        null, 
-        /*FROM*/        Employee.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "firstname == \"emp1\" + \"First\"",
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-        // string field + string literal 
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null,
-        /*INTO*/        null, 
-        /*FROM*/        Employee.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "firstname + \"Ext\" == param",
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  "String param",
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null)
-    };
-    
-    /** 
-     * The expected results of valid queries.
-     */
-    private Object[] expectedResult = {
-        // string literal + string literal 
-        getTransientCompanyModelInstancesAsList(new String[]{"emp1"}),
-        // string field + string literal 
-        getTransientCompanyModelInstancesAsList(new String[]{"emp1"})
-    };
-    
-    /** Parameters of valid queries. */
-    private Object[][] parameters = {
-        // string literal + string literal 
-        null,
-        // string field + string literal 
-        {"emp1FirstExt"}
-    };
-            
     /**
      * The <code>main</code> is called when the class
      * is directly executed from the command line.
@@ -106,15 +57,71 @@ public class StringConcatenation extends
     public static void main(String[] args) {
         BatchTestRunner.run(StringConcatenation.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 testStringLiteralPlusStringLiteral() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"emp1"});
+
+        JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
+        QEmployee cand = QEmployee.candidate();
+        query.filter(cand.firstname.eq("emp1" + "First"));
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Employee.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "firstname == \"emp1\" + \"First\"",
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  null,
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*JDOQLTyped*/   query,
+                /*paramValues*/  null);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
+    }
+
+    public void testStringFieldPlusStringLiteral() {
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"emp1"});
+
+        JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
+        QEmployee cand = QEmployee.candidate();
+        StringExpression paramExpr = query.stringParameter("param");
+        query.filter(cand.firstname.add("Ext").eq(paramExpr));
+
+        Map<String, Object> paramValues = new HashMap<>();
+        paramValues.put("param", "emp1FirstExt");
+
+        // Import Department twice
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Employee.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "firstname + \"Ext\" == param",
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  "String param",
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*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/parameters/ImplicitParameters.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/parameters/ImplicitParameters.java?rev=1845744&r1=1845743&r2=1845744&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/parameters/ImplicitParameters.java (original)
+++ db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/parameters/ImplicitParameters.java Sun Nov  4 18:37:24 2018
@@ -18,7 +18,9 @@
 package org.apache.jdo.tck.query.jdoql.parameters;
 
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.company.CompanyModelReader;
@@ -37,8 +39,8 @@ import org.apache.jdo.tck.util.BatchTest
  *<BR>
  *<B>Assertion Description: </B>
  * Parameters implicitly declared (in the result, filter, grouping, ordering, 
- * or range) are identified by prepending a ":" to the parameter 
- * everywhere it appears. All parameter types can be determined 
+ * or range) are identified by prepending a ":" to the parameter
+ * everywhere it appears. All parameter types can be determined
  * by one of the following techniques:
  */
 public class ImplicitParameters extends QueryTest {
@@ -47,84 +49,7 @@ public class ImplicitParameters extends
     private static final String ASSERTION_FAILED = 
         "Assertion A14.6.3-3 (ImplicitParameters) 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*/      "this, :param", 
-        /*INTO*/        null, 
-        /*FROM*/        Person.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       null,
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      null, 
-        /*INTO*/        null, 
-        /*FROM*/        Person.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "firstname == :param",
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      "department.name", 
-        /*INTO*/        null, 
-        /*FROM*/        Employee.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       null,
-        /*VARIABLES*/   null,
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    "department.name HAVING COUNT(this) >= :minValue",
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-        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*/    null,
-        /*FROM*/        ":zero",
-        /*TO*/          ":five")
-    };
-    
-    private static String parameter = "parameterInResult";
-    
-    /** 
-     * The expected results of valid queries.
-     */
-    private Object[] expectedResult = {
-        getExpectedResultOfFirstQuery(
-                getTransientCompanyModelInstancesAsList(new String[] {
-                "emp1", "emp2", "emp3", "emp4", "emp5"})),
-        getTransientCompanyModelInstancesAsList(new String[]{"emp1"}),
-        /* Note: "Development" is not a bean name! */
-        Arrays.asList(new Object[]{"Development"}),
-        getTransientCompanyModelInstancesAsList(new String[] {
-                "emp1", "emp2", "emp3", "emp4", "emp5"})
-    };
+    private static final String PARAMETER = "parameterInResult";
             
     /**
      * The <code>main</code> is called when the class
@@ -137,27 +62,124 @@ public class ImplicitParameters extends
     
     /** */
     public void testResult() {
-        int index = 0;
-        executeQuery(index, new Object[] {parameter});
+        Object expected = getExpectedResultOfFirstQuery(
+                getTransientCompanyModelInstancesAsList(new String[] {"emp1", "emp2", "emp3", "emp4", "emp5"}));
+
+        Map<String, Object> paramValues = new HashMap<>();
+        paramValues.put("param", PARAMETER);
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      "this, :param",
+                /*INTO*/        null,
+                /*FROM*/        Person.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       null,
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  null,
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*JDOQLTyped*/  null,
+                /*paramValues*/ paramValues);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        //TBD executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
     }
     
     /** */
     public void testFilter() {
-        int index = 1;
-        executeQuery(index, new Object[] {"emp1First"});
+        Object expected = getTransientCompanyModelInstancesAsList(new String[]{"emp1"});
+
+        Map<String, Object> paramValues = new HashMap<>();
+        paramValues.put("param", "emp1First");
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      null,
+                /*INTO*/        null,
+                /*FROM*/        Person.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "firstname == :param",
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  null,
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    null,
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*JDOQLTyped*/  null,
+                /*paramValues*/ paramValues);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        //TBD executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
     }
     
     /** */
     public void testGrouping() {
-        int index = 2;
-        executeQuery(index, new Object[] {new Long(3)});
+        Object expected = /* Note: "Development" is not a bean name! */
+                Arrays.asList("Development");
+
+        Map<String, Object> paramValues = new HashMap<>();
+        paramValues.put("minValue", Long.valueOf(3));
+
+        // Import Department twice
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      "department.name",
+                /*INTO*/        null,
+                /*FROM*/        Employee.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       null,
+                /*VARIABLES*/   null,
+                /*PARAMETERS*/  null,
+                /*IMPORTS*/     null,
+                /*GROUP BY*/    "department.name HAVING COUNT(this) >= :minValue",
+                /*ORDER BY*/    null,
+                /*FROM*/        null,
+                /*TO*/          null,
+                /*JDOQLTyped*/  null,
+                /*paramValues*/ paramValues);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        //TBD executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
     }
     
     /** */
     public void testRange() {
-        int index = 3;
-        executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                new Object[] {new Long(0), new Long(5)}, expectedResult[index]);
+        Object expected = getTransientCompanyModelInstancesAsList(new String[] {
+                "emp1", "emp2", "emp3", "emp4", "emp5"});
+
+        Map<String, Object> paramValues = new HashMap<>();
+        paramValues.put("zero", Long.valueOf(0));
+        paramValues.put("five", Long.valueOf(5));
+
+        // Import Department twice
+        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*/    null,
+                /*FROM*/        ":zero",
+                /*TO*/          ":five",
+                /*JDOQLTyped*/  null,
+                /*paramValues*/ paramValues);
+
+        executeAPIQuery(ASSERTION_FAILED, holder, expected);
+        executeSingleStringQuery(ASSERTION_FAILED, holder, expected);
+        //TBD executeJDOQLTypedQuery(ASSERTION_FAILED, holder, expected);
     }
     
     /**
@@ -167,19 +189,11 @@ public class ImplicitParameters extends
         addTearDownClass(CompanyModelReader.getTearDownClasses());
         loadAndPersistCompanyModel(getPM());
     }
-
-    /** */
-    private void executeQuery(int index, Object[] parameters) {
-        executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                parameters, expectedResult[index]);
-        executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                parameters, expectedResult[index]);
-    }
     
     private List getExpectedResultOfFirstQuery(List instances) {
         Object[] expectedResult = new Object[instances.size()];
         for (int i = 0; i < expectedResult.length; i++) {
-            expectedResult[i] = new Object[] {instances.get(i), parameter};
+            expectedResult[i] = new Object[] {instances.get(i), PARAMETER};
         }
         return Arrays.asList(expectedResult);
     }

Modified: db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/parameters/OrderOfParameters.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/parameters/OrderOfParameters.java?rev=1845744&r1=1845743&r2=1845744&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/parameters/OrderOfParameters.java (original)
+++ db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/parameters/OrderOfParameters.java Sun Nov  4 18:37:24 2018
@@ -24,6 +24,10 @@ import org.apache.jdo.tck.query.QueryEle
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
 
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+import java.util.List;
+
 /**
  *<B>Title:</B> Order of Parameters.
  *<BR>
@@ -40,39 +44,6 @@ public class OrderOfParameters extends Q
     /** */
     private static final String ASSERTION_FAILED = 
         "Assertion A14.6.13-3 (OrderOfParameters) 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*/       "firstname == :param1 & lastname == :param2",
-        /*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 = {
-        getTransientCompanyModelInstancesAsList(new String[]{"emp1"})
-    };
-            
-    /** Parameters of valid queries. */
-    private Object[][] parameters = {
-        {"emp1First", "emp1Last"}
-    };
             
     /**
      * The <code>main</code> is called when the class
@@ -84,12 +55,52 @@ public class OrderOfParameters extends Q
     }
     
     /** */
-    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 testAPIQuery() {
+        // Do not use QueryElementHolder, because QueryElementHolder always uses a Map for parameter values
+        Transaction tx = pm.currentTransaction();
+        Query<Person> query = null;
+        Object result = null;
+        try {
+            tx.begin();
+            String singleStringQuery =
+                    "select from org.apache.jdo.tck.pc.company.Person where firstname == :param1 & lastname == :param2";
+            query = pm.newQuery(Person.class, "firstname == :param1 & lastname == :param2");
+            result = query.execute("emp1First", "emp1Last");
+            List<Person> expected = getTransientCompanyModelInstancesAsList(new String[]{"emp1"});
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, singleStringQuery, result, expected);
+            tx.commit();
+        } finally {
+            if (query != null) {
+                query.close(result);
+            }
+            if (tx.isActive()) {
+                tx.rollback();
+            }
+        }
+    }
+
+    /** */
+    public void testSingleStringAPIQuery() {
+        // Do not use QueryElementHolder, because QueryElementHolder always uses a Map for parameter values
+        Transaction tx = pm.currentTransaction();
+        Query<Person> query = null;
+        Object result = null;
+        try {
+            tx.begin();
+            String singleStringQuery =
+                    "select from org.apache.jdo.tck.pc.company.Person where firstname == :param1 & lastname == :param2";
+            query = pm.newQuery(singleStringQuery);
+            result = query.execute("emp1First", "emp1Last");
+            List<Person> expected = getTransientCompanyModelInstancesAsList(new String[]{"emp1"});
+            checkQueryResultWithoutOrder(ASSERTION_FAILED, singleStringQuery, result, expected);
+            tx.commit();
+        } finally {
+            if (query != null) {
+                query.close(result);
+            }
+            if (tx.isActive()) {
+                tx.rollback();
+            }
         }
     }
     

Modified: db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/variables/UnconstrainedVariable.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/variables/UnconstrainedVariable.java?rev=1845744&r1=1845743&r2=1845744&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/variables/UnconstrainedVariable.java (original)
+++ db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/jdoql/variables/UnconstrainedVariable.java Sun Nov  4 18:37:24 2018
@@ -20,10 +20,16 @@ package org.apache.jdo.tck.query.jdoql.v
 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;
+import javax.jdo.query.NumericExpression;
+import java.util.HashMap;
+import java.util.Map;
+
 /**
  *<B>Title:</B> Unconstrained Variables.
  *<BR>
@@ -41,40 +47,6 @@ public class UnconstrainedVariable exten
     /** */
     private static final String ASSERTION_FAILED = 
         "Assertion A14.6.5-1 (UnconstrainedVariable) 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*/        Employee.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "this.hireDate > e.hireDate & e.personid = id",
-        /*VARIABLES*/   "Employee e",
-        /*PARAMETERS*/  "int id",
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null)
-    };
-    
-    /** 
-     * The expected results of valid queries.
-     */
-    private Object[] expectedResult = {
-        getTransientCompanyModelInstancesAsList(new String[]{
-                "emp2", "emp3", "emp4"})
-    };
-            
-    /** Parameters of valid queries. */
-    private Object[][] parameters = {
-        {new Integer(1)},
-    };
             
     /**
      * The <code>main</code> is called when the class
@@ -88,12 +60,37 @@ public class UnconstrainedVariable exten
     /** */
     public void testPositive() {
         if (isUnconstrainedVariablesSupported()) {
-            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 = getTransientCompanyModelInstancesAsList(new String[]{"emp2", "emp3", "emp4"});
+
+            JDOQLTypedQuery<Employee> query = getPM().newJDOQLTypedQuery(Employee.class);
+            QEmployee cand = QEmployee.candidate();
+            QEmployee e = QEmployee.variable("e");
+            NumericExpression<?> param = query.numericParameter("id");
+            query.filter(cand.hiredate.gt(e.hiredate).and(e.hiredate.eq(param)));
+
+            Map<String, Object> paramValues = new HashMap<>();
+            paramValues.put("id", Integer.valueOf(1));
+
+            QueryElementHolder holder = new QueryElementHolder(
+                    /*UNIQUE*/      null,
+                    /*RESULT*/      null,
+                    /*INTO*/        null,
+                    /*FROM*/        Employee.class,
+                    /*EXCLUDE*/     null,
+                    /*WHERE*/       "this.hiredate > e.hiredate & e.personid = id",
+                    /*VARIABLES*/   "Employee e",
+                    /*PARAMETERS*/  "int id",
+                    /*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);
         }
     }
     



Mime
View raw message