db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r158179 [6/61] - in incubator/jdo/trunk/tck11: ./ assertions/ iut_jars/ test/ test/conf/ test/java/ test/java/org/ test/java/org/apache/ test/java/org/apache/jdo/ test/java/org/apache/jdo/tck/ test/java/org/apache/jdo/tck/api/ test/java/org/apache/jdo/tck/api/instancecallbacks/ test/java/org/apache/jdo/tck/api/jdohelper/ test/java/org/apache/jdo/tck/api/persistencemanager/ test/java/org/apache/jdo/tck/api/persistencemanagerfactory/ test/java/org/apache/jdo/tck/enhancement/ test/java/org/apache/jdo/tck/extents/ test/java/org/apache/jdo/tck/lifecycle/ test/java/org/apache/jdo/tck/lifecycle/nontransactional/ test/java/org/apache/jdo/tck/models/ test/java/org/apache/jdo/tck/models/embedded/ test/java/org/apache/jdo/tck/models/fieldtypes/ test/java/org/apache/jdo/tck/models/inheritance/ test/java/org/apache/jdo/tck/pc/ test/java/org/apache/jdo/tck/pc/company/ test/java/org/apache/jdo/tck/pc/fieldtypes/ test/java/org/apache/jdo/tck/pc/inheritance/ test/java/org/apache/jdo/tck/pc/instancecallbacks/ test/java/org/apache/jdo/tck/pc/lifecycle/ test/java/org/apache/jdo/tck/pc/mylib/ test/java/org/apache/jdo/tck/query/ test/java/org/apache/jdo/tck/query/operators/ test/java/org/apache/jdo/tck/transactions/ test/java/org/apache/jdo/tck/util/ test/jdo/ test/jdo/applicationidentity/ test/jdo/applicationidentity/org/ test/jdo/applicationidentity/org/apache/ test/jdo/applicationidentity/org/apache/jdo/ test/jdo/applicationidentity/org/apache/jdo/tck/ test/jdo/applicationidentity/org/apache/jdo/tck/pc/ test/jdo/applicationidentity/org/apache/jdo/tck/pc/company/ test/jdo/applicationidentity/org/apache/jdo/tck/pc/fieldtypes/ test/jdo/applicationidentity/org/apache/jdo/tck/pc/inheritance/ test/jdo/applicationidentity/org/apache/jdo/tck/pc/instancecallbacks/ test/jdo/applicationidentity/org/apache/jdo/tck/pc/lifecycle/ test/jdo/applicationidentity/org/apache/jdo/tck/pc/mylib/ test/jdo/datastoreidentity/ test/jdo/datastoreidentity/org/ test/jdo/datastoreidentity/org/apache/ test/jdo/datastoreidentity/org/apache/jdo/ test/jdo/datastoreidentity/org/apache/jdo/tck/ test/jdo/datastoreidentity/org/apache/jdo/tck/pc/ test/jdo/datastoreidentity/org/apache/jdo/tck/pc/company/ test/jdo/datastoreidentity/org/apache/jdo/tck/pc/fieldtypes/ test/jdo/datastoreidentity/org/apache/jdo/tck/pc/inheritance/ test/jdo/datastoreidentity/org/apache/jdo/tck/pc/instancecallbacks/ test/jdo/datastoreidentity/org/apache/jdo/tck/pc/lifecycle/ test/jdo/datastoreidentity/org/apache/jdo/tck/pc/mylib/
Date Sat, 19 Mar 2005 01:09:44 GMT
Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/DeletePersistentHasNoEffectOnDeletedInstances.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/DeletePersistentHasNoEffectOnDeletedInstances.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/DeletePersistentHasNoEffectOnDeletedInstances.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/DeletePersistentHasNoEffectOnDeletedInstances.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,161 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import java.util.Collection;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> DeletePersistent Has No Effect On Deleted Instances
+ *<BR>
+ *<B>Keywords:</B>
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.7-10.
+ *<BR>
+ *<B>Assertion Description: </B>
+ PersistenceManager.deletePersistent and deletePersistentAll have no effect on parameter instances already deleted in the transaction.
+
+ */
+
+public class DeletePersistentHasNoEffectOnDeletedInstances extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.7-10 (DeletePersistentHasNoEffectOnDeletedInstances) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(DeletePersistentHasNoEffectOnDeletedInstances.class);
+    }
+    
+    private PCPoint p1 = null;
+    private PCPoint p2 = null;
+    private PCPoint p3 = null;
+    private PCPoint p4 = null;
+    private PCPoint p5 = null;
+
+    /** */
+    public void testDeletePersistentHasNoEffectOnDeletedInstances() {
+        pm = getPM();
+        createObjects(pm);
+        runTestDeletePersistent(pm);
+        runTestDeletePersistentAll1(pm);
+        runTestDeletePersistentAll2(pm);
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    private void createObjects(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            p1 = new PCPoint(1,3);
+            p2 = new PCPoint(2,4);
+            p3 = new PCPoint(3,5);
+            p4 = new PCPoint(4,6);
+            p5 = new PCPoint(5,7);
+            
+            pm.makePersistent(p1);
+            pm.makePersistent(p2);
+            pm.makePersistent(p3);
+            pm.makePersistent(p4);
+            pm.makePersistent(p5);
+            
+            tx.commit();
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /* test makePersistent (Object pc) */
+    private void runTestDeletePersistent(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            pm.deletePersistent(p1);
+            pm.deletePersistent(p1);
+            pm.deletePersistent(p1);
+            pm.deletePersistent(p1);
+            tx.commit();
+            if (debug) logger.debug(" \nPASSED in testDeletePersistent()");
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /* test makePersistentAll (Collection pcs) */
+    private void runTestDeletePersistentAll1(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx = pm.currentTransaction();
+
+            Collection col1 = new java.util.HashSet();
+            col1.add(p2);
+            col1.add(p3);
+
+            tx.begin();
+            pm.deletePersistentAll(col1);
+            pm.deletePersistentAll(col1);
+            pm.deletePersistentAll(col1);
+            pm.deletePersistentAll(col1);
+            tx.commit();
+            if (debug) logger.debug(" \nPASSED in testDeletePersistentAll1()");
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /* test makePersistentAll (Object[] o) */
+    private void runTestDeletePersistentAll2(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            Collection col1 = new java.util.HashSet();
+            col1.add(p4);
+            col1.add(p5);
+
+            Object[] obj1= col1.toArray();
+
+            tx.begin();
+            pm.deletePersistentAll(obj1);
+            pm.deletePersistentAll(obj1);
+            pm.deletePersistentAll(obj1);
+            pm.deletePersistentAll(obj1);
+            tx.commit();
+            if (debug) logger.debug(" \nPASSED in testDeletePersistentAll2()");
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/EvictAllWithNoParameters.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/EvictAllWithNoParameters.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/EvictAllWithNoParameters.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/EvictAllWithNoParameters.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint2;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> EvictAllWithNoParameters
+ *<BR>
+ *<B>Keywords:</B> cache
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.1-2
+ *<BR>
+ *<B>Assertion Description: </B>
+ If PersistenceManager.evict is called with no parameter, then all referenced instances are evicted. For each instance evicted, it:
+ *<UL>
+ *<LI> calls the jdoPreClearmethod on each instance, if the class of the instance implements InstanceCallbacks </LI>
+ *<LI> clears persistent fields on each instance after the call to jdoPreClear()</LI>
+ *<LI> changes the state of instances to hollow or persistent-nontransactional (cannot distinguish between these two states) this is not directly testable. </LI>
+ *</UL>
+
+ */
+
+public class EvictAllWithNoParameters extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.1-2 (EvictAllWithNoParameters) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(EvictAllWithNoParameters.class);
+    }
+    
+    private PCPoint2 pnt1 = null;
+    private PCPoint2 p1 = null;
+
+    /** */
+    public void testEvictAllWithNoParameters() {
+        pm = getPM();
+        createObjects(pm);
+        runTestEvictAll(pm);
+        pm.close();
+        pm = null;
+    }
+    
+    /** */
+    private void createObjects(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            pnt1 = new PCPoint2(1,3);
+            p1   = new PCPoint2 (3,5);
+            pm.makePersistent(pnt1);
+            pm.makePersistent(p1);
+            tx.commit();
+
+            // P-nontransactional instance
+            // Check whether pmf supported optimitic tx
+            tx.setOptimistic(isOptimisticSupported());
+            tx.begin();
+            pnt1.getX();
+            tx.commit();
+            
+            // P-clean instance 
+            tx.setOptimistic(false);
+            tx.begin();
+            p1.getX();
+            tx.commit();
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void runTestEvictAll(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            pm.evictAll();
+
+            if ( !p1.wasClearCalled()) {
+                fail(ASSERTION_FAILED,
+                     "missing call of p1.jdoPreClear during pm.evictAll");
+            }
+            if ( !pnt1.wasClearCalled()) {
+                fail(ASSERTION_FAILED,
+                     "missing call of pnt1.jdoPreClear during pm.evictAll");
+            }
+
+            if ( testState(p1, HOLLOW, "hollow") ||
+                 testState(p1, PERSISTENT_NONTRANSACTIONAL, "persistent_nontransaction")) {
+                ;  // expected result
+            } 
+            else {
+                fail(ASSERTION_FAILED,
+                     "p1 should be HOLLOW or P-NONTX after pm.evictAll.");
+            }
+
+            if ( testState(pnt1, HOLLOW, "hollow") ||
+                 testState(pnt1, PERSISTENT_NONTRANSACTIONAL, "persistent_nontransaction")) {
+                ;  // expected result
+            } 
+            else {
+                fail(ASSERTION_FAILED,
+                     "pnt1 should be HOLLOW or P-NONTX after pm.evictAll.");
+            }
+            tx.commit();
+            if (debug) logger.debug(" \nPASSED in testEvictAll()");
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/EvictingCollectionOfInstancesSideEffects.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/EvictingCollectionOfInstancesSideEffects.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/EvictingCollectionOfInstancesSideEffects.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/EvictingCollectionOfInstancesSideEffects.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,201 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import java.util.Collection;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint2;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> EvictingCollectionOfInstancesSideEffects
+ *<BR>
+ *<B>Keywords:</B> cache
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.1-4
+ *<BR>
+ *<B>Assertion Description: </B>
+ If PersistenceManager.evict is called with no parameter, then all referenced instances are evicted. For each instance evicted, it:
+ *<UL>
+ *<LI> calls the jdoPreClearmethod on each instance, if the class of the instance implements InstanceCallbacks </LI>
+ *<LI> clears persistent fields on each instance after the call to jdoPreClear()</LI>
+ *<LI> changes the state of instances to hollow or persistent-nontransactional (cannot distinguish between these two states) this is not directly testable. </LI>
+ *</UL>
+
+ */
+
+public class EvictingCollectionOfInstancesSideEffects extends PersistenceManagerTest {
+       
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.1-4 (EvictingCollectionOfInstancesSideEffects) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(EvictingCollectionOfInstancesSideEffects.class);
+    }
+    
+    private PCPoint2 pnt1 = null;
+    private PCPoint2 pnt2 = null;
+    private PCPoint2 p1 = null;
+    private PCPoint2 p2 = null;
+
+    /** */
+    public void testEvictingCollectionOfInstancesSideEffects() {
+        pm = getPM();
+        createObjects(pm);
+        runTestEvictAllCollection(pm);
+        runTestEvictAllArray(pm);
+        pm.close();
+        pm = null;
+    }
+    
+    /** */
+    private void createObjects(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            pnt1 = new PCPoint2(1,2);
+            pnt2 = new PCPoint2(2,3);
+            p1   = new PCPoint2 (3,1);
+            p2   = new PCPoint2 (4,2);
+            pm.makePersistent(pnt1);
+            pm.makePersistent(pnt2);
+            pm.makePersistent(p1);
+            pm.makePersistent(p2);
+            tx.commit();
+
+            // P-nontransactional instance
+            // Check whether pmf supported optimitic tx
+            tx.setOptimistic(isOptimisticSupported());
+            tx.begin();
+            pnt1.getX();
+            pnt2.getX();
+            tx.commit();
+
+            /* P-clean instance */
+            tx.setOptimistic(false);
+            tx.begin();
+            p1.getX();
+            p2.getX();
+            tx.commit();
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void runTestEvictAllCollection(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Collection col1 = new java.util.HashSet();
+            col1.add(pnt1);
+            col1.add(p1);
+
+            pm.evictAll(col1);
+
+            if ( !p1.wasClearCalled()) {
+                fail(ASSERTION_FAILED,
+                     "missing call of p1.jdoPreClear during pm.evictAll(Collection)");
+            }
+            if ( !pnt1.wasClearCalled()) {
+                fail(ASSERTION_FAILED,
+                     "missing call of pnt1.jdoPreClear during pm.evictAll(Collection)");
+            }
+
+            if ( testState(p1, HOLLOW, "hollow")  ||
+                 testState(p1, PERSISTENT_NONTRANSACTIONAL, "persistent_nontransactional"))  {
+                ; // expected result
+            } 
+            else { 
+                fail(ASSERTION_FAILED,
+                     "p1 should be HOLLOW or P-NONTX after pm.evictAll(Collection).");
+            }
+
+            if ( testState(pnt1, HOLLOW, "hollow")  ||
+                 testState(pnt1, PERSISTENT_NONTRANSACTIONAL, "persistent_nontransactional"))  {
+                ; // expected result
+            } else {
+                fail(ASSERTION_FAILED,
+                     "pnt1 should be HOLLOW or P-NONTX after pm.evictAll(Collection).");
+            }
+
+            tx.commit();
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+    
+    /** */
+    private void runTestEvictAllArray(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Collection col1 = new java.util.HashSet();
+            col1.add(pnt2);
+            col1.add(p2);
+
+            pm.evictAll(col1.toArray());
+
+            if ( !p2.wasClearCalled()) {
+                fail(ASSERTION_FAILED,
+                     "missing call of p2.jdoPreClear during pm.evictAll(Object[])");
+            }
+            if ( !pnt2.wasClearCalled()) {
+                fail(ASSERTION_FAILED,
+                     "missing call of pnt2.jdoPreClear during pm.evictAll(Object[])");
+            }
+
+            if ( testState(p2, HOLLOW, "hollow")  ||
+                 testState(p2, PERSISTENT_NONTRANSACTIONAL, "persistent_nontransactional"))  {
+                ; // expected result
+            } else {
+                fail(ASSERTION_FAILED,
+                     "p2 should be HOLLOW or P-NONTX after pm.evictAll(Object[]).");
+            }
+
+            if ( testState(pnt2, HOLLOW, "hollow")  ||
+                 testState(pnt2, PERSISTENT_NONTRANSACTIONAL, "persistent_nontransactional"))  {
+                ; // expected result
+            } else {
+                fail(ASSERTION_FAILED,
+                     "pnt2 should be HOLLOW or P-NONTX after pm.evictAll(Object[]).");
+            }
+
+            tx.commit();
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/EvictingWithRestoreValuesFalse.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/EvictingWithRestoreValuesFalse.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/EvictingWithRestoreValuesFalse.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/EvictingWithRestoreValuesFalse.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.mylib.PCPoint2;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Evicting With RestoreValues False
+ *<BR>
+ *<B>Keywords:</B> cache
+ *<BR>
+ *<B>Assertion ID:</B> A12.6.1-1.
+ *<BR>
+ *<B>Assertion Description: </B>
+If users wish to automatically <code>evict</code> transactional instances at transaction
+<code>rollback</code> time, then they should set <code>RestoreValues</code> to <code>false</code>.
+For each persistent-clean instance that the
+JDO <code>PersistenceManager</code> evicts, it:
+<UL>
+<LI>calls the <code>jdoPreClear</code> method on each instance,
+if the class of the instance implements <code>InstanceCallbacks</code></LI>
+<LI>clears persistent fields on each instance (sets the value of the field to its Java default value)</LI>
+<LI>changes the state of instances to hollow</LI>
+</UL>
+
+ */
+
+public class EvictingWithRestoreValuesFalse extends JDO_Test {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.6.1-1 (EvictingWithRestoreValuesFalse) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(EvictingWithRestoreValuesFalse.class);
+    }	
+
+    /** */
+    public void test() {
+        pm = getPM();
+		PCPoint2 pt = getHollowInstance();
+
+		Transaction tx = pm.currentTransaction();
+		tx.setRestoreValues(false); //This should cause eviction of transactional instances when transaction is later rolled back.
+					
+		//Test
+		tx.begin();
+		makePersistentClean(pt);
+		tx.rollback(); // This should evict pt
+		verify(pt);
+    }
+
+	/** */
+    private PCPoint2 getHollowInstance() {
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+        PCPoint2 pt = new PCPoint2(1,2);
+        pm.makePersistent(pt);
+        tx.commit();
+
+		int curr = currentState(pt);
+	    if (curr != HOLLOW){
+			fail(ASSERTION_FAILED,
+			     "Unable to create HOLLOW instance, state is " + states[curr]);
+	    }
+		return pt;
+    }
+
+    /** */
+    private void makePersistentClean(PCPoint2 pt) {
+		pm.makeTransactional(pt);
+        int curr = currentState(pt);
+        if (curr != PERSISTENT_CLEAN){
+        	fail(ASSERTION_FAILED,
+        	     "Unable to create PERSISTENT_CLEAN instance, state is " + states[curr]);
+        }
+    }
+
+	/** */
+    private void verify(PCPoint2 pt) {
+		// When PersistenceManager evicts instances, it: calls the jdoPreClear method on each instance
+        if ( !pt.wasClearCalled()) {
+            fail(ASSERTION_FAILED,
+                 "missing call of jdoPreClear");
+        }
+
+		// When PersistenceManager evicts instances, it: changes the state of the instances to hollow
+		int curr = currentState(pt);
+        if ( (curr != HOLLOW) && (curr != PERSISTENT_NONTRANSACTIONAL) ) {
+            fail(ASSERTION_FAILED,
+                 "Instance should be HOLLOW after tx.rollback(), state is " + states[curr]);
+        }
+		
+        pm.makeTransient(pt);
+        // When PersistenceManager evicts instances, it: clears persistent fields on each instance (sets the value of the field to its Java default value)
+        int x=pt.getX();
+        Integer y=pt.getY();
+        if ((x != 0) || (y != null)) {
+        	fail(ASSERTION_FAILED,
+        	     "persistent fields not cleared, pt.getX()=="+x+" and pt.getY()=="+y);
+        }
+    }	
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/EvictingWithRetainValuesFalse.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/EvictingWithRetainValuesFalse.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/EvictingWithRetainValuesFalse.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/EvictingWithRetainValuesFalse.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,135 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.mylib.PCPoint2;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Evicting With RetainValues False
+ *<BR>
+ *<B>Keywords:</B> cache
+ *<BR>
+ *<B>Assertion ID:</B> A12.5.1-3.
+ *<BR>
+ *<B>Assertion Description: </B>
+If users wish to automatically <code>evict</code> transactional instances at transaction
+<code>commit</code> time, then they should set <code>RetainValues</code> to <code>false</code>.
+For each persistent-clean instance that the
+JDO <code>PersistenceManager</code> evicts, it:
+<UL>
+<LI>calls the <code>jdoPreClear</code> method on each instance,
+if the class of the instance implements <code>InstanceCallbacks</code></LI>
+<LI>clears persistent fields on each instance (sets the value of the field to its Java default value)</LI>
+<LI>changes the state of instances to hollow</LI>
+</UL>
+
+ */
+
+public class EvictingWithRetainValuesFalse extends JDO_Test {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.1-3 (EvictingWithRetainValuesFalse) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(EvictingWithRetainValuesFalse.class);
+    }	
+
+    /** */
+    public void test() {
+
+	    if (!isRetainValuesSupported()) {
+    		printUnsupportedOptionalFeatureNotTested("EvictingWithRetainValuesFalse", "javax.jdo.option.RetainValues");
+	    }
+		else
+		{
+	        pm = getPM();
+			PCPoint2 pt = getHollowInstance();
+
+			Transaction tx = pm.currentTransaction();
+			tx.setRetainValues(false); //This should cause eviction of transactional instances when transaction is later commited.
+						
+			//Test
+			tx.begin();
+			makePersistentClean(pt);
+			tx.commit(); // This should evict pt
+			verify(pt);
+		}
+    }
+
+	/** */
+    private PCPoint2 getHollowInstance() {
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+        PCPoint2 pt = new PCPoint2(1,2);
+        pm.makePersistent(pt);
+        tx.commit();
+
+		int curr = currentState(pt);
+	    if (curr != HOLLOW){
+			fail(ASSERTION_FAILED,
+			     "Unable to create HOLLOW instance, state is " + states[curr]);
+	    }
+		return pt;
+    }
+
+    /** */
+    private void makePersistentClean(PCPoint2 pt) {
+		pm.makeTransactional(pt);
+        int curr = currentState(pt);
+        if (curr != PERSISTENT_CLEAN){
+        	fail(ASSERTION_FAILED,
+        	     "Unable to create PERSISTENT_CLEAN instance, state is " + states[curr]);
+        }
+    }
+
+	/** */
+    private void verify(PCPoint2 pt) {
+		// When PersistenceManager evicts instances, it: calls the jdoPreClear method on each instance
+        if ( !pt.wasClearCalled()) {
+            fail(ASSERTION_FAILED,
+                 "missing call of jdoPreClear");
+        }
+
+		// When PersistenceManager evicts instances, it: changes the state of the instances to hollow
+		int curr = currentState(pt);
+        if ( (curr != HOLLOW) && (curr != PERSISTENT_NONTRANSACTIONAL) ) {
+            fail(ASSERTION_FAILED,
+                 "Instance should be HOLLOW after tx.commit(), state is " + states[curr]);
+        }
+		
+        pm.makeTransient(pt);
+        // When PersistenceManager evicts instances, it: clears persistent fields on each instance (sets the value of the field to its Java default value)
+        int x=pt.getX();
+        Integer y=pt.getY();
+        if ((x != 0) || (y != null)) {
+        	fail(ASSERTION_FAILED,
+        	     "persistent fields not cleared, pt.getX()=="+x+" and pt.getY()=="+y);
+        }
+    }	
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetExtentWithInstancesMadePersistentViaReachability.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetExtentWithInstancesMadePersistentViaReachability.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetExtentWithInstancesMadePersistentViaReachability.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetExtentWithInstancesMadePersistentViaReachability.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import java.util.Iterator;
+import java.util.Date;
+
+import javax.jdo.Extent;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+
+import org.apache.jdo.tck.pc.company.Company;
+import org.apache.jdo.tck.pc.company.Department;
+import org.apache.jdo.tck.pc.company.Address;
+
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> GetExtentWithInstancesMadePersistentViaReachability
+ *<BR>
+ *<B>Keywords:</B> inheritance extent
+ *<BR>
+ *<B>Assertion ID:</B> A12.5.4-1.
+ *<BR>
+ *<B>Assertion Description: </B>
+If an instance of a class or interface that has a managed extent is made persistent via reachability, the instance is put into the extent implicitly.
+ */
+
+public class GetExtentWithInstancesMadePersistentViaReachability extends JDO_Test {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.4-3 (GetExtentWithInstancesMadePersistentViaReachability) failed: ";
+
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(GetExtentWithInstancesMadePersistentViaReachability.class);
+    }
+
+    /** */
+    public void test() {
+        pm = getPM();
+        createObjects(pm);
+        runTest(pm);
+    }
+
+    /** */
+    private void createObjects(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+        Company comp = new Company(1L, "Sun Microsystems", new Date(), new Address(0,"","","","",""));
+        pm.makePersistent(comp);
+        //Add transient departments
+        comp.addDepartment(new Department(1L, "Department 1"));
+        comp.addDepartment(new Department(2L, "Department 2"));
+        comp.addDepartment(new Department(3L, "Department 3"));
+        tx.commit(); //Now the transient departments should be made persistent via reachability
+    }
+
+    /** */
+    private void runTest(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+        Extent e = pm.getExtent(Department.class, false);
+
+        boolean foundDep1 = false;
+        boolean foundDep2 = false;
+        boolean foundDep3 = false;
+
+        for (Iterator i = e.iterator(); i.hasNext();) {
+            Department dep = (Department) i.next();
+            if (dep.getName().equals("Department 1"))
+                foundDep1=true;
+            else if (dep.getName().equals("Department 2"))
+                foundDep2=true;
+            else if (dep.getName().equals("Department 3"))
+                foundDep3=true;		
+        }
+
+        if (!foundDep1) {
+            fail(ASSERTION_FAILED,
+                "Extent of class " + Department.class.getName() + " does not include instance with deptid 1L");
+        }
+        if (!foundDep2) {
+            fail(ASSERTION_FAILED,
+                "Extent of class " + Department.class.getName() + " does not include instance with deptid 2L");
+        }
+        if (!foundDep3) {
+            fail(ASSERTION_FAILED,
+                "Extent of class " + Department.class.getName() + " does not include instance with deptid 3L");
+        }
+
+        tx.commit();
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetExtentWithNoSubclasses.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetExtentWithNoSubclasses.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetExtentWithNoSubclasses.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetExtentWithNoSubclasses.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import java.util.Iterator;
+
+import javax.jdo.Extent;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> GetExtentWithNoSubclasses
+ *<BR>
+ *<B>Keywords:</B> inheritance extent
+ *<BR>
+ *<B>Assertion ID:</B> A12.5.4-2.
+ *<BR>
+ *<B>Assertion Description: </B>
+The getExtent method returns an Extent that contains all of the instances in the parameter class. With the subclasses parameter false, only instances of the specified class are returned.
+
+ */
+
+public class GetExtentWithNoSubclasses extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.4-2 (GetExtentWithNoSubclasses) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(GetExtentWithNoSubclasses.class);
+    }
+
+    private PCPoint p1 = null;
+    private PCPoint p2 = null;
+
+    /** */
+    public void testGetExtentWithNoSubclasses() {
+        pm = getPM();
+        createObjects(pm);
+        runTestGetExtent(pm);
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    private void createObjects(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            PCPoint p1 = new PCPoint (1,3);
+            PCPoint p2 = new PCPoint (3,5);
+            pm.makePersistent(p1);
+            pm.makePersistent(p2);
+            tx.commit();
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void runTestGetExtent(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            Extent e = pm.getExtent(PCPoint.class, false);
+            
+            int c = 0;
+            for (Iterator i = e.iterator(); i.hasNext();) {
+                PCPoint p = (PCPoint) i.next();
+                if (debug) logger.debug("p.getX() = " + p.getX());
+                if ((p.getX() == 1) || (p.getX() == 3)) {
+                    // OK
+                }
+                else {
+                    fail(ASSERTION_FAILED, 
+                         "Extent of class " + PCPoint.class.getName() + 
+                         " includes unexpected instance, p.getX():" + p.getX());
+                }
+            }
+            tx.commit();
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetExtentWithSubclasses.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetExtentWithSubclasses.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetExtentWithSubclasses.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetExtentWithSubclasses.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,130 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import java.util.Iterator;
+import java.util.Date;
+
+import javax.jdo.Extent;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+
+import org.apache.jdo.tck.pc.company.Person;
+import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.pc.company.PartTimeEmployee;
+import org.apache.jdo.tck.pc.company.FullTimeEmployee;
+
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> GetExtentWithSubclasses
+ *<BR>
+ *<B>Keywords:</B> inheritance extent
+ *<BR>
+ *<B>Assertion ID:</B> A12.5.4-3.
+ *<BR>
+ *<B>Assertion Description: </B>
+The getExtent method returns an Extent that contains all of the instances in the parameter class or interface, and if the subclasses flag is true, all of the instances of the parameter class and its subclasses.
+ */
+
+public class GetExtentWithSubclasses extends JDO_Test {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.4-3 (GetExtentWithSubclasses) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(GetExtentWithSubclasses.class);
+    }
+
+    /** */
+    public void test() {
+        pm = getPM();
+        createObjects(pm);
+        runTest(pm);
+    }
+
+    /** */
+    private void createObjects(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+        Date date = new Date();
+        Person p1 = new Person(1L, "Craig", "Russell", null, date, null);
+        Employee p2 = new FullTimeEmployee(2L, "Michael", "Bouschen", null, date, null, date, 0.0);
+        Employee p3 = new PartTimeEmployee(3L, "Michelle", "Caisse", null, date, null, date, 0.0);
+        Employee p4 = new FullTimeEmployee(4L, "Victor", "Kirkebo", null, date, null, date, 0.0);
+        pm.makePersistent(p1);
+        pm.makePersistent(p2);
+        pm.makePersistent(p3);
+        pm.makePersistent(p4);
+        tx.commit();
+    }
+
+    /** */
+    private void runTest(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+        Extent e = pm.getExtent(Person.class, true);
+
+        boolean foundCraig = false;
+        boolean foundMichael = false;
+        boolean foundMichelle = false;
+        boolean foundVictor = false;
+
+        for (Iterator i = e.iterator(); i.hasNext();) {
+            Person p = (Person) i.next();
+            if ((p.getFirstname().equals("Craig")) && (p.getLastname().equals("Russell")))
+                foundCraig=true;
+            else if ((p.getFirstname().equals("Michael")) && (p.getLastname().equals("Bouschen")))
+                foundMichael=true;
+            else if ((p.getFirstname().equals("Michelle")) && (p.getLastname().equals("Caisse")))
+                foundMichelle=true;
+            else if ((p.getFirstname().equals("Victor")) && (p.getLastname().equals("Kirkebo")))
+                foundVictor=true;
+        }
+
+        if (!foundCraig) {
+            fail(ASSERTION_FAILED,
+                "Extent of class " + Person.class.getName() + 
+                " does not include instance of class " + Person.class.getName() + " with personid 1L");
+        }
+        if (!foundMichael) {
+            fail(ASSERTION_FAILED,
+                "Extent of class " + Person.class.getName() + 
+                " does not include instance of class " + Employee.class.getName() + " with personid 2L");
+        }
+        if (!foundMichelle) {
+            fail(ASSERTION_FAILED,
+                "Extent of class " + Person.class.getName() + 
+                " does not include instance of class " + PartTimeEmployee.class.getName() + " with personid 3L");
+        }
+        if (!foundVictor) {
+            fail(ASSERTION_FAILED,
+                "Extent of class " + Person.class.getName() + 
+                " does not include instance of class " + FullTimeEmployee.class.getName() + " with personid 4L");
+        }
+
+        tx.commit();
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetIgnoreCache.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetIgnoreCache.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetIgnoreCache.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetIgnoreCache.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Get IgnoreCache Value from PersistenceManager
+ *<BR>
+ *<B>Keywords:</B>
+ *<BR>
+ *<B>Assertion ID:</B> A12.5.3-1.
+ *<BR>
+ *<B>Assertion Description: </B>
+ The PersistenceManager.getIgnoreCache method returns the current value of the
+ IgnoreCache option.
+
+ */
+
+public class GetIgnoreCache extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.3-1 (GetIgnoreCache) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(GetIgnoreCache.class);
+    }
+
+    /** */
+    public void testGetIgnoreCache() {
+        pm = getPM();
+        Transaction tx = pm.currentTransaction();
+        try {
+            PCPoint p1 = new PCPoint();
+            tx.begin();
+            pm.setIgnoreCache(true);
+            boolean returnValue = pm.getIgnoreCache();
+
+            if (!returnValue)
+                fail(ASSERTION_FAILED,
+                     "pm.getIgnoreCache() returns false after setting the falg to true");
+            tx.commit();
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+        pm.close();
+        pm = null;
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectById.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectById.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectById.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectById.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Get Object By Id
+ *<BR>
+ *<B>Keywords:</B> identity cache
+ *<BR>
+ *<B>Assertion ID:</B> A12.5.6-9.
+ *<BR>
+ *<B>Assertion Description: </B>
+ If <code>PersistenceManager.getObjectById</code> is called with a value of
+ <code>true</code> for the second parameter named <code>validate</code>,
+ and there is not an instance already in the cache with the same JDO identity
+ as the oid parameter, then this method creates an instance with the specified
+ JDO identity, verifies that it exists in the data store, and returns it.
+ <OL TYPE=A>
+ <LI>If there is no transaction in progress, the returned instance will be
+ hollow or persistent-nontransactional, at the choice of the implementation.</LI>
+ <LI>If there is a data store transaction in progress,
+ the returned instance will be persistent-clean.</LI>
+ <LI>If there is an optimistic transaction in progress,
+ the returned instance will be persistent-nontransactional.</LI>
+ </OL>
+
+ */
+
+public class GetObjectById extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.6-9 (GetObjectById) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(GetObjectById.class);
+    }
+
+    /** */
+    public void testGetObjectById() {
+        if (debug) logger.debug ("\nSTART GetObjectById");
+
+        Transaction tx = null;
+        try {
+            pm = getPM();
+            Object oid = createPCPointInstance(pm);
+            if (pm != null) {
+                pm.close();
+                pm = null; // make sure to get a different pm so obj is not in cache
+            }
+            
+            Object obj = null;
+            int state = 0;
+                
+            // nontransactional access
+            if (isNontransactionalReadSupported()) {
+                if (debug) logger.debug("nontransactional");
+                pm = getPM();
+                tx = pm.currentTransaction();
+                tx.setNontransactionalRead(true);
+                obj = pm.getObjectById(oid, true);
+                state = currentState (obj);
+                if (state != PERSISTENT_NONTRANSACTIONAL && state != HOLLOW) {
+                    fail(ASSERTION_FAILED,
+                         "Expected persistent-nontransactional or hollow; got " + 
+                         getStateOfInstance(obj));
+                }
+                tx = null;
+                pm.close();
+                pm = null; // make sure to get a different pm so obj is not in cache
+            }
+            
+            // pessimistic transactional access
+            if (debug) logger.debug("pessimistic");
+            pm = getPM();
+            tx = pm.currentTransaction();
+            tx.setOptimistic(false);
+            tx.begin();
+            obj = pm.getObjectById(oid, true);
+            state = currentState (obj);
+            tx.commit();
+            tx = null;
+            if (state != PERSISTENT_CLEAN) {
+                fail(ASSERTION_FAILED,
+                     "Expected persistent-clean; got " + getStateOfInstance(obj));
+            }
+            pm.close();
+            pm = null; // make sure to get a different pm so obj is not in cache
+            
+            // optimistic transactional access
+            if (isOptimisticSupported()) {
+                if (debug) logger.debug("optimistic");
+                pm = getPM();
+                tx = pm.currentTransaction();
+                tx.setOptimistic(true);
+                tx.begin();
+                obj = pm.getObjectById(oid, true);
+                state = currentState (obj);
+                tx.commit();
+                if (state != PERSISTENT_NONTRANSACTIONAL & state != HOLLOW) {
+                    fail(ASSERTION_FAILED,
+                         "Expected persistent-nontransactional; got " + getStateOfInstance(obj));
+                }
+                tx = null;
+                pm.close();
+                pm = null; // make sure to get a different pm so obj is not in cache
+            }
+        }
+        finally {
+            if (debug) logger.debug ("END GetObjectById");
+
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdNoValidationInstanceInCache.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdNoValidationInstanceInCache.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdNoValidationInstanceInCache.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdNoValidationInstanceInCache.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Get Object By Id No Validation, Instance In Cache
+ *<BR>
+ *<B>Keywords:</B> identity cache
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.6-2
+ *<BR>
+ *<B>Assertion Description: </B>
+If PersistenceManager.getObjectById is called with a value of false
+for the second parameter named validate, and there is already an instance in the cache with the
+same JDO identity as the oid parameter, then this method returns it.
+
+ */
+
+
+public class GetObjectByIdNoValidationInstanceInCache extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.6-2 (GetObjectByIdNoValidationInstanceInCache) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(GetObjectByIdNoValidationInstanceInCache.class);
+    }
+
+    /** */
+    public void testGetObjectByIdNoValidationInstanceInCache() {
+        pm = getPM();
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            PCPoint p1 = new PCPoint (1,3);
+            pm.makePersistent(p1);
+            int curr = currentState(p1);
+
+            Object oid = pm.getObjectId(p1);
+            tx.commit();
+
+            tx.begin();
+            Object obj = pm.getObjectById(oid, false);
+
+            if (p1 != obj)
+                fail(ASSERTION_FAILED,
+                     "pm.getObjectById(oid, false) should find existing instance in pm cache");
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+        pm.close();
+        pm = null;
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdNoValidationInstanceInCacheNoStateChange.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdNoValidationInstanceInCacheNoStateChange.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdNoValidationInstanceInCacheNoStateChange.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdNoValidationInstanceInCacheNoStateChange.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Get Object By Id No Validation, Instance In Cache, No State Change
+ *<BR>
+ *<B>Keywords:</B> identity cache lifecycle
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.6-3
+ *<BR>
+ *<B>Assertion Description: </B>
+If PersistenceManager.getObjectById is called with a value of false for the second parameter named validate, and there is already an instance in the cache with the same JDO identity as the oid parameter, there is no change made to the state of the returned instance.
+ */
+
+public class GetObjectByIdNoValidationInstanceInCacheNoStateChange extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.6-3 (GetObjectByIdNoValidationInstanceInCacheNoStateChange) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(GetObjectByIdNoValidationInstanceInCacheNoStateChange.class);
+    }
+
+    /** */
+    public void testGetObjectByIdNoValidationInstanceInCacheNoStateChange() {
+        pm = getPM();
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            
+            PCPoint p1 = new PCPoint (1,3);
+            pm.makePersistent(p1);
+            Object oid = pm.getObjectId(p1);
+            tx.commit();
+            int curr = currentState(p1);
+
+            tx.begin();
+            Object obj = pm.getObjectById (oid, false);
+
+            int actualState = currentState(obj);
+
+            if (actualState != curr) {
+                fail(ASSERTION_FAILED,
+                     "State mismatched - Expected state: " +
+                     curr + " Actual state: " + actualState);
+            }
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+        pm.close();
+        pm = null;
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdNoValidationInstanceNotInCache.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdNoValidationInstanceNotInCache.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdNoValidationInstanceNotInCache.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdNoValidationInstanceNotInCache.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Get Object By Id No Validation Instance Not In Cache
+ *<BR>
+ *<B>Keywords:</B> identity cache
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.6-5
+ *<BR>
+ *<B>Assertion Description: </B>
+If PersistenceManager.getObjectById is called with a value of false for the second parameter named validate, and there is not an instance already in the cache with the same JDO identity as the oid parameter, and there is a transaction in progress, then this method creates an instance with the specified JDO identity and returns it with a state of hollow, persistent-nontransactional, or persistent-clean, at the choice of the implementation.
+ */
+
+public class GetObjectByIdNoValidationInstanceNotInCache extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.6-5 (GetObjectByIdNoValidationInstanceNotInCache) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(GetObjectByIdNoValidationInstanceNotInCache.class);
+    }
+
+    /** */
+    public void testGetObjectByIdNoValidationInstanceNotInCache() {
+        pm = getPM();
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            PCPoint p1 = new PCPoint (1,3);
+            pm.makePersistent(p1);
+            Object oid = pm.getObjectId(p1);
+            pm.evict(p1);
+            tx.commit();
+
+            tx.begin();
+            Object obj = pm.getObjectById (oid, false);
+
+            int curr = currentState(obj);
+            if ( curr == HOLLOW ||
+                 curr == PERSISTENT_NONTRANSACTIONAL ||
+                 curr == PERSISTENT_CLEAN ) {
+                ; // expected result
+            } 
+            else {
+                fail(ASSERTION_FAILED,
+                     "returned state mismatched - " +
+                     " Actual state " + curr);
+            }
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+        pm.close();
+        pm = null;
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdNoValidationInstanceNotInCacheNoTx.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdNoValidationInstanceNotInCacheNoTx.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdNoValidationInstanceNotInCacheNoTx.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdNoValidationInstanceNotInCacheNoTx.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Get Object By Id No Validation Instance Not In Cache, No Tx
+ *<BR>
+ *<B>Keywords:</B> identity cache
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.6-4
+ *<BR>
+ *<B>Assertion Description: </B>
+If PersistenceManager.getObjectById is called with a value of false for the
+second parameter named validate, and there is not an instance already in the cache with the same JDO identity as the oid parameter, and there is no transaction in progress, then this method creates an instance with the specified JDO identity and returns it with a state of hollow or persistent-nontransactional, at the choice of the implementation.
+ */
+
+public class GetObjectByIdNoValidationInstanceNotInCacheNoTx extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.6-4 (GetObjectByIdNoValidationInstanceNotInCacheNoTx) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(GetObjectByIdNoValidationInstanceNotInCacheNoTx.class);
+    }
+
+    /** */
+    public void testGetObjectByIdNoValidationInstanceNotInCacheNoTx() {
+        pm = getPM();
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            PCPoint p1 = new PCPoint (1,3);
+            pm.makePersistent(p1);
+            Object oid = pm.getObjectId(p1);
+            pm.evict(p1);
+            tx.commit();
+
+            /* get oid for p1, no transaction in progress */
+            Object obj = pm.getObjectById (oid, false);
+
+            int curr = currentState(p1);
+
+            if (curr == HOLLOW ||
+                curr == PERSISTENT_NONTRANSACTIONAL ||
+                curr == PERSISTENT_CLEAN ) {
+                // expected result
+            } 
+            else {
+                fail(ASSERTION_FAILED,
+                     "returned state mismatched - " +
+                     " Actual state " + curr);
+            }
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+        pm.close();
+        pm = null;
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdNoValidationInstanceNotInDatastore.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdNoValidationInstanceNotInDatastore.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdNoValidationInstanceNotInDatastore.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdNoValidationInstanceNotInDatastore.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import javax.jdo.JDOObjectNotFoundException;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Get Object By Id No Validation Instance Not In Datastore
+ *<BR>
+ *<B>Keywords:</B> identity exception
+ *<BR>
+ *<B>Assertion ID:</B> A12.5.6-6.
+ *<BR>
+ *<B>Assertion Description: </B>
+If <code>PersistenceManager.getObjectById</code> is called with a value of
+<code>false</code> for the second parameter named <code>validate</code>,
+and the instance does not exist in the data store, a subsequent access
+of the fields of the instance will throw a <code>JDODatastoreException</code>
+if the instance does not exist at that time.
+
+ */
+
+public class GetObjectByIdNoValidationInstanceNotInDatastore extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.6-6 (GetIgnoreCGetObjectByIdNoValidationInstanceNotInDatastore) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(GetObjectByIdNoValidationInstanceNotInDatastore.class);
+    }
+
+    /** */
+    public void testGetObjectByIdNoValidationInstanceNotInDatastore() {
+        if (debug)
+            logger.debug ("\nSTART GetObjectByIdNoValidationInstanceNotInDatastore");
+        Object oid = null;
+        pm = getPM();
+        oid = createPCPointInstance(pm);
+        deletePCPointInstance(pm, oid);
+    
+        try {
+            PCPoint p1 = (PCPoint)pm.getObjectById(oid, false); // might throw exception here
+            if (debug)
+                logger.debug ("Got object in cache, even though not in datastore.");
+            p1.getX(); // if not thrown above, throws exception here
+            fail(ASSERTION_FAILED,
+                 "accessing unknown instance should throw JDOObjectNotFoundException");
+        } 
+        catch (JDOObjectNotFoundException ex) {
+            // expected exception
+        }
+        pm.close();
+        pm = null;
+        if (debug)
+            logger.debug ("END GetObjectByIdNoValidationInstanceNotInDatastore");
+   }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdNotResolved.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdNotResolved.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdNotResolved.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdNotResolved.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import javax.jdo.JDOObjectNotFoundException;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Get ObjectId For Null Or Not Persistent
+ *<BR>
+ *<B>Keywords:</B> identity
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.6-1
+ *<BR>
+ *<B>Assertion Description: </B>
+In a call to PersistenceManager.getObjectById, if the PersistenceManager is
+unable to resolve the oid parameter to an ObjectId instance, then it throws a JDOUserException.
+ */
+
+public class GetObjectByIdNotResolved extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.6-1 (GetObjectByIdNotResolved) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(GetObjectByIdNotResolved.class);
+    }
+
+    /* passing null paramameter to getObjectId */
+    public void testGetObjectByIdNotResolved() {
+        pm = getPM();
+        if (debug) logger.debug(" *** testObjectByIdNotResolved *** ");
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            PCPoint p1 = new PCPoint (1,3);
+            pm.makePersistent(p1);
+            Object oid = pm.getObjectId(p1);
+            pm.deletePersistent(p1);
+            tx.commit();
+
+            tx.begin();
+            try {
+                PCPoint p2 = (PCPoint) pm.getObjectById(oid, true);
+                fail(ASSERTION_FAILED,
+                     "pm.getObjectById(oid, true) should throw JDOObjectNotFoundException, if oid refers to an non existing object");
+            } 
+            catch (JDOObjectNotFoundException e) {
+                // expected exception
+            }
+            tx.rollback();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+        pm.close();
+        pm = null;
+    }
+}
+

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdWithValidationInstanceInCache.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdWithValidationInstanceInCache.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdWithValidationInstanceInCache.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdWithValidationInstanceInCache.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Get Object By Id With Validation Instance in Cache
+ *<BR>
+ *<B>Keywords:</B> identity cache
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.6-7
+ *<BR>
+ *<B>Assertion Description: </B>
+If PersistenceManager.getObjectById is called with a value of true for the second parameter named validate, and there is already a transactional instance in the cache with the same JDO identity as the oid parameter, then this method returns it. There is no change made to the state of the returned instance.
+ */
+
+public class GetObjectByIdWithValidationInstanceInCache extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.6-7 (GetObjectByIdWithValidationInstanceInCache) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(GetObjectByIdWithValidationInstanceInCache.class);
+    }
+
+    /** */
+    public void testGetObjectByIdWithValidationInstanceInCache() {
+        pm = getPM();
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            PCPoint p1 = new PCPoint (1,3);
+            pm.makePersistent(p1);
+            Object oid = pm.getObjectId(p1);
+            tx.commit();
+            int curr = currentState(p1);
+
+            tx.begin();
+            Object obj = pm.getObjectById(oid, false);
+            int curr2 = currentState(obj);
+
+            if (obj != p1) {
+                fail(ASSERTION_FAILED, 
+                     "pm.getObjectById(oid, false) should find existing instance in pm cache");
+            }
+            
+            if (curr2 != curr) {
+                fail(ASSERTION_FAILED,
+                     "State changed in the returned instance, expected state: " + 
+                     curr + " Actual state: " + curr2);
+            }
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+        pm.close();
+        pm = null;
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdWithValidationInstanceInCacheNotInDatastore.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdWithValidationInstanceInCacheNotInDatastore.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdWithValidationInstanceInCacheNotInDatastore.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdWithValidationInstanceInCacheNotInDatastore.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import javax.jdo.JDOObjectNotFoundException;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Get Object By Id With Validation, Instance in Cache, Not in Datastore
+ *<BR>
+ *<B>Keywords:</B> identity cache
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.6-8.
+ *<BR>
+ *<B>Assertion Description: </B>
+If PersistenceManager.getObjectById is called with a value of true
+for the second parameter named validate, and there is an instance already in the cache with the
+same JDO identity as the oid parameter, and the instance is not transactional, and the instance
+does not exist in the datastore, then a JDODatastoreException is thrown.
+
+ */
+
+public class GetObjectByIdWithValidationInstanceInCacheNotInDatastore extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.6-8 (GetObjectByIdWithValidationInstanceInCacheNotInDatastore) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(GetObjectByIdWithValidationInstanceInCacheNotInDatastore.class);
+    }
+
+    /* passing null paramameter to getObjectId */
+    public void testGetObjectByIdWithValidationInstanceInCacheNotInDatastore() {
+        pm = getPM();
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            PCPoint p1 = new PCPoint (1,3);
+            pm.makePersistent(p1);
+            Object oid = pm.getObjectId(p1);
+            pm.deletePersistent(p1);
+            tx.commit();
+            
+            tx.begin();
+            try {
+                PCPoint p2 = (PCPoint) pm.getObjectById(oid, true);
+                fail(ASSERTION_FAILED,
+                     "pm.getObjectById(oid, true) should throw JDOObjectNotFoundException, if oid refers to an non existing object");
+            } 
+            catch (JDOObjectNotFoundException ex) {
+                // expected exception
+            }
+            tx.rollback();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+        pm.close();
+        pm = null;
+	}
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdWithValidationInstanceNotInCacheNotInDatastore.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdWithValidationInstanceNotInCacheNotInDatastore.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdWithValidationInstanceNotInCacheNotInDatastore.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectByIdWithValidationInstanceNotInCacheNotInDatastore.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import javax.jdo.JDOObjectNotFoundException;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Get Object By Id With Validation, Instance Not in Cache, Not in Datastore
+ *<BR>
+ *<B>Keywords:</B> exception
+ *<BR>
+ *<B>Assertion IDs:</B> A12.6.5-2.
+ *<BR>
+ *<B>Assertion Description: </B>
+Object getObjectById (Object oid, boolean validate) with validate==true. If the instance does not exist in the datastore, then a JDOObjectNotFoundException is thrown.
+ */
+
+public class GetObjectByIdWithValidationInstanceNotInCacheNotInDatastore extends JDO_Test {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.6.5-2 (GetObjectByIdWithValidationInstanceNotInCacheNotInDatastore) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(GetObjectByIdWithValidationInstanceNotInCacheNotInDatastore.class);
+    }
+
+    /** */
+    public void test() {
+        pm = getPM();
+        Transaction tx = pm.currentTransaction();
+        tx.setRestoreValues(false); //This should cause eviction of transactional instances when transaction is later rolled back.
+        tx.begin();		
+        PCPoint p1 = new PCPoint (1,3);
+        pm.makePersistent(p1);
+        Object oid = pm.getObjectId(p1);
+        tx.rollback();
+
+        tx.begin();
+        try {
+            PCPoint p2 = (PCPoint) pm.getObjectById(oid, true);
+            fail(ASSERTION_FAILED, "pm.getObjectById(oid, true) should throw JDOObjectNotFoundException, if oid refers to an non existing object");
+        }
+        catch (JDOObjectNotFoundException ex) {
+            // expected exception
+        }
+        finally {
+            tx.rollback();
+        }
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectId.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectId.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectId.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/GetObjectId.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Get Objectid
+ *<BR>
+ *<B>Keywords:</B> identity
+ *<BR>
+ *<B>Assertion ID:</B> A12.5.6-10
+ *<BR>
+ *<B>Assertion Description: </B>
+The PersistenceManager.getObjectId method returns an ObjectId instance that re presents the object identity of the specified JDO Instance. Test: The method g etObjectById returns the exact same object, evaluating to true when == is used .
+
+ */
+
+public class GetObjectId extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.6-10 (GetObjectId) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(GetObjectId.class);
+    }
+    
+    /** */
+    public void testGetObjectId() {
+        pm = getPM();
+        Transaction tx = pm.currentTransaction();
+        try {
+            PCPoint p1 = new PCPoint(8,8);
+
+            tx = pm.currentTransaction();
+            tx.begin();
+            pm.makePersistent(p1);
+            Object oid = pm.getObjectId(p1);
+            tx.commit();
+
+            tx.begin();
+            Object obj = pm.getObjectById(oid, false);
+            if (obj != p1) {
+                fail(ASSERTION_FAILED,
+                     "m.getObjectById(oid, false) should find existing instance in pm cache.");
+            }
+            tx.rollback();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+        pm.close();
+        pm = null;
+    }
+}



Mime
View raw message