Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/instancecallbacks/TestParts.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/instancecallbacks/TestParts.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/instancecallbacks/TestParts.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/instancecallbacks/TestParts.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,139 @@ +/* + * 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.instancecallbacks; + +import java.util.Date; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.instancecallbacks.InstanceCallbackClass; + +public abstract class TestParts extends JDO_Test { + + /** */ + public TestParts() { + } + + /** */ + void checkInstances(String assertion, String label, int intValue, String capturedNextObjName, + int numberOfChildren, int sumOfChildrenIntValue) { + if (InstanceCallbackClass.processedIndex[intValue] != true) { + fail(assertion, label + "Callback never made on object with intValue = " + intValue); + } + if (capturedNextObjName != null && + InstanceCallbackClass.capturedNextObjName[intValue] == null) { + fail(assertion, label + "nextObj attribute for object with intValue = " + + intValue + " should not have been null."); + } else if (capturedNextObjName == null && + InstanceCallbackClass.capturedNextObjName[intValue] != null) { + fail(assertion, label + "nextObj attribute for object with intValue = " + + intValue + " should have been null."); + } else if(capturedNextObjName != null && + !InstanceCallbackClass.capturedNextObjName[intValue].equals(capturedNextObjName)) { + fail(assertion, + label + "nextObj.name attribute for object with intValue = " + intValue + + " should have been \"" + capturedNextObjName + "\". It was \"" + + InstanceCallbackClass.capturedNextObjName[intValue] + "\" instead."); + } + + if(InstanceCallbackClass.numberOfChildren[intValue] != numberOfChildren) { + fail(assertion, + label + "Number of instances in attribute children for object with intValue = " + + intValue + " should have been " + numberOfChildren + ". It was " + + InstanceCallbackClass.numberOfChildren[intValue] + " instead."); + } + + if(InstanceCallbackClass.sumOfChildrenIntValue[intValue] != sumOfChildrenIntValue) { + fail(assertion, + label + "Sum of intValue of instances in attribute children for object with intValue = " + + intValue + " should have been " + sumOfChildrenIntValue + ". It was " + + InstanceCallbackClass.sumOfChildrenIntValue[intValue] + " instead."); + } + } + + /** */ + void checkPMAccess(String assertion, String label, int intValue, boolean transactionActive) { + if (InstanceCallbackClass.processedIndex[intValue] != true) { + fail(assertion, label + "Callback never made on object with intValue = " + intValue); + return; + } + // Only verify isActive() returned true for the object if transactionActive is true + if (transactionActive && InstanceCallbackClass.transactionActive[intValue] != true) { + fail(assertion, label + "PersistenceManager.currentTransaction.isAcive() returned false"); + } + } + + /** + * The attributes are: label, name, date, intValue, doubleValue, + * childToDelete, charValue + */ + void checkFieldValues(String assertion, String label, int intValue, + String name, Date timeStamp, double doubleValue, + short childToDelete, char charValue) { + if (InstanceCallbackClass.processedIndex[intValue] != true) { + fail(assertion, label + "Callback never made on object with intValue = " + intValue); + return; + } + + if (!InstanceCallbackClass.capturedName[intValue].equals(name)) { + fail(assertion, + label + "name attribute for object with intValue = " + intValue + + " should be \"" + name + "\". It was \"" + + InstanceCallbackClass.capturedName[intValue] + "\" instead."); + } + + if (!InstanceCallbackClass.capturedTimeStamp[intValue].equals(timeStamp)) { + fail(assertion, + label + "timeStamp attribute for object with intValue = " + intValue + + " should be " + timeStamp + ". It was " + + InstanceCallbackClass.capturedTimeStamp[intValue] + " instead."); + } + + if (InstanceCallbackClass.capturedDoubleValue[intValue] != doubleValue) { + fail (assertion, + label + "doubleValue attribute for object with intValue = " + + intValue + " should be " + doubleValue + ". It was " + + InstanceCallbackClass.capturedDoubleValue[intValue] + " instead."); + } + + if (InstanceCallbackClass.capturedCharValue[intValue] != charValue) { + fail(assertion, + label + "charValue attribute for object with intValue = " + + intValue + " should be " + charValue + ". It was " + + InstanceCallbackClass.capturedCharValue[intValue] + " instead."); + } + + if (InstanceCallbackClass.capturedChildToDelete[intValue] != childToDelete) { + fail(assertion, + label + "childToDelete attribute for object with intValue = " + + intValue + " should be " + childToDelete + ". It was " + + InstanceCallbackClass.capturedChildToDelete[intValue] + " instead."); + } + } + + /** Touch fields to guarantee that they are loaded into the instance + */ + double touchFields (InstanceCallbackClass o) { + // make a checksum from the fields and return it; this cannot be optimized out... + double rc = o.doubleValue; + rc += o.intValue; + rc += o.charValue; + rc += o.childToDelete; + rc += o.name.length(); + rc += o.timeStamp.getTime(); + return rc; + } +}
Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/instancecallbacks/TestParts.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetObjectId.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetObjectId.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetObjectId.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/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.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.Transaction; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.mylib.PCPoint; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *<B>Title:</B> Get Objectid + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.3-1 + *<BR> + *<B>Assertion Description: </B> + * The jdohelper.getObjectId method returns an ObjectId instance that represents + * the object identity of the specified JDO Instance. Test: The method + * getObjectById returns the exact same object, evaluating to true when == is used . + */ + + /* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 9/26/01 1.0 + */ + +public class GetObjectId extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.3-1 (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); + } + + /* test JDOHelper.getObjectId(Object pc) + * + */ + public void testGetObjectId() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + PCPoint p1 = new PCPoint(1,3); + pm.makePersistent(p1); + Object oid = JDOHelper.getObjectId(p1); + if (oid == null) + fail(ASSERTION_FAILED, + "JDOHelper.getObjectId called for a P_NEW instance returned null ObjectId"); + Object p2 = pm.getObjectById(oid, false); + if (p2 != p1) + fail(ASSERTION_FAILED, + "JDOHelper.getObjectBy returned different instance " + p2 + " expected " + p1); + tx.commit(); + pm.close(); + pm = null; + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetObjectId.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetObjectIdForNull.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetObjectIdForNull.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetObjectIdForNull.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetObjectIdForNull.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.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.Transaction; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.util.BatchTestRunner; + + +/** + *<B>Title:</B> Get Object Id For Null + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.3-4. + *<BR> + *<B>Assertion Description: </B> +The jdohelper.getObjectId method returns null if Object is null. + Evaluating to true when == is used. + + */ + + + /* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 9/26/01 1.0 + */ + +public class GetObjectIdForNull extends JDO_Test { + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.3-4 (GetObjectIdForNull) 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(GetObjectIdForNull.class); + } + + /* test jdohelper.getObjectId(Object pc) + */ + public void testGetObjectIdForNull() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + Object p1 = null; + Object oid = JDOHelper.getObjectId(p1); + tx.commit(); + if (oid != null) + fail(ASSERTION_FAILED, + "JDOHelper.getObjectId called for null instance returned non-null ObjectId"); + pm.close(); + pm = null; + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetObjectIdForNull.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetObjectIdForTransient.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetObjectIdForTransient.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetObjectIdForTransient.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetObjectIdForTransient.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,75 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.jdo.tck.api.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.Transaction; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.mylib.PCPoint; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *<B>Title:</B> Get Object Id For Transient + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.3-2. + *<BR> + *<B>Assertion Description: </B> +The jdohelper.getObjectId method returns null if Object is a transient. +Evaluating to true when == is used. + */ + + /* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 9/27/01 1.0 + */ + +public class GetObjectIdForTransient extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.3-2 (GetObjectIdForTransient) 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(GetObjectIdForTransient.class); + } + + /* test JDOHelper.getObjectId(Object pc) + * + */ + public void testGetObjectIdForTransient() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + PCPoint p1 = new PCPoint(1,3); + Object oid = JDOHelper.getObjectId(p1); + tx.commit(); + if (oid != null) + fail(ASSERTION_FAILED, + "JDOHelper.getObjectId called for transient instance returned non-null ObjectId " + oid); + pm.close(); + pm = null; + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetObjectIdForTransient.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetObjectIdNotPersistenceCapable.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetObjectIdNotPersistenceCapable.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetObjectIdNotPersistenceCapable.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetObjectIdNotPersistenceCapable.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.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.Transaction; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.mylib.Point; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *<B>Title:</B> Get Object Id Not Persistence Capable + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.3-3. + *<BR> + *<B>Assertion Description: </B> +The jdohelper.getObjectId method returns null if Object is not persistence capable + + */ + + /* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 9/26/01 1.0 + */ + +public class GetObjectIdNotPersistenceCapable extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.3-3 (GetObjectIdNotPersistenceCapable) 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(GetObjectIdNotPersistenceCapable.class); + } + + /* test JDOHelper.getObjectId(Object pc) + * + */ + public void testGetObjectIdNotPersistenceCapable() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + Point p1 = new Point(1,3); + Object oid = JDOHelper.getObjectId(p1); + tx.commit(); + if (oid != null) + fail(ASSERTION_FAILED, + "JDOHelper.getObjectId called for instance of non-pc class returned non-null ObjectId " + oid); + pm.close(); + pm = null; + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetObjectIdNotPersistenceCapable.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetPersistenceManager.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetPersistenceManager.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetPersistenceManager.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetPersistenceManager.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,83 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.api.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.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 Persistence Manager + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.1-1. + *<BR> + *<B>Assertion Description: </B> +The jdohelper.getPersistenceManager method returns associated persistence manager + if the object parameter is not null and implements persistenceCapable. + evaluating to true when == is used. + */ + + + /* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 9/26/01 1.0 + */ +public class GetPersistenceManager extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.1-1 (GetPersistenceManager) failed: "; + + /** + * The <code>main</code> is called when the class + * is directly executed from the command line. + * @param args The arguments passed to the program. + */ + public static void main(String[] args) { + BatchTestRunner.run(GetPersistenceManager.class); + } + + /* test jdohelper.getPersistenceManager(Object pc) + * + */ + public void testGetPersistenceManager() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + PCPoint p1 = new PCPoint(1,3); + pm.makePersistent(p1); + PersistenceManager pm1= JDOHelper.getPersistenceManager(p1); + tx.commit(); + if (pm1 == null) + fail(ASSERTION_FAILED, + "JDOHelper.getPersistenceManager returns null for persistent instance"); + if (pm1 != pm) + fail(ASSERTION_FAILED, + "JDOHelper.getPersistenceManager returns wrong pm " + pm1 + + ", expected " + pm); + pm.close(); + pm = null; + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetPersistenceManager.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetPersistenceManagerForNull.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetPersistenceManagerForNull.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetPersistenceManagerForNull.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetPersistenceManagerForNull.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,77 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.api.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.PersistenceManager; +import javax.jdo.Transaction; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.util.BatchTestRunner; + + +/** + *<B>Title:</B> Get Persistence Manager For Null + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.1-4. + *<BR> + *<B>Assertion Description: </B> +The jdohelper.getPersistenceManager method returns null if Object is null. +Evaluating to true when == is used. + */ + + + /* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 9/27/01 1.0 + */ + +public class GetPersistenceManagerForNull extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.1-4 (GetPersistenceManagerForNull) 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(GetPersistenceManagerForNull.class); + } + + /** */ + public void testGetPersistenceManagerForNull() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + Object p1 = null; + PersistenceManager pm1 = JDOHelper.getPersistenceManager(p1); + tx.commit(); + + if (pm1 != null) + fail(ASSERTION_FAILED, + "JDOHelper.getPersistenceManager with argument null returned non-null pm " + pm1); + pm.close(); + pm = null; + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetPersistenceManagerForNull.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetPersistenceManagerForTransient.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetPersistenceManagerForTransient.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetPersistenceManagerForTransient.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetPersistenceManagerForTransient.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,75 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.api.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.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 Persistence Manager For Transien + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.1-2. + *<BR> + *<B>Assertion Description: </B> +The jdohelper.getPersistenceManager method returns null if object is transient + evaluating to true when == is used. + */ + + /* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 9/28/01 1.0 + */ + +public class GetPersistenceManagerForTransient extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.1-2 (GetPersistenceManagerForTransient) 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(GetPersistenceManagerForTransient.class); + } + + /* test jdohelper.getPersistenceManager(Object transient) + */ + public void testGetPersistenceManagerForTransient() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + PCPoint p1 = new PCPoint(1,3); + tx.commit(); + PersistenceManager pm1 = JDOHelper.getPersistenceManager(p1); + + if (pm1 != null) + fail(ASSERTION_FAILED, + "JDOHelper.getPersistenceManager called for transient instance returned non-null pm " + pm1); + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetPersistenceManagerForTransient.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetPersistenceManagerNotPersistenceCapable.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetPersistenceManagerNotPersistenceCapable.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetPersistenceManagerNotPersistenceCapable.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetPersistenceManagerNotPersistenceCapable.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,75 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.api.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.PersistenceManager; +import javax.jdo.Transaction; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.mylib.Point; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *<B>Title:</B> Get Persistence Manager Not Persistence Capable + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.1-3. + *<BR> + *<B>Assertion Description: </B> +The jdohelper.getPersistenceManager method returns null if object is not +persistence capable evaluating to true when == is used. + */ + /* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 9/28/01 1.0 + */ +public class GetPersistenceManagerNotPersistenceCapable extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.1-3 (GetPersistenceManagerNotPersistenceCapable) 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(GetPersistenceManagerNotPersistenceCapable.class); + } + + /* test jdohelper.getPersistenceManager(Object pc) + * + */ + public void testGetPersistenceManagerNotPersistenceCapable() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + Point p1 = new Point(1,3); + tx.commit(); + PersistenceManager pm1 = JDOHelper.getPersistenceManager(p1); + if (pm1 != null) + fail(ASSERTION_FAILED, + "JDOHelper.getPersistenceManager called for instance of non-pc class returned non-null pm " + pm1); + pm.close(); + pm = null; + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetPersistenceManagerNotPersistenceCapable.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetTransactionalObjectId.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetTransactionalObjectId.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetTransactionalObjectId.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetTransactionalObjectId.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.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.Transaction; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.mylib.PCPoint; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *<B>Title:</B> Get Transactional Object Id + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.3-5 + *<BR> + *<B>Assertion Description: </B> + If the object parameter implements PersistenceCapable, + JDOHelper.getTransactionalObjectId delegates to the parameter instance and + returns the JDO identity of the instance. + */ + /* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 9/26/01 1.0 + */ + +public class GetTransactionalObjectId extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.3-5 (GetTransactionalObjectId) 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(GetTransactionalObjectId.class); + } + + /* test JDOHelper.getTransactionalObjectId(Object pc) + * + */ + public void testGetTransactionalObjectId() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + PCPoint p1 = new PCPoint(1,3); + pm.makePersistent(p1); + Object oid = JDOHelper.getTransactionalObjectId(p1); + tx.commit(); + + if (oid == null) + fail(ASSERTION_FAILED, + "JDOHelper.getTransactionalObjectId returned null oid."); + pm.close(); + pm = null; + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetTransactionalObjectId.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetTransactionalObjectIdForNull.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetTransactionalObjectIdForNull.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetTransactionalObjectIdForNull.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetTransactionalObjectIdForNull.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,75 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.api.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.Transaction; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *<B>Title:</B> Get Transactional Object Id For Null + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.3-8 + *<BR> + *<B>Assertion Description: </B> + The jdohelper.getTransactionalObjectIdForNull method returns null if Object is null.Evaluating to true when == is used. + */ + /* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 10/1/01 1.0 + */ + +public class GetTransactionalObjectIdForNull extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.3-8 (GetTransactionalObjectIdForNull) 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(GetTransactionalObjectIdForNull.class); + } + + /* test jdohelper.getTransactionalObjectId(Object pc) + * + */ + public void testGetTransactionalObjectIdForNull() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + Object p1 = null; + Object oid = JDOHelper.getTransactionalObjectId(p1); + tx.commit(); + + if (oid != null) + fail(ASSERTION_FAILED, + "JDOHelper.getTransactionalObjectId with argument null returned non-null oid " + oid); + pm.close(); + pm = null; + } +} + Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetTransactionalObjectIdForNull.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetTransactionalObjectIdForTransient.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetTransactionalObjectIdForTransient.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetTransactionalObjectIdForTransient.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetTransactionalObjectIdForTransient.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.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.Transaction; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.mylib.PCPoint; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *<B>Title:</B> Get Transactional Object Id For Transient + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.3-6 + *<BR> + *<B>Assertion Description: </B> + The jdohelper.getTransactionalObjectIdForTransient method returns null if Object is a transient.Evaluating to true when == is used. + */ + + /* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 10/1/01 1.0 + */ + +public class GetTransactionalObjectIdForTransient extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.3-6 (GetTransactionalObjectIdForTransient) 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(GetTransactionalObjectIdForTransient.class); + } + + /* test JDOHelper.getTransactionalObjectId(Object pc) + * + */ + public void testGetTransactionalObjectIdForTransient() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + PCPoint p1 = new PCPoint(1,3); + Object oid = JDOHelper.getTransactionalObjectId(p1); + tx.commit(); + + if (oid != null) + fail(ASSERTION_FAILED, + "JDOHelper.getTransactionalObjectId called for transiewt instance returned non-null oid " + oid); + pm.close(); + pm = null; + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetTransactionalObjectIdForTransient.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetTransactionalObjectIdNotPersistenceCapable.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetTransactionalObjectIdNotPersistenceCapable.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetTransactionalObjectIdNotPersistenceCapable.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetTransactionalObjectIdNotPersistenceCapable.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,73 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.api.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.Transaction; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.mylib.Point; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *<B>Title:</B> Get Object Id Not Persistence Capable + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.3-7 + *<BR> + *<B>Assertion Description: </B> + The jdohelper.getTransactionalObjectId method returns null if Object is not PC.Evaluating to true when == is used. + */ + /* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 10/1/01 1.0 + */ + +public class GetTransactionalObjectIdNotPersistenceCapable extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.3-7 (GetTransactionalObjectIdNotPersistenceCapable) 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(GetTransactionalObjectIdNotPersistenceCapable.class); + } + + /* test JDOHelper.getTransactionalObjectId(Object pc) + * + */ + public void testGetTransactionalObjectIdNotPersistenceCapable() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + Point p1 = new Point(1,3); + Object oid = JDOHelper.getTransactionalObjectId(p1); + tx.commit(); + + if (oid != null) + fail(ASSERTION_FAILED, + "JDOHelper.getTransactionalObjectId called for instance of non-pc class returned non-null ObjectId " + oid); + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/GetTransactionalObjectIdNotPersistenceCapable.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDeleted.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDeleted.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDeleted.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDeleted.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.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.Transaction; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.mylib.PCPoint; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *<B>Title:</B> Is Deleted + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.4.5-1 + *<BR> + *<B>Assertion Description: </B> + The jdohelper.isDeleted method returns true if the instance of persistence capable + have been deleted in the current transaction + evaluating to true when == is used. + */ + /* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 9/26/01 1.0 + */ + +public class IsDeleted extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.4.5-1 (IsDeleted) 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(IsDeleted.class); + } + + /* test jdohelper.isDeleted(Object pc) + * + */ + public void testIsDeleted() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + PCPoint p1 = new PCPoint(1,3); + pm.makePersistent(p1); + pm.deletePersistent(p1); + boolean deleted = JDOHelper.isDeleted(p1); + tx.commit(); + if (!deleted) + fail(ASSERTION_FAILED, + "JDOHelper.isDeleted returns false for deleted instance"); + pm.close(); + pm = null; + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDeleted.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDeletedFalse.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDeletedFalse.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDeletedFalse.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDeletedFalse.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,79 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.api.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.Transaction; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.mylib.PCPoint; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *<B>Title:</B> Is Deleted False + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.4.5-2 + *<BR> + *<B>Assertion Description: </B> + The object parameter that implements PersistenceCapable, JDOHelper.isDeleted + delegates to the parameter instance and instances that have not been deleted + in the current transaction return false. + evaluating to true when == is used. + */ + /* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 9/29/01 1.0 + */ + +public class IsDeletedFalse extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.4.5-2 (IsDeletedFalse) 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(IsDeletedFalse.class); + } + + /* test JDOHelper.isDeleted(Object pc) + * + */ + public void testIsDeletedFalse() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + PCPoint p1 = new PCPoint(1,3); + pm.makePersistent(p1); + //pm.deletePersistent(p1); + boolean deleted = JDOHelper.isDeleted(p1); + tx.commit(); + if (deleted) + fail(ASSERTION_FAILED, + "JDOHelper.isDeleted returns true for non-deleted instance"); + pm.close(); + pm = null; + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDeletedFalse.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDeletedForNull.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDeletedForNull.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDeletedForNull.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDeletedForNull.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,75 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.api.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.Transaction; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *<B>Title:</B> Is Deleted For Null + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.4.5-5 + *<BR> + *<B>Assertion Description: </B> + The jdohelper.isDeleted method returns false for the instance of null, + evaluating to true when == is used. + */ + /* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 9/28/01 1.0 + */ + +public class IsDeletedForNull extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.4.5-5 (IsDeletedForNull) 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(IsDeletedForNull.class); + } + + /* test JDOHelper.IsDeleted(object PC) + * + */ + public void testIsDeletedForNull() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + Object p1 = null; + //pm.deletePersistent(p1); + boolean deleted = JDOHelper.isDeleted(p1); + tx.commit(); + if (deleted) + fail(ASSERTION_FAILED, + "JDOHelper.isDeleted with argumnet null returns true."); + pm.close(); + pm = null; + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDeletedForNull.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDeletedForTransient.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDeletedForTransient.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDeletedForTransient.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDeletedForTransient.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,75 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.api.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.Transaction; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.mylib.PCPoint; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *<B>Title:</B> Is Deleted For Transient + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.4.5-3 + *<BR> + *<B>Assertion Description: </B> + The JDOHelper.IsDeleted method returns false if the instance is a transient, + evaluating to true when == is used. + */ + /* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 9/26/01 1.0 + */ + +public class IsDeletedForTransient extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.4.5-3 (IsDeletedForTransient) 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(IsDeletedForTransient.class); + } + + /* test JDOHelper.IsDeleted(Object pc) + * + */ + public void testIsDeletedForTransient() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + PCPoint p1 = new PCPoint(1,3); + boolean deleted = JDOHelper.isDeleted(p1); + tx.commit(); + if (deleted) + fail(ASSERTION_FAILED, + "JDOHelper.isDeleted called for transient instance returns true."); + pm.close(); + pm = null; + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDeletedForTransient.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDeletedNotPersistenceCapable.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDeletedNotPersistenceCapable.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDeletedNotPersistenceCapable.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDeletedNotPersistenceCapable.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,75 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.api.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.Transaction; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.mylib.Point; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *<B>Title:</B> Is Deleted Not Persistence Capable + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.4.5-4 + *<BR> + *<B>Assertion Description: </B> + The JDOHelper.IsDeleted method returns false if the instance is not persistence + capable , evaluating to true when == is used. + */ + +/* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 9/26/01 1.0 + */ +public class IsDeletedNotPersistenceCapable extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.4.5-4 (IsDeletedNotPersistenceCapable) 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(IsDeletedNotPersistenceCapable.class); + } + + /* test JDOHelper.isDeleted(Object pc) + * + */ + public void testIsDeletedNotPersistenceCapable() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + Point p1 = new Point(1,3); + boolean deleted = JDOHelper.isDeleted(p1); + tx.commit(); + if (deleted) + fail(ASSERTION_FAILED, + "JDOHelper.isDeleted called for instance of non-pc class returns true."); + pm.close(); + pm = null; + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDeletedNotPersistenceCapable.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDirty.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDirty.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDirty.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDirty.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.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.Transaction; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.mylib.PCPoint; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *<B>Title:</B> Is Dirty + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.4.1-1 + *<BR> + *<B>Assertion Description: </B> + The jdohelper.isDirty method returns true if the instance of persistence capable + have changed the state in the current transaction + evaluating to true when == is used. + */ + /* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 9/30/01 1.0 + */ +public class IsDirty extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.4.1-1 (IsDirty) 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(IsDirty.class); + } + + /* test JDOHelper.isDeleted(Object pc) + * + */ + public void testIsDirty() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + PCPoint p1 = new PCPoint(1,3); + pm.makePersistent(p1); + + boolean dirty = JDOHelper.isDirty(p1); + tx.commit(); + + if (!dirty) + fail(ASSERTION_FAILED, + "JDOHelper.isDirty returns false for P-NEW instance"); + pm.close(); + pm = null; + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDirty.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDirtyFalse.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDirtyFalse.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDirtyFalse.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDirtyFalse.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.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.Transaction; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.mylib.PCPoint; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *<B>Title:</B> Is Dirty False + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.4.1-2 + *<BR> + *<B>Assertion Description: </B> + The jdohelper.isDirty method returns false if the instance of persistence capable + have not changed the state in the current transaction + evaluating to true when == is used. + */ + /* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 9/25/01 1.0 + */ +public class IsDirtyFalse extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.4.1-2 (IsDirtyFalse) 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(IsDirtyFalse.class); + } + + /* test JDOHelper.isDirty(Object pc) + * + */ + public void testIsDirtyFalse() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + PCPoint p1 = new PCPoint(1,3); + pm.makePersistent(p1); + tx.commit(); + + tx.begin(); + // access p1 field to make sure the instance is loaded in new tx + p1.getX(); + boolean dirty = JDOHelper.isDirty(p1); + tx.commit(); + if (dirty) + fail(ASSERTION_FAILED, + "JDOHelper.isDirty returns true for P-CLEAN instance"); + pm.close(); + pm = null; + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDirtyFalse.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDirtyForNull.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDirtyForNull.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDirtyForNull.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDirtyForNull.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,74 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.api.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.Transaction; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *<B>Title:</B> Is Dirty For Null + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.4.1-5 + *<BR> + *<B>Assertion Description: </B> + The jdohelper.isDirty method returns false if the instance is null, + evaluating to true when == is used. + */ + +/* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 9/27/01 1.0 + */ +public class IsDirtyForNull extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.4.1-5 (IsDirtyForNull) 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(IsDirtyForNull.class); + } + + /* test JDOHelper.isDirthy(Object pc) + * + */ + public void testIsDirtyForNull() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + Object p1 = null; + boolean dirty = JDOHelper.isDirty(p1); + tx.commit(); + if (dirty) + fail(ASSERTION_FAILED, + "JDOHelper.isDirty with argument null returns true."); + pm.close(); + pm = null; + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDirtyForNull.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDirtyForTransient.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDirtyForTransient.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDirtyForTransient.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDirtyForTransient.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,75 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.api.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.Transaction; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.mylib.PCPoint; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *<B>Title:</B> Is Dirty For Transient + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.4.1-3 + *<BR> + *<B>Assertion Description: </B> + The jdohelper.isDirty method returns false If the instance is transient, + evaluating to true when == is used. + */ + + /* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 9/28/01 1.0 + */ +public class IsDirtyForTransient extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.4.1-3 (IsDirtyForTransient) 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(IsDirtyForTransient.class); + } + + /* test JDOHelper.isDeleted(Object pc) + * + */ + public void testIsDirtyForTransient() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + PCPoint p1 = new PCPoint(1,3); + boolean dirty = JDOHelper.isDirty(p1); + tx.commit(); + if (dirty) + fail(ASSERTION_FAILED, + "JDOHelper.isDirty returns true for transient instance"); + pm.close(); + pm = null; + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDirtyForTransient.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDirtyNotPersistenceCapable.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDirtyNotPersistenceCapable.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDirtyNotPersistenceCapable.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDirtyNotPersistenceCapable.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,75 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.api.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.Transaction; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.mylib.Point; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *<B>Title:</B> Is Dirty Not Persistence Capable + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.4.1-4 + *<BR> + *<B>Assertion Description: </B> + The jdohelper.isDirty method returns false If the instance does not implement PersistenceCapable + evaluating to true when == is used. + */ + /* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 9/26/01 1.0 + */ + +public class IsDirtyNotPersistenceCapable extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.4.1-4 (IsDirtyNotPersistenceCapable) 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(IsDirtyNotPersistenceCapable.class); + } + + /* test JDOHelper.isDeleted(Object pc) + * + */ + public void testIsDirtyNotPersistenceCapable() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + Point p1 = new Point(1,3); + boolean dirty = JDOHelper.isDirty(p1); + tx.commit(); + if (dirty) + fail(ASSERTION_FAILED, + "JDOHelper.isDirty returns true for instance of non-pc class."); + pm.close(); + pm = null; + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsDirtyNotPersistenceCapable.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsNew.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsNew.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsNew.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsNew.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.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.Transaction; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.mylib.PCPoint; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *<B>Title:</B> Is New + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.4.4-1 + *<BR> + *<B>Assertion Description: </B> + The jdohelper.isNew method returns true for instances that have + been made persistent in the current transactionthe evaluating to + true when == is used. + */ + /* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 10/2/01 1.0 + */ +public class IsNew extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.4.4-1 (IsNew) 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(IsNew.class); + } + + /* test JDOHelper.isNew(Object pc) + * + */ + public void testIsNew() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + PCPoint p1 = new PCPoint(1,3); + pm.makePersistent(p1); + boolean isNew = JDOHelper.isNew(p1); + tx.commit(); + if (!isNew) + fail(ASSERTION_FAILED, + "JDOHelper.isNew returns false for P-NEW instance"); + pm.close(); + pm = null; + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsNew.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsNewFalse.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsNewFalse.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsNewFalse.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsNewFalse.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,80 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.api.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.Transaction; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.mylib.PCPoint; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *<B>Title:</B> Is New False + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.4.4-2 + *<BR> + *<B>Assertion Description: </B> + The jdohelper.isnew method returns false for the instances that have not +been made persistent in the current transaction + evaluating to true when == is used. + */ + /* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 10/2/01 1.0 + */ +public class IsNewFalse extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.4.4-2 (IsNewFalse) 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(IsNewFalse.class); + } + + /* test JDOHelper.isNew(Object pc) + * + */ + public void testIsNewFalse() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + PCPoint p1 = new PCPoint(1,3); + tx.commit(); + + tx.begin(); + // access p1 field to make sure the instance is loaded in new tx + p1.getX(); + boolean isNew = JDOHelper.isNew(p1); + tx.commit(); + if (isNew) + fail(ASSERTION_FAILED, + "JDOHelper.isNew returns true for P-CLEAN instance"); + pm.close(); + pm = null; + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsNewFalse.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsNewForNull.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsNewForNull.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsNewForNull.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsNewForNull.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,74 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.api.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.Transaction; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *<B>Title:</B> Is New For Null + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.4.4-5 + *<BR> + *<B>Assertion Description: </B> + The jdohelper.isNew method returns false for the instance which is null, + evaluating to true when == is used. + */ + +/* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 10/2/01 1.0 + */ +public class IsNewForNull extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.4.4-5 (IsNewForNull) 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(IsNewForNull.class); + } + + /* test JDOHelper.isNew(Object pc) + * + */ + public void testIsNewForNull() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + Object p1 = null; + boolean isNew = JDOHelper.isNew(p1); + tx.commit(); + if (isNew) + fail(ASSERTION_FAILED, + "JDOHelper.isNew with argument null returns true"); + pm.close(); + pm = null; + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsNewForNull.java ------------------------------------------------------------------------------ svn:executable = * Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsNewForTransient.java URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsNewForTransient.java?view=auto&rev=160090 ============================================================================== --- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsNewForTransient.java (added) +++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsNewForTransient.java Mon Apr 4 12:41:23 2005 @@ -0,0 +1,75 @@ +/* + * Copyright 2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.api.jdohelper; + +import javax.jdo.JDOHelper; +import javax.jdo.Transaction; + +import org.apache.jdo.tck.JDO_Test; +import org.apache.jdo.tck.pc.mylib.PCPoint; +import org.apache.jdo.tck.util.BatchTestRunner; + +/** + *<B>Title:</B> Is New For Transient + *<BR> + *<B>Keywords:</B> jdohelper + *<BR> + *<B>Assertion ID:</B> A8.4.4-3 + *<BR> + *<B>Assertion Description: </B> + The jdohelper.isNew method returns false If the instance is transient, + evaluating to true when == is used. + */ + + /* + * Revision History + * ================ + * Author : Date : Version + * Azita Kamangar 10/2/01 1.0 + */ +public class IsNewForTransient extends JDO_Test { + + /** */ + private static final String ASSERTION_FAILED = + "Assertion A8.4.4-3 (IsNewForTransient) 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(IsNewForTransient.class); + } + + /* test JDOHelper.isNew(Object pc) + * + */ + public void testIsNewForTransient() { + pm = getPM(); + Transaction tx = pm.currentTransaction(); + tx.begin(); + PCPoint p1 = new PCPoint(1,3); + boolean isNew = JDOHelper.isNew(p1); + tx.commit(); + if (isNew) + fail(ASSERTION_FAILED, + "JDOHelper.isNew returns true for transient instance"); + pm.close(); + pm = null; + } +} Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/jdohelper/IsNewForTransient.java ------------------------------------------------------------------------------ svn:executable = *