db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r365610 - /db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/ResultExpressions.java
Date Tue, 03 Jan 2006 11:43:40 GMT
Author: mbo
Date: Tue Jan  3 03:43:37 2006
New Revision: 365610

URL: http://svn.apache.org/viewcvs?rev=365610&view=rev
Log:
Added negative tests accessing unknown fields in the select clause

Modified:
    db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/ResultExpressions.java

Modified: db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/ResultExpressions.java
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/ResultExpressions.java?rev=365610&r1=365609&r2=365610&view=diff
==============================================================================
--- db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/ResultExpressions.java (original)
+++ db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/ResultExpressions.java Tue
Jan  3 03:43:37 2006
@@ -322,6 +322,43 @@
     };
     
     /** 
+     * The array of invalid queries which may be executed as 
+     * single string queries and as API queries.
+     */
+    private static final QueryElementHolder[] INVALID_QUERIES = {
+        // unknown field x
+        new QueryElementHolder(
+        /*UNIQUE*/      null,
+        /*RESULT*/      "x",
+        /*INTO*/        null, 
+        /*FROM*/        Employee.class,
+        /*EXCLUDE*/     null,
+        /*WHERE*/       null,
+        /*VARIABLES*/   null,
+        /*PARAMETERS*/  null,
+        /*IMPORTS*/     null,
+        /*GROUP BY*/    null,
+        /*ORDER BY*/    null,
+        /*FROM*/        null,
+        /*TO*/          null),
+        // field salary is declared in a subclass of the candidate class
+        new QueryElementHolder(
+        /*UNIQUE*/      null,
+        /*RESULT*/      "salary",
+        /*INTO*/        null, 
+        /*FROM*/        Employee.class,
+        /*EXCLUDE*/     null,
+        /*WHERE*/       null,
+        /*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 = {
@@ -476,6 +513,15 @@
     public void testCast() {
         int index = 16;
         executeQuery(index, null);
+    }
+
+    /** */
+    public void testNegative() {
+        for (int i = 0; i < INVALID_QUERIES.length; i++) {
+            compileAPIQuery(ASSERTION_FAILED, INVALID_QUERIES[i], false);
+            compileSingleStringQuery(ASSERTION_FAILED, INVALID_QUERIES[i], 
+                    false);
+        }
     }
 
     /** */



Mime
View raw message