You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by mc...@apache.org on 2005/04/04 21:43:46 UTC

svn commit: r160090 [9/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/

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectByIdWithValidationInstanceNotInCacheNotInDatastore.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectByIdWithValidationInstanceNotInCacheNotInDatastore.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectByIdWithValidationInstanceNotInCacheNotInDatastore.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectByIdWithValidationInstanceNotInCacheNotInDatastore.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.persistencemanager.getobject;
+
+import javax.jdo.JDOObjectNotFoundException;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Get Object By Id With Validation, Instance Not in Cache, Not in Datastore
+ *<BR>
+ *<B>Keywords:</B> exception
+ *<BR>
+ *<B>Assertion IDs:</B> A12.6.5-2.
+ *<BR>
+ *<B>Assertion Description: </B>
+Object getObjectById (Object oid, boolean validate) with validate==true. If the instance does not exist in the datastore, then a JDOObjectNotFoundException is thrown.
+ */
+
+public class GetObjectByIdWithValidationInstanceNotInCacheNotInDatastore extends JDO_Test {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.6.5-2 (GetObjectByIdWithValidationInstanceNotInCacheNotInDatastore) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(GetObjectByIdWithValidationInstanceNotInCacheNotInDatastore.class);
+    }
+
+    /** */
+    public void test() {
+        pm = getPM();
+        Transaction tx = pm.currentTransaction();
+        tx.setRestoreValues(false); //This should cause eviction of transactional instances when transaction is later rolled back.
+        tx.begin();		
+        PCPoint p1 = new PCPoint (1,3);
+        pm.makePersistent(p1);
+        Object oid = pm.getObjectId(p1);
+        tx.rollback();
+
+        tx.begin();
+        try {
+            PCPoint p2 = (PCPoint) pm.getObjectById(oid, true);
+            fail(ASSERTION_FAILED, "pm.getObjectById(oid, true) should throw JDOObjectNotFoundException, if oid refers to an non existing object");
+        }
+        catch (JDOObjectNotFoundException ex) {
+            // expected exception
+        }
+        finally {
+            tx.rollback();
+        }
+    }
+}

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

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

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

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectIdClass.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectIdClass.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectIdClass.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectIdClass.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.persistencemanager.getobject;
+
+import javax.jdo.PersistenceManager;
+
+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> Get ObjectId Class
+ *<BR>
+ *<B>Keywords:</B> identity
+ *<BR>
+ *<B>Assertion IDs:</B> A12.10-1
+ *<BR>
+ *<B>Assertion Description: </B>
+The method PersistenceManager.getObjectIdClass returns the class of the
+object id for the given class.
+If the parameter class is not persistence-capable, or the parameter is null, 
+ null is returned. If the object-id class defined in the metadata for the 
+ parameter class is abstract then null is returned.
+If the implementation does not support application identity, and the class 
+ is defined in the jdo metadata to use application identity, 
+ then null is returned. 
+ */
+
+public class GetObjectIdClass extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.10-1 (GetObjectIdClass) 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(GetObjectIdClass.class);
+    }    
+
+    /** */
+    public void test() {
+        pm = getPM();
+        runTestGetObjectIdClassForNull(pm);
+        runTestGetObjectIdClassForNonPCClass(pm);
+        runTestGetObjectIdClassForAbstractClass(pm);
+        runTestGetObjectIdClass(pm);
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    private void runTestGetObjectIdClass(PersistenceManager pm) {
+        if (pm.getObjectIdClass(PCPoint.class) == null) {
+            fail(ASSERTION_FAILED,
+                 "pm.getObjectIdClass(PCPoint.class) returned null");
+        }
+    }
+
+    /** */
+    private void runTestGetObjectIdClassForNull(PersistenceManager pm) {
+        Class cl = pm.getObjectIdClass(null);
+        if (cl != null) {
+            fail(ASSERTION_FAILED,
+                 "pm.getObjectIdClass for null returned non-null class: " +
+                 cl.getName());
+        }
+    }
+
+    /** */
+    private void runTestGetObjectIdClassForNonPCClass(PersistenceManager pm) {
+        Class cl = pm.getObjectIdClass(java.lang.Throwable.class);
+        if (cl != null) {
+            fail(ASSERTION_FAILED,
+                 "pm.getObjectIdClass for non-PC class returned non-null class: " +
+                 cl.getName());
+        }
+    }
+
+    private void runTestGetObjectIdClassForAbstractClass(PersistenceManager pm) {
+        // not implemented; the tck contains no classes with which to test this.
+        // we need an abstract class whose object-id class is itself abstract.
+    }
+}

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

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectIdClassForAbstractOrNonPersistenceCapableClass.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectIdClassForAbstractOrNonPersistenceCapableClass.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectIdClassForAbstractOrNonPersistenceCapableClass.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectIdClassForAbstractOrNonPersistenceCapableClass.java Mon Apr  4 12:41:23 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.persistencemanager.getobject;
+
+import javax.jdo.PersistenceManager;
+
+import org.apache.jdo.tck.pc.mylib.Point;
+import org.apache.jdo.tck.util.BatchTestRunner;
+import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest;
+
+/**
+ *<B>Title:</B> Get ObjectId Class For Abstract or Non-PersistenceCapable Class
+ *<BR>
+ *<B>Keywords:</B> identity
+ *<BR>
+ *<B>Assertion IDs:</B> A12.10-2
+ *<BR>
+ *<B>Assertion Description: </B>
+A call to PersistenceManager.getObjectIdClass returns null if the class is abstract or not persistence-capable, or the parameter is null.
+ */
+
+public class GetObjectIdClassForAbstractOrNonPersistenceCapableClass extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.10-2 (GetObjectIdClassForAbstractOrNonPersistenceCapableClass) 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(GetObjectIdClassForAbstractOrNonPersistenceCapableClass.class);
+    }
+
+    /** */
+    public void testGetObjectIdClassForAbstractOrNonPersistenceCapableClass() {
+        pm = getPM();
+        runTestNonPcClass(pm);
+        runTestNullParam(pm);
+        pm.close();
+        pm = null;
+    }
+    
+    /** */
+    private void runTestNonPcClass(PersistenceManager pm) {
+        Class c1 = pm.getObjectIdClass(Point.class);
+        if ( c1 != null) {
+            fail(ASSERTION_FAILED,
+                 "pm.getObjectIdClass returns non-null ObjectId class for non pc class");
+        }
+    }
+
+    /** */
+    private void runTestNullParam(PersistenceManager pm) {
+        Class c1 = pm.getObjectIdClass(null);
+        if (c1 != null) {
+            fail(ASSERTION_FAILED,
+                 "pm.getObjectIdClass for null returned non-null class: " +
+                 c1.getName());    
+        }
+    }
+}

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

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectIdForNullOrNotPersistent.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectIdForNullOrNotPersistent.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectIdForNullOrNotPersistent.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectIdForNullOrNotPersistent.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.api.persistencemanager.getobject;
+
+import javax.jdo.PersistenceManager;
+
+import org.apache.jdo.tck.pc.mylib.Point;
+import org.apache.jdo.tck.util.BatchTestRunner;
+import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest;
+
+/**
+ *<B>Title:</B> GetObjectIdForNullOrNotPersistent
+ *<BR>
+ *<B>Keywords:</B> identity
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.6-14.
+ *<BR>
+ *<B>Assertion Description: </B>
+If a call is made to PersistenceManager.getObjectId and the
+parameter pc is not persistent, or is null, then null is returned.
+ */
+
+
+public class GetObjectIdForNullOrNotPersistent extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.6-14 (GetObjectIdForNullOrNotPersistent) 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(GetObjectIdForNullOrNotPersistent.class);
+    }
+
+    /** */
+    public void testGetObjectIdForNullOrNotPersistent() {
+        pm = getPM();
+        runTestNonPcClass(pm);
+        runTestNullParam(pm);
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    private void runTestNonPcClass(PersistenceManager pm) {
+        Point p = new Point(1,3);
+        Object oid = pm.getObjectId(p);
+        if (oid != null) {
+            fail(ASSERTION_FAILED,
+                 "pm.getObjectId returned non null ObjectId: " + oid + 
+                 " for instance of non-pc class");
+        }
+    }
+    
+    /** */
+    private void runTestNullParam(PersistenceManager pm) {
+        Object oid = pm.getObjectId(null);
+        if (oid != null) {
+            fail(ASSERTION_FAILED,
+                 "pm.getObjectId(null) returned non null ObjectId: " + oid);
+        }
+    }
+}

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

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectIdWithApplicationModifyingIdentity.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectIdWithApplicationModifyingIdentity.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectIdWithApplicationModifyingIdentity.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectIdWithApplicationModifyingIdentity.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.persistencemanager.getobject;
+
+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> Get ObjectId With Application Modifying Identity
+ *<BR>
+ *<B>Keywords:</B> identity applicationidentity
+ *<BR>
+ *<B>Assertion ID:</B> A12.5.6-11.
+ *<BR>
+ *<B>Assertion Description: </B>
+If the object identity is being changed in the transaction,
+by the application modifying one or more of the application key fields,
+then the method <code>PersistenceManager.getObjectId</code> returns the
+identity as of the beginning of the transaction. The value returned by
+<code>getObjectId</code> will be different following <code>afterCompletion</code>
+processing for successful transactions.
+
+ */
+
+public class GetObjectIdWithApplicationModifyingIdentity extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.6-11 (GetObjectIdWithApplicationModifyingIdentity) 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(GetObjectIdWithApplicationModifyingIdentity.class);
+    }
+
+    /** */
+    public void testGetObjectByIdWithApplicationModifyingIdentity() {
+        if (!isChangeApplicationIdentitySupported()) {
+            if (debug)
+                logger.debug("Implementation does not support chaning application identity");
+            return;
+        }
+        
+        if (debug)
+            logger.debug("\nSTART GetObjectIdWithApplicationModifyingIdentity");
+        pm = getPM();
+        Object oid = createPCPointInstance(pm);
+        PCPoint p1 = (PCPoint) pm.getObjectById(oid, false);
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            p1.setX(10000); // this is the primary key
+            Object oid2 = pm.getObjectId (p1); // should be the same
+            tx.commit();
+            
+            Object oid3 = pm.getObjectId (p1); // should be same as oid3
+            if (!oid.equals(oid2)) {
+                fail(ASSERTION_FAILED,
+                     "Oid before is different from oid after modifying pk");
+            }
+            
+            if (oid.equals(oid3)) {
+                fail(ASSERTION_FAILED,
+                     "Oid before is the same as oid after modifying pk");
+            }
+        }
+        finally {
+            if (debug)
+                logger.debug("END GetObjectIdWithApplicationModifyingIdentity");
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+        pm.close();
+        pm = null;
+    }
+}

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

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeNontransactionalAllFails.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeNontransactionalAllFails.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeNontransactionalAllFails.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeNontransactionalAllFails.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,174 @@
+/*
+ * 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.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;
+import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest;
+
+/**
+ *<B>Title:</B> MakeNontransactionalAllFails
+ *<BR>
+ *<B>Keywords:</B> exception
+ *<BR>
+ *<B>Assertion ID:</B> A12.5.7-5
+ *<BR>
+ *<B>Assertion Description: </B>
+If a collection or array of instances is passed to PersistenceManager.makeNontransactionalAll, 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 a nested exception array, each exception 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 MakeNontransactionalAllFails extends PersistenceManagerTest {
+       
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.7-5 (MakeNontransactionalAllFails) 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(MakeNontransactionalAllFails.class);
+    }
+    
+    private PCPoint p1 = null;
+    private PCPoint p2 = null;
+    private PCPoint p3 = null;
+    private PCPoint p4 = null;
+    private Point p5 = null;
+
+    /** */
+    public void testTransactionalInst() {
+        pm = getPM();
+
+        createObjects(pm);
+        runTestMakeNontransactional1(pm);
+        runTestMakeNontransactionalAll1(pm);
+
+        pm.close();
+        pm = null;
+    }
+    
+    /** */
+    private void createObjects(PersistenceManager pm) {
+        p1 = new PCPoint(1,3);
+        p2 = new PCPoint(2,4);
+        p3 = new PCPoint(3,5);
+        p4 = new PCPoint(4,6);
+    }
+    
+    /* test makeNontransactional (Object pc) */
+    private void runTestMakeNontransactional1(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            pm.makePersistent(p1);
+            try {
+                pm.makeNontransactional(p1);
+                fail(ASSERTION_FAILED,
+                     "pm.makeNontransactional should throw a JDOUserException when called for a P-NEW instance.");
+            }
+            catch (JDOUserException ex) {
+                // expected exception
+            }
+            tx.rollback();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+    
+    /* test makeNontransactionalAll (Collection pcs) */
+    private void runTestMakeNontransactionalAll1(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            pm.makePersistent(p2);
+            tx.commit();
+
+            tx.begin();
+            pm.makePersistent(p3);
+            pm.makePersistent(p4);
+
+            Collection col1 = new java.util.HashSet();
+            col1.add(p2);
+            col1.add(p3);
+            col1.add(p4);
+            
+            try {
+                pm.makeNontransactionalAll(col1);
+                fail(ASSERTION_FAILED,
+                     "pm.makeNontransactionalAll(Collection) should throw a JDOUserException when called for collection including P-NEW instances.");
+            }
+            catch (JDOUserException ex) {
+                // expected exception
+            }
+            tx.rollback();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /* test makeNontransactionalAll (Object[] pcs) */
+    private void testMakeNontransactionalAll2(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx = pm.currentTransaction();
+            tx.begin();
+            pm.makePersistent(p2);
+            tx.commit();
+            
+            tx.begin();
+            pm.makePersistent(p3);
+            pm.makePersistent(p4);
+            
+            Collection col1 = new java.util.HashSet();
+            col1.add(p2);
+            col1.add(p3);
+            col1.add(p4);
+            
+            try {
+                pm.makeNontransactionalAll(col1.toArray());
+                fail(ASSERTION_FAILED,
+                     "pm.makeNontransactionalAll(Object []) should throw a JDOUserException when called for an array including P-NEW 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/MakeNontransactionalAllFails.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeNontransactionalDirtyInstance.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeNontransactionalDirtyInstance.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeNontransactionalDirtyInstance.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeNontransactionalDirtyInstance.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,305 @@
+/*
+ * 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.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> Make Nontransactional a Dirty Instance
+ *<BR>
+ *<B>Keywords:</B> exception
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.7-28
+ *<BR>
+ *<B>Assertion Description: </B>
+If PersistenceManager.makeNontransactional or makeNontransactionalAll is called with an explicit dirty parameter instance, a JDOUserException is thrown.
+
+ */
+
+public class MakeNontransactionalDirtyInstance extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.7-28 (MakeNontransactionalDirtyInstance) 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(MakeNontransactionalDirtyInstance.class);
+    }
+
+    private PCPoint p1 = null;
+    private PCPoint p2 = null;
+    private PCPoint p3 = null;
+    private PCPoint p4 = null;
+    private PCPoint p5 = null;
+    private PCPoint p6 = null;
+    private PCPoint p7 = null;
+
+    private PCPoint c1 = null;
+    private PCPoint c2 = null;
+    private PCPoint c3 = null;
+    private PCPoint c4 = null;
+    private PCPoint c5 = null;
+    private PCPoint c6 = null;
+    private PCPoint c7 = null;
+
+    private Collection pcol1 = new HashSet();
+    private Collection pcol2 = new HashSet();
+    private Collection ccol1 = new HashSet();
+    private Collection ccol2 = new HashSet();
+
+    /** */
+    public void testMakeNontransactional() {
+        pm = getPM();
+        /*  call with an explicit persistent dirty parameter instance */
+        String pstate="persistent";
+        createPersistentObjects(pm);
+        if (debug)
+            logger.debug(" -- testing with persistent dirty instance -- ");
+        runTestMakeNontransactionalDirtyInstance(pm, p1,pstate);
+        runTestMakeNontransactionalDirtyInstanceAll1(pm, pcol1, pstate);
+        runTestMakeNontransactionalDirtyInstanceAll2(pm, pcol2, pstate);
+        
+        /*  call with an explicit transient dirty parameter instance */
+        pstate="transient";
+        createTcleanObjects(pm);
+        if (debug)
+            logger.debug (" -- testing with transient dirty instance -- ");
+        runTestMakeNontransactionalDirtyInstance(pm, c1,pstate);
+        runTestMakeNontransactionalDirtyInstanceAll1(pm, ccol1, pstate);
+        runTestMakeNontransactionalDirtyInstanceAll2(pm, ccol2, pstate);
+        
+        pm.close();
+        pm = null;
+    }
+    
+    /** */
+    private void createTcleanObjects(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            c1 = new PCPoint(1,3);
+            c2 = new PCPoint(2,4);
+            c3 = new PCPoint(3,5);
+            c4 = new PCPoint(4,6);
+            c5 = new PCPoint (5,7);
+            c6 = new PCPoint (6,8);
+            c7 = new PCPoint (7,9);
+            
+            ccol1.add(c2);
+            ccol1.add(c3);
+            ccol1.add(c4);
+            
+            ccol2.add(c5);
+            ccol2.add(c6);
+            ccol2.add(c7);
+            
+            pm.makeTransactional(c1);
+            pm.makeTransactional(c2);
+            pm.makeTransactional(c3);
+            pm.makeTransactional(c4);
+            pm.makeTransactional(c5);
+            pm.makeTransactional(c6);
+            pm.makeTransactional(c7);
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    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);
+            p6 = new PCPoint (6,8);
+            p7 = new PCPoint (7,9);
+
+            pm.makePersistent(p1);
+            pm.makePersistent(p2);
+            pm.makePersistent(p3);
+            pm.makePersistent(p4);
+            pm.makePersistent(p5);
+            pm.makePersistent(p6);
+            pm.makePersistent(p7);
+
+            pcol1.add(p2);
+            pcol1.add(p3);
+            pcol1.add(p4);
+
+            pcol2.add(p5);
+            pcol2.add(p6);
+            pcol2.add(p7);
+            tx.commit();
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+    
+    /** */
+    private void runTestMakeNontransactionalDirtyInstance(PersistenceManager pm, PCPoint obj, String state) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            if (debug)
+                logger.debug(" ** in testMakeNontransactionalDirtyInstance()");
+            int curr;
+            tx.begin();
+            if (makeAndTestDirtyInstance(obj,state)) {
+                try {
+                    pm.makeNontransactional(obj);
+                    fail (ASSERTION_FAILED, 
+                          "pm.makeNontransactional should throw a JDOUserException when called for P-DIRTY instance.");
+                }
+                catch (JDOUserException ex) {
+                    // expected exception
+                }
+            }
+            tx.rollback();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void runTestMakeNontransactionalDirtyInstanceAll1(PersistenceManager pm, Collection tcol, String state) {
+        Transaction tx = pm.currentTransaction();
+        boolean stopFlag = false;
+        try {
+            if (debug)
+                logger.debug(" ** in testMakeNontransactionalDirtyInstanceAll1()");
+            int curr;
+            tx.begin();
+
+            Iterator iter = tcol.iterator();
+            while (iter.hasNext()) {
+                PCPoint p = (PCPoint) iter.next();
+                if (makeAndTestDirtyInstance(p,state))
+                    stopFlag = true;
+            }
+
+            if (! stopFlag) {
+                try {
+                    pm.makeNontransactionalAll(tcol);
+                    fail (ASSERTION_FAILED, 
+                          "pm.makeNontransactionalAll(Collection) should throw a 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();
+        }
+    }
+
+    /** */
+    private void runTestMakeNontransactionalDirtyInstanceAll2(PersistenceManager pm, 
+                                                              Collection tcol, 
+                                                              String state) {
+        Transaction tx = pm.currentTransaction();
+        boolean stopFlag = false;
+        try {
+            if (debug)
+                logger.debug(" ** in testMakeNontransactionalDirtyInstanceAll2()");
+            tx.begin();
+
+            Iterator iter = tcol.iterator();
+            while (iter.hasNext()) {
+                PCPoint p = (PCPoint) iter.next();
+                if (makeAndTestDirtyInstance(p,state))
+                    stopFlag = true;
+            }
+
+            Object[] objArray = tcol.toArray();
+
+            if (! stopFlag) {
+                try {
+                    pm.makeNontransactionalAll(objArray);
+                    fail (ASSERTION_FAILED, 
+                          "pm.makeNontransactionalAll(Object []) should throw a JDOUserException when called for an arry including P-DIRTY instances.");
+                }
+                catch (JDOUserException ex) {
+                    // expected exception
+                }
+            }
+            tx.rollback();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private boolean makeAndTestDirtyInstance (PCPoint obj, String state) {
+        int i = obj.getX();
+        i = i*10;
+
+        obj.setX(i);
+        int curr = currentState(obj);
+
+        if (state.equals("persistent")) {
+            if ( curr != PERSISTENT_DIRTY ) {
+                fail(ASSERTION_FAILED,
+                     " Object not in persistent dirty state " +
+                     " for " + obj.getX() + " current state: " + curr);
+                return false;
+            }
+        }
+        else if (state.equals("transient")) {
+            if ( curr != TRANSIENT_DIRTY ) {
+                fail(ASSERTION_FAILED,
+                     " Object not in transient dirty state " +
+                     " for " + obj.getX() + " current state: " + curr);
+                return false;
+            }
+        }
+        return true;
+    }
+}
+

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

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeNontransactionalIsImmediate.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeNontransactionalIsImmediate.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeNontransactionalIsImmediate.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeNontransactionalIsImmediate.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> Make Nontransactional is immediate
+ *<BR>
+ *<B>Keywords:</B>
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.7-29
+ *<BR>
+ *<B>Assertion Description: </B>
+The effect of PersistenceManager.makeNontransactional or
+makeNontransactionalAll is immediate and not subject to rollback.
+ */
+
+public class MakeNontransactionalIsImmediate extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.7-29 (MakeNontransactionalIsImmediate) 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(MakeNontransactionalIsImmediate.class);
+    }
+    
+    private PCPoint p1 = null;
+    private PCPoint p2 = null;
+    private PCPoint p3 = null;
+    private PCPoint p4 = null;
+    private PCPoint p5 = null;
+    private PCPoint p6 = null;
+    private PCPoint p7 = null;
+
+    private Collection col1 = new HashSet();
+    private Collection col2 = new HashSet();
+
+    /** */
+    public void testTransactionalInst() {
+        pm = getPM();
+
+        createTcleanObjects();
+        runTestMakeNontransactionalIsImmediate(pm);
+        runTestMakeNontransactionalIsImmediateAll1(pm);
+        runTestMakeNontransactionalIsImmediateAll2(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    private void createTcleanObjects() {
+        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);
+            p6 = new PCPoint (6,8);
+            p7 = new PCPoint (7,9);
+            
+            col1.add(p2);
+            col1.add(p3);
+            col1.add(p4);
+            
+            col2.add(p5);
+            col2.add(p6);
+            col2.add(p7);
+            
+            pm.makeTransactional(p1);
+            pm.makeTransactional(p2);
+            pm.makeTransactional(p3);
+            pm.makeTransactional(p4);
+            pm.makeTransactional(p5);
+            pm.makeTransactional(p6);
+            pm.makeTransactional(p7);
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void runTestMakeNontransactionalIsImmediate(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            if (debug)
+                logger.debug (" ** in runTestMakeNontransactionalIsImmediate()");
+            int curr;
+            tx.begin();
+            
+            if (testState(p1, TRANSIENT_CLEAN, "transient clean")) {
+                pm.makeNontransactional(p1);
+                if (! testState(p1, TRANSIENT, "transient")) {
+                    fail(ASSERTION_FAILED,
+                         "transient clean instance shoud become transient immediately after pm.makeNontransactional");
+                }
+            }
+            tx.rollback();
+            tx = null;
+            
+            if (! testState(p1, TRANSIENT, "transient")) {
+                fail(ASSERTION_FAILED,
+                     "tx.rollback should rollback effect of pm.makeNontransactional");
+            }
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void runTestMakeNontransactionalIsImmediateAll1(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            if (debug)
+                logger.debug(" ** in runTestMakeNontransactionalIsImmediateAll1()");
+            int curr;
+            tx.begin();
+
+            if (testState (p2, TRANSIENT_CLEAN, "transient clean") &&
+                testState (p3, TRANSIENT_CLEAN, "transient clean") &&
+                testState (p4, TRANSIENT_CLEAN, "transient clean")) {
+
+                pm.makeNontransactionalAll(col1);
+                if (! navigateAndTestTransientCol(col1)) {
+                    fail(ASSERTION_FAILED, 
+                         "transient clean instances shoud become transient immediately after pm.makeNontransactionalAll(Collection)");
+                }
+            }
+            
+            tx.rollback();
+
+            tx.begin();
+            if (! navigateAndTestTransientCol(col1)) {
+                fail(ASSERTION_FAILED, 
+                     "tx.rollback should rollback effect of pm.makeNontransactionalAll(Collection)");
+            }
+            tx.rollback();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void runTestMakeNontransactionalIsImmediateAll2(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            if (debug)
+                logger.debug(" ** in runTestMakeNontransactionalIsImmediateAll2()");
+            int curr;
+            tx.begin();
+            Object[] objArray = col2.toArray();
+
+            if (testState (p5, TRANSIENT_CLEAN, "transient clean") &&
+                testState (p6, TRANSIENT_CLEAN, "transient clean") &&
+                testState (p7, TRANSIENT_CLEAN, "transient clean")) {
+                
+                pm.makeNontransactionalAll(objArray);
+                if (! navigateAndTestTransientArray(objArray)) {
+                    fail(ASSERTION_FAILED, 
+                         "transient clean instances shoud become transient immediately after pm.makeNontransactionalAll(Object[])");
+                }
+            }
+            tx.rollback();
+            
+            tx.begin();
+            if (! navigateAndTestTransientArray(objArray)) { 
+                fail(ASSERTION_FAILED, 
+                     "tx.rollback should rollback effect of pm.makeNontransactionalAll(Object[])");
+            }
+            tx.rollback();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+    
+    /** */
+    private boolean navigateAndTestTransientCol (Collection col) {
+        boolean noError = true;
+        Iterator iter = col1.iterator();
+        while (iter.hasNext() ) {
+            PCPoint p = (PCPoint) iter.next();
+            if (! testState(p, TRANSIENT, "transient")) {
+                noError = false;
+            }
+        }
+        return noError;
+    }
+    
+    /** */
+    private boolean navigateAndTestTransientArray (Object[] objArray) {
+        boolean noError = true;
+        for (int i=0; i < objArray.length; i++) {
+            PCPoint p = (PCPoint) objArray[i];
+            if (! testState(p, TRANSIENT, "transient")) {
+                noError = false;
+            }
+        }
+        return noError;
+    }
+}

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

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeNontransactionalPersistentCleanInstance.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeNontransactionalPersistentCleanInstance.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeNontransactionalPersistentCleanInstance.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeNontransactionalPersistentCleanInstance.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,240 @@
+/*
+ * 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.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> Make Nontransactional a Persistent-Clean Instance
+ *<BR>
+ *<B>Keywords:</B> lifecycle
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.7-27
+ *<BR>
+ *<B>Assertion Description: </B>
+PersistenceManager.makeNontransactional and makeNontransactionalAll makes a
+ *persistent-clean instance nontransactional and causes a state transition to
+ *persistent-nontransactional.
+ */
+
+public class MakeNontransactionalPersistentCleanInstance
+    extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.7-27 (MakeNontransactionalPersistentCleanInstance) 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(MakeNontransactionalPersistentCleanInstance.class);
+    }
+    
+    private PCPoint p1 = null;
+    private PCPoint p2 = null;
+    private PCPoint p3 = null;
+    private PCPoint p4 = null;
+    private PCPoint p5 = null;
+    private PCPoint p6 = null;
+    private PCPoint p7 = null;
+
+    private Collection col1 = new java.util.HashSet();
+    private Collection col2 = new java.util.HashSet();
+
+    /** */
+    public void testTransactionalInstance() {
+        pm = getPM();
+        
+        createObjects(pm);
+        runTestMakeNontransactionalPersistentCleanInstance(pm);
+        runTestMakeNontransactionalPersistentCleanInstanceAll1(pm);
+        runTestMakeNontransactionalPersistentCleanInstanceAll2(pm);
+
+        pm.close();
+        pm = null;
+   }
+
+    /** */
+    private void createObjects(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            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);
+            p6 = new PCPoint (6,8);
+            p7 = new PCPoint (7,9);
+            
+            col1.add(p2);
+            col1.add(p3);
+            col1.add(p4);
+            
+            col2.add(p5);
+            col2.add(p6);
+            col2.add(p7);
+            
+            pm.makePersistent(p1);
+            pm.makePersistent(p2);
+            pm.makePersistent(p3);
+            pm.makePersistent(p4);
+            pm.makePersistent(p5);
+            pm.makePersistent(p6);
+            pm.makePersistent(p7);
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void runTestMakeNontransactionalPersistentCleanInstance(
+        PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            if (debug)
+                logger.debug(" ** in testMakeNontransactionalPersistentCleanInstance()");
+            int curr;
+            tx.setOptimistic(false);
+            tx.begin();
+
+            if (makePersistentCleanInstance(p1)) {
+                pm.makeNontransactional(p1);
+                curr = currentState(p1);
+
+                if (curr == HOLLOW ||
+                    curr == PERSISTENT_NONTRANSACTIONAL) {
+                }
+                else {
+                    fail(ASSERTION_FAILED,
+                         "Excpected P-HOLLOW or P-NONTX instance, instance is " + 
+                         getStateOfInstance(p1));
+                }
+            }
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void runTestMakeNontransactionalPersistentCleanInstanceAll1(
+        PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            if (debug)
+                logger.debug(" ** in testMakeNontransactionalPersistentCleanInstanceAll1()");
+            int curr;
+
+            tx.setOptimistic(false);
+            tx.begin();
+            
+            if ( makePersistentCleanInstance(p2) &&
+                 makePersistentCleanInstance(p3) &&
+                 makePersistentCleanInstance(p4)) {
+                
+                pm.makeNontransactionalAll(col1);
+                Iterator iter = col1.iterator();
+                while (iter.hasNext() ) {
+                    PCPoint p = (PCPoint) iter.next();
+                    curr = currentState(p);
+                    if (curr == HOLLOW ||
+                        curr == PERSISTENT_NONTRANSACTIONAL) {
+                    }
+                    else {
+                        fail(ASSERTION_FAILED,
+                             "Expected persistent-nontransactional or hollow; got " + 
+                             getStateOfInstance(p));
+                    }
+                }
+            }
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+
+    }
+
+    /** */
+    private void runTestMakeNontransactionalPersistentCleanInstanceAll2(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            if (debug)
+                logger.debug(" ** in testMakeNontransactionalPersistentCleanInstanceAll2()");
+            int curr;
+            if (tx.getOptimistic())
+                if (debug) logger.debug (" opt flag set to true");
+            tx.begin();
+
+            Object[] objArray = col2.toArray();
+
+            if ( makePersistentCleanInstance(p5) &&
+                 makePersistentCleanInstance(p6) &&
+                 makePersistentCleanInstance(p7)) {
+                
+                pm.makeNontransactionalAll(objArray);
+
+                for (int i=0; i < objArray.length; i++) {
+                    PCPoint p = (PCPoint) objArray[i];
+                    curr = currentState(p);
+                    if (curr == HOLLOW ||
+                        curr == PERSISTENT_NONTRANSACTIONAL) {
+                    }
+                    else {
+                        fail(ASSERTION_FAILED,
+                             "Expected persistent-nontransactional or hollow; got " + 
+                             getStateOfInstance(p));
+                    }
+                }
+            }
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private boolean makePersistentCleanInstance (PCPoint obj) {
+        int val = obj.getX();
+        return (testState(obj, PERSISTENT_CLEAN, "persistent clean"));
+    }
+}

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

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeNontransactionalTransientCleanInstance.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeNontransactionalTransientCleanInstance.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeNontransactionalTransientCleanInstance.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakeNontransactionalTransientCleanInstance.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,219 @@
+/*
+ * 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.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> MakeNontransactionalTransientCleanInstance
+ *<BR>
+ *<B>Keywords:</B> lifecycle
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.7-26
+ *<BR>
+ *<B>Assertion Description: </B>
+PersistenceManager.makeNontransactional and makeNontransactionalAll makes a transient-clean instance nontransactional and causes a state transition to transient. After the method completes, the instance does not observe transaction boundaries.
+ */
+
+public class MakeNontransactionalTransientCleanInstance extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.7-26 (MakeNontransactionalTransientCleanInstance) 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(MakeNontransactionalTransientCleanInstance.class);
+    }
+    
+    private PCPoint p1 = null;
+    private PCPoint p2 = null;
+    private PCPoint p3 = null;
+    private PCPoint p4 = null;
+    private PCPoint p5 = null;
+    private PCPoint p6 = null;
+    private PCPoint p7 = null;
+
+    private Collection col1 = new java.util.HashSet();
+    private Collection col2 = new java.util.HashSet();
+
+    /** */
+    public void testTransactionalInst() {
+        pm = getPM();
+
+        createTcleanObjects(pm);
+        runTestMakeNontransactionalTransientCleanInstance(pm);
+        runTestMakeNontransactionalTransientCleanInstanceAll1(pm);
+        runTestMakeNontransactionalTransientCleanInstanceAll2(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    private void createTcleanObjects(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);
+            p6 = new PCPoint (6,8);
+            p7 = new PCPoint (7,9);
+
+            col1.add(p2);
+            col1.add(p3);
+            col1.add(p4);
+
+            col2.add(p5);
+            col2.add(p6);
+            col2.add(p7);
+
+            pm.makeTransactional(p1);
+            pm.makeTransactional(p2);
+            pm.makeTransactional(p3);
+            pm.makeTransactional(p4);
+            pm.makeTransactional(p5);
+            pm.makeTransactional(p6);
+            pm.makeTransactional(p7);
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void runTestMakeNontransactionalTransientCleanInstance(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            if (debug)
+                logger.debug(" ** in testMakeNontransactionalTransientCleanInstance()");
+            int curr;
+            tx.begin();
+            
+            if (testState(p1, TRANSIENT_CLEAN, "transient clean")) {
+                pm.makeNontransactional(p1);
+                
+                if (testState(p1, TRANSIENT, "transient")) {
+                    // expected result
+                }
+                else {
+                    fail(ASSERTION_FAILED, 
+                         "expected transient instance after pm.makeNontransactional, instance is " +
+                         getStateOfInstance(p1));
+                }
+            }
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+    
+    /** */
+    private void runTestMakeNontransactionalTransientCleanInstanceAll1(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            if (debug)
+                logger.debug(" ** in testMakeNontransactionalTransientCleanInstanceAll1()");
+            int curr;
+            tx.begin();
+
+            if (testState(p2, TRANSIENT_CLEAN, "transient clean") &&
+                testState(p3, TRANSIENT_CLEAN, "transient clean") &&
+                testState(p4, TRANSIENT_CLEAN, "transient clean")) {
+                
+                pm.makeNontransactionalAll(col1);
+                Iterator iter = col1.iterator();
+                while (iter.hasNext() ) {
+                    PCPoint p = (PCPoint) iter.next();
+                    if (testState(p, TRANSIENT, "transient")) {
+                        // expected result
+                    }
+                    else {
+                    fail(ASSERTION_FAILED, 
+                         "expected transient instance after pm.makeNontransactionalAll, instance is " +
+                         getStateOfInstance(p));
+                    }
+                }
+            }
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void runTestMakeNontransactionalTransientCleanInstanceAll2(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            if (debug)
+                logger.debug (" ** in testMakeNontransactionalTransientCleanInstanceAll2()");
+            int curr;
+            tx.begin();
+
+            Object[] objArray = col2.toArray();
+            
+            if (testState(p5, TRANSIENT_CLEAN, "transient clean") &&
+                testState(p6, TRANSIENT_CLEAN, "transient clean") &&
+                testState(p7, TRANSIENT_CLEAN, "transient clean")) {
+                
+                pm.makeNontransactionalAll(objArray);
+                
+                for (int i=0; i < objArray.length; i++) {
+                    PCPoint p = (PCPoint) objArray[i];
+                    if (testState(p, TRANSIENT, "transient")) {
+                        // expected result
+                    }
+                    else {
+                        fail(ASSERTION_FAILED, 
+                             "expected transient instance after pm.makeNontransactionalAll, instance is " +
+                             getStateOfInstance(p));
+                    }
+                }
+            }
+            tx.commit();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+}

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

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakePersistent.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakePersistent.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakePersistent.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakePersistent.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,221 @@
+/*
+ * 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> make instance persistent
+ *<BR>
+ *<B>Keywords:</B> persistencemanager
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.7-6A
+ *<BR>
+ *<B>Assertion Description: </B>
+The method <code>PersistenceManager.makePersistent</code> and
+<code>makePersistentAll</code> makes a transient instance(s) persistent directly.
+It must be called in the context of an active transaction,
+or a <code>JDOUserException</code> is thrown.
+
+ */
+
+public class MakePersistent extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.7-6A (MakePersistent) 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(MakePersistent.class);
+    }
+
+    private PCPoint p1 = null;
+    private PCPoint p2 = null;
+    private PCPoint p3 = null;
+    private PCPoint p4 = null;
+    private PCPoint p5 = null;
+
+    /** */
+    public void testMakePersistent() {
+        pm = getPM();
+        
+        createObjects();
+        
+        /* positive tests */
+        runTestMakePersistent1(pm);
+        runTestMakePersistent2(pm);
+        runTestMakePersistent3(pm);
+        
+        /* negative tests */
+        runTestMakePersistent4(pm);
+        runTestMakePersistent5(pm);
+        runTestMakePersistent6(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    private void  createObjects() {
+        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 makePersistent (Object pc) */
+    private void runTestMakePersistent1(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            pm.makePersistent(p1);
+            tx.commit();
+            tx = null;
+            if (debug) logger.debug(" \nPASSED in runTestMakePersistent1()");
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /* test makePersistentAll (Collection pcs) */
+    private void runTestMakePersistent2(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            Collection col1 = new HashSet();
+            col1.add(p2);
+            col1.add(p3);
+            
+            pm.makePersistentAll(col1);
+            tx.commit();
+            tx = null;
+            if (debug) logger.debug(" \nPASSED in runTestMakePersistent2()");
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+    
+    /* test makePersistentAll (Object[] o) */
+    private void runTestMakePersistent3(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx = pm.currentTransaction();
+            tx.begin();
+            
+            Collection col1 = new HashSet();
+            col1.add(p1);
+            col1.add(p2);
+            
+            Object[] obj1= col1.toArray();
+            
+            pm.makePersistentAll(obj1);
+            tx.commit();
+            tx = null;
+            if (debug) logger.debug (" \nPASSED in runTestMakePersistent3()");
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+    }
+    
+    /* test makePersistent (Object pc) */
+    private void runTestMakePersistent4(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        if (tx.isActive())
+            tx.rollback();
+
+        PCPoint np1 = new PCPoint(1,3);
+        try {
+            pm.makePersistent(np1);
+            fail(ASSERTION_FAILED,
+                 "pm.makePersistent outside of a tx should throw a JDOUserException");
+        }
+        catch (JDOUserException ex) {
+            // expected expected
+        }
+    }
+
+    /* test makePersistentAll (Collection pcs) */
+    private void runTestMakePersistent5(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        if (tx.isActive())
+            tx.rollback();
+
+        PCPoint np1 = new PCPoint (3,3);
+        PCPoint np2 = new PCPoint (4,4);
+        
+        Collection col1 = new HashSet();
+        col1.add(np1);
+        col1.add(np2);
+        
+        try {
+            pm.makePersistentAll(col1);
+            fail(ASSERTION_FAILED,
+                 "pm.makePersistentAll(Collection) outside of a tx should throw a JDOUserException");
+        }
+        catch (JDOUserException ex) {
+            // expected expected
+        }
+    }
+
+    /* test makePersistentAll (Object[] o) */
+    private void runTestMakePersistent6(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        if (tx.isActive())
+            tx.rollback();
+
+        PCPoint np1 = new PCPoint (3,3);
+        PCPoint np2 = new PCPoint (4,4);
+        
+        Collection col1 = new HashSet();
+        col1.add(np1);
+        col1.add(np2);
+        
+        Object[] obj1=col1.toArray();
+        
+        try {
+            pm.makePersistentAll(obj1);  
+            fail(ASSERTION_FAILED,
+                 "pm.makePersistentAll(Object[]) outside of a tx should throw a JDOUserException");
+        }
+        catch (JDOUserException ex) {
+            // expected expected
+        }
+    }
+}

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

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakePersistentAllFails.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakePersistentAllFails.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakePersistentAllFails.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakePersistentAllFails.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,132 @@
+/*
+ * 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.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;
+import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest;
+
+/**
+ *<B>Title:</B> MakePersistentAll Fails
+ *<BR>
+ *<B>Keywords:</B> exception
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.7-1.
+ *<BR>
+ *<B>Assertion Description: </B>
+If a collection or array of instances is passed to PersistenceManager.makePersistentAll, and one or more of the instances fail to complete the operation, then all instances will be attempted, and a JDOUserException will be thrown which contains a nested exception array, each exception 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 MakePersistentAllFails extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.7-1 (MakePersistentAllFails) 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(MakePersistentAllFails.class);
+    }
+
+    /** */
+    public void testMakePersistentAllFails() {
+        pm = getPM();
+        
+        runTestMakePersistentAllFails1(pm);
+        runTestMakePersistentAllFails2(pm);
+        
+        pm.close();
+        pm = null;
+    }
+
+    /* test makePersistentAll (Collection pcs) */
+   private void runTestMakePersistentAllFails1(PersistenceManager pm) {
+       Transaction tx = pm.currentTransaction();
+       try {
+           tx.begin();
+
+           PCPoint np1 = new PCPoint (3,3);
+           PCPoint np2 = new PCPoint (4,4);
+           Point np3 =  new Point (5,5);
+           
+           Collection col1 = new java.util.HashSet();
+           col1.add(np1);
+           col1.add(np2);
+           col1.add(np3);
+
+           try {
+               pm.makePersistentAll(col1);
+               fail(ASSERTION_FAILED,
+                    "pm.makePersistentAll(Collection) should thro JDOUserException when called for collection including instance of non-pc class.");
+           }
+           catch (JDOUserException ex) {
+               // expected exception
+           }
+           tx.rollback();
+           tx = null;
+       }
+       finally {
+           if ((tx != null) && tx.isActive())
+               tx.rollback();
+       }
+   }
+
+    /* test makePersistentAll (Object[] o) */
+    private void runTestMakePersistentAllFails2(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            
+            PCPoint np1 = new PCPoint (3,3);
+            PCPoint np2 = new PCPoint (4,4);
+            Point np3 =  new Point (5,5);
+            
+            Collection col1 = new java.util.HashSet();
+            col1.add(np1);
+            col1.add(np2);
+            col1.add(np3);
+            
+            Object[] obj1=col1.toArray();
+            
+            try {
+                pm.makePersistentAll(obj1);
+                fail(ASSERTION_FAILED,
+                     "pm.makePersistentAll(Object[]) should thro JDOUserException when called for array including instance of non-pc class ");
+            }
+            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/MakePersistentAllFails.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakePersistentAndInstancesNotReachable.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakePersistentAndInstancesNotReachable.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakePersistentAndInstancesNotReachable.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/MakePersistentAndInstancesNotReachable.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,125 @@
+/*
+ * 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.Iterator;
+import java.util.Date;
+
+import javax.jdo.Extent;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.JDO_Test;
+
+import org.apache.jdo.tck.pc.company.Company;
+import org.apache.jdo.tck.pc.company.Department;
+import org.apache.jdo.tck.pc.company.Address;
+
+import org.apache.jdo.tck.util.BatchTestRunner;
+import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest;
+
+/**
+ *<B>Title:</B> MakePersistent And Instances Not Reachable
+ *<BR>
+ *<B>Keywords:</B> 
+ *<BR>
+ *<B>Assertion ID:</B> A12.5.7-6C.
+ *<BR>
+ *<B>Assertion Description: </B>
+When calling <code>PersistenceManager.makePersistent</code> or <code>makePersistentAll</code>, 
+transient instances will become persistent and any transient instances reachable via persistent 
+fields will become provisionally persistent. That is, they behave as persistent-new instances 
+(return true to isPersistent, isNew, and isDirty).
+But at commit time, the reachability algorithm is run again, 
+and instances made provisionally persistent that are not 
+currently reachable from persistent instances will revert to transient.
+ */
+
+public class MakePersistentAndInstancesNotReachable extends JDO_Test {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.7-6C (MakePersistentAndInstancesNotReachable) failed: ";
+    
+    private Department dep1 = null;
+    private Department dep2 = null;
+    private Department dep3 = null;
+
+    /**
+     * 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(MakePersistentAndInstancesNotReachable.class);
+    }
+    
+    /** */
+    public void test() {
+        pm = getPM();
+        createObjects(pm);
+        runTest(pm);
+  }
+
+    /** */
+    private void createObjects(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+        Company comp = new Company(1L, "Sun Microsystems", new Date(), new Address(0,"","","","",""));
+        //Add transient departments
+        dep1 = new Department(1L, "Department 1");
+        dep2 = new Department(2L, "Department 1");
+        dep3 = new Department(3L, "Department 1");
+        comp.addDepartment(dep1);
+        comp.addDepartment(dep2);
+        comp.addDepartment(dep3);
+        pm.makePersistent(comp); //Now the transient departments should be made provisionally persistent via reachability
+        int curr = currentState(dep1);
+        if( curr != PERSISTENT_NEW ){
+            fail(ASSERTION_FAILED, "dep1 should be persistent-new, state is " + states[curr]);
+        }
+        curr = currentState(dep2);
+        if( curr != PERSISTENT_NEW ){
+            fail(ASSERTION_FAILED, "dep2 should be persistent-new, state is " + states[curr]);
+        }
+        curr = currentState(dep3);
+        if( curr != PERSISTENT_NEW ){
+            fail(ASSERTION_FAILED, "dep3 should be persistent-new, state is " + states[curr]);
+        }
+        //Remove departments
+        comp.removeDepartment(dep1);
+        comp.removeDepartment(dep2);
+        comp.removeDepartment(dep3);
+        tx.commit(); //Now the removed departments should be made transient again
+    }
+
+    /** */
+    void runTest(PersistenceManager pm) {
+        int curr = currentState(dep1);
+        if( curr != TRANSIENT ){
+            fail(ASSERTION_FAILED, "dep1 should be transient, state is " + states[curr]);
+        }
+        curr = currentState(dep2);
+        if( curr != TRANSIENT ){
+            fail(ASSERTION_FAILED, "dep2 should be transient, state is " + states[curr]);
+        }
+        curr = currentState(dep3);
+        if( curr != TRANSIENT ){
+            fail(ASSERTION_FAILED, "dep3 should be transient, state is " + states[curr]);
+        }
+    }
+}

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