db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r158179 [5/61] - in incubator/jdo/trunk/tck11: ./ assertions/ iut_jars/ test/ test/conf/ test/java/ test/java/org/ test/java/org/apache/ test/java/org/apache/jdo/ test/java/org/apache/jdo/tck/ test/java/org/apache/jdo/tck/api/ test/java/org/apache/jdo/tck/api/instancecallbacks/ test/java/org/apache/jdo/tck/api/jdohelper/ test/java/org/apache/jdo/tck/api/persistencemanager/ test/java/org/apache/jdo/tck/api/persistencemanagerfactory/ test/java/org/apache/jdo/tck/enhancement/ test/java/org/apache/jdo/tck/extents/ test/java/org/apache/jdo/tck/lifecycle/ test/java/org/apache/jdo/tck/lifecycle/nontransactional/ test/java/org/apache/jdo/tck/models/ test/java/org/apache/jdo/tck/models/embedded/ test/java/org/apache/jdo/tck/models/fieldtypes/ test/java/org/apache/jdo/tck/models/inheritance/ test/java/org/apache/jdo/tck/pc/ test/java/org/apache/jdo/tck/pc/company/ test/java/org/apache/jdo/tck/pc/fieldtypes/ test/java/org/apache/jdo/tck/pc/inheritance/ test/java/org/apache/jdo/tck/pc/instancecallbacks/ test/java/org/apache/jdo/tck/pc/lifecycle/ test/java/org/apache/jdo/tck/pc/mylib/ test/java/org/apache/jdo/tck/query/ test/java/org/apache/jdo/tck/query/operators/ test/java/org/apache/jdo/tck/transactions/ test/java/org/apache/jdo/tck/util/ test/jdo/ test/jdo/applicationidentity/ test/jdo/applicationidentity/org/ test/jdo/applicationidentity/org/apache/ test/jdo/applicationidentity/org/apache/jdo/ test/jdo/applicationidentity/org/apache/jdo/tck/ test/jdo/applicationidentity/org/apache/jdo/tck/pc/ test/jdo/applicationidentity/org/apache/jdo/tck/pc/company/ test/jdo/applicationidentity/org/apache/jdo/tck/pc/fieldtypes/ test/jdo/applicationidentity/org/apache/jdo/tck/pc/inheritance/ test/jdo/applicationidentity/org/apache/jdo/tck/pc/instancecallbacks/ test/jdo/applicationidentity/org/apache/jdo/tck/pc/lifecycle/ test/jdo/applicationidentity/org/apache/jdo/tck/pc/mylib/ test/jdo/datastoreidentity/ test/jdo/datastoreidentity/org/ test/jdo/datastoreidentity/org/apache/ test/jdo/datastoreidentity/org/apache/jdo/ test/jdo/datastoreidentity/org/apache/jdo/tck/ test/jdo/datastoreidentity/org/apache/jdo/tck/pc/ test/jdo/datastoreidentity/org/apache/jdo/tck/pc/company/ test/jdo/datastoreidentity/org/apache/jdo/tck/pc/fieldtypes/ test/jdo/datastoreidentity/org/apache/jdo/tck/pc/inheritance/ test/jdo/datastoreidentity/org/apache/jdo/tck/pc/instancecallbacks/ test/jdo/datastoreidentity/org/apache/jdo/tck/pc/lifecycle/ test/jdo/datastoreidentity/org/apache/jdo/tck/pc/mylib/
Date Sat, 19 Mar 2005 01:09:44 GMT
Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/IsPersistentNotPersistenceCapable.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/IsPersistentNotPersistenceCapable.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/IsPersistentNotPersistenceCapable.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/IsPersistentNotPersistenceCapable.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,75 @@
+/*
+ * 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.jdohelper;
+
+import javax.jdo.JDOHelper;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.mylib.Point;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Is Persistent Not Persistence Capable
+ *<BR>
+ *<B>Keywords:</B> jdohelper 
+ *<BR>
+ *<B>Assertion ID:</B> A8.4.3-4
+ *<BR>
+ *<B>Assertion Description: </B>
+  The jdohelper.isPersistent method returns false If the instance does not implement PersistenceCapable
+  evaluating to true when == is used. 
+ */
+ /*
+ * Revision History
+ * ================
+ * Author         :   	Date   : 	Version  
+ * Azita Kamangar  	10/2/01		 1.0
+ */
+ 
+public class IsPersistentNotPersistenceCapable extends JDO_Test {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A8.4.3-4 (IsPersistentNotPersistenceCapable) 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(IsPersistentNotPersistenceCapable.class);
+    }
+
+    /* test JDOHelper.isPersistent(Object pc)
+     *  
+     */
+    public void testIsPersistentNotPersistenceCapable() {
+    	pm = getPM();
+    	Transaction tx = pm.currentTransaction();
+    	tx.begin();
+    	Point p1 = new Point(1,3);
+    	boolean persistent = JDOHelper.isPersistent(p1);
+    	tx.commit();
+    	if (persistent)
+    		fail(ASSERTION_FAILED,
+                 "JDOHelper.isPersistent returns false for instance of non-pc class.");
+        pm.close();
+        pm = null;
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/IsTransactional.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/IsTransactional.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/IsTransactional.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/IsTransactional.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.api.jdohelper;
+
+import javax.jdo.JDOHelper;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Is Transactional
+ *<BR>
+ *<B>Keywords:</B> jdohelper 
+ *<BR>
+ *<B>Assertion ID:</B> A8.4.2-1
+ *<BR>
+ *<B>Assertion Description: </B>
+  The jdohelper.isTransactional method returns true and delegates to the parameter instance 
+  and instances whose state is associated with the current transaction .  evaluating to true when == is used. 
+ */
+ /*
+ * Revision History
+ * ================
+ * Author         :   	Date   : 	Version  
+ * Azita Kamangar  	10/4/01		 1.0
+ */
+public class IsTransactional extends JDO_Test {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A8.4.2-1 (IsTransactional) 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(IsTransactional.class);
+    }
+ 
+    /* test JDOHelper.IsTransactional(Object pc)
+     *  
+     */
+    public void testIsTransactional() {
+    	pm = getPM();
+    	Transaction tx = pm.currentTransaction();
+    	tx.begin();
+    	PCPoint p1 = new PCPoint(1,3);
+    	pm.makePersistent(p1);
+        boolean transactional = JDOHelper.isTransactional(p1);
+        tx.commit();
+        if (!transactional)
+            fail(ASSERTION_FAILED,
+                 "JDOHelper.isTransactional returns false for P-NEW instance");
+
+        tx.begin();
+        // check transactional flag in new tx  
+        transactional = JDOHelper.isTransactional(p1);
+        tx.commit();
+        if (transactional)
+            fail(ASSERTION_FAILED,
+                 "JDOHelper.isTransactional returns true for P-HOLLOW/P-NONTX instance");
+        pm.close();
+        pm = null;
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/IsTransactionalFalse.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/IsTransactionalFalse.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/IsTransactionalFalse.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/IsTransactionalFalse.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.api.jdohelper;
+
+import javax.jdo.JDOHelper;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Is Transactional False
+ *<BR>
+ *<B>Keywords:</B> jdohelper 
+ *<BR>
+ *<B>Assertion ID:</B> A8.4.2-2
+ *<BR>
+ *<B>Assertion Description: </B>
+  The jdohelper.isTransactional method returns false and delegates to the parameter
+instance and instances whose state is not associated with the current transaction return false. 
+ */
+ /*
+ * Revision History
+ * ================
+ * Author         :   	Date   : 	Version  
+ * Azita Kamangar  	10/4/01		 1.0
+ */
+public class IsTransactionalFalse extends JDO_Test {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A8.4.2-2 (IsTransactionalFalse) 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(IsTransactionalFalse.class);
+    }
+ 
+    /* test JDOHelper.IsTransactionalFalse(Object pc)
+     *  
+     */
+    public void testIsTransactionalFalse() {
+    	pm = getPM();
+    	Transaction tx = pm.currentTransaction();
+    	tx.begin();
+    	PCPoint p1 = new PCPoint(1,3);
+    	pm.makePersistent(p1);
+    	tx.commit();
+          
+    	tx.begin();
+    	boolean transactional = JDOHelper.isTransactional(p1);
+    	tx.commit();
+    	if (transactional)
+    		fail(ASSERTION_FAILED,
+                 "JDOHelper.isTransactional returns true for P-HOLLOW/P-NONTX instance");
+          
+    	tx.begin();
+    	// access field to make sure the instance is P-CLEAN
+    	p1.getX();
+    	transactional = JDOHelper.isTransactional(p1);
+    	tx.commit();
+    	if (!transactional)
+    		fail(ASSERTION_FAILED,
+                 "JDOHelper.isTransactional returns false for P-CLEAN instance");
+
+    	pm.close();
+        pm = null;
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/IsTransactionalForNull.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/IsTransactionalForNull.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/IsTransactionalForNull.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/IsTransactionalForNull.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,72 @@
+/*
+ * 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.jdohelper;
+
+import javax.jdo.JDOHelper;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Is Transactional For Null
+ *<BR>
+ *<B>Keywords:</B> jdohelper 
+ *<BR>
+ *<B>Assertion ID:</B> A8.4.2-5
+ *<BR>
+ *<B>Assertion Description: </B>
+  The jdohelper.isTransactional method returns false, if the instance is null.
+ */
+ /*
+ * Revision History
+ * ================
+ * Author         :   	Date   : 	Version  
+ * Azita Kamangar  	10/4/01		 1.0
+ */
+public class IsTransactionalForNull extends JDO_Test {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A8.4.2-5 (IsTransactionalForNull) 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(IsTransactionalForNull.class);
+    }
+
+    /* test JDOHelper.IsTransactionalForNull(Object pc)
+     *  
+     */
+    public void testIsTransactionalForNull() {
+    	pm = getPM();
+    	Transaction tx = pm.currentTransaction();
+    	tx.begin();
+    	Object p1 = null;
+        boolean transactional = JDOHelper.isTransactional(p1);
+        tx.commit();
+        if (transactional)
+            fail(ASSERTION_FAILED,
+                 "JDOHelper.isTransactional with argument null returns true.");
+        pm.close();
+        pm = null;
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/IsTransactionalForTransient.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/IsTransactionalForTransient.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/IsTransactionalForTransient.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/IsTransactionalForTransient.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,73 @@
+/*
+ * 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.jdohelper;
+
+import javax.jdo.JDOHelper;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Is Transactional For Transient
+ *<BR>
+ *<B>Keywords:</B> jdohelper 
+ *<BR>
+ *<B>Assertion ID:</B> A8.4.2-3
+ *<BR>
+ *<B>Assertion Description: </B>
+  The jdohelper.isTransactional method returns false if the instance is transien .  evaluating to true when == is used. 
+ */
+ /*
+ * Revision History
+ * ================
+ * Author         :   	Date   : 	Version  
+ * Azita Kamangar  	10/4/01		 1.0
+ */
+public class IsTransactionalForTransient extends JDO_Test {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A8.4.2-3 (IsTransactionalForTransient) 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(IsTransactionalForTransient.class);
+    }
+
+    /* test JDOHelper.IsTransactionalForTransient(Object pc)
+     *  
+     */
+    public void testIsTransactionalForTransient() {
+    	pm = getPM();
+    	Transaction tx = pm.currentTransaction();
+    	tx.begin();
+    	PCPoint p1 = new PCPoint(1,3);
+    	boolean transactional = JDOHelper.isTransactional(p1);
+    	tx.commit();
+    	if (transactional)
+    		fail(ASSERTION_FAILED,
+                 "JDOHelper.isTransactional returns true for transient instance.");
+    	pm.close();
+        pm = null;
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/IsTransactionalNotPersistenceCapable.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/IsTransactionalNotPersistenceCapable.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/IsTransactionalNotPersistenceCapable.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/IsTransactionalNotPersistenceCapable.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.api.jdohelper;
+
+import javax.jdo.JDOHelper;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.mylib.Point;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Is Transactional Not Persistence Capable
+ *<BR>
+ *<B>Keywords:</B> jdohelper 
+ *<BR>
+ *<B>Assertion ID:</B> A8.4.2-4
+ *<BR>
+ *<B>Assertion Description: </B>
+  The jdohelper.isTransactional method returns false If 
+  the instance does not implement PersistenceCapable .  evaluating to true when == is used. 
+ */
+ /*
+ * Revision History
+ * ================
+ * Author         :   	Date   : 	Version  
+ * Azita Kamangar  	10/4/01		 1.0
+ */
+public class IsTransactionalNotPersistenceCapable extends JDO_Test {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A8.4.2-4 (IsTransactionalNotPersistenceCapable) 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(IsTransactionalNotPersistenceCapable.class);
+    }
+
+    /* test JDOHelper.IsTransactionalNotPersistenceCapable(Object pc)
+     *  
+     */
+    public void testIsTransactionalNotPersistenceCapable() {
+    	pm = getPM(); 
+    	Transaction tx = pm.currentTransaction();
+    	tx.begin();
+    	Point p1 = new Point(1,3);
+        boolean transactional = JDOHelper.isTransactional(p1);
+        tx.commit();
+        if (transactional)
+            fail(ASSERTION_FAILED,
+                 "JDOHelper.isTransactional returns true for instance of non-pc class.");
+        pm.close();
+        pm = null;
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/MakeDirty.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/MakeDirty.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/MakeDirty.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/MakeDirty.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.api.jdohelper;
+
+import javax.jdo.JDOHelper;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Make Dirty 
+ *<BR>
+ *<B>Keywords:</B> jdohelper 
+ *<BR>
+ *<B>Assertion ID:</B> A8.2-1
+ *<BR>
+ *<B>Assertion Description: </B>
+  The jdohelper.makeDirty method delegates to the parameter instance
+   and marks the specified field  dirty if parameter is instance of Persistence
+   capable .  evaluating to true when == is used. 
+ */
+ /*
+ * Revision History
+ * ================
+ * Author         :     Date   :    Version  
+ * Azita Kamangar   10/2/01      1.0
+ */
+public class MakeDirty extends JDO_Test {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A8.2-1 (MakeDirty) 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(MakeDirty.class);
+    }
+
+    /* test JDOHelper.MakeDirty(Object pc)
+     *  
+     */
+    public void testMakeDirty() {
+        pm = getPM();
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+        PCPoint p1 = new PCPoint(1,3);
+        pm.makePersistent(p1);
+        if (debug) logger.debug(" isDirty1:"+ JDOHelper.isDirty(p1));  
+        tx.commit();
+        if (debug) logger.debug(" isDirty2:" + JDOHelper.isDirty(p1));
+        
+        tx.begin();
+        JDOHelper.makeDirty(p1,"x");
+        boolean dirty = JDOHelper.isDirty(p1);
+        tx.commit();
+        if (debug) logger.debug(" isDirty3:" + dirty);
+        if (!dirty)
+            fail(ASSERTION_FAILED,
+                 "Instance is not dirty after calling JDOHelper.makeDirty");
+        pm.close();
+        pm = null;
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/MakeDirtyForNull.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/MakeDirtyForNull.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/MakeDirtyForNull.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/MakeDirtyForNull.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,75 @@
+/*
+ * 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.jdohelper;
+
+import javax.jdo.JDOHelper;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Make Dirty For Null
+ *<BR>
+ *<B>Keywords:</B> jdohelper 
+ *<BR>
+ *<B>Assertion ID:</B> A8.2-3
+ *<BR>
+ *<B>Assertion Description: </B>
+  The JDOHelper.makeDirty method has no affect if the instance is null, 
+  evaluating to true when == is used. 
+ */
+
+/*
+ * Revision History
+ * ================
+ * Author         :     Date   :    Version  
+ * Azita Kamangar   9/27/01      1.0
+ */
+public class MakeDirtyForNull extends JDO_Test {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A8.2-3 (MakeDirtyForNull) 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(MakeDirtyForNull.class);
+    }
+ 
+    /* test JDOHelper.makeDirthy(Object pc)
+     *  
+     */
+    public void testMakeDirtyForNull() {
+        pm = getPM();
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+        Object p1 = null;
+        JDOHelper.makeDirty(p1,"x");
+        boolean dirty = JDOHelper.isDirty(p1);
+        tx.commit();
+        if (dirty)
+            fail(ASSERTION_FAILED,
+                 "null instance is dirty after calling JDOHelper.makeDirty.");
+        pm.close();
+        pm = null;
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/MakeDirtyForTransient.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/MakeDirtyForTransient.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/MakeDirtyForTransient.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/MakeDirtyForTransient.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,78 @@
+/*
+ * 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.jdohelper;
+
+import javax.jdo.JDOHelper;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Make Dirty For Transient
+ *<BR>
+ *<B>Keywords:</B> jdohelper 
+ *<BR>
+ *<B>Assertion ID:</B> A8.2-2
+ *<BR>
+ *<B>Assertion Description: </B>
+  The JDOHelper.makeDirty method has no affect if the instance is transient, 
+  evaluating to true when == is used. 
+ */
+
+/*
+ * Revision History
+ * ================
+ * Author         :     Date   :    Version  
+ * Azita Kamangar   10/3/01      1.0
+ */
+public class MakeDirtyForTransient extends JDO_Test {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A8.2-2 (MakeDirtyForTransient) 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(MakeDirtyForTransient.class);
+    }
+
+    /* test JDOHelper.makeDirthy(Object pc)
+     *  
+     */
+    public void testMakeDirtyForTransient() {
+        pm = getPM();
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+        PCPoint p1 = new PCPoint(1,2);
+        if (debug) logger.debug(" isDirty1:"+ JDOHelper.isDirty(p1));
+        JDOHelper.makeDirty(p1,"x");
+        if (debug) logger.debug(" isDirty2:"+ JDOHelper.isDirty(p1));
+        boolean dirty = JDOHelper.isDirty(p1);
+        tx.commit();
+        if (dirty)
+            fail(ASSERTION_FAILED,
+                 "transient instance is dirty after calling JDOHelper.makeDirty.");
+        pm.close();
+        pm = null;
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/MakeDirtyNotPersistenceCapable.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/MakeDirtyNotPersistenceCapable.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/MakeDirtyNotPersistenceCapable.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/jdohelper/MakeDirtyNotPersistenceCapable.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.api.jdohelper;
+
+import javax.jdo.JDOHelper;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.mylib.Point;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Make Dirty Not Persistence Capable
+ *<BR>
+ *<B>Keywords:</B> jdohelper 
+ *<BR>
+ *<B>Assertion ID:</B> A8.2-4
+ *<BR>
+ *<B>Assertion Description: </B>
+  The JDOHelper.makeDirty method has no affect if the instance is not persistence capable
+  evaluating to true when == is used. 
+ */
+
+/*
+ * Revision History
+ * ================
+ * Author         :     Date   :    Version  
+ * Azita Kamangar   10/3/01      1.0
+ */
+public class MakeDirtyNotPersistenceCapable extends JDO_Test {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A8.2-4 (MakeDirtyNotPersistenceCapable) 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(MakeDirtyNotPersistenceCapable.class);
+    }
+
+    /* test JDOHelper.makeDirthy(Object pc)
+     *  
+     */
+    public void testMakeDirtyNotPersistenceCapable() {
+        pm = getPM();
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+        Point p1 = new Point(1,2);
+        JDOHelper.makeDirty(p1,"x");
+        boolean dirty = JDOHelper.isDirty(p1);
+        tx.commit();
+        if (dirty)
+            fail(ASSERTION_FAILED,
+                 "instance of non-pc class is dirty after calling JDOHelper.makeDirty.");
+        pm.close();
+        pm = null;
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/AfterCloseAllMethodsThrowException.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/AfterCloseAllMethodsThrowException.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/AfterCloseAllMethodsThrowException.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/AfterCloseAllMethodsThrowException.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import javax.jdo.JDOFatalUserException;
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> AfterCloseAllMethodsThrowException
+ *<BR>
+ *<B>Keywords:</B> exception
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5-6
+ *<BR>
+ *<B>Assertion Description: </B>
+After the PersistenceManager.close method completes,
+all methods on PersistenceManager except isClosed throw a
+JDOFatalUserException.
+
+ */
+
+public class AfterCloseAllMethodsThrowException extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5-6 (AfterCloseAllMethodsThrowException) 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(AfterCloseAllMethodsThrowException.class);
+    }
+    
+    private PersistenceManagerFactory   pmf;
+    private PersistenceManager          pm;
+    private Transaction                 tx;
+
+    /** */
+    public void testAfterCloseAllMethodsThrowException() {
+    	pm = getPM();
+    	pm.close();
+    	runTestEvict();
+    	runTestRefresh();
+    	runTestIsClosed();
+        pm = null;
+   }
+
+    /** */
+    private void runTestEvict() {
+    	try {
+    		pm.evictAll();
+            fail(ASSERTION_FAILED, 
+                 "pm.evictAll does not throw exception if pm is closed.");
+    	}
+    	catch (JDOFatalUserException ex) {
+            // caught expected exception
+    	}
+    }
+
+    /** */
+    private void runTestRefresh() {
+    	try {
+    		pm.refreshAll();
+            fail(ASSERTION_FAILED, 
+                 "pm.refreshAll does not throw exception if pm is closed.");
+    	}
+    	catch (JDOFatalUserException ex) {
+            // caught expected exception
+    	}
+   }
+
+    /** */
+    private void runTestIsClosed() {
+        if (!pm.isClosed())
+            fail(ASSERTION_FAILED, 
+                 "pm.isClosed returns false for closed pm.");
+    }
+}
+

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/CallingEvictAllWithCollectionContainingNulls.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/CallingEvictAllWithCollectionContainingNulls.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/CallingEvictAllWithCollectionContainingNulls.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/CallingEvictAllWithCollectionContainingNulls.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import java.util.Collection;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Calling EvictAll With Collection Containing Nulls
+ *<BR>
+ *<B>Keywords:</B> cache
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5-11
+ *<BR>
+ *<B>Assertion Description: </B>
+Passing a non-null Object[] or Collection arguments to evictAll that
+contain null elements will have the documented behavior for non-null elements, and the null elements
+will be ignored.
+
+ */
+
+public class CallingEvictAllWithCollectionContainingNulls extends PersistenceManagerTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5-11 (CallingEvictAllWithCollectionContainingNulls) 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(CallingEvictAllWithCollectionContainingNulls.class);
+    }
+    
+    private PCPoint p1;
+    private PCPoint p2;
+    private PCPoint p3;
+    private PCPoint p4;
+    private PCPoint p5;
+
+    /** */
+    public void testCallingEvictAllWithCollectionContainingNulls() {
+        pm = getPM();
+        createObjects(pm);
+        runTestEvictAll1(pm);
+        runTestEvictAll2(pm);
+        pm.close();
+        pm = null;
+    }
+    
+    /** */
+    private void createObjects(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            p1 = new PCPoint (1,3);
+            p2 = new PCPoint (4,3);
+            p3 = new PCPoint (4,2);
+            p4 = new PCPoint (3,3);
+            
+            pm.makePersistent(p1);
+            pm.makePersistent(p2);
+            pm.makePersistent(p3);
+            pm.makePersistent(p4);
+         
+            tx.commit();
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+    
+    /* test evictAll (Collection col1) */
+    private void runTestEvictAll1(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            
+            PCPoint p5 = null;
+            Collection col1 = new java.util.HashSet();
+            col1.add (p1);
+            col1.add (p5);
+            col1.add (p2);
+            
+            pm.evictAll(col1);
+            if (debug) logger.debug(" \nPASSED in testEvictAll1()");
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+    
+    /** test evictAll (Object[] objArray) */
+    private void runTestEvictAll2(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            
+            PCPoint p5 = null;
+            Collection col1 = new java.util.HashSet();
+            col1.add (p3);
+            col1.add (p4);
+            col1.add (p5);
+            
+            pm.evictAll(col1.toArray());
+            if (debug) logger.debug(" \nPASSED in testEvictAll2()");
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/CallingRefreshAllWithCollectionContainingNulls.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/CallingRefreshAllWithCollectionContainingNulls.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/CallingRefreshAllWithCollectionContainingNulls.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/CallingRefreshAllWithCollectionContainingNulls.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import java.util.Collection;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Calling RefreshAll With Collection Containing Nulls
+ *<BR>
+ *<B>Keywords:</B> cache
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5-12
+ *<BR>
+ *<B>Assertion Description: </B>
+Passing a non-null Object[] or Collection arguments to refreshAll that
+contain null elements will have the documented behavior for non-null elements, and the null
+elements will be ignored.
+
+ */
+
+public class CallingRefreshAllWithCollectionContainingNulls extends PersistenceManagerTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5-12 (CallingRefreshAllWithCollectionContainingNulls) 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(CallingRefreshAllWithCollectionContainingNulls.class);
+    }
+    
+    private PCPoint p1;
+    private PCPoint p2;
+    private PCPoint p3;
+    private PCPoint p4;
+    private PCPoint p5;
+
+    /** */
+    public void testCallingRefreshAllWithCollectionContainingNulls() {
+    	pm = getPM();  
+    	createObjects(pm);
+    	runTestRefreshAll1(pm);
+    	runTestRefreshAll2(pm);
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    private void createObjects(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+        	tx.begin();
+        	p1 = new PCPoint (1,3);
+        	p2 = new PCPoint (2,3);
+        	p3 = new PCPoint (4,2);
+        	p4 = new PCPoint (3,3);
+
+        	pm.makePersistent(p1);
+        	pm.makePersistent(p2);
+        	pm.makePersistent(p3);
+        	pm.makePersistent(p4);
+
+        	tx.commit();
+        }
+        finally {
+        	if (tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /**  test refreshAll (Collection col1) */
+    private void runTestRefreshAll1(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+        	tx.begin();
+
+        	PCPoint p5 = null;
+        	Collection col1 = new java.util.HashSet();
+        	col1.add (p1);
+        	col1.add (p5);
+        	col1.add (p2);
+
+        	pm.refreshAll(col1);
+        	if (debug) logger.debug(" \nPASSED in testRefreshAll1()");
+        	tx.rollback();
+        }
+        finally {
+        	if (tx.isActive())
+        		tx.rollback();
+        }
+    }
+
+
+    /* test refreshAll (Object[] objArray) */
+    private void runTestRefreshAll2(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {           	
+        	tx.begin();
+
+        	PCPoint p5 = null;
+        	Collection col1 = new java.util.HashSet();
+        	col1.add (p3);
+        	col1.add (p4);
+        	col1.add (p5);
+          
+        	pm.refreshAll(col1.toArray());
+        	if (debug) logger.debug(" \nPASSED in testRefreshAll2()");
+        	tx.rollback();
+        } 
+        finally {
+        	if (tx.isActive())
+        		tx.rollback();
+        }
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/ChangingObjectIdHasNoEffectOnInstance.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/ChangingObjectIdHasNoEffectOnInstance.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/ChangingObjectIdHasNoEffectOnInstance.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/ChangingObjectIdHasNoEffectOnInstance.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Changing ObjectId Has No Effect On Instance
+ *<BR>
+ *<B>Keywords:</B> identity
+ *<BR>
+ *<B>Assertion ID:</B> A12.5.6-13.
+ *<BR>
+ *<B>Assertion Description: </B>
+If the application makes a change to the <code>ObjectId</code> instance
+returned by <code>PersistenceManager.getObjectId</code>, there is no effect
+on the instance from which the <code>ObjectId</code> was obtained.
+
+ */
+
+public class ChangingObjectIdHasNoEffectOnInstance extends PersistenceManagerTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.6-13 (ChangingObjectIdHasNoEffectOnInstance) 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(ChangingObjectIdHasNoEffectOnInstance.class);
+    }
+
+    /** */
+    public void testChangingObjectIdHasNoEffectOnInstance() throws Exception {
+        pm = getPM();
+        Object oid = createPCPointInstance(pm);
+        Object p1 = pm.getObjectById(oid, false);
+        Object oid2 = pm.getObjectId(p1);
+        
+        mangleObject(oid);
+        // now oid3 should equal oid2 even though we mangled oid
+        Object oid3 = getPM().getObjectId(p1);
+        if (!oid2.equals(oid3))
+        	fail(ASSERTION_FAILED,
+        	     "Changing the ObjectId returned by getObjectId has an effect on ObjectId's returned by subsequent calls of getObjectId");
+        pm.close();
+        pm = null;
+    }          
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/CloseThrowsExceptionWhenActiveTx.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/CloseThrowsExceptionWhenActiveTx.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/CloseThrowsExceptionWhenActiveTx.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/CloseThrowsExceptionWhenActiveTx.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import javax.jdo.JDOUserException;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Close Throws Exception
+ *<BR>
+ *<B>Keywords:</B> exception
+ *<BR>
+ *<B>Assertion IDs:</B> A12.6-2.
+ *<BR>
+ *<B>Assertion Description: </B>
+In a non-managed environment, if the current transaction is active, close throws JDOUserException.
+ */
+
+public class CloseThrowsExceptionWhenActiveTx extends JDO_Test {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.6-2 (CloseThrowsExceptionWhenActiveTx) 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(CloseThrowsExceptionWhenActiveTx.class);
+    }
+
+    /** */
+    public void test() {
+        pm = getPM();
+        pm.currentTransaction().begin();
+
+		try {
+			pm.close();
+			fail(ASSERTION_FAILED, "JDOUserException was not thrown when closing PersistenceManager while transaction was open");
+        }
+		catch (JDOUserException juex) {
+			// expected this exception
+        }
+		finally {
+			pm.currentTransaction().rollback();
+		}
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/ConcurrentPersistenceManagers.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/ConcurrentPersistenceManagers.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/ConcurrentPersistenceManagers.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/ConcurrentPersistenceManagers.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import java.util.Properties;
+
+import javax.jdo.JDOHelper;
+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> Concurrent Persistence Managers
+ *<BR>
+ *<B>Keywords:</B> concurrency multipleJDOimpls
+ *<BR>
+ *<B>Assertion ID:</B> A5.2-1.
+ *<BR>
+ *<B>Assertion Description: </B>
+An implementation should support its own <code>PersistenceManager</code>
+concurrently with another <code>PersistenceManager</code>.
+A non-reference implementation will be tested concurrently
+with the Reference Implementation.
+
+ */
+
+public class ConcurrentPersistenceManagers extends JDO_Test {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A5.2-1 (ConcurrentPersistenceManagers) 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(ConcurrentPersistenceManagers.class);
+    }
+
+    /** */
+    public void test() {
+    	Properties pmfProperties = loadPMF2Properties();
+    	PersistenceManagerFactory pmf2 = JDOHelper.getPersistenceManagerFactory(pmfProperties);
+    	PersistenceManager pm2 = pmf2.getPersistenceManager();
+    	Transaction tx2 = pm2.currentTransaction();
+        pm = getPM();
+    	Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            tx2.begin();
+            tx.commit();
+            tx = null;
+            tx2.commit();
+            tx2 = null;
+        }
+        finally {
+            cleanupPM(pm);
+            pm = null;
+            cleanupPM(pm2);
+            pm2 = null;
+            pmf2.close();
+        }
+    }
+
+    private Properties loadPMF2Properties() {
+    	String PMF2 = System.getProperty ("PMF2Properties", "jdori2.properties");
+    	if (debug) logger.debug("Got PMF2Properties file name:" + PMF2);
+    	Properties ret = loadProperties (PMF2);
+    	if (debug) logger.debug("Got PMF2Properties: " + ret);
+    	return ret;
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/ConcurrentPersistenceManagersSameClasses.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/ConcurrentPersistenceManagersSameClasses.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/ConcurrentPersistenceManagersSameClasses.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/ConcurrentPersistenceManagersSameClasses.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,137 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+
+import javax.jdo.JDOHelper;
+import javax.jdo.PersistenceManager;
+import javax.jdo.PersistenceManagerFactory;
+import javax.jdo.Query;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.pc.mylib.PCRect;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Same Classes with Concurrent Persistence Managers
+ *<BR>
+ *<B>Keywords:</B> concurrency multipleJDOimpls
+ *<BR>
+ *<B>Assertion ID:</B> A5.2-2.
+ *<BR>
+ *<B>Assertion Description: </B>
+The same classes must be supported concurrently by multiple
+<code>PersistenceManager</code>s from different implementations.
+
+ */
+
+public class ConcurrentPersistenceManagersSameClasses extends JDO_Test {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A5.2-2 (ConcurrentPersistenceManagersSameClasses) 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(ConcurrentPersistenceManagersSameClasses.class);
+    }
+    
+    /** */
+    public void test() {
+    	Properties pmfProperties = loadPMF2Properties();
+        PersistenceManagerFactory pmf2 = JDOHelper.getPersistenceManagerFactory(pmfProperties);
+        PersistenceManager pm2 = pmf2.getPersistenceManager();
+        Transaction tx2 = pm2.currentTransaction();
+        
+        pm = getPM();
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            tx2.begin();
+            
+            PCPoint p11 = new PCPoint(110, 120);
+            PCPoint p12 = new PCPoint(120, 140);
+            PCRect rect1 = new PCRect (0, p11, p12);
+            pm.makePersistent (rect1);
+            
+            PCPoint p21 = new PCPoint(210, 220);
+            PCPoint p22 = new PCPoint(220, 240);
+            PCRect rect2 = new PCRect (0, p21, p22);
+            pm2.makePersistent (rect2);
+            
+            tx.commit();
+            tx2.commit();
+        
+            tx.begin();
+            tx2.begin();
+            
+            PCPoint p11a = findPoint (pm, 110, 120);
+            if (p11a != p11) {
+                fail(ASSERTION_FAILED, 
+                     "unexpected PCPoint instance, expected: 110, 120, found: " + p11a.getX() + ", " + p11a.getY());
+            }
+            
+            PCPoint p21a = findPoint (pm2, 210, 220);
+            if (p21a != p21) {
+                fail(ASSERTION_FAILED, 
+                     "unexpected PCPoint instance, expected: 210, 220, found: " + p21a.getX() + ", " + p21a.getY());
+            }
+            
+            tx.commit();
+            tx = null;
+            tx2.commit();
+            tx2 = null;
+        }
+        finally {
+            cleanupPM(pm);
+            pm = null;
+            cleanupPM(pm2);
+            pm2 = null;
+            pmf2.close();
+        }
+    }
+
+    /** */
+    private Properties loadPMF2Properties() {
+        String PMF2 = System.getProperty ("PMF2Properties", "jdori2.properties");
+        if (debug) logger.debug("Got PMF2Properties file name:" + PMF2);
+        Properties ret = loadProperties (PMF2);
+        if (debug) logger.debug("Got PMF2Properties: " + ret);
+        return ret;
+    }
+
+    /** */
+    private PCPoint findPoint (PersistenceManager pm, int x, int y) {
+        Query q = pm.newQuery (PCPoint.class);
+        q.declareParameters ("int px, int py");
+        q.setFilter ("x == px & y == py");
+        Collection results = (Collection)q.execute (new Integer(x), new Integer(y));
+        Iterator it = results.iterator();
+        PCPoint ret = (PCPoint)it.next();
+        return ret;
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/CurrentTransaction.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/CurrentTransaction.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/CurrentTransaction.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/CurrentTransaction.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> CurrentTransaction
+ *<BR>
+ *<B>Keywords:</B>
+ *<BR>
+ *<B>Assertion ID:</B> A12.5.2-1
+ *<BR>
+ *<B>Assertion Description: </B>
+The PersistenceManager.currentTransaction method returns the
+Transaction instance associated with the PersistenceManager.
+
+ */
+
+public class CurrentTransaction extends PersistenceManagerTest {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.2-1 (CurrentTransaction) 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(CurrentTransaction.class);
+    }
+    
+    /** */
+    public void testCurrentTransaction() {
+        pm = getPM();
+        PCPoint p1 = new PCPoint();
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+        pm.makePersistent(p1);
+        tx.commit();
+        pm.close();
+        pm = null;
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/DeletePersistent.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/DeletePersistent.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/DeletePersistent.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/DeletePersistent.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,254 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import java.util.Collection;
+import 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;
+
+/**
+ *<B>Title:</B> Delete Persistent
+ *<BR>
+ *<B>Keywords:</B>
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.7-9
+ *<BR>
+ *<B>Assertion Description: </B>
+PersistenceManager.deletePersistent and deletePersistentAll delete a persistent instance(s) from the data store. It must be called in the context of an active transaction, or a JDOUserExceptionis thrown. The representation in the data store will be deleted when this instance is flushed to the data store (via commit, or evict).
+
+ */
+
+public class DeletePersistent extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.7-9 (DeletePersistent) 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(DeletePersistent.class);
+    }
+    
+    private PCPoint p1 = null;
+    private PCPoint p2 = null;
+    private PCPoint p3 = null;
+    private PCPoint p4 = null;
+    private PCPoint p5 = null;
+
+    /** */
+    public void testDeletePersistent() {
+        pm = getPM();   
+        createObjects(pm);
+
+        /* positive tests */
+        /* method called in the context of an active transaction */
+        runTestDeletePersistent1(pm);
+        runTestDeletePersistent2(pm);
+        runTestDeletePersistent3(pm);
+
+        /* negative tests */
+        /* method called in the context of an non-active transaction */
+        runTestDeletePersistent4(pm);
+        runTestDeletePersistent5(pm);
+        runTestDeletePersistent6(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    private void  createObjects(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            p1 = new PCPoint(1,3);
+            p2 = new PCPoint(2,4);
+            p3 = new PCPoint(3,5);
+            p4 = new PCPoint(4,6);
+            p5 = new PCPoint(5,7);
+
+            pm.makePersistent(p1);
+            pm.makePersistent(p2);
+            pm.makePersistent(p3);
+            pm.makePersistent(p4);
+            pm.makePersistent(p5);
+
+            tx.commit();
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** test deletePersistent (Object pc) */
+    private void runTestDeletePersistent1(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx = pm.currentTransaction();
+            tx.begin();
+            pm.deletePersistent(p1);
+            tx.commit();
+            if (debug) logger.debug(" \nPASSED in testDeletePersistent1()");
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }        
+    }
+
+    /* test deletePersistentAll (Collection pcs) */
+    private void runTestDeletePersistent2(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Collection col1 = new java.util.HashSet();
+            col1.add(p2);
+            col1.add(p3);
+
+            pm.deletePersistentAll(col1);
+            tx.commit();
+            if (debug) logger.debug(" \nPASSED in testDeletePersistent2()");
+        } 
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }   
+    }
+
+    /* test deletePersistentAll (Object[] o) */
+    private void runTestDeletePersistent3(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Collection col1 = new HashSet();
+            col1.add(p4);
+            col1.add(p5);
+
+            Object[] obj1= col1.toArray();
+
+            pm.deletePersistentAll(obj1);
+            tx.commit();
+            if (debug) logger.debug(" \nPASSED in testDeletePersistent3()");
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /* test deletePersistent (Object pc) */
+    public void runTestDeletePersistent4(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            PCPoint np1 = new PCPoint(1,3);
+            pm.makePersistent(np1);
+            tx.commit();
+            
+            try {
+                pm.deletePersistent(np1);
+                fail(ASSERTION_FAILED, 
+                     "pm.deletePersistent(Object) outside of tx should throw an exception");
+            }
+            catch (JDOUserException ex) {
+                // expected exception
+            }
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /* test deletePersistentAll (Collection pcs) */
+    public void runTestDeletePersistent5(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            PCPoint np1 = new PCPoint (3,3);
+            PCPoint np2 = new PCPoint (4,4);
+            pm.makePersistent(np1);
+            pm.makePersistent(np2);
+            tx.commit();
+
+            Collection col1 = new java.util.HashSet();
+            col1.add(np1);
+            col1.add(np2);
+
+            try {
+                pm.deletePersistentAll(col1);
+                fail(ASSERTION_FAILED, 
+                     "pm.deletePersistentAll(Collection) outside of tx should throw an exception");
+            }
+            catch (JDOUserException ex) {
+                // expected exception
+            }
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+   }
+
+    /* test deletePersistentAll (Object[] o) */
+    public void runTestDeletePersistent6(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            
+            PCPoint np1 = new PCPoint (3,3);
+            PCPoint np2 = new PCPoint (4,4);
+            
+            pm.makePersistent(np1);
+            pm.makePersistent(np2);
+            tx.commit();
+            
+            Collection col1 = new java.util.HashSet();
+            col1.add(np1);
+            col1.add(np2);
+            Object[] obj1=col1.toArray();
+            
+            try {
+                pm.deletePersistentAll(obj1);
+                fail(ASSERTION_FAILED, 
+                     "pm.deletePersistentAll(Object[]) outside of tx should throw an exception");
+            }
+            catch (JDOUserException ex) {
+                // expected exception
+            }
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/DeletePersistentAllFails.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/DeletePersistentAllFails.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/DeletePersistentAllFails.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/DeletePersistentAllFails.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,155 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import java.util.Collection;
+
+import javax.jdo.JDOUserException;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.pc.mylib.Point;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> DeletePersistentAll Fails
+ *<BR>
+ *<B>Keywords:</B> exception
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.7-2.
+ *<BR>
+ *<B>Assertion Description: </B>
+If a collection or array of instances is passed to PersistenceManager.deletePersistentAll, and one or more of the instances fail to complete the required operation, then all instances will be attempted, and a JDOUserException will be thrown which contains nested exceptions, each of which contains one of the failing instances. The succeeding instances will transition to the specified life cycle state, and the failing instances will remain in their current state.
+ */
+
+public class DeletePersistentAllFails extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.7-2 (DeletePersistentAllFails) 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(DeletePersistentAllFails.class);
+    }
+    
+    private PCPoint p1 = null;
+    private PCPoint p2 = null;
+    private PCPoint p3 = null;
+    private PCPoint p4 = null;
+    private PCPoint p5 = null;
+    
+    /** */
+    public void testDeletePersistentAllFails() {
+        pm = getPM();
+        createObjects(pm);
+        runTestDeletePersistentAllFails1(pm);
+        runTestDeletePersistentAllFails2(pm);
+        pm.close();
+        pm = null;
+    }
+
+    private void createObjects(PersistenceManager pm) {
+        Transaction tx =  pm.currentTransaction();
+        try {
+            tx.begin();
+            p1 = new PCPoint(1,3);
+            p2 = new PCPoint(2,4);
+            p3 = new PCPoint(3,5);
+            p4 = new PCPoint(4,6);
+            p5 = new PCPoint(5,7);
+
+            pm.makePersistent(p1);
+            pm.makePersistent(p2);
+            pm.makePersistent(p3);
+            pm.makePersistent(p4);
+            pm.makePersistent(p5);
+        
+            tx.commit();
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+    
+    /* test deletePersistentAll (Collection pcs) */
+    private void runTestDeletePersistentAllFails1(PersistenceManager pm) {
+        Transaction tx =  pm.currentTransaction();
+        try {
+            tx.begin();
+            
+            Point np3 =  new Point (5,5);
+            
+            Collection col1 = new java.util.HashSet();
+            col1.add(p1);
+            col1.add(p2);
+            col1.add(np3);
+            
+            try {
+                pm.deletePersistentAll(col1);
+                fail(ASSERTION_FAILED,
+                     "pm.deletePersistentAll(Collection) with non persistent instances should throw an exception");
+            }
+            catch (JDOUserException ex) {
+                // expected exception
+            }
+            tx.rollback();
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+    
+    /* test deletePersistentAll (Object[] o) */
+    private void runTestDeletePersistentAllFails2(PersistenceManager pm) {
+        Transaction tx =  pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Point np3 =  new Point (5,5);
+
+            Collection col1 = new java.util.HashSet();
+            col1.add(p3);
+            col1.add(p4);
+            col1.add(np3);
+            
+            Object[] obj1=col1.toArray();
+
+            try {
+                pm.deletePersistentAll(obj1);
+                fail(ASSERTION_FAILED,
+                     "pm.deletePersistentAll(Object[]) with non persistent instances should throw an exception");
+            }
+            catch (JDOUserException ex) {
+                // expected exception
+            }
+            tx.rollback();
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/DeletePersistentFailsIfInstanceIsTransient.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/DeletePersistentFailsIfInstanceIsTransient.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/DeletePersistentFailsIfInstanceIsTransient.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/DeletePersistentFailsIfInstanceIsTransient.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,146 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import java.util.Collection;
+
+import javax.jdo.JDOUserException;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> DeletePersistent Fails If Instance Is Transient
+ *<BR>
+ *<B>Keywords:</B> exception
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.7-12.
+ *<BR>
+ *<B>Assertion Description: </B>
+PersistenceManager.deletePersistent and deletePersistentAll will throw a JDOUserException if the parameter instance is transient.
+ */
+
+public class DeletePersistentFailsIfInstanceIsTransient extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.7-12 (DeletePersistentFailsIfInstanceIsTransient) 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(DeletePersistentFailsIfInstanceIsTransient.class);
+    }
+    
+    /** */
+    public void testDeletePersistentFailsIfInstanceIsTransient() {
+        pm = getPM();
+        runTestDeletePersistent();
+        runTestDeletePersistentAll1();
+        runTestDeletePersistentAll2();
+        pm.close();
+        pm = null;
+    }
+
+    /* test deletePersistent (Object pc) */
+    private void runTestDeletePersistent() {
+        Transaction tx =  pm.currentTransaction();
+        try {
+
+          tx = pm.currentTransaction();
+          tx.begin();
+          PCPoint p1 = new PCPoint (3,3);
+          try {
+              pm.deletePersistent(p1);
+              fail(ASSERTION_FAILED,
+                   "pm.deletePersistent(Object) with transient instance should throw exception");
+          }
+          catch (JDOUserException ex) {
+              // expected exception
+          } 
+          tx.rollback();
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+
+
+    /* test deletePersistentAll (Collection pcs) */
+    private void runTestDeletePersistentAll1() {
+        Transaction tx =  pm.currentTransaction();
+        try {
+            tx.begin();
+            
+            PCPoint p1 = new PCPoint (3,3);
+            PCPoint p2 = new PCPoint (4,4);
+            
+            Collection col1 = new java.util.HashSet();
+            col1.add(p1);
+            col1.add(p2);
+            
+            try {
+                pm.deletePersistentAll(col1);
+                fail(ASSERTION_FAILED,
+                     "pm.deletePersistent(Collection) with transient instance(s) should throw exception");
+          }
+          catch (JDOUserException ex) {
+              // expected exception
+          } 
+          tx.rollback();
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+   }
+
+    /* test deletePersistentAll (Object[] o) */
+    private void runTestDeletePersistentAll2() {
+        Transaction tx =  pm.currentTransaction();
+        try {
+            tx.begin();
+
+            PCPoint p1 = new PCPoint (3,3);
+            PCPoint p2 = new PCPoint (4,4);
+            
+            Collection col1 = new java.util.HashSet();
+            col1.add(p1);
+            col1.add(p2);
+
+            try {
+                pm.deletePersistentAll(col1.toArray());
+                fail(ASSERTION_FAILED,
+                     "pm.deletePersistent(Object[]) with transient instance(s) should throw exception");
+          }
+          catch (JDOUserException ex) {
+              // expected exception
+          } 
+          tx.rollback();
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+   }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/DeletePersistentFailsIfInstanceManagedByAnotherPersistenceManager.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/DeletePersistentFailsIfInstanceManagedByAnotherPersistenceManager.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/DeletePersistentFailsIfInstanceManagedByAnotherPersistenceManager.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/api/persistencemanager/DeletePersistentFailsIfInstanceManagedByAnotherPersistenceManager.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,179 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+
+package org.apache.jdo.tck.api.persistencemanager;
+
+import java.util.Collection;
+import 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;
+
+/**
+ *<B>Title:</B> DeletePersistent Fails If Instance Managed By Another PersistenceManager
+ *<BR>
+ *<B>Keywords:</B> exception
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.7-11.
+ *<BR>
+ *<B>Assertion Description: </B>
+ PersistenceManager.deletePersistent and deletePersistentAll will throw a JDOUserException if the parameter instance is managed by a different PersistenceManager.
+
+ */
+
+public class DeletePersistentFailsIfInstanceManagedByAnotherPersistenceManager extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.7-11 (DeletePersistentFailsIfInstanceManagedByAnotherPersistenceManager) 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(DeletePersistentFailsIfInstanceManagedByAnotherPersistenceManager.class);
+    }
+
+    private PCPoint p1 = null;
+    private PCPoint p2 = null;
+    private PCPoint p3 = null;
+    private PCPoint p4 = null;
+    private PCPoint p5 = null;
+
+    /** */
+    public void testDeletePersistentFailsIfInstanceManagedByAnotherPersistenceManager() {
+        pm = getPM();
+        PersistenceManager pm2 = getPMF().getPersistenceManager();
+        try {
+            createObjects(pm2);
+        
+            /* positive tests */
+            runTestDeletePersistent(pm);
+            runTestDeletePersistentAll1(pm);
+            runTestDeletePersistentAll2(pm);
+        }
+        finally {
+            cleanupPM(pm2);
+            pm = null;
+            cleanupPM(pm);
+            pm = null;
+        }
+    }
+    
+    /** */
+    private void  createObjects(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            p1 = new PCPoint(1,3);
+            p2 = new PCPoint(2,4);
+            p3 = new PCPoint(3,5);
+            p4 = new PCPoint(4,6);
+            p5 = new PCPoint(5,7);
+            
+            pm.makePersistent(p1);
+            pm.makePersistent(p2);
+            pm.makePersistent(p3);
+            pm.makePersistent(p4);
+            pm.makePersistent(p5);
+            tx.commit();
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /* test deletePersistent (Object pc) */
+    private void runTestDeletePersistent(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            try {
+                pm.deletePersistent(p1);
+                fail(ASSERTION_FAILED,
+                     "pm.deletePersistent(Object) with pc instance managed by another pm should throw exception");
+            }
+            catch (JDOUserException ex) {
+                // expected exception
+            }
+            tx.rollback();
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+    
+    /* test deletePersistentAll (Collection pcs) */
+    private void runTestDeletePersistentAll1(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Collection col1 = new HashSet();
+            col1.add(p2);
+            col1.add(p3);
+
+            try {
+                pm.deletePersistentAll(col1);
+                fail(ASSERTION_FAILED,
+                     "pm.deletePersistent(Collection) with pc instance(s) managed by another pm should throw exception");
+            }
+            catch (JDOUserException ex) {
+                // expected exception
+            } 
+            tx.rollback();
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /* test deletePersistentAll (Object[] o) */
+    private void runTestDeletePersistentAll2(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Collection col1 = new HashSet();
+            col1.add(p4);
+            col1.add(p5);
+            Object[] obj1= col1.toArray();
+            try {
+                pm.deletePersistentAll(obj1);
+                fail(ASSERTION_FAILED,
+                     "pm.deletePersistent(Object[]) with pc instance(s) managed by another pm should throw exception");
+            }
+            catch (JDOUserException ex) {
+                // expected exception
+            } 
+            tx.rollback();
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+}



Mime
View raw message