You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by mb...@apache.org on 2015/01/02 23:48:43 UTC
svn commit: r1649150 - in
/db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query:
jdoql/IfElseInFilter.java result/IfElseResult.java
Author: mbo
Date: Fri Jan 2 22:48:43 2015
New Revision: 1649150
URL: http://svn.apache.org/r1649150
Log:
JDO-650: new positive IF/Else test in filter and new negative tests
Modified:
db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/IfElseInFilter.java
db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/result/IfElseResult.java
Modified: db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/IfElseInFilter.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/IfElseInFilter.java?rev=1649150&r1=1649149&r2=1649150&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/IfElseInFilter.java (original)
+++ db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/IfElseInFilter.java Fri Jan 2 22:48:43 2015
@@ -19,6 +19,7 @@ package org.apache.jdo.tck.query.jdoql;
import org.apache.jdo.tck.JDO_Test;
import org.apache.jdo.tck.pc.company.CompanyModelReader;
+import org.apache.jdo.tck.pc.company.Employee;
import org.apache.jdo.tck.pc.company.FullTimeEmployee;
import org.apache.jdo.tck.query.QueryElementHolder;
import org.apache.jdo.tck.query.QueryTest;
@@ -64,9 +65,9 @@ public class IfElseInFilter extends Quer
/*UNIQUE*/ null,
/*RESULT*/ null,
/*INTO*/ null,
- /*FROM*/ FullTimeEmployee.class,
+ /*FROM*/ Employee.class,
/*EXCLUDE*/ null,
- /*WHERE*/ "IF (this.department.name == 'Development') this.salary > 15000 ELSE this.salary > 25000",
+ /*WHERE*/ "(IF (this.manager == null) this.mentor.department ELSE this.manager.department) == this.department",
/*VARIABLES*/ null,
/*PARAMETERS*/ null,
/*IMPORTS*/ null,
@@ -96,14 +97,29 @@ public class IfElseInFilter extends Quer
/*ORDER BY*/ null,
/*FROM*/ null,
/*TO*/ null),
- //
+ // missing ELSE
new QueryElementHolder(
/*UNIQUE*/ null,
/*RESULT*/ null,
/*INTO*/ null,
/*FROM*/ FullTimeEmployee.class,
/*EXCLUDE*/ null,
- /*WHERE*/ "IF (this.department.name == 'Development') this.salary > 15000",
+ /*WHERE*/ "IF (this.department.name == 'Development') 15000",
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null),
+ // type of THEN expr must be the same as type of ELSE expr
+ new QueryElementHolder(
+ /*UNIQUE*/ null,
+ /*RESULT*/ null,
+ /*INTO*/ null,
+ /*FROM*/ Employee.class,
+ /*EXCLUDE*/ null,
+ /*WHERE*/ "IF (this.department == null) 'Michael' ELSE this.department",
/*VARIABLES*/ null,
/*PARAMETERS*/ null,
/*IMPORTS*/ null,
@@ -117,7 +133,8 @@ public class IfElseInFilter extends Quer
* The expected results of valid queries.
*/
private Object[] expectedResult = {
- getTransientCompanyModelInstancesAsList(new String[]{"emp1", "emp5"})
+ getTransientCompanyModelInstancesAsList(new String[]{"emp1", "emp5"}),
+ getTransientCompanyModelInstancesAsList(new String[]{"emp1", "emp2", "emp3", "emp4", "emp5"})
};
/**
@@ -126,7 +143,7 @@ public class IfElseInFilter extends Quer
* @param args The arguments passed to the program.
*/
public static void main(String[] args) {
- BatchTestRunner.run(DenoteUniquenessInFilter.class);
+ BatchTestRunner.run(IfElseInFilter.class);
}
/** */
Modified: db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/result/IfElseResult.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/result/IfElseResult.java?rev=1649150&r1=1649149&r2=1649150&view=diff
==============================================================================
--- db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/result/IfElseResult.java (original)
+++ db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/result/IfElseResult.java Fri Jan 2 22:48:43 2015
@@ -113,13 +113,28 @@ public class IfElseResult extends QueryT
/*ORDER BY*/ null,
/*FROM*/ null,
/*TO*/ null),
- //
+ // missing ELSE
new QueryElementHolder(
/*UNIQUE*/ null,
/*RESULT*/ "IF (this.employee == null) 0",
/*INTO*/ null,
/*FROM*/ DentalInsurance.class,
/*EXCLUDE*/ null,
+ /*WHERE*/ null,
+ /*VARIABLES*/ null,
+ /*PARAMETERS*/ null,
+ /*IMPORTS*/ null,
+ /*GROUP BY*/ null,
+ /*ORDER BY*/ null,
+ /*FROM*/ null,
+ /*TO*/ null),
+ // type of THEN expr must be the same as type of ELSE expr
+ new QueryElementHolder(
+ /*UNIQUE*/ null,
+ /*RESULT*/ "IF (this.employee == null) 'Michael' ELSE this.employee",
+ /*INTO*/ null,
+ /*FROM*/ DentalInsurance.class,
+ /*EXCLUDE*/ null,
/*WHERE*/ null,
/*VARIABLES*/ null,
/*PARAMETERS*/ null,