db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r366237 - in /db/jdo/trunk/tck20/test: conf/alltests.conf java/org/apache/jdo/tck/query/jdoql/Having.java java/org/apache/jdo/tck/query/result/Having.java
Date Thu, 05 Jan 2006 18:20:48 GMT
Author: mbo
Date: Thu Jan  5 10:20:39 2006
New Revision: 366237

URL: http://svn.apache.org/viewcvs?rev=366237&view=rev
Log:
JDO-245: Changed query test class Having:
- Added a new positive test 
  SELECT department, AVG(weeklyhours) FROM Employee GROUP BY department HAVING COUNT(personid)
> 1
- Added a new negative test  
  SELECT department, AVG(weeklyhours) FROM Employee GROUP BY department HAVING firstname ==
'emp1First'
- Moved class Having from package query.result to query.jdoql

Added:
    db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/Having.java
      - copied, changed from r366180, db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/Having.java
Removed:
    db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/Having.java
Modified:
    db/jdo/trunk/tck20/test/conf/alltests.conf

Modified: db/jdo/trunk/tck20/test/conf/alltests.conf
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/test/conf/alltests.conf?rev=366237&r1=366236&r2=366237&view=diff
==============================================================================
--- db/jdo/trunk/tck20/test/conf/alltests.conf (original)
+++ db/jdo/trunk/tck20/test/conf/alltests.conf Thu Jan  5 10:20:39 2006
@@ -312,6 +312,7 @@
 org.apache.jdo.tck.query.jdoql.ExecuteQueryWhenPersistenceManagerIsClosed \
 org.apache.jdo.tck.query.jdoql.ExecutingMultipleQueriesSimultaneouslyIsThreadSafe \
 org.apache.jdo.tck.query.jdoql.ExecutingQueryWhenNoTransactionNoNontransactionalRead \
+org.apache.jdo.tck.query.jdoql.Having \
 org.apache.jdo.tck.query.jdoql.IdentifiersEqualFieldNames \
 org.apache.jdo.tck.query.jdoql.IgnoreCacheFalse \
 org.apache.jdo.tck.query.jdoql.MultipleActiveQueryInstanceInSamePersistenceManager \
@@ -389,7 +390,6 @@
 org.apache.jdo.tck.query.result.DistinctCandidateInstances \
 org.apache.jdo.tck.query.result.DistinctQuery \
 org.apache.jdo.tck.query.result.Grouping \
-org.apache.jdo.tck.query.result.Having \
 org.apache.jdo.tck.query.result.ImmutableQueryResult \
 org.apache.jdo.tck.query.result.NPEInResultExpr \
 org.apache.jdo.tck.query.result.NullResults \

Copied: db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/Having.java (from r366180,
db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/Having.java)
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/Having.java?p2=db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/Having.java&p1=db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/Having.java&r1=366180&r2=366237&rev=366237&view=diff
==============================================================================
--- db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/Having.java (original)
+++ db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/jdoql/Having.java Thu Jan  5 10:20:39
2006
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package org.apache.jdo.tck.query.result;
+package org.apache.jdo.tck.query.jdoql;
 
 import java.util.Arrays;
 
@@ -60,6 +60,21 @@
         /*GROUP BY*/    "department HAVING COUNT(department) > 0",
         /*ORDER BY*/    null,
         /*FROM*/        null,
+        /*TO*/          null),
+        // HAVING clause uses field that isn't contained in the SELECT clause.
+        new QueryElementHolder(
+        /*UNIQUE*/      null,
+        /*RESULT*/      "department, AVG(weeklyhours)",
+        /*INTO*/        null, 
+        /*FROM*/        Employee.class,
+        /*EXCLUDE*/     null,
+        /*WHERE*/       null,
+        /*VARIABLES*/   null,
+        /*PARAMETERS*/  null,
+        /*IMPORTS*/     null,
+        /*GROUP BY*/    "department HAVING COUNT(personid) > 1",
+        /*ORDER BY*/    null,
+        /*FROM*/        null,
         /*TO*/          null)
     };
     
@@ -68,6 +83,7 @@
      * single string queries and as API queries.
      */
     private static final QueryElementHolder[] INVALID_QUERIES = {
+        // HAVING clause is not a boolean expression
         new QueryElementHolder(
         /*UNIQUE*/      null,
         /*RESULT*/      "department, AVG(weeklyhours)",
@@ -81,6 +97,21 @@
         /*GROUP BY*/    "department HAVING firstname",
         /*ORDER BY*/    null,
         /*FROM*/        null,
+        /*TO*/          null),
+        // HAVING clause is a non-aggregate expression using a non-grouping field
+        new QueryElementHolder(
+        /*UNIQUE*/      null,
+        /*RESULT*/      "department, AVG(weeklyhours)",
+        /*INTO*/        null, 
+        /*FROM*/        Employee.class,
+        /*EXCLUDE*/     null,
+        /*WHERE*/       null,
+        /*VARIABLES*/   null,
+        /*PARAMETERS*/  null,
+        /*IMPORTS*/     null,
+        /*GROUP BY*/    "department HAVING firstname == 'emp1First'",
+        /*ORDER BY*/    null,
+        /*FROM*/        null,
         /*TO*/          null)
     };
     
@@ -88,6 +119,13 @@
      * The expected results of valid queries.
      */
     private Object[] expectedResult = {
+        Arrays.asList(new Object[] {
+            new Object[] {
+                    getTransientCompanyModelInstance("dept1"),
+                    new Double(33.0)},
+            new Object[] {
+                    getTransientCompanyModelInstance("dept2"),
+                    new Double(0.0)}}),
         Arrays.asList(new Object[] {
             new Object[] {
                     getTransientCompanyModelInstance("dept1"),



Mime
View raw message