db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcai...@apache.org
Subject svn commit: r160090 [11/63] - in incubator/jdo/trunk: ./ tck20/ tck20/assertions/ tck20/iut_jars/ tck20/test/ tck20/test/conf/ tck20/test/java/ tck20/test/java/org/ tck20/test/java/org/apache/ tck20/test/java/org/apache/jdo/ tck20/test/java/org/apache/jdo/tck/ tck20/test/java/org/apache/jdo/tck/api/ tck20/test/java/org/apache/jdo/tck/api/instancecallbacks/ tck20/test/java/org/apache/jdo/tck/api/jdohelper/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/close/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/extent/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/ tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/ tck20/test/java/org/apache/jdo/tck/enhancement/ tck20/test/java/org/apache/jdo/tck/extents/ tck20/test/java/org/apache/jdo/tck/lifecycle/ tck20/test/java/org/apache/jdo/tck/lifecycle/nontransactional/ tck20/test/java/org/apache/jdo/tck/models/ tck20/test/java/org/apache/jdo/tck/models/embedded/ tck20/test/java/org/apache/jdo/tck/models/fieldtypes/ tck20/test/java/org/apache/jdo/tck/models/inheritance/ tck20/test/java/org/apache/jdo/tck/pc/ tck20/test/java/org/apache/jdo/tck/pc/company/ tck20/test/java/org/apache/jdo/tck/pc/fieldtypes/ tck20/test/java/org/apache/jdo/tck/pc/inheritance/ tck20/test/java/org/apache/jdo/tck/pc/instancecallbacks/ tck20/test/java/org/apache/jdo/tck/pc/lifecycle/ tck20/test/java/org/apache/jdo/tck/pc/mylib/ tck20/test/java/org/apache/jdo/tck/query/ tck20/test/java/org/apache/jdo/tck/query/operators/ tck20/test/java/org/apache/jdo/tck/transactions/ tck20/test/java/org/apache/jdo/tck/util/ tck20/test/jdo/ tck20/test/jdo/applicationidentity/ tck20/test/jdo/applicationidentity/org/ tck20/test/jdo/applicationidentity/org/apache/ tck20/test/jdo/applicationidentity/org/apache/jdo/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/company/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/fieldtypes/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/inheritance/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/instancecallbacks/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/lifecycle/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/mylib/ tck20/test/jdo/datastoreidentity/ tck20/test/jdo/datastoreidentity/org/ tck20/test/jdo/datastoreidentity/org/apache/ tck20/test/jdo/datastoreidentity/org/apache/jdo/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/company/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/fieldtypes/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/inheritance/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/instancecallbacks/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/lifecycle/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/mylib/ tck20/test/orm/ tck20/test/orm/applicationidentity/ tck20/test/orm/applicationidentity/org/ tck20/test/orm/applicationidentity/org/apache/ tck20/test/orm/applicationidentity/org/apache/jdo/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/company/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/fieldtypes/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/inheritance/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/instancecallbacks/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/lifecycle/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/mylib/ tck20/test/orm/datastoreidentity/ tck20/test/orm/datastoreidentity/org/ tck20/test/orm/datastoreidentity/org/apache/ tck20/test/orm/datastoreidentity/org/apache/jdo/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/company/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/fieldtypes/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/inheritance/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/instancecallbacks/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/lifecycle/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/mylib/ tck20/test/sql/ tck20/test/sql/derby/
Date Mon, 04 Apr 2005 19:43:46 GMT
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeTransientFailsWithDirtyInstance.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeTransientFailsWithDirtyInstance.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeTransientFailsWithDirtyInstance.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeTransientFailsWithDirtyInstance.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,191 @@
+/*
+ * 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.lifecycle;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import javax.jdo.JDOUserException;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest;
+
+/**
+ *<B>Title:</B>MakeTransientFailsWithDirtyInstance
+ *<BR>
+ *<B>Keywords:</B> exception
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.7-16
+ *<BR>
+ *<B>Assertion Description: </B>
+If the instance passed to PersistenceManager.makeTransient or makeTransientAll is dirty, a JDOUserException is thrown.
+
+ */
+
+public class MakeTransientFailsWithDirtyInstance extends PersistenceManagerTest {
+       
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.7-16 (MakeTransientFailsWithDirtyInstance) 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(MakeTransientFailsWithDirtyInstance.class);
+    }
+
+    private PCPoint p1 = null;
+    private PCPoint p2 = null;
+    private PCPoint p3 = null;
+    private PCPoint p4 = null;
+    private PCPoint p5 = null;
+
+    /** */
+    public void testMakeTransientFailsWithDirtyInstance() {
+        pm = getPM();
+
+        createObjects(pm);
+        runTestMakeTransient(pm);
+        runTestMakeTransientAll1(pm);
+        runTestMakeTransientAll2(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    private void  createObjects(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx = pm.currentTransaction();
+            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();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /* test makeTansient (Object pc) */
+    private void runTestMakeTransient(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            
+            // make instance dirty
+            p1.setX(100);
+            
+            try {
+                pm.makeTransient(p1);
+                fail(ASSERTION_FAILED,
+                     "pm.makeTransient should throw JDOUserException when called for P-DIRTY instance.");
+            }
+            catch (JDOUserException ex) {
+                // expected exception
+            }
+            tx.rollback();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /* test makeTansientAll (Collection pcs) */
+    private void runTestMakeTransientAll1(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+
+            tx = pm.currentTransaction();
+            tx.begin();
+
+            Collection col1 = new HashSet();
+            col1.add(p2);
+            col1.add(p3);
+
+            p2.setX(200);
+            p3.setX(201);
+
+            try {
+                pm.makeTransientAll(col1);
+                fail(ASSERTION_FAILED,
+                     "pm.makeTransientAll(Collection) should throw JDOUserException when called for a collection including P-DIRTY instances.");
+            }
+            catch (JDOUserException ex) {
+                // expected exception
+            }
+            tx.rollback();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /* test makeTransientAll (Object[] o) */
+    private void runTestMakeTransientAll2(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+        	tx.begin();
+
+            Collection col1 = new HashSet();
+            col1.add(p4);
+            col1.add(p5);
+
+            p4.setX(300);
+            p5.setX(301);
+
+            Object[] obj1=col1.toArray();
+            
+            try {
+                pm.makeTransientAll(obj1);
+                fail(ASSERTION_FAILED,
+                     "pm.makeTransientAll(Object[]) should throw JDOUserException when called for an array including P-DIRTY instances.");
+            }
+            catch (JDOUserException ex) {
+                // expected exception
+            }
+            tx.rollback();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeTransientFailsWithDirtyInstance.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeTransientFieldsPreservedUnchanged.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeTransientFieldsPreservedUnchanged.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeTransientFieldsPreservedUnchanged.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeTransientFieldsPreservedUnchanged.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,244 @@
+/*
+ * 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.lifecycle;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest;
+
+/**
+ *<B>Title:</B> MakeTransient Fields Preserved Unchanged
+ *<BR>
+ *<B>Keywords:</B> transient
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.7-15, A12.5.7-18
+ *<BR>
+ *<B>Assertion Description: </B>
+If the instance passed to PersistenceManager.makeTransient or makeTransientAll has field values (persistent-nontransactional or persistent-clean), the fields in the cache are preserved unchanged. The instance(s) are not modified in any way.
+ */
+
+public class MakeTransientFieldsPreservedUnchanged extends PersistenceManagerTest {
+       
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.7-15, A12.5.7-18 (MakeTransientFieldsPreservedUnchanged) 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(MakeTransientFieldsPreservedUnchanged.class);
+    }
+
+    private PCPoint p1 = null;
+    private PCPoint p2 = null;
+    private PCPoint p3 = null;
+    private PCPoint p4 = null;
+    private PCPoint p5 = null;
+
+    private PCPoint np1 = null;
+    private PCPoint np2 = null;
+    private PCPoint np3 = null;
+    private PCPoint np4 = null;
+    private PCPoint np5 = null;
+
+    /** */
+    public void testMakeTransientFieldsPreservedUnchanged() {
+        pm = getPM();
+
+        createObjects(pm);
+        runTestMakeTransientFieldsPreservedUnchanged1(pm);
+        runTestMakeTransientFieldsPreservedUnchangedAll1(pm);
+        runTestMakeTransientFieldsPreservedUnchangedAll2(pm);
+        
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    private void createObjects(PersistenceManager pm) {
+        createPCleanObjects(pm);
+        createPNonTransactionalObjects(pm);
+    }
+    
+    /** */
+    private void  createPCleanObjects(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            // create P-clean instances
+            tx.setOptimistic(false);
+            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();
+
+            tx.begin();
+            p1.getX();
+            p2.getX();
+            p3.getX();
+            p4.getX();
+            p5.getX();
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void createPNonTransactionalObjects(PersistenceManager pm) {
+        if (isOptimisticSupported()) {
+            Transaction tx = pm.currentTransaction();
+            try {
+                tx.setOptimistic(true);
+                tx.begin();
+                
+                np1 = new PCPoint(1,3);
+                np2 = new PCPoint(2,4);
+                np3 = new PCPoint(3,5);
+                np4 = new PCPoint(4,6);
+                np5 = new PCPoint(5,7);
+                
+                pm.makePersistent(np1);
+                pm.makePersistent(np2);
+                pm.makePersistent(np3);
+                pm.makePersistent(np4);
+                pm.makePersistent(np5);
+                tx.commit();
+                
+                tx.begin();
+                np1.getX();
+                np2.getX();
+                np3.getX();
+                np4.getX();
+                np5.getX();
+                tx.commit();
+                tx = null;
+            }
+            finally {
+                if ((tx != null) && tx.isActive())
+                    tx.rollback();
+            }
+        }
+    }
+    
+    /* test makeTransient (Object pc)
+     * instance passed has field values and is P-nontransactional *
+     */
+    private void runTestMakeTransientFieldsPreservedUnchanged1(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            pm.makeTransient(p1);
+            tx.commit();
+            tx = null;
+
+            if (!testState(p1, TRANSIENT, "transient")) {
+                fail(ASSERTION_FAILED,
+                     "expected TRANSIENT instance, instance " + p1 + 
+                     " is " + getStateOfInstance(p1));
+            }
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /* test makeTransientAll (Collection pcs) */
+    private void runTestMakeTransientFieldsPreservedUnchangedAll1(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Collection col1 = new HashSet();
+            col1.add(p2);
+            col1.add(p3);
+
+            pm.makeTransientAll(col1);
+            tx.commit();
+            tx = null;
+            
+            for (Iterator iter = col1.iterator(); iter.hasNext();) {
+                PCPoint p = (PCPoint) iter.next();
+                if (!testState(p, TRANSIENT, "transient")) {
+                    fail(ASSERTION_FAILED,
+                         "expected TRANSIENT instance, instance " + p + 
+                         " is " + getStateOfInstance(p));
+                }
+            }
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /* test makeTransientAll (Object[] o) */
+    private void runTestMakeTransientFieldsPreservedUnchangedAll2(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            int NUM_OBJS = 2;
+            tx.begin();
+
+            Collection col1 = new HashSet();
+            col1.add(p4);
+            col1.add(p5);
+
+            Object[] obj1= col1.toArray();
+
+            pm.makeTransientAll(obj1);
+            tx.commit();
+            tx = null;
+            
+            for (int i=0; i < NUM_OBJS; ++i ) {
+                PCPoint p = (PCPoint) obj1[i];
+                if (!testState(p, TRANSIENT, "transient")) {
+                    fail(ASSERTION_FAILED,
+                         "expected TRANSIENT instance, instance " + p + 
+                         " is " + getStateOfInstance(p));
+                }
+            }
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+}
+

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeTransientFieldsPreservedUnchanged.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeTransientHasNoEffectOnTransientInstances.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeTransientHasNoEffectOnTransientInstances.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeTransientHasNoEffectOnTransientInstances.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeTransientHasNoEffectOnTransientInstances.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,151 @@
+/*
+ * 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.lifecycle;
+
+import java.util.Collection;
+import java.util.HashSet;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest;
+
+/**
+ *<B>Title:</B> MakeTransientHasNoEffectOnTransientInstances
+ *<BR>
+ *<B>Keywords:</B> transient
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.7-19
+ *<BR>
+ *<B>Assertion Description: </B>
+PersistenceManager.makeTransient and
+makeTransientAll have no effect if the parameter instance is transient.
+
+ */
+
+public class MakeTransientHasNoEffectOnTransientInstances
+    extends PersistenceManagerTest {
+       
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.7-19 (MakeTransientHasNoEffectOnTransientInstances) 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(MakeTransientHasNoEffectOnTransientInstances.class);
+    }
+
+    private PCPoint p1 = null;
+    private PCPoint p2 = null;
+    private PCPoint p3 = null;
+    private PCPoint p4 = null;
+    private PCPoint p5 = null;
+
+    /** */
+    public void testMakeTransientHasNoEffectOnTransientInstances() {
+        pm = getPM();
+
+        createTransientObjects();
+        runTestMakeTransientHasNoEffectOnTransientInstances1(pm);
+        runTestMakeTransientHasNoEffectOnTransientInstancesAll1(pm);
+        runTestMakeTransientHasNoEffectOnTransientInstancesAll2(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    private void  createTransientObjects() {
+        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);
+    }
+
+    /* test makeTransient (Object pc) */
+    private void runTestMakeTransientHasNoEffectOnTransientInstances1(
+        PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            pm.makeTransient(p1);
+            tx.commit();
+            tx = null;
+            if (debug)
+                logger.debug (" \nPASSED in runTestMakeTransientHasNoEffectOnTransientInstances()");
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /* test makeTransientAll (Collection pcs) */
+    private void runTestMakeTransientHasNoEffectOnTransientInstancesAll1(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Collection col1 = new HashSet();
+            col1.add(p2);
+            col1.add(p3);
+
+            pm.makeTransientAll(col1);
+            tx.commit();
+            tx = null;
+            if (debug)
+                logger.debug(" \nPASSED in runTestMakeTransientHasNoEffectOnTransientInstancesAll1()");
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /* test makeTransientAll (Object[] o) */
+    private void runTestMakeTransientHasNoEffectOnTransientInstancesAll2(
+        PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Collection col1 = new HashSet();
+            col1.add(p4);
+            col1.add(p5);
+
+            Object[] obj1= col1.toArray();
+
+            pm.makeTransientAll(obj1);
+            tx.commit();
+            tx = null;
+            if (debug)
+                logger.debug (" \nPASSED in runTestMakeTransientHasNoEffectOnTransientInstancesAll2()");
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeTransientHasNoEffectOnTransientInstances.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeTransientNotSubjectToRollback.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeTransientNotSubjectToRollback.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeTransientNotSubjectToRollback.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeTransientNotSubjectToRollback.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,185 @@
+/*
+ * 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.lifecycle;
+
+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;
+import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest;
+
+/**
+ *<B>Title:</B> MakeTransientNotSubjectToRollback
+ *<BR>
+ *<B>Keywords:</B>
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.7-17
+ *<BR>
+ *<B>Assertion Description: </B>
+The effect of PersistenceManager.makeTransient or makeTransientAll is immediate and not subject to rollback.
+
+ */
+
+public class MakeTransientNotSubjectToRollback extends PersistenceManagerTest {
+       
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.7-17 (MakeTransientNotSubjectToRollback) 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(MakeTransientNotSubjectToRollback.class);
+    }
+
+    private PCPoint p1 = null;
+    private PCPoint p2 = null;
+    private PCPoint p3 = null;
+    private PCPoint p4 = null;
+    private PCPoint p5 = null;
+
+    /** */
+    public void testMakeTransientNotSubjectToRollback() {
+        pm = getPM();
+
+        createPersistentObjects(pm);
+        runTestMakeTransientNotSubjectToRollback1(pm);
+        runTestMakeTransientNotSubjectToRollbackAll1(pm);
+        runTestMakeTransientNotSubjectToRollbackAll2(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    private void  createPersistentObjects(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();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /* test makeTransient (Object pc) */
+    private void runTestMakeTransientNotSubjectToRollback1(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            pm.makeTransient(p1);
+            int curr1 = currentState(p1);
+            tx.rollback();
+
+            if (curr1 != currentState(p1)) {
+                fail(ASSERTION_FAILED,
+                     "expected TRANSIENT instancew, instance " + p1 + 
+                     " is " + getStateOfInstance(p1));
+            }
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /* test makeTransientAll (Collection pcs) */
+    private void runTestMakeTransientNotSubjectToRollbackAll1(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Collection col1 = new java.util.HashSet();
+            col1.add(p2);
+            col1.add(p3);
+            pm.makeTransientAll(col1);
+            int p2_curr = currentState(p2);
+            int p3_curr = currentState(p3);
+            tx.rollback();
+
+            if (p2_curr != currentState(p2)) {
+                fail(ASSERTION_FAILED,
+                     "expected TRANSIENT instancew, instance " + p2 + 
+                     " is " + getStateOfInstance(p2));
+            }
+            if (p3_curr != currentState(p3)) {
+                fail(ASSERTION_FAILED,
+                     "expected TRANSIENT instancew, instance " + p3 + 
+                     " is " + getStateOfInstance(p3));
+            }
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /* test makeTransientAll (Object[] o) */
+    private void runTestMakeTransientNotSubjectToRollbackAll2(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Collection col1 = new java.util.HashSet();
+            col1.add(p4);
+            col1.add(p5);
+
+            Object[] obj1= col1.toArray();
+
+            pm.makeTransientAll(obj1);
+            int p4_curr = currentState(p4);
+            int p5_curr = currentState(p5);
+            tx.rollback();
+
+            if (p4_curr != currentState(p4)) {
+                fail(ASSERTION_FAILED,
+                     "expected TRANSIENT instancew, instance " + p4 + 
+                     " is " + getStateOfInstance(p2));
+            }
+            if (p5_curr != currentState(p5)) {
+                fail(ASSERTION_FAILED,
+                     "expected TRANSIENT instancew, instance " + p5 + 
+                     " is " + getStateOfInstance(p5));
+            }
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeTransientNotSubjectToRollback.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/AfterCloseGetPMThrowsException.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/AfterCloseGetPMThrowsException.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/AfterCloseGetPMThrowsException.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/AfterCloseGetPMThrowsException.java Mon Apr  4 12:41:23 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.persistencemanagerfactory;
+
+import javax.jdo.JDOUserException;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B>AfterCloseGetPMThrowsException of PersistenceManagerFactory  
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A11.4-9B.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * PersistenceManagerFactory.getPersistenceManager() throws
+ * JDOUserException after the PersistenceManagerFactory is closed.
+ */
+
+/* 
+ * Revision History
+ * ================
+ * Author :  Craig Russell
+ * Date   :  05/16/03
+ *
+ */
+
+public class AfterCloseGetPMThrowsException extends JDO_Test {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A11.4-9B (AfterCloseGetPMThrowsException) 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(AfterCloseGetPMThrowsException.class);
+    }
+
+    /** */
+    public void test() {
+        try {
+            pmf = getPMF();
+            pmf.close();
+            pm = pmf.getPersistenceManager();
+            fail(ASSERTION_FAILED,
+                 "pmf.getPersistenceManager should throw JDOUserException if pmf is closed.");
+        } catch (JDOUserException ex) {
+            // expected exception
+            if (debug)
+                logger.debug("caught expected exception " + ex.toString());
+        } finally { 
+            if (pm != null) 
+                pm.close();
+        }
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/AfterCloseGetPMThrowsException.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/AfterCloseSetMethodsThrowException.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/AfterCloseSetMethodsThrowException.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/AfterCloseSetMethodsThrowException.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/AfterCloseSetMethodsThrowException.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,196 @@
+/*
+ * 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.persistencemanagerfactory;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.jdo.JDOException;
+import javax.jdo.JDOFatalInternalException;
+import javax.jdo.JDOUserException;
+import javax.jdo.PersistenceManagerFactory;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B>AfterCloseSetMethodsThrowException  
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A11.4-9A.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * If a set method is called after close, then JDOUserException is thrown.
+ */
+
+/* 
+ * Revision History
+ * ================
+ * Author :   Craig Russell
+ * Date   :  05/16/03
+ *
+ */
+
+public class AfterCloseSetMethodsThrowException extends JDO_Test {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A11.4-9A (AfterCloseSetMethodsThrowException) 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(AfterCloseSetMethodsThrowException.class);
+    }
+
+    /** */
+    public void test() {
+        Class[] stringParameters = new Class[]{String.class};
+        Class[] booleanParameters = new Class[]{boolean.class};
+        Object[] stringParameter = new Object[]{"Nobody knows the trouble"};
+        Object[] booleanParameter = new Object[]{new Boolean(false)};
+        
+        SetProperty[] setMethods = new SetProperty[] {
+            new SetProperty("setConnectionDriverName", stringParameters, stringParameter),
+            new SetProperty("setConnectionFactoryName", stringParameters, stringParameter),
+            new SetProperty("setConnectionFactory2Name", stringParameters, stringParameter),
+            new SetProperty("setConnectionURL", stringParameters, stringParameter),
+            new SetProperty("setConnectionUserName", stringParameters, stringParameter),
+            new SetProperty("setConnectionPassword", stringParameters, stringParameter),
+            new SetProperty("setIgnoreCache", booleanParameters, booleanParameter),
+            new SetProperty("setMultithreaded", booleanParameters, booleanParameter),
+            new SetProperty("setNontransactionalRead", booleanParameters, booleanParameter),
+            new SetProperty("setNontransactionalWrite", booleanParameters, booleanParameter),
+            new SetProperty("setOptimistic", booleanParameters, booleanParameter),
+            new SetProperty("setRestoreValues", booleanParameters, booleanParameter),
+            new SetProperty("setRetainValues", booleanParameters, booleanParameter)
+        };
+       
+        GetProperty[] getMethods = new GetProperty[] {
+            new GetProperty("getConnectionDriverName"),
+            new GetProperty("getConnectionFactoryName"),
+            new GetProperty("getConnectionFactory2Name"),
+            new GetProperty("getConnectionURL"),
+            new GetProperty("getConnectionUserName"),
+            new GetProperty("getIgnoreCache"),
+            new GetProperty("getMultithreaded"),
+            new GetProperty("getNontransactionalRead"),
+            new GetProperty("getNontransactionalWrite"),
+            new GetProperty("getOptimistic"),
+            new GetProperty("getRestoreValues"),
+            new GetProperty("getRetainValues")
+        };
+       
+        pmf = getPMF();
+        pmf.close();
+        // each set method should throw an exception
+        Collection setCollection = Arrays.asList(setMethods);
+        for (Iterator it = setCollection.iterator(); it.hasNext();) {
+            SetProperty sp = (SetProperty)it.next();
+            String where = sp.getMethodName();
+            try {
+                sp.execute(pmf);
+                fail(ASSERTION_FAILED,
+                     "pmf method " + where + " shoudl throw JDOUserException when called for closed pmf");
+            } catch (JDOUserException ex) {
+                if (debug)
+                    logger.debug("Caught expected exception " + ex.toString() +
+                                 " from " + where);
+            }
+        }
+        // each get method should succeed
+        Collection getCollection = Arrays.asList(getMethods);
+        for (Iterator it = getCollection.iterator(); it.hasNext();) {
+            GetProperty gp = (GetProperty)it.next();
+            String where = gp.getMethodName();
+            try {
+                gp.execute(pmf);
+            } catch (JDOUserException ex) {
+                fail(ASSERTION_FAILED,
+                     "Caught unexpected exception " + ex.toString() + " from " +
+                     where);
+            }
+        }
+    }
+   
+    /** */
+    class SetProperty {
+        
+        java.lang.reflect.Method method;
+        String methodName;
+        Class[] parameters;
+        Object[] parameter;
+       
+        SetProperty(String methodName, Class[] parameters, Object[] parameter) {
+            this.methodName = methodName;
+            this.parameters = parameters;
+            this.parameter = parameter;
+            try {
+                method = PersistenceManagerFactory.class.getMethod(methodName, parameters);
+            } catch (NoSuchMethodException ex) {
+                throw new JDOFatalInternalException("Method not defined: " + methodName);
+            }
+        }
+        void execute(PersistenceManagerFactory pmf) {
+            try {
+                method.invoke(pmf, parameter);
+            } catch (IllegalAccessException ex) {
+                throw new JDOFatalInternalException("IllegalAccessException", ex);
+            } catch (java.lang.reflect.InvocationTargetException ex) {
+                throw (JDOException)ex.getTargetException();
+            }
+        }
+       
+        String getMethodName() {
+            return methodName;
+        }
+    }
+   
+    /** */
+    class GetProperty {
+       
+        java.lang.reflect.Method method;
+        String methodName;
+       
+        GetProperty(String methodName) {
+            this.methodName = methodName;
+            try {
+                method = PersistenceManagerFactory.class.getMethod(methodName, null);
+            } catch (NoSuchMethodException ex) {
+                throw new JDOFatalInternalException("Method not defined: " + methodName);
+            }
+        }
+        void execute(PersistenceManagerFactory pmf) {
+            try {
+                method.invoke(pmf, null);
+            } catch (IllegalAccessException ex) {
+                throw new JDOFatalInternalException("IllegalAccessException", ex);
+            } catch (java.lang.reflect.InvocationTargetException ex) {
+                throw (JDOException)ex.getTargetException();
+            }
+        }
+       
+        String getMethodName() {
+            return methodName;
+        }
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/AfterCloseSetMethodsThrowException.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/AfterGetPersistenceManagerNoSetMethodsSucceed.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/AfterGetPersistenceManagerNoSetMethodsSucceed.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/AfterGetPersistenceManagerNoSetMethodsSucceed.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/AfterGetPersistenceManagerNoSetMethodsSucceed.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,231 @@
+/*
+ * 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.persistencemanagerfactory;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+
+import javax.jdo.PersistenceManagerFactory;
+import javax.jdo.PersistenceManager;
+import javax.jdo.JDOException;
+import javax.jdo.JDOFatalInternalException;
+import javax.jdo.JDOUserException;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> After GetPersistenceManager No Set Methods Succeed
+ *<BR>
+ *<B>Keywords:</B> 
+ *<BR>
+ *<B>Assertion ID:</B> A11.3-3.
+ *<BR>
+ *<B>Assertion Description: </B>
+After the first use of <code>PersistenceManagerFactory.getPersistenceManager()</code>,
+none of the <code>set</code> methods will succeed.
+
+ */
+
+public class AfterGetPersistenceManagerNoSetMethodsSucceed extends JDO_Test {
+
+    private String username;
+    private String password;
+    private static final String USERNAME_PROPERTY = "javax.jdo.option.ConnectionUserName";
+    private static final String PASSWORD_PROPERTY = "javax.jdo.option.ConnectionPassword";
+
+    private Class[] stringParameters = null;
+    private Class[] booleanParameters = null;
+    private Object[] stringParameter = null;
+    private Object[] booleanParameter = null;
+    private SetProperty[] setMethods = null;
+    private GetProperty[] getMethods = null;
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A11.3-3 (AfterGetPersistenceManagerNoSetMethodsSucceed) 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(AfterGetPersistenceManagerNoSetMethodsSucceed.class);
+    }
+
+    /** */
+    public AfterGetPersistenceManagerNoSetMethodsSucceed() {
+		super();
+        initVariables();
+    }
+
+    /** */
+    public void initVariables() {
+        stringParameters = new Class[]{String.class};
+        booleanParameters = new Class[]{boolean.class};
+        stringParameter = new Object[]{"Nobody knows the trouble"};
+        booleanParameter = new Object[]{Boolean.FALSE};
+
+        setMethods = new SetProperty[] {
+            new SetProperty("setConnectionDriverName", stringParameters, stringParameter),
+            new SetProperty("setConnectionFactoryName", stringParameters, stringParameter),
+            new SetProperty("setConnectionFactory2Name", stringParameters, stringParameter),
+            new SetProperty("setConnectionURL", stringParameters, stringParameter),
+            new SetProperty("setConnectionUserName", stringParameters, stringParameter),
+            new SetProperty("setConnectionPassword", stringParameters, stringParameter),
+            new SetProperty("setIgnoreCache", booleanParameters, booleanParameter),
+            new SetProperty("setMultithreaded", booleanParameters, booleanParameter),
+            new SetProperty("setNontransactionalRead", booleanParameters, booleanParameter),
+            new SetProperty("setNontransactionalWrite", booleanParameters, booleanParameter),
+            new SetProperty("setOptimistic", booleanParameters, booleanParameter),
+            new SetProperty("setRestoreValues", booleanParameters, booleanParameter),
+            new SetProperty("setRetainValues", booleanParameters, booleanParameter)
+        };
+
+        getMethods = new GetProperty[] {
+            new GetProperty("getConnectionDriverName"),
+            new GetProperty("getConnectionFactoryName"),
+            new GetProperty("getConnectionFactory2Name"),
+            new GetProperty("getConnectionURL"),
+            new GetProperty("getConnectionUserName"),
+            new GetProperty("getIgnoreCache"),
+            new GetProperty("getMultithreaded"),
+            new GetProperty("getNontransactionalRead"),
+            new GetProperty("getNontransactionalWrite"),
+            new GetProperty("getOptimistic"),
+            new GetProperty("getRestoreValues"),
+            new GetProperty("getRetainValues")
+        };
+    }
+
+    /** */
+    public void testGetPersistenceManagerWithNoParametes() {
+        runTest(false);
+    }
+
+    /** */
+    public void testGetPersistenceManagerWithParameters() {
+        Properties props = loadProperties(PMFProperties);
+        username = props.getProperty(USERNAME_PROPERTY);  
+        password = props.getProperty(PASSWORD_PROPERTY);  
+        runTest(true);
+    }
+
+	/** */
+    public void runTest(boolean bUserAndPasswd) {       
+        pmf = getPMF();
+        if (!bUserAndPasswd)
+            pm = getPM();
+        else
+            pm = getPMF().getPersistenceManager(username,password);	
+	
+        // each set method should throw an exception
+        Collection setCollection = Arrays.asList(setMethods);
+        for (Iterator it = setCollection.iterator(); it.hasNext();) {
+            SetProperty sp = (SetProperty)it.next();
+            String where = sp.getMethodName();
+            try {
+                sp.execute(pmf);
+                fail(ASSERTION_FAILED,
+                     "pmf method " + where + 
+                     " should throw JDOUserException when called after getPersistenceManager");
+            } catch (JDOUserException ex) {
+                if (debug)
+                    logger.debug("Caught expected exception " + ex.toString() + " from " + where);
+            }
+        }
+        // each get method should succeed
+        Collection getCollection = Arrays.asList(getMethods);
+        for (Iterator it = getCollection.iterator(); it.hasNext();) {
+            GetProperty gp = (GetProperty)it.next();
+            String where = gp.getMethodName();
+            try {
+                gp.execute(pmf);
+            } catch (JDOUserException ex) {
+                fail(ASSERTION_FAILED,
+                     "Caught unexpected exception " + ex.toString() + " from " + where);
+            }
+        }
+    }
+   
+    /** */
+    static class SetProperty {
+        
+        java.lang.reflect.Method method;
+        String methodName;
+        Class[] parameters;
+        Object[] parameter;
+       
+        SetProperty(String methodName, Class[] parameters, Object[] parameter) {
+            this.methodName = methodName;
+            this.parameters = parameters;
+            this.parameter = parameter;
+            try {
+                method = PersistenceManagerFactory.class.getMethod(methodName, parameters);
+            } catch (NoSuchMethodException ex) {
+                throw new JDOFatalInternalException("Method not defined: " + methodName);
+            }
+        }
+        void execute(PersistenceManagerFactory pmf) {
+            try {
+                method.invoke(pmf, parameter);
+            } catch (IllegalAccessException ex) {
+                throw new JDOFatalInternalException("IllegalAccessException", ex);
+            } catch (java.lang.reflect.InvocationTargetException ex) {
+                throw (JDOException)ex.getTargetException();
+            }
+        }
+       
+        String getMethodName() {
+            return methodName;
+        }
+    }
+   
+    /** */
+    static class GetProperty {
+       
+        java.lang.reflect.Method method;
+        String methodName;
+       
+        GetProperty(String methodName) {
+            this.methodName = methodName;
+            try {
+                method = PersistenceManagerFactory.class.getMethod(methodName, null);
+            } catch (NoSuchMethodException ex) {
+                throw new JDOFatalInternalException(
+                    "Method not defined: " + methodName);
+            }
+        }
+        void execute(PersistenceManagerFactory pmf) {
+            try {
+                method.invoke(pmf, null);
+            } catch (IllegalAccessException ex) {
+                throw new JDOFatalInternalException("IllegalAccessException", ex);
+            } catch (java.lang.reflect.InvocationTargetException ex) {
+                throw (JDOException)ex.getTargetException();
+            }
+        }
+       
+        String getMethodName() {
+            return methodName;
+        }
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/AfterGetPersistenceManagerNoSetMethodsSucceed.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/Close.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/Close.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/Close.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/Close.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,66 @@
+/*
+ * 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.persistencemanagerfactory;
+
+import javax.jdo.JDOUserException;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B>Close of PersistenceManagerFactory  
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A11.4-2
+ *<BR>
+ *<B>Assertion Description: </B>
+ * PersistenceManagerFactory.close() closes this PersistenceManagerFactory.
+ */
+
+
+public class Close extends JDO_Test {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertions A11.4-2 (Close) 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(Close.class);
+    }
+
+    /** */
+    public void test() {
+        pmf = getPMF();
+        pmf.close();
+        //check that pmf is really closed by trying to get a getPersistenceManager
+        try {
+            pm = pmf.getPersistenceManager();
+            fail(ASSERTION_FAILED,
+                "JDOUserException was not thrown when calling pmf.getPersistenceManager() after pmf was closed");
+        } catch (JDOUserException ex) {
+            // expected exception
+            if (debug)
+                logger.debug("caught expected exception " + ex.toString());
+        }
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/Close.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/CloseFailsIfTransactionActive.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/CloseFailsIfTransactionActive.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/CloseFailsIfTransactionActive.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/CloseFailsIfTransactionActive.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,203 @@
+/*
+ * 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.persistencemanagerfactory;
+
+import javax.jdo.JDOException;
+import javax.jdo.JDOUserException;
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B>CloseFailsIfTransactionActive of PersistenceManagerFactory  
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A11.4-4.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * PersistenceManagerFactory.getPersistenceManager() throws
+ * JDOUserException after the PersistenceManagerFactory is closed.
+ * The exception contains an array of nested exceptions; each nested
+ * exception contains as its failed object the PersistenceManager whose
+ * Transaction is still active.
+ * During close of the PersistenceManagerFactory, all PersistenceManager 
+ * instances obtained from this PersistenceManagerFactory are 
+ * themselves closed.
+ */
+
+/* 
+ * Revision History
+ * ================
+ * Author :  Craig Russell
+ * Date   :  05/16/03
+ *
+ */
+
+public class CloseFailsIfTransactionActive extends JDO_Test {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A11.4-4 (CloseFailsIfTransactionActive) 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(CloseFailsIfTransactionActive.class);
+    }
+
+    protected boolean aborted = false;
+    
+    /** */
+    public void test() {
+        PersistenceManager pm1 = null;
+        PersistenceManager pm2 = null;
+        cleanupPMF(getPMF());
+        pmf = null;
+        
+        try {
+            pm1 = getPM();
+            pm2 = getPM();
+            pm1.currentTransaction().begin();
+            pm1.currentTransaction().commit();
+            pm2.currentTransaction().begin();
+            pmf.close();
+            setAborted();
+            fail(ASSERTION_FAILED,
+                 "Close incorrectly succeeded with active transaction");
+        } 
+        catch (JDOUserException ex) {
+            try {
+                if (debug)
+                    logger.debug("Caught expected exception " + ex.getMessage());
+                PersistenceManager[] pms = getFailedPersistenceManagers(ex);
+                if (pms.length != 1) {
+                    setAborted();
+                    fail(ASSERTION_FAILED,
+                         "Unexpected number of nested exceptions: " + pms.length);
+                } 
+                else {
+                    Object failed = pms[0];
+                    if (pm2.equals(failed)) {
+                        if (debug)
+                            logger.debug("Found expected failed object " +
+                                         failed.toString());
+                    } 
+                    else {
+                        setAborted();
+                        fail(ASSERTION_FAILED,
+                             "Found unexpected failed object " +
+                             failed.toString());
+                    }
+                }
+            } 
+            catch (Exception uex) {
+                setAborted();
+                fail(ASSERTION_FAILED,
+                     "Caught 1 unexpected exception " + uex.toString());
+            }
+        } 
+        catch (Exception ex) {
+            setAborted();
+            fail(ASSERTION_FAILED,
+                 "Caught 2 unexpected exception " + ex.toString());
+        }
+        
+        if (!isAborted()) {
+            try {
+                pm2.currentTransaction().commit();
+                pmf.close();
+                if (!pm1.isClosed()){
+                    fail(ASSERTION_FAILED,
+                         "Unexpected pm1 is not closed.");
+                }
+                if (!pm2.isClosed()) {
+                    fail(ASSERTION_FAILED,
+                         "Unexpected pm2 is not closed.");
+                }
+            } 
+            catch (Exception ex) {
+                fail(ASSERTION_FAILED,
+                     "Caught 3 unexpected exception " + ex.toString());
+            }
+        }
+    }
+    
+    /** */
+    protected void cleanupPMF(PersistenceManagerFactory pmf) {
+        try {
+            pmf.close();
+        } catch (JDOException ex) {
+            PersistenceManager[] pms = getFailedPersistenceManagers(ex);
+            int numberOfPersistenceManagers = pms.length;
+            for (int i = 0; i < numberOfPersistenceManagers; ++i) {
+                PersistenceManager pm = pms[i];
+                if (pm == null) {
+                    fail(ASSERTION_FAILED,
+                         "Found unexpected null PersistenceManager");
+                } 
+                else {
+                    Transaction tx = pm.currentTransaction();
+                    if (tx.isActive()) {
+                        if (debug)
+                            logger.debug("Found active transaction; rolling back.");
+                        tx.rollback();
+                    } 
+                    else {
+                        fail(ASSERTION_FAILED,
+                             "Unexpectedly, this transaction is not active: " + tx);
+                    }
+                }
+            }
+        }
+    }
+    
+    /** */
+    protected void setAborted() {
+        aborted = true;
+    }
+    
+    /** */
+    protected boolean isAborted() {
+        return aborted;
+    }
+
+    /** */
+    protected PersistenceManager[] getFailedPersistenceManagers(JDOException ex) {
+        Throwable[] nesteds = ex.getNestedExceptions();
+        int numberOfExceptions = nesteds==null ? 0 : nesteds.length;
+        PersistenceManager[] result = new PersistenceManager[numberOfExceptions];
+        for (int i = 0; i < numberOfExceptions; ++i) {
+            JDOException exc = (JDOException)nesteds[i];
+            Object failedObject = exc.getFailedObject();
+            if (exc.getFailedObject() instanceof PersistenceManager) {
+                result[i] = (PersistenceManager)failedObject;
+            } else {
+                fail(ASSERTION_FAILED,
+                     "Unexpected failed object of type: " +
+                     failedObject.getClass().getName());
+            }
+        }
+        return result;
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/CloseFailsIfTransactionActive.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/CloseWithoutPermissionThrowsSecurityException.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/CloseWithoutPermissionThrowsSecurityException.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/CloseWithoutPermissionThrowsSecurityException.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/CloseWithoutPermissionThrowsSecurityException.java Mon Apr  4 12:41:23 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.persistencemanagerfactory;
+
+import java.security.Permission;
+
+import javax.jdo.spi.JDOPermission;
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B>Close of PersistenceManagerFactory Throws SecurityException if
+ * JDOPermission("closePersistenceManagerFactory") Is Not Set
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory SecurityException
+ *<BR>
+ *<B>Assertion IDs:</B> A11.4-3
+ *<BR>
+ *<B>Assertion Description: </B>
+ * PersistenceManagerFactory.close() closes this PersistenceManagerFactory.
+ * If JDOPermission("closePersistenceManagerFactory") is not set, then
+ * SecurityException in thrown. 
+ */
+
+
+public class CloseWithoutPermissionThrowsSecurityException extends JDO_Test {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertions A11.4-3 (CloseWithoutPermissionThrowsSecurityException) 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(CloseWithoutPermissionThrowsSecurityException.class);
+    }
+
+    /** */
+    public void test() {
+	    pmf = getPMF();
+
+        SecurityManager oldSecMgr = System.getSecurityManager();
+        try {
+            System.setSecurityManager(new MySecurityManager());
+        } catch (SecurityException se) {
+            fail(ASSERTION_FAILED,
+                "SecurityManager already set, setSecurityManager throws " +
+                se.toString());
+        }
+
+        try {
+            pmf.close();
+        } catch (SecurityException ex) {
+            // expected exception if JDOPermission("closePersistenceManagerFactory") is not set
+            if (debug)
+                logger.debug("caught expected exception " + ex.toString());
+        }
+        finally {
+            System.setSecurityManager(oldSecMgr);
+        }
+    }
+
+    public class MySecurityManager extends SecurityManager {
+        public void checkPermission(Permission perm) {
+            if (perm==JDOPermission.CLOSE_PERSISTENCE_MANAGER_FACTORY)
+                throw new SecurityException(
+                    "JDOPermission.CLOSE_PERSISTENCE_MANAGER_FACTORY not set");
+        }
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/CloseWithoutPermissionThrowsSecurityException.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPersistenceManager.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPersistenceManager.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPersistenceManager.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPersistenceManager.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,101 @@
+/*
+ * 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.persistencemanagerfactory;
+
+import java.util.Properties;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+
+/**
+ *<B>Title:</B>GetPersistenceManager of PersistenceManagerFactory  
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A11.3-1.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * PersistenceManagerFactory.getPersistenceManager() returns a
+PersistenceManager instance with the configured properties and the
+default values for option settings. 
+ */
+
+/* 
+ * Revision History
+ * ================
+ * Author         :   Linga Neerathilingam
+ * Date   :  10/22/01
+ *
+ */
+
+public class GetPersistenceManager extends JDO_Test {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A11.3-1 (GetPersistenceManager) 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(GetPersistenceManager.class);
+    }
+
+    private PersistenceManagerFactory   pmf;
+    private PersistenceManager          pm;
+    private String 			pmfClass;
+    private String                      url;
+    private String 			username;
+    private String 			password;
+
+    private static  String  		PMFCLASS = "javax.jdo.PersistenceManagerFactoryClass";
+    private static  String  		URL      = "javax.jdo.option.ConnectionURL";
+    private static  String  		USERNAME = "javax.jdo.option.ConnectionUserName";
+    private static  String  		PASSWORD = "javax.jdo.option.ConnectionPassword";
+
+
+    public void test() {
+        Properties props = loadProperties(PMFProperties);
+        pmfClass = props.getProperty(PMFCLASS);  
+        url      = props.getProperty(URL);
+        username = props.getProperty(USERNAME);  
+        password = props.getProperty(PASSWORD);  
+        
+        try {
+            Class cl = Class.forName(pmfClass);
+            pmf = (PersistenceManagerFactory) cl.newInstance();
+            pmf.setConnectionURL(url);
+            pmf.setConnectionUserName(username);
+            pmf.setConnectionPassword(password);
+            pm  = pmf.getPersistenceManager();
+        }
+        catch (Exception ex) {
+        	fail(ASSERTION_FAILED,
+                 "unexpected exception " + ex);
+        }
+        finally { 
+            if (debug) logger.debug("Persistence Manager obtained: " + pm); 
+            if (pm != null) pm.close();
+        }
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPersistenceManager.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPersistenceManagerFactoryByPropertiesInstance.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPersistenceManagerFactoryByPropertiesInstance.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPersistenceManagerFactoryByPropertiesInstance.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPersistenceManagerFactoryByPropertiesInstance.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,70 @@
+/*
+ * 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.persistencemanagerfactory;
+
+import java.util.Date;
+
+import javax.jdo.JDOHelper;
+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.Address;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B>Close of PersistenceManagerFactory  
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A11.1-32
+ *<BR>
+ *<B>Assertion Description: </B>
+ * An implementation must provide a method to construct a PersistenceManagerFactory by a Properties instance.
+ * This static method is called by the JDOHelper method getPersistenceManagerFactory (Properties props).
+ */
+
+
+public class GetPersistenceManagerFactoryByPropertiesInstance extends JDO_Test {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertions A11.1-32 (GetPersistenceManagerFactoryByPropertiesInstance) 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(GetPersistenceManagerFactoryByPropertiesInstance.class);
+    }
+
+    /** */
+    public void test() {
+        PMFPropertiesObject = loadProperties(PMFProperties);
+        pmf = JDOHelper.getPersistenceManagerFactory(PMFPropertiesObject);
+        //Try to get a PersistenceManager and begin and commit a transaction
+        pm = pmf.getPersistenceManager();
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+        Company comp = new Company(1L, "Sun Microsystems", new Date(), new Address(0,"","","","",""));
+        pm.makePersistent(comp);
+        tx.commit();
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPersistenceManagerFactoryByPropertiesInstance.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPersistenceManagerForUser.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPersistenceManagerForUser.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPersistenceManagerForUser.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPersistenceManagerForUser.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,98 @@
+/*
+ * 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.persistencemanagerfactory;
+
+import java.util.Properties;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+
+/**
+ *<B>Title:</B>GetPersistenceManagerForUser of PersistenceManagerFactory
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A11.3-2.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * PersistenceManagerFactory.getPersistenceManager(String userid,
+String password) returns a PersistenceManager instance with the
+configured properties and the default values for option settings. 
+ */
+
+/* 
+ * Revision History
+ * ================
+ * Author         :   Linga Neerathilingam
+ * Date   :  10/22/01
+ *
+ */
+
+public class GetPersistenceManagerForUser extends JDO_Test {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A11.3-2 (GetPersistenceManagerForUser) 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(GetPersistenceManagerForUser.class);
+    }
+    private PersistenceManagerFactory   pmf;
+    private PersistenceManager          pm;
+    private String 			pmfClass;
+    private String                      url;
+    private String 			username;
+    private String 			password;
+
+    private static  String  		PMFCLASS = "javax.jdo.PersistenceManagerFactoryClass";
+    private static  String  		URL      = "javax.jdo.option.ConnectionURL";
+    private static  String  		USERNAME = "javax.jdo.option.ConnectionUserName";
+    private static  String  		PASSWORD = "javax.jdo.option.ConnectionPassword";
+
+    /** */
+    public void test() {
+        Properties props = loadProperties(PMFProperties);
+        pmfClass = props.getProperty(PMFCLASS);  
+        url      = props.getProperty(URL);
+        username = props.getProperty(USERNAME);  
+        password = props.getProperty(PASSWORD);  
+
+        try {
+            Class cl = Class.forName(pmfClass);
+            pmf = (PersistenceManagerFactory) cl.newInstance();
+            pmf.setConnectionURL(url);
+            pm  = pmf.getPersistenceManager(username, password);
+        } 
+        catch (Exception ex) {
+            fail(ASSERTION_FAILED,
+                 "unexpected exception " + ex);
+        }
+        finally { 
+            if (debug) logger.debug("Persistence Manager obtained: " + pm); 
+            if (pm != null) pm.close();
+        }
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetPersistenceManagerForUser.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetProperties.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetProperties.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetProperties.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetProperties.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,77 @@
+/*
+ * 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.persistencemanagerfactory;
+
+import java.util.Enumeration;
+import java.util.Properties;
+
+import javax.jdo.PersistenceManagerFactory;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+
+/**
+ *<B>Title:</B>Get properties of PersistenceManagerFactory
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A11.4-1.
+ *<BR>
+ *<B>Assertion Description: </B>
+  PersistenceManagerFactory.getProperties() returns a Properties instance 
+  containing two standard JDO implementation properties
+  VendorName: The name of the JDO vendor. 
+  VersionNumber: The version number string. 
+ */
+
+public class GetProperties extends JDO_Test {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A11.4-1 (GetProperties) 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(GetProperties.class);
+    }
+
+    /** */
+    public void test() {
+       PersistenceManagerFactory pmf = getPMF();
+       int foundStandardProperties = 0;
+
+       Properties p = pmf.getProperties();
+       for (Enumeration e = p.propertyNames(); e.hasMoreElements(); ) {
+           String s = (String) e.nextElement();
+           if (debug) logger.debug ("\t" + s + ": " + p.getProperty(s));
+           
+           if (s.equals("VendorName") || s.equals("VersionNumber")) {
+               foundStandardProperties++;
+           }
+       }
+       
+       if (foundStandardProperties != 2) {
+           fail(ASSERTION_FAILED,
+                "Standard properties not found.");
+       }
+    }  
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/GetProperties.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetConnectionPassword.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetConnectionPassword.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetConnectionPassword.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetConnectionPassword.java Mon Apr  4 12:41:23 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.persistencemanagerfactory;
+
+import java.util.Properties;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+
+/**
+ *<B>Title:</B>Set ConnectionPassword of persistencemanagerfactory  
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A11.1-15.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * PersistenceManagerFactory.setConnectionPassword(String
+password) sets the value of the ConnectionPassword property (the password for the user)
+ */
+
+public class SetConnectionPassword extends JDO_Test {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A11.1-15 (SetConnectionPassword) 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(SetConnectionPassword.class);
+    }
+
+    private PersistenceManagerFactory   pmf;
+    private PersistenceManager          pm;
+    private String 			pmfClass;
+    private String                      url;
+    private String 			username;
+    private String 			password;
+
+    private static  String  		PMFCLASS = "javax.jdo.PersistenceManagerFactoryClass";
+    private static  String  		URL      = "javax.jdo.option.ConnectionURL";
+    private static  String  		USERNAME = "javax.jdo.option.ConnectionUserName";
+    private static  String  		PASSWORD = "javax.jdo.option.ConnectionPassword";
+
+    /** set ConnectionPassword */ 
+    public void test() {
+        Properties props = loadProperties(PMFProperties);
+        pmfClass = props.getProperty(PMFCLASS);  
+        url      = props.getProperty(URL);
+        username = props.getProperty(USERNAME);  
+        password = props.getProperty(PASSWORD);  
+        
+        try {
+            Class cl = Class.forName(pmfClass);
+            pmf = (PersistenceManagerFactory) cl.newInstance();
+            pmf.setConnectionPassword(password);
+        } catch (Exception ex) {
+            fail(ASSERTION_FAILED,
+                 "Failed in setting ConnectionPassword " + ex);
+        } 
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetConnectionPassword.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetConnectionURL.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetConnectionURL.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetConnectionURL.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetConnectionURL.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,93 @@
+/*
+ * 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.persistencemanagerfactory;
+
+import java.util.Properties;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+
+/**
+ *<B>Title:</B>Set ConnectionURL of PersistenceManagerFactory  
+ *<BR>
+ *<B>Keywords:</B> persistencemanagerfactory
+ *<BR>
+ *<B>Assertion IDs:</B> A11.1-16,A11.1-17.
+ *<BR>
+ *<B>Assertion Description: </B>
+ * PersistenceManagerFactory.setConnectionURL(String URL) sets the value of the ConnectionURL property (the URL for the data source).
+ * PersistenceManagerFactory.getConnectionURL() returns the value of the ConnectionURL property. 
+ */
+
+public class SetConnectionURL extends JDO_Test {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A11.1-16,A11.1-17 (SetConnectionURL) 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(SetConnectionURL.class);
+    }
+
+    private PersistenceManagerFactory   pmf;
+    private PersistenceManager          pm;
+    private String 			pmfClass;
+    private String                      url;
+    private String 			username;
+    private String 			password;
+
+    private static  String  		PMFCLASS = "javax.jdo.PersistenceManagerFactoryClass";
+    private static  String  		URL      = "javax.jdo.option.ConnectionURL";
+    private static  String  		USERNAME = "javax.jdo.option.ConnectionUserName";
+    private static  String  		PASSWORD = "javax.jdo.option.ConnectionPassword";
+
+ 
+    /** set ConnectionURL value and get ConnectionURL value to verify */ 
+    public void test() {
+        Properties props = loadProperties(PMFProperties);
+        pmfClass = props.getProperty(PMFCLASS);  
+        url      = props.getProperty(URL);
+        username = props.getProperty(USERNAME);  
+        password = props.getProperty(PASSWORD);  
+
+        try {
+            Class cl = Class.forName(pmfClass);
+            pmf = (PersistenceManagerFactory) cl.newInstance();
+            pmf.setConnectionURL(url);
+            if (!url.equals(pmf.getConnectionURL())) {
+                fail(ASSERTION_FAILED,
+                     "ConnectionURL " + url + 
+                     " not equal to value returned by PMF " +
+                     pmf.getConnectionURL());
+            }
+        }
+        catch (Exception ex) {
+            fail(ASSERTION_FAILED,
+                 "Failed in setting ConnectionURL" + ex);
+        }
+        if (debug) logger.debug("ConnectionURL: " + pmf.getConnectionURL()); 
+    }
+}

Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/SetConnectionURL.java
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message