db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r453265 - in /db/jdo: branches/2.0.1/tck20/src/java/org/apache/jdo/tck/query/api/GetFetchPlan.java trunk/tck20/src/java/org/apache/jdo/tck/query/api/GetFetchPlan.java
Date Thu, 05 Oct 2006 15:19:13 GMT
Author: mbo
Date: Thu Oct  5 08:19:13 2006
New Revision: 453265

URL: http://svn.apache.org/viewvc?view=rev&rev=453265
Log:
JDO-404: changed test GetFetchPlan to not check whether fields are loaded because a certain
fetch group is active

Modified:
    db/jdo/branches/2.0.1/tck20/src/java/org/apache/jdo/tck/query/api/GetFetchPlan.java
    db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/query/api/GetFetchPlan.java

Modified: db/jdo/branches/2.0.1/tck20/src/java/org/apache/jdo/tck/query/api/GetFetchPlan.java
URL: http://svn.apache.org/viewvc/db/jdo/branches/2.0.1/tck20/src/java/org/apache/jdo/tck/query/api/GetFetchPlan.java?view=diff&rev=453265&r1=453264&r2=453265
==============================================================================
--- db/jdo/branches/2.0.1/tck20/src/java/org/apache/jdo/tck/query/api/GetFetchPlan.java (original)
+++ db/jdo/branches/2.0.1/tck20/src/java/org/apache/jdo/tck/query/api/GetFetchPlan.java Thu
Oct  5 08:19:13 2006
@@ -20,10 +20,7 @@
 
 import javax.jdo.FetchPlan;
 import javax.jdo.Query;
-import javax.jdo.Transaction;
 
-import org.apache.jdo.tck.JDO_Test;
-import org.apache.jdo.tck.pc.mylib.MylibReader;
 import org.apache.jdo.tck.pc.mylib.PCClass;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
@@ -60,11 +57,7 @@
 
     /** */
     private Query createQuery() {
-        // initialize the PM with datastore transactions and no retain values
-        getPM().currentTransaction().setOptimistic(false);
-        getPM().currentTransaction().setRetainValues(false);
-        Query query = getPM().newQuery(PCClass.class, "number1 == param");
-        query.declareParameters("int param");
+        Query query = getPM().newQuery(PCClass.class, "true");
         query.getFetchPlan().setGroup(FETCH_GROUP_1);
         return query;
     }
@@ -105,30 +98,6 @@
         assertTrue("FetchPlan should include fetchGroup1 and not fetchGroup2",
                 fetchgroups.contains(FETCH_GROUP_1) && 
                 !fetchgroups.contains(FETCH_GROUP_2));
-        Transaction transaction = query.getPersistenceManager().
-            currentTransaction();
-        transaction.begin();
-        Collection result = (Collection) query.execute(new Integer(10));
-        if (result.size() != 1) {
-            fail(ASSERTION_FAILED + "Query returned " + result.size() + 
-                    " instances, expected size is " + 1);
-        }
-        PCClass pcClass = (PCClass) result.iterator().next();
-        int transient1 = pcClass.getTransientNumber1();
-        int transient2 = pcClass.getTransientNumber2();
-        boolean field1loaded = transient1 == 10;
-        boolean field2loaded = transient2 == 10;
-        transaction.commit();
-
-        if (!field1loaded || field2loaded) {
-            fail(ASSERTION_FAILED +
-                    "\nUnexpected: TransientNumber1 = " + transient1 +
-                    ", and TransientNumber2 = " + transient2 + ".\n" +
-                    "Field number1 loaded = " + field1loaded + 
-                    ", Field number2 loaded = " + field2loaded + ".\n" +
-                    "With fetchGroup1 active, expect field number1 " +
-                    " loaded and field number2 not loaded.");
-        }
     }
     
     /**
@@ -144,45 +113,12 @@
         FetchPlan fetchplan = query.getFetchPlan();
         fetchplan.addGroup(FETCH_GROUP_2);
         Collection fetchgroups = fetchplan.getGroups();
-        assertTrue("FetchPlan should include fetchGroup1 and fetchGroup2",
-                fetchgroups.contains(FETCH_GROUP_1) && 
-                fetchgroups.contains(FETCH_GROUP_2));
         try {
-            Transaction transaction = query.getPersistenceManager().
-                currentTransaction();
-            transaction.begin();
-            Collection result = (Collection) query.execute(new Integer(20));
-            if (result.size() != 1) {
-                fail(ASSERTION_FAILED + "Query returned " + result.size() + 
-                        " instances, expected size is " + 1);
-            }
-            PCClass pcClass = (PCClass) result.iterator().next();
-            int transient1 = pcClass.getTransientNumber1();
-            int transient2 = pcClass.getTransientNumber2();
-            boolean field1loaded = transient1 == 20;
-            boolean field2loaded = transient2 == 20;
-            transaction.commit();
-
-            if (!field1loaded || !field2loaded) {
-                fail(ASSERTION_FAILED +
-                        "\nUnexpected: TransientNumber1 = " + transient1 +
-                        ", and TransientNumber2 = " + transient2 + ".\n" +
-                        "Field number1 loaded = " + field1loaded + 
-                        ", Field number2 loaded = " + field2loaded + ".\n" +
-                        "With fetchGroup1 and fetchGroup2 active, expect" +
-                        " field number1 loaded and field number2 loaded.");
-            }
+            assertTrue("FetchPlan should include fetchGroup1 and fetchGroup2",
+                       fetchgroups.contains(FETCH_GROUP_1) && 
+                       fetchgroups.contains(FETCH_GROUP_2));
         } finally {
             query.getFetchPlan().removeGroup(FETCH_GROUP_2);
         }
-    }
-    
-    /**
-     * @see JDO_Test#localSetUp()
-     */
-    protected void localSetUp() {
-        addTearDownClass(MylibReader.getTearDownClasses());
-        loadAndPersistMylib(getPM());
-        cleanupPM();
     }
 }

Modified: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/query/api/GetFetchPlan.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/query/api/GetFetchPlan.java?view=diff&rev=453265&r1=453264&r2=453265
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/query/api/GetFetchPlan.java (original)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/query/api/GetFetchPlan.java Thu Oct  5
08:19:13 2006
@@ -20,10 +20,7 @@
 
 import javax.jdo.FetchPlan;
 import javax.jdo.Query;
-import javax.jdo.Transaction;
 
-import org.apache.jdo.tck.JDO_Test;
-import org.apache.jdo.tck.pc.mylib.MylibReader;
 import org.apache.jdo.tck.pc.mylib.PCClass;
 import org.apache.jdo.tck.query.QueryTest;
 import org.apache.jdo.tck.util.BatchTestRunner;
@@ -60,11 +57,7 @@
 
     /** */
     private Query createQuery() {
-        // initialize the PM with datastore transactions and no retain values
-        getPM().currentTransaction().setOptimistic(false);
-        getPM().currentTransaction().setRetainValues(false);
-        Query query = getPM().newQuery(PCClass.class, "number1 == param");
-        query.declareParameters("int param");
+        Query query = getPM().newQuery(PCClass.class, "true");
         query.getFetchPlan().setGroup(FETCH_GROUP_1);
         return query;
     }
@@ -105,30 +98,6 @@
         assertTrue("FetchPlan should include fetchGroup1 and not fetchGroup2",
                 fetchgroups.contains(FETCH_GROUP_1) && 
                 !fetchgroups.contains(FETCH_GROUP_2));
-        Transaction transaction = query.getPersistenceManager().
-            currentTransaction();
-        transaction.begin();
-        Collection result = (Collection) query.execute(new Integer(10));
-        if (result.size() != 1) {
-            fail(ASSERTION_FAILED + "Query returned " + result.size() + 
-                    " instances, expected size is " + 1);
-        }
-        PCClass pcClass = (PCClass) result.iterator().next();
-        int transient1 = pcClass.getTransientNumber1();
-        int transient2 = pcClass.getTransientNumber2();
-        boolean field1loaded = transient1 == 10;
-        boolean field2loaded = transient2 == 10;
-        transaction.commit();
-
-        if (!field1loaded || field2loaded) {
-            fail(ASSERTION_FAILED +
-                    "\nUnexpected: TransientNumber1 = " + transient1 +
-                    ", and TransientNumber2 = " + transient2 + ".\n" +
-                    "Field number1 loaded = " + field1loaded + 
-                    ", Field number2 loaded = " + field2loaded + ".\n" +
-                    "With fetchGroup1 active, expect field number1 " +
-                    " loaded and field number2 not loaded.");
-        }
     }
     
     /**
@@ -144,45 +113,12 @@
         FetchPlan fetchplan = query.getFetchPlan();
         fetchplan.addGroup(FETCH_GROUP_2);
         Collection fetchgroups = fetchplan.getGroups();
-        assertTrue("FetchPlan should include fetchGroup1 and fetchGroup2",
-                fetchgroups.contains(FETCH_GROUP_1) && 
-                fetchgroups.contains(FETCH_GROUP_2));
         try {
-            Transaction transaction = query.getPersistenceManager().
-                currentTransaction();
-            transaction.begin();
-            Collection result = (Collection) query.execute(new Integer(20));
-            if (result.size() != 1) {
-                fail(ASSERTION_FAILED + "Query returned " + result.size() + 
-                        " instances, expected size is " + 1);
-            }
-            PCClass pcClass = (PCClass) result.iterator().next();
-            int transient1 = pcClass.getTransientNumber1();
-            int transient2 = pcClass.getTransientNumber2();
-            boolean field1loaded = transient1 == 20;
-            boolean field2loaded = transient2 == 20;
-            transaction.commit();
-
-            if (!field1loaded || !field2loaded) {
-                fail(ASSERTION_FAILED +
-                        "\nUnexpected: TransientNumber1 = " + transient1 +
-                        ", and TransientNumber2 = " + transient2 + ".\n" +
-                        "Field number1 loaded = " + field1loaded + 
-                        ", Field number2 loaded = " + field2loaded + ".\n" +
-                        "With fetchGroup1 and fetchGroup2 active, expect" +
-                        " field number1 loaded and field number2 loaded.");
-            }
+            assertTrue("FetchPlan should include fetchGroup1 and fetchGroup2",
+                       fetchgroups.contains(FETCH_GROUP_1) && 
+                       fetchgroups.contains(FETCH_GROUP_2));
         } finally {
             query.getFetchPlan().removeGroup(FETCH_GROUP_2);
         }
-    }
-    
-    /**
-     * @see JDO_Test#localSetUp()
-     */
-    protected void localSetUp() {
-        addTearDownClass(MylibReader.getTearDownClasses());
-        loadAndPersistMylib(getPM());
-        cleanupPM();
     }
 }



Mime
View raw message