db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r1661445 - /db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/IfElseInFilter.java
Date Sat, 21 Feb 2015 22:10:48 GMT
Author: mbo
Date: Sat Feb 21 22:10:47 2015
New Revision: 1661445

URL: http://svn.apache.org/r1661445
Log:
JDO-650: added IfElse testcase using distinct conditions

Modified:
    db/jdo/trunk/tck/src/java/org/apache/jdo/tck/query/jdoql/IfElseInFilter.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=1661445&r1=1661444&r2=1661445&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 Sat Feb 21
22:10:47 2015
@@ -47,7 +47,7 @@ public class IfElseInFilter extends Quer
      * single string queries and as API queries.
      */
     private static final QueryElementHolder[] VALID_QUERIES = {
-        // 
+        // simple If/Else using literals
         new QueryElementHolder(
         /*UNIQUE*/      null,
         /*RESULT*/      null,
@@ -62,6 +62,7 @@ public class IfElseInFilter extends Quer
         /*ORDER BY*/    "this.personid",
         /*FROM*/        null,
         /*TO*/          null),
+        // simple If/Else using relationships
         new QueryElementHolder(
         /*UNIQUE*/      null,
         /*RESULT*/      null,
@@ -76,13 +77,29 @@ public class IfElseInFilter extends Quer
         /*ORDER BY*/    "this.personid",
         /*FROM*/        null,
         /*TO*/          null),
+        // multiple If/Else with distinct conditions
         new QueryElementHolder(
         /*UNIQUE*/      null,
         /*RESULT*/      null,
         /*INTO*/        null, 
         /*FROM*/        FullTimeEmployee.class,
         /*EXCLUDE*/     null,
-        /*WHERE*/       "(IF (this.salary < 10001.0) 1 ELSE IF (this.salary < 20001.0)
2 ELSE IF (this.salary < 30001.0) 3 ELSE 4) == 2",
+        /*WHERE*/       "(IF (0.0 <= this.salary && this.salary < 10000.1)
1 ELSE IF (10000.1 <= this.salary && this.salary < 20000.1) 2 ELSE IF (20000.1
<= this.salary && this.salary < 30000.1) 3 ELSE 4) == 2",
+        /*VARIABLES*/   null,
+        /*PARAMETERS*/  null,
+        /*IMPORTS*/     null,
+        /*GROUP BY*/    null,
+        /*ORDER BY*/    "this.personid",
+        /*FROM*/        null,
+        /*TO*/          null),
+        // multiple If/Else with overlapping conditions
+        new QueryElementHolder(
+        /*UNIQUE*/      null,
+        /*RESULT*/      null,
+        /*INTO*/        null, 
+        /*FROM*/        FullTimeEmployee.class,
+        /*EXCLUDE*/     null,
+        /*WHERE*/       "(IF (this.salary < 10000.1) 1 ELSE IF (this.salary < 20000.1)
2 ELSE IF (this.salary < 30000.1) 3 ELSE 4) == 2",
         /*VARIABLES*/   null,
         /*PARAMETERS*/  null,
         /*IMPORTS*/     null,
@@ -150,6 +167,7 @@ public class IfElseInFilter extends Quer
     private Object[] expectedResult = {
         getTransientCompanyModelInstancesAsList(new String[]{"emp1", "emp5"}),
         getTransientCompanyModelInstancesAsList(new String[]{"emp1", "emp2", "emp3"}),
+        getTransientCompanyModelInstancesAsList(new String[]{"emp1"}),
         getTransientCompanyModelInstancesAsList(new String[]{"emp1"})
     };
     



Mime
View raw message