db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c..@apache.org
Subject svn commit: r377253 - /db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/query/result/VariableInResult.java
Date Sun, 12 Feb 2006 22:07:54 GMT
Author: clr
Date: Sun Feb 12 14:07:52 2006
New Revision: 377253

URL: http://svn.apache.org/viewcvs?rev=377253&view=rev
Log:
JDO-246 update tests with variables to include distinct and non-distinct queries

Modified:
    db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/query/result/VariableInResult.java

Modified: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/query/result/VariableInResult.java
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/query/result/VariableInResult.java?rev=377253&r1=377252&r2=377253&view=diff
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/query/result/VariableInResult.java (original)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/query/result/VariableInResult.java Sun
Feb 12 14:07:52 2006
@@ -52,6 +52,20 @@
     private static final QueryElementHolder[] VALID_QUERIES = {
         new QueryElementHolder(
         /*UNIQUE*/      null,
+        /*RESULT*/      "distinct p",
+        /*INTO*/        null, 
+        /*FROM*/        Employee.class,
+        /*EXCLUDE*/     null,
+        /*WHERE*/       "projects.contains(p) & p.name == 'orange'",
+        /*VARIABLES*/   "Project p",
+        /*PARAMETERS*/  null,
+        /*IMPORTS*/     null,
+        /*GROUP BY*/    null,
+        /*ORDER BY*/    null,
+        /*FROM*/        null,
+        /*TO*/          null),
+        new QueryElementHolder(
+        /*UNIQUE*/      null,
         /*RESULT*/      "p",
         /*INTO*/        null, 
         /*FROM*/        Employee.class,
@@ -66,6 +80,20 @@
         /*TO*/          null),
         new QueryElementHolder(
         /*UNIQUE*/      null,
+        /*RESULT*/      "distinct p.projid, p.name",
+        /*INTO*/        null, 
+        /*FROM*/        Employee.class,
+        /*EXCLUDE*/     null,
+        /*WHERE*/       "projects.contains(p) & p.name == 'orange'",
+        /*VARIABLES*/   "Project p",
+        /*PARAMETERS*/  null,
+        /*IMPORTS*/     null,
+        /*GROUP BY*/    null,
+        /*ORDER BY*/    null,
+        /*FROM*/        null,
+        /*TO*/          null),
+        new QueryElementHolder(
+        /*UNIQUE*/      null,
         /*RESULT*/      "p.projid, p.name",
         /*INTO*/        null, 
         /*FROM*/        Employee.class,
@@ -86,8 +114,13 @@
     private Object[] expectedResult = {
         // this
         getTransientCompanyModelInstancesAsList(new String[]{"proj1"}),
+        getTransientCompanyModelInstancesAsList(new String[]{"proj1","proj1","proj1"}),
         // Note: "orange" is not a bean name!
-        Arrays.asList(new Object[]{new Object[]{new Long(1), "orange"}})
+        Arrays.asList(new Object[]{new Object[]{new Long(1), "orange"}}),
+        Arrays.asList(new Object[]{
+            new Object[]{new Long(1), "orange"}, 
+            new Object[]{new Long(1), "orange"},
+            new Object[]{new Long(1), "orange"}})
     };
 
     /**
@@ -100,7 +133,7 @@
     }
     
     /** */
-    public void testNoNavigation() {
+    public void testDistinctNoNavigation() {
         int index = 0;
         executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
                 expectedResult[index]);
@@ -109,8 +142,26 @@
     }
 
     /** */
-    public void testNavigation() {
+    public void testNoNavigation() {
         int index = 1;
+        executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
+                expectedResult[index]);
+        executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
+                expectedResult[index]);
+    }
+
+    /** */
+    public void testDistinctNavigation() {
+        int index = 2;
+        executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
+                expectedResult[index]);
+        executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
+                expectedResult[index]);
+    }
+
+    /** */
+    public void testNavigation() {
+        int index = 3;
         executeAPIQuery(ASSERTION_FAILED, VALID_QUERIES[index], 
                 expectedResult[index]);
         executeSingleStringQuery(ASSERTION_FAILED, VALID_QUERIES[index], 



Mime
View raw message