db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r358033 - /db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/DistinctCandidateInstances.java
Date Tue, 20 Dec 2005 16:37:06 GMT
Author: mbo
Date: Tue Dec 20 08:37:01 2005
New Revision: 358033

URL: http://svn.apache.org/viewcvs?rev=358033&view=rev
Log:
JDO-241: Change the test using a memory collection as query candidates to 
include persistent instances in the memory collection. 
Fix the result expression of the distinct query.

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

Modified: db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/DistinctCandidateInstances.java
URL: http://svn.apache.org/viewcvs/db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/DistinctCandidateInstances.java?rev=358033&r1=358032&r2=358033&view=diff
==============================================================================
--- db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/DistinctCandidateInstances.java
(original)
+++ db/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/result/DistinctCandidateInstances.java
Tue Dec 20 08:37:01 2005
@@ -16,10 +16,11 @@
 
 package org.apache.jdo.tck.query.result;
 
-import java.util.Collection;
+import java.util.ArrayList;
 import java.util.List;
 
 import javax.jdo.Query;
+import javax.jdo.Transaction;
 
 import org.apache.jdo.tck.JDO_Test;
 import org.apache.jdo.tck.pc.company.CompanyModelReader;
@@ -88,12 +89,8 @@
      * The expected results of valid queries.
      */
     private Object[] expectedResult = {
-        addAll(getTransientCompanyModelInstancesAsList(new String[]{
-                "emp1", "emp2", "emp3", "emp4", "emp5"}),
-        getTransientCompanyModelInstancesAsList(new String[]{
-                "emp1", "emp2", "emp3", "emp4", "emp5"})),
-        getTransientCompanyModelInstancesAsList(new String[]{
-                "emp1", "emp2", "emp3", "emp4", "emp5"})
+        getTransientCompanyModelInstancesAsList(new String[]{"emp1", "emp1"}),
+        getTransientCompanyModelInstancesAsList(new String[]{"emp1"})
     };
             
     /**
@@ -123,13 +120,16 @@
         String singleStringDistinctQuery = 
             "SELECT DISTINCT FROM " + Person.class.getName();
         
-        Query query = getPM().newQuery();
+        List candidates = getPersistentCompanyModelInstancesAsList(
+            new String[]{"emp1", "emp1"});
+        Query query = pm.newQuery();
         query.setClass(Person.class);
-        query.setCandidates((Collection)expectedResult[0]);
+        query.setCandidates(candidates);
+        query.setResult("this");
         executeJDOQuery(ASSERTION_FAILED, query, singleStringQuery, 
                 false, null, expectedResult[0], true);
         
-        query.setResult("DISTINCT");
+        query.setResult("DISTINCT this");
         executeJDOQuery(ASSERTION_FAILED, query, singleStringDistinctQuery, 
                 false, null, expectedResult[1], true);
     }
@@ -142,8 +142,4 @@
         loadAndPersistCompanyModel(getPM());
     }
     
-    private List addAll(List list1, List list2) {
-        list1.addAll(list2);
-        return list1;
-    }
 }



Mime
View raw message