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 [9/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/result/VariableInResultMultipleNavigation.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/result/VariableInResultMultipleNavigation.java?rev=1845744&r1=1845743&r2=1845744&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/result/VariableInResultMultipleNavigation.java
(original)
+++ db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/result/VariableInResultMultipleNavigation.java
Sun Nov  4 18:37:24 2018
@@ -22,10 +22,16 @@ import java.util.Arrays;
 import org.apache.jdo.tck.pc.company.CompanyModelReader;
 import org.apache.jdo.tck.pc.company.Company;
 import org.apache.jdo.tck.pc.company.Department;
+import org.apache.jdo.tck.pc.company.QCompany;
+import org.apache.jdo.tck.pc.company.QDepartment;
+import org.apache.jdo.tck.pc.company.QEmployee;
+import org.apache.jdo.tck.pc.company.QProject;
 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> Variable in Result.
  *<BR>
@@ -58,56 +64,7 @@ public class VariableInResultMultipleNav
     /** */
     private static final String ASSERTION_FAILED = 
         "Assertion A14.6.9-3 (VariableInResult) 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, d, e, p",
-        /*INTO*/        null, 
-        /*FROM*/        Company.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "name == \"Sun Microsystems, Inc.\" && departments.contains(d)
&& d.employees.contains(e) && e.projects.contains(p)",
-        /*VARIABLES*/   "Department d; Employee e; Project p",
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      "this, e, p",
-        /*INTO*/        null, 
-        /*FROM*/        Company.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "name == \"Sun Microsystems, Inc.\" && departments.contains(d)
&& d.employees.contains(e) && e.projects.contains(p)",
-        /*VARIABLES*/   "Department d; Employee e; Project p",
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      "d, e, p",
-        /*INTO*/        null, 
-        /*FROM*/        Company.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "name == \"Sun Microsystems, Inc.\" && departments.contains(d)
&& d.employees.contains(e) && e.projects.contains(p)",
-        /*VARIABLES*/   "Department d; Employee e; Project p",
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null)
-    };
-    
+
     /** 
      * The expected results of valid queries.
      */
@@ -123,33 +80,6 @@ public class VariableInResultMultipleNav
     private Object dept1 = getTransientCompanyModelInstance("dept1");
     private Object dept2 = getTransientCompanyModelInstance("dept2");
 
-    private Object[] expectedResult = {
-        Arrays.asList(new Object[] {
-            new Object[] {company1, dept1, emp1, proj1},
-            new Object[] {company1, dept1, emp2, proj1},
-            new Object[] {company1, dept1, emp3, proj1},
-            new Object[] {company1, dept1, emp2, proj2},
-            new Object[] {company1, dept1, emp3, proj2},
-            new Object[] {company1, dept2, emp4, proj3},
-            new Object[] {company1, dept2, emp5, proj3}}),
-        Arrays.asList(new Object[] {
-            new Object[] {company1, emp1, proj1},
-            new Object[] {company1, emp2, proj1},
-            new Object[] {company1, emp3, proj1},
-            new Object[] {company1, emp2, proj2},
-            new Object[] {company1, emp3, proj2},
-            new Object[] {company1, emp4, proj3},
-            new Object[] {company1, emp5, proj3}}),
-        Arrays.asList(new Object[] {
-            new Object[] {dept1, emp1, proj1},
-            new Object[] {dept1, emp2, proj1},
-            new Object[] {dept1, emp3, proj1},
-            new Object[] {dept1, emp2, proj2},
-            new Object[] {dept1, emp3, proj2},
-            new Object[] {dept2, emp4, proj3},
-            new Object[] {dept2, emp5, proj3}})
-    };
-
     /**
      * The <code>main</code> is called when the class
      * is directly executed from the command line.
@@ -161,29 +91,131 @@ public class VariableInResultMultipleNav
     
     /** */
     public void testNavigationWithCompanyAndDepartmentAndEmployeeAndProject() {
-        int index = 0;
-        executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                expectedResult[index]);
-        executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                expectedResult[index]);
+        Object expected = Arrays.asList(
+                new Object[] {company1, dept1, emp1, proj1},
+                new Object[] {company1, dept1, emp2, proj1},
+                new Object[] {company1, dept1, emp3, proj1},
+                new Object[] {company1, dept1, emp2, proj2},
+                new Object[] {company1, dept1, emp3, proj2},
+                new Object[] {company1, dept2, emp4, proj3},
+                new Object[] {company1, dept2, emp5, proj3});
+
+        JDOQLTypedQuery<Company> query = getPM().newJDOQLTypedQuery(Company.class);
+        QCompany cand = QCompany.candidate();
+        QDepartment d = QDepartment.variable("d");
+        QEmployee e = QEmployee.variable("e");
+        QProject p = QProject.variable("p");
+        query.filter(cand.name.eq("Sun Microsystems, Inc.").and(
+                cand.departments.contains(d)).and(d.employees.contains(e)).and(e.projects.contains(p)));
+        query.result(false, cand, d, e, p);
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      "this, d, e, p",
+                /*INTO*/        null,
+                /*FROM*/        Company.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "name == \"Sun Microsystems, Inc.\" && " +
+                "departments.contains(d) && d.employees.contains(e) && e.projects.contains(p)",
+                /*VARIABLES*/   "Department d; Employee e; Project p",
+                /*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, Object[].class, expected);
     }
 
     /** */
     public void testNavigationWithCompanyAndEmployeeAndProject() {
-        int index = 1;
-        executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                expectedResult[index]);
-        executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                expectedResult[index]);
+        Object expected = Arrays.asList(
+                new Object[] {company1, emp1, proj1},
+                new Object[] {company1, emp2, proj1},
+                new Object[] {company1, emp3, proj1},
+                new Object[] {company1, emp2, proj2},
+                new Object[] {company1, emp3, proj2},
+                new Object[] {company1, emp4, proj3},
+                new Object[] {company1, emp5, proj3});
+
+        JDOQLTypedQuery<Company> query = getPM().newJDOQLTypedQuery(Company.class);
+        QCompany cand = QCompany.candidate();
+        QDepartment d = QDepartment.variable("d");
+        QEmployee e = QEmployee.variable("e");
+        QProject p = QProject.variable("p");
+        query.filter(cand.name.eq("Sun Microsystems, Inc.").and(
+                cand.departments.contains(d)).and(d.employees.contains(e)).and(e.projects.contains(p)));
+        query.result(false, cand, e, p);
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      "this, e, p",
+                /*INTO*/        null,
+                /*FROM*/        Company.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "name == \"Sun Microsystems, Inc.\" && " +
+                "departments.contains(d) && d.employees.contains(e) && e.projects.contains(p)",
+                /*VARIABLES*/   "Department d; Employee e; Project p",
+                /*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, Object[].class, expected);
     }
 
     /** */
     public void testNavigationWithDepartmentAndEmployeeAndProject() {
-        int index = 2;
-        executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                expectedResult[index]);
-        executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                expectedResult[index]);
+        Object expected = Arrays.asList(
+                new Object[] {dept1, emp1, proj1},
+                new Object[] {dept1, emp2, proj1},
+                new Object[] {dept1, emp3, proj1},
+                new Object[] {dept1, emp2, proj2},
+                new Object[] {dept1, emp3, proj2},
+                new Object[] {dept2, emp4, proj3},
+                new Object[] {dept2, emp5, proj3});
+
+        JDOQLTypedQuery<Company> query = getPM().newJDOQLTypedQuery(Company.class);
+        QCompany cand = QCompany.candidate();
+        QDepartment d = QDepartment.variable("d");
+        QEmployee e = QEmployee.variable("e");
+        QProject p = QProject.variable("p");
+        query.filter(cand.name.eq("Sun Microsystems, Inc.").and(
+                cand.departments.contains(d)).and(d.employees.contains(e)).and(e.projects.contains(p)));
+        query.result(false, d, e, p);
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      "d, e, p",
+                /*INTO*/        null,
+                /*FROM*/        Company.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "name == \"Sun Microsystems, Inc.\" && " +
+                "departments.contains(d) && d.employees.contains(e) && e.projects.contains(p)",
+                /*VARIABLES*/   "Department d; Employee e; Project p",
+                /*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, Object[].class, expected);
     }
 
     /**

Modified: db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/result/VariableInResultNavigation.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/result/VariableInResultNavigation.java?rev=1845744&r1=1845743&r2=1845744&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/result/VariableInResultNavigation.java
(original)
+++ db/jdo/trunk/tck/src/main/java/org/apache/jdo/tck/query/result/VariableInResultNavigation.java
Sun Nov  4 18:37:24 2018
@@ -22,10 +22,15 @@ import java.util.Arrays;
 import org.apache.jdo.tck.pc.company.CompanyModelReader;
 import org.apache.jdo.tck.pc.company.Company;
 import org.apache.jdo.tck.pc.company.Department;
+import org.apache.jdo.tck.pc.company.QDepartment;
+import org.apache.jdo.tck.pc.company.QEmployee;
+import org.apache.jdo.tck.pc.company.QProject;
 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> Variable in Result.
  *<BR>
@@ -58,84 +63,7 @@ public class VariableInResultNavigation
     /** */
     private static final String ASSERTION_FAILED = 
         "Assertion A14.6.9-3 (VariableInResult) 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*/      "e, p",
-        /*INTO*/        null, 
-        /*FROM*/        Department.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "employees.contains(e) && e.projects.contains(p) &&
p.name == 'orange'",
-        /*VARIABLES*/   "Employee e; Project p",
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      "e, p",
-        /*INTO*/        null, 
-        /*FROM*/        Department.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "employees.contains(e) && e.projects.contains(p)",
-        /*VARIABLES*/   "Employee e; Project p",
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      "this, e, p",
-        /*INTO*/        null, 
-        /*FROM*/        Department.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "employees.contains(e) && e.projects.contains(p)",
-        /*VARIABLES*/   "Employee e; Project p",
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      "e, p",
-        /*INTO*/        null, 
-        /*FROM*/        Department.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "deptid == 1 && employees.contains(e) && e.projects.contains(p)",
-        /*VARIABLES*/   "Employee e; Project p",
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null),
-        new QueryElementHolder(
-        /*UNIQUE*/      null,
-        /*RESULT*/      "e, p",
-        /*INTO*/        null, 
-        /*FROM*/        Department.class,
-        /*EXCLUDE*/     null,
-        /*WHERE*/       "company.name == \"Sun Microsystems, Inc.\" && employees.contains(e)
&& e.projects.contains(p)",
-        /*VARIABLES*/   "Employee e; Project p",
-        /*PARAMETERS*/  null,
-        /*IMPORTS*/     null,
-        /*GROUP BY*/    null,
-        /*ORDER BY*/    null,
-        /*FROM*/        null,
-        /*TO*/          null)
-    };
-    
+
     /** 
      * The expected results of valid queries.
      */
@@ -150,43 +78,6 @@ public class VariableInResultNavigation
     private Object dept1 = getTransientCompanyModelInstance("dept1");
     private Object dept2 = getTransientCompanyModelInstance("dept2");
 
-    private Object[] expectedResult = {
-        Arrays.asList(new Object[] {
-            new Object[] {emp1, proj1},
-            new Object[] {emp2, proj1},
-            new Object[] {emp3, proj1}}),
-        Arrays.asList(new Object[] {
-            new Object[] {emp1, proj1},
-            new Object[] {emp2, proj1},
-            new Object[] {emp3, proj1},
-            new Object[] {emp2, proj2},
-            new Object[] {emp3, proj2},
-            new Object[] {emp4, proj3},
-            new Object[] {emp5, proj3}}),
-        Arrays.asList(new Object[] {
-            new Object[] {dept1, emp1, proj1},
-            new Object[] {dept1, emp2, proj1},
-            new Object[] {dept1, emp3, proj1},
-            new Object[] {dept1, emp2, proj2},
-            new Object[] {dept1, emp3, proj2},
-            new Object[] {dept2, emp4, proj3},
-            new Object[] {dept2, emp5, proj3}}),
-        Arrays.asList(new Object[] {
-            new Object[] {emp1, proj1},
-            new Object[] {emp2, proj1},
-            new Object[] {emp3, proj1},
-            new Object[] {emp2, proj2},
-            new Object[] {emp3, proj2}}),
-        Arrays.asList(new Object[] {
-            new Object[] {emp1, proj1},
-            new Object[] {emp2, proj1},
-            new Object[] {emp3, proj1},
-            new Object[] {emp2, proj2},
-            new Object[] {emp3, proj2},
-            new Object[] {emp4, proj3},
-            new Object[] {emp5, proj3}})
-    };
-
     /**
      * The <code>main</code> is called when the class
      * is directly executed from the command line.
@@ -198,47 +89,196 @@ public class VariableInResultNavigation
     
     /** */
     public void testNavigationWithConstraint() {
-        int index = 0;
-        executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                expectedResult[index]);
-        executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                expectedResult[index]);
+        Object expected = Arrays.asList(
+                new Object[] {emp1, proj1},
+                new Object[] {emp2, proj1},
+                new Object[] {emp3, proj1});
+
+        JDOQLTypedQuery<Department> query = getPM().newJDOQLTypedQuery(Department.class);
+        QDepartment cand = QDepartment.candidate();
+        QEmployee e = QEmployee.variable("e");
+        QProject p = QProject.variable("p");
+        query.filter(cand.employees.contains(e).and(e.projects.contains(p)).and(p.name.eq("orange")));
+        query.result(false, e, p);
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      "e, p",
+                /*INTO*/        null,
+                /*FROM*/        Department.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "employees.contains(e) && e.projects.contains(p)
&& p.name == 'orange'",
+                /*VARIABLES*/   "Employee e; Project p",
+                /*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, Object[].class, expected);
     }
 
     /** */
     public void testNavigationWithoutConstraint() {
-        int index = 1;
-        executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                expectedResult[index]);
-        executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                expectedResult[index]);
+        Object expected = Arrays.asList(
+                new Object[] {emp1, proj1},
+                new Object[] {emp2, proj1},
+                new Object[] {emp3, proj1},
+                new Object[] {emp2, proj2},
+                new Object[] {emp3, proj2},
+                new Object[] {emp4, proj3},
+                new Object[] {emp5, proj3});
+
+        JDOQLTypedQuery<Department> query = getPM().newJDOQLTypedQuery(Department.class);
+        QDepartment cand = QDepartment.candidate();
+        QEmployee e = QEmployee.variable("e");
+        QProject p = QProject.variable("p");
+        query.filter(cand.employees.contains(e).and(e.projects.contains(p)));
+        query.result(false, e, p);
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      "e, p",
+                /*INTO*/        null,
+                /*FROM*/        Department.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "employees.contains(e) && e.projects.contains(p)",
+                /*VARIABLES*/   "Employee e; Project p",
+                /*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, Object[].class, expected);
     }
 
     /** */
     public void testNavigationWithThis() {
-        int index = 2;
-        executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                expectedResult[index]);
-        executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                expectedResult[index]);
+        Object expected = Arrays.asList(
+                new Object[] {dept1, emp1, proj1},
+                new Object[] {dept1, emp2, proj1},
+                new Object[] {dept1, emp3, proj1},
+                new Object[] {dept1, emp2, proj2},
+                new Object[] {dept1, emp3, proj2},
+                new Object[] {dept2, emp4, proj3},
+                new Object[] {dept2, emp5, proj3});
+
+        JDOQLTypedQuery<Department> query = getPM().newJDOQLTypedQuery(Department.class);
+        QDepartment cand = QDepartment.candidate();
+        QEmployee e = QEmployee.variable("e");
+        QProject p = QProject.variable("p");
+        query.filter(cand.employees.contains(e).and(e.projects.contains(p)));
+        query.result(false, cand, e, p);
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      "this, e, p",
+                /*INTO*/        null,
+                /*FROM*/        Department.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "employees.contains(e) && e.projects.contains(p)",
+                /*VARIABLES*/   "Employee e; Project p",
+                /*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, Object[].class, expected);
     }
 
     /** */
     public void testNavigationWithThisConstraint() {
-        int index = 3;
-        executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                expectedResult[index]);
-        executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                expectedResult[index]);
+        Object expected = Arrays.asList(
+                new Object[] {emp1, proj1},
+                new Object[] {emp2, proj1},
+                new Object[] {emp3, proj1},
+                new Object[] {emp2, proj2},
+                new Object[] {emp3, proj2});
+
+        JDOQLTypedQuery<Department> query = getPM().newJDOQLTypedQuery(Department.class);
+        QDepartment cand = QDepartment.candidate();
+        QEmployee e = QEmployee.variable("e");
+        QProject p = QProject.variable("p");
+        query.filter(cand.deptid.eq(1l).and(cand.employees.contains(e)).and(e.projects.contains(p)));
+        query.result(false, e, p);
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      "e, p",
+                /*INTO*/        null,
+                /*FROM*/        Department.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "deptid == 1 && employees.contains(e) &&
e.projects.contains(p)",
+                /*VARIABLES*/   "Employee e; Project p",
+                /*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, Object[].class, expected);
     }
 
     /** */
     public void testNavigationWithCompanyConstraint() {
-        int index = 4;
-        executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                expectedResult[index]);
-        executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
-                expectedResult[index]);
+        Object expected = Arrays.asList(
+                new Object[] {emp1, proj1},
+                new Object[] {emp2, proj1},
+                new Object[] {emp3, proj1},
+                new Object[] {emp2, proj2},
+                new Object[] {emp3, proj2},
+                new Object[] {emp4, proj3},
+                new Object[] {emp5, proj3});
+
+        JDOQLTypedQuery<Department> query = getPM().newJDOQLTypedQuery(Department.class);
+        QDepartment cand = QDepartment.candidate();
+        QEmployee e = QEmployee.variable("e");
+        QProject p = QProject.variable("p");
+        query.filter(cand.company.name.eq("Sun Microsystems, Inc.").and(cand.employees.contains(e)).and(e.projects.contains(p)));
+        query.result(false, e, p);
+
+        QueryElementHolder holder = new QueryElementHolder(
+                /*UNIQUE*/      null,
+                /*RESULT*/      "e, p",
+                /*INTO*/        null,
+                /*FROM*/        Department.class,
+                /*EXCLUDE*/     null,
+                /*WHERE*/       "company.name == \"Sun Microsystems, Inc.\" && employees.contains(e)
&& e.projects.contains(p)",
+                /*VARIABLES*/   "Employee e; Project p",
+                /*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, Object[].class, expected);
     }
     /**
      * @see QueryTest#localSetUp()

Modified: db/jdo/trunk/tck/src/main/resources/conf/jdo-signatures.txt
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/main/resources/conf/jdo-signatures.txt?rev=1845744&r1=1845743&r2=1845744&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/main/resources/conf/jdo-signatures.txt (original)
+++ db/jdo/trunk/tck/src/main/resources/conf/jdo-signatures.txt Sun Nov  4 18:37:24 2018
@@ -1727,6 +1727,12 @@ public interface javax.jdo.JDOQLTypedQue
     javax.jdo.JDOQLTypedQuery excludeSubclasses();
     javax.jdo.JDOQLTypedQuery includeSubclasses();
     javax.jdo.JDOQLTypedQuery filter(javax.jdo.query.BooleanExpression expr);
+    javax.jdo.query.IfThenElseExpression ifThen(java.lang.Class, javax.jdo.query.BooleanExpression,
javax.jdo.query.Expression);
+    javax.jdo.query.IfThenElseExpression ifThen(javax.jdo.query.BooleanExpression, java.lang.Object);
+    javax.jdo.query.IfThenElseExpression ifThenElse(javax.jdo.query.BooleanExpression, java.lang.Object,
java.lang.Object);
+    javax.jdo.query.IfThenElseExpression ifThenElse(javax.jdo.query.BooleanExpression, javax.jdo.query.Expression,
java.lang.Object);
+    javax.jdo.query.IfThenElseExpression ifThenElse(javax.jdo.query.BooleanExpression, java.lang.Object,
javax.jdo.query.Expression);
+    javax.jdo.query.IfThenElseExpression ifThenElse(java.lang.Class, javax.jdo.query.BooleanExpression,
javax.jdo.query.Expression, javax.jdo.query.Expression);
     varargs javax.jdo.JDOQLTypedQuery groupBy(javax.jdo.query.Expression[] exprs);
     javax.jdo.JDOQLTypedQuery having(javax.jdo.query.Expression expr);
     varargs javax.jdo.JDOQLTypedQuery orderBy(javax.jdo.query.OrderExpression[] orderExprs);
@@ -1817,8 +1823,8 @@ public interface javax.jdo.query.Compara
     javax.jdo.query.BooleanExpression gt(Object t);
     javax.jdo.query.BooleanExpression gteq(javax.jdo.query.ComparableExpression expr);
     javax.jdo.query.BooleanExpression gteq(Object t);
-    javax.jdo.query.NumericExpression min();
-    javax.jdo.query.NumericExpression max();
+    javax.jdo.query.ComparableExpression min();
+    javax.jdo.query.ComparableExpression max();
     javax.jdo.query.OrderExpression asc();
     javax.jdo.query.OrderExpression desc();
 }
@@ -1859,6 +1865,8 @@ public interface javax.jdo.query.ListExp
 }
 public interface javax.jdo.query.MapExpression extends javax.jdo.query.Expression
 {
+    javax.jdo.query.Expression get(javax.jdo.query.Expression);
+    javax.jdo.query.Expression get(java.lang.Object);
     javax.jdo.query.BooleanExpression containsKey(javax.jdo.query.Expression expr);
     javax.jdo.query.BooleanExpression containsKey(Object key);
     javax.jdo.query.BooleanExpression containsValue(javax.jdo.query.Expression expr);
@@ -1883,7 +1891,9 @@ public interface javax.jdo.query.Numeric
     javax.jdo.query.NumericExpression neg();
     javax.jdo.query.NumericExpression com();
     javax.jdo.query.NumericExpression avg();
+    javax.jdo.query.NumericExpression avgDistinct();
     javax.jdo.query.NumericExpression sum();
+    javax.jdo.query.NumericExpression sumDistinct();
     javax.jdo.query.NumericExpression abs();
     javax.jdo.query.NumericExpression sqrt();
     javax.jdo.query.NumericExpression acos();
@@ -1908,6 +1918,9 @@ public interface javax.jdo.query.OrderEx
 {
     enum javax.jdo.query.OrderExpression$OrderDirection getDirection();
     javax.jdo.query.Expression getExpression();
+    enum javax.jdo.query.OrderExpression$OrderNullsPosition getNullsPosition();
+    javax.jdo.query.OrderExpression nullsFirst();
+    javax.jdo.query.OrderExpression nullsLast();
 }
 
 public interface javax.jdo.query.PersistableExpression extends javax.jdo.query.Expression
@@ -1937,6 +1950,8 @@ public interface javax.jdo.query.StringE
     javax.jdo.query.BooleanExpression matches(String str);
     javax.jdo.query.BooleanExpression startsWith(javax.jdo.query.StringExpression expr);
     javax.jdo.query.BooleanExpression startsWith(String str);
+    javax.jdo.query.BooleanExpression startsWith(javax.jdo.query.StringExpression, int);
+    javax.jdo.query.BooleanExpression startsWith(java.lang.String, int);
     javax.jdo.query.StringExpression substring(javax.jdo.query.NumericExpression pos);
     javax.jdo.query.StringExpression substring(int pos);
     javax.jdo.query.StringExpression substring(javax.jdo.query.NumericExpression startPos,
javax.jdo.query.NumericExpression endPos);



Mime
View raw message