db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcai...@apache.org
Subject svn commit: r160090 [8/63] - in incubator/jdo/trunk: ./ tck20/ tck20/assertions/ tck20/iut_jars/ tck20/test/ tck20/test/conf/ tck20/test/java/ tck20/test/java/org/ tck20/test/java/org/apache/ tck20/test/java/org/apache/jdo/ tck20/test/java/org/apache/jdo/tck/ tck20/test/java/org/apache/jdo/tck/api/ tck20/test/java/org/apache/jdo/tck/api/instancecallbacks/ tck20/test/java/org/apache/jdo/tck/api/jdohelper/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/cache/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/close/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/extent/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/ tck20/test/java/org/apache/jdo/tck/api/persistencemanager/lifecycle/ tck20/test/java/org/apache/jdo/tck/api/persistencemanagerfactory/ tck20/test/java/org/apache/jdo/tck/enhancement/ tck20/test/java/org/apache/jdo/tck/extents/ tck20/test/java/org/apache/jdo/tck/lifecycle/ tck20/test/java/org/apache/jdo/tck/lifecycle/nontransactional/ tck20/test/java/org/apache/jdo/tck/models/ tck20/test/java/org/apache/jdo/tck/models/embedded/ tck20/test/java/org/apache/jdo/tck/models/fieldtypes/ tck20/test/java/org/apache/jdo/tck/models/inheritance/ tck20/test/java/org/apache/jdo/tck/pc/ tck20/test/java/org/apache/jdo/tck/pc/company/ tck20/test/java/org/apache/jdo/tck/pc/fieldtypes/ tck20/test/java/org/apache/jdo/tck/pc/inheritance/ tck20/test/java/org/apache/jdo/tck/pc/instancecallbacks/ tck20/test/java/org/apache/jdo/tck/pc/lifecycle/ tck20/test/java/org/apache/jdo/tck/pc/mylib/ tck20/test/java/org/apache/jdo/tck/query/ tck20/test/java/org/apache/jdo/tck/query/operators/ tck20/test/java/org/apache/jdo/tck/transactions/ tck20/test/java/org/apache/jdo/tck/util/ tck20/test/jdo/ tck20/test/jdo/applicationidentity/ tck20/test/jdo/applicationidentity/org/ tck20/test/jdo/applicationidentity/org/apache/ tck20/test/jdo/applicationidentity/org/apache/jdo/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/company/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/fieldtypes/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/inheritance/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/instancecallbacks/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/lifecycle/ tck20/test/jdo/applicationidentity/org/apache/jdo/tck/pc/mylib/ tck20/test/jdo/datastoreidentity/ tck20/test/jdo/datastoreidentity/org/ tck20/test/jdo/datastoreidentity/org/apache/ tck20/test/jdo/datastoreidentity/org/apache/jdo/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/company/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/fieldtypes/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/inheritance/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/instancecallbacks/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/lifecycle/ tck20/test/jdo/datastoreidentity/org/apache/jdo/tck/pc/mylib/ tck20/test/orm/ tck20/test/orm/applicationidentity/ tck20/test/orm/applicationidentity/org/ tck20/test/orm/applicationidentity/org/apache/ tck20/test/orm/applicationidentity/org/apache/jdo/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/company/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/fieldtypes/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/inheritance/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/instancecallbacks/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/lifecycle/ tck20/test/orm/applicationidentity/org/apache/jdo/tck/pc/mylib/ tck20/test/orm/datastoreidentity/ tck20/test/orm/datastoreidentity/org/ tck20/test/orm/datastoreidentity/org/apache/ tck20/test/orm/datastoreidentity/org/apache/jdo/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/company/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/fieldtypes/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/inheritance/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/instancecallbacks/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/lifecycle/ tck20/test/orm/datastoreidentity/org/apache/jdo/tck/pc/mylib/ tck20/test/sql/ tck20/test/sql/derby/
Date Mon, 04 Apr 2005 19:43:46 GMT
Propchange: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/close/AfterCloseAllMethodsThrowException.java
------------------------------------------------------------------------------
    svn:executable = *

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

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

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/close/IsClosedIsFalseUponConstruction.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/close/IsClosedIsFalseUponConstruction.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/close/IsClosedIsFalseUponConstruction.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/close/IsClosedIsFalseUponConstruction.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,59 @@
+/*
+ * 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.close;
+
+import org.apache.jdo.tck.util.BatchTestRunner;
+import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest;
+
+/**
+ *<B>Title:</B> Is Closed returns false Upon Construction
+ *<BR>
+ *<B>Keywords:</B>
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5-3
+ *<BR>
+ *<B>Assertion Description: </B>
+The PersistenceManager.isClosed method returns false upon construction of
+the PersistenceManager instance.
+*/
+
+public class IsClosedIsFalseUponConstruction extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5-3 (IsClosedIsFalseUponConstruction) 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(IsClosedIsFalseUponConstruction.class);
+    }
+
+    /** */
+    public void test() {
+        pm = getPM();
+        
+        if (pm.isClosed()) {
+            fail(ASSERTION_FAILED,
+                 "pm is closed after creation");
+        }
+    }
+}
+

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

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/close/IsClosedIsFalseUponRetrievalFromPool.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/close/IsClosedIsFalseUponRetrievalFromPool.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/close/IsClosedIsFalseUponRetrievalFromPool.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/close/IsClosedIsFalseUponRetrievalFromPool.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,62 @@
+/*
+ * 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.close;
+
+import org.apache.jdo.tck.util.BatchTestRunner;
+import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest;
+
+/**
+ *<B>Title:</B> Is Closed Is False Upon Retrieval From a Pool
+ *<BR>
+ *<B>Keywords:</B>
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5-4
+ *<BR>
+ *<B>Assertion Description: </B>
+The PersistenceManager.isClosed method returns false upon retrieval
+of a PersistenceManager from a pool.
+*/
+
+public class IsClosedIsFalseUponRetrievalFromPool extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5-4 (IsClosedIsFalseUponRetrievalFromPool) 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(IsClosedIsFalseUponRetrievalFromPool.class);
+    }
+
+    /** */
+    public void testIsClosed() {
+        String sname="Jojo";
+        String spswd="mypswd";
+
+        pmf = getPMF();
+        pm = pmf.getPersistenceManager(sname,spswd);
+
+        if (pm.isClosed()) {
+            fail(ASSERTION_FAILED,
+                 "pm is closed after creation");
+        }
+    }
+}

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

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/close/IsClosedIsTrueAfterClose.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/close/IsClosedIsTrueAfterClose.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/close/IsClosedIsTrueAfterClose.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/close/IsClosedIsTrueAfterClose.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,62 @@
+/*
+ * 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.close;
+
+import javax.jdo.PersistenceManagerFactory;
+
+import org.apache.jdo.tck.util.BatchTestRunner;
+import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest;
+
+/**
+ *<B>Title:</B> Is Closed Is True After Close
+ *<BR>
+ *<B>Keywords:</B>
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5-5
+ *<BR>
+ *<B>Assertion Description: </B>
+The PersistenceManager.isClosed method returns true only after the
+closemethod completes successfully, meaning the PersistenceManager has been closed. (same as A35-01).
+*/
+
+public class IsClosedIsTrueAfterClose extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5-5 (IsClosedIsTrueAfterClose) 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(IsClosedIsTrueAfterClose.class);
+    }
+
+    /** */
+    public void test() {
+        PersistenceManagerFactory pmf = getPMF();
+        pm = pmf.getPersistenceManager();
+        pm.close();
+        
+        if (!pm.isClosed()) {
+            fail(ASSERTION_FAILED,
+                 "pm.isClosed returns false after pm.close");
+        }
+    }
+}

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

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

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

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/extent/GetExtentWithNoSubclasses.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/extent/GetExtentWithNoSubclasses.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/extent/GetExtentWithNoSubclasses.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/extent/GetExtentWithNoSubclasses.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,112 @@
+/*
+ * 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.extent;
+
+import java.util.Iterator;
+
+import javax.jdo.Extent;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.mylib.PCPoint;
+import org.apache.jdo.tck.util.BatchTestRunner;
+import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest;
+
+/**
+ *<B>Title:</B> GetExtentWithNoSubclasses
+ *<BR>
+ *<B>Keywords:</B> inheritance extent
+ *<BR>
+ *<B>Assertion ID:</B> A12.5.4-2.
+ *<BR>
+ *<B>Assertion Description: </B>
+The getExtent method returns an Extent that contains all of the instances in the parameter class. With the subclasses parameter false, only instances of the specified class are returned.
+
+ */
+
+public class GetExtentWithNoSubclasses extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.4-2 (GetExtentWithNoSubclasses) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(GetExtentWithNoSubclasses.class);
+    }
+
+    private PCPoint p1 = null;
+    private PCPoint p2 = null;
+
+    /** */
+    public void testGetExtentWithNoSubclasses() {
+        pm = getPM();
+        createObjects(pm);
+        runTestGetExtent(pm);
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    private void createObjects(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            PCPoint p1 = new PCPoint (1,3);
+            PCPoint p2 = new PCPoint (3,5);
+            pm.makePersistent(p1);
+            pm.makePersistent(p2);
+            tx.commit();
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+
+    /** */
+    private void runTestGetExtent(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            Extent e = pm.getExtent(PCPoint.class, false);
+            
+            int c = 0;
+            for (Iterator i = e.iterator(); i.hasNext();) {
+                PCPoint p = (PCPoint) i.next();
+                if (debug) logger.debug("p.getX() = " + p.getX());
+                if ((p.getX() == 1) || (p.getX() == 3)) {
+                    // OK
+                }
+                else {
+                    fail(ASSERTION_FAILED, 
+                         "Extent of class " + PCPoint.class.getName() + 
+                         " includes unexpected instance, p.getX():" + p.getX());
+                }
+            }
+            tx.commit();
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+    }
+}

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

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

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

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/GetIgnoreCache.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/GetIgnoreCache.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/GetIgnoreCache.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/GetIgnoreCache.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.persistencemanager.flags;
+
+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 IgnoreCache Value from PersistenceManager
+ *<BR>
+ *<B>Keywords:</B>
+ *<BR>
+ *<B>Assertion ID:</B> A12.5.3-1.
+ *<BR>
+ *<B>Assertion Description: </B>
+ The PersistenceManager.getIgnoreCache method returns the current value of the
+ IgnoreCache option.
+
+ */
+
+public class GetIgnoreCache extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.3-1 (GetIgnoreCache) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(GetIgnoreCache.class);
+    }
+
+    /** */
+    public void testGetIgnoreCache() {
+        pm = getPM();
+        Transaction tx = pm.currentTransaction();
+        try {
+            PCPoint p1 = new PCPoint();
+            tx.begin();
+            pm.setIgnoreCache(true);
+            boolean returnValue = pm.getIgnoreCache();
+
+            if (!returnValue)
+                fail(ASSERTION_FAILED,
+                     "pm.getIgnoreCache() returns false after setting the falg to true");
+            tx.commit();
+        }
+        finally {
+            if (tx.isActive())
+                tx.rollback();
+        }
+        pm.close();
+        pm = null;
+    }
+}

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

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/SetIgnoreCacheToFalse.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/SetIgnoreCacheToFalse.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/SetIgnoreCacheToFalse.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/SetIgnoreCacheToFalse.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.api.persistencemanager.flags;
+
+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> Set IgnoreCache To False
+ *<BR>
+ *<B>Keywords:cache
+ *<BR>
+ *<B>Assertion ID:</B> A12.5.3-3.
+ *<BR>
+ *<B>Assertion Description: </B>
+The PersistenceManager.setIgnoreCache method called with a value of false instructs the
+query engine that the user expects queries to return results that reflect changed values in the cache.
+
+
+ */
+
+public class SetIgnoreCacheToFalse extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.3-3 (SetIgnoreCacheToFalse) 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(SetIgnoreCacheToFalse.class);
+    }
+
+    /** */
+    public void test() {
+        pm = getPM();
+    
+        runTestSetIgnoreCacheToFalse(pm);
+        
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    private void runTestSetIgnoreCacheToFalse(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            PCPoint p1 = new PCPoint();
+            tx.begin();
+            pm.setIgnoreCache(false);
+            if (pm.getIgnoreCache()) {
+                fail(ASSERTION_FAILED,
+                     "pm.getIgnoreCache() should return false after setting the flag to false.");
+            }
+            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/flags/SetIgnoreCacheToFalse.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/SetIgnoreCacheToTrue.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/SetIgnoreCacheToTrue.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/SetIgnoreCacheToTrue.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/SetIgnoreCacheToTrue.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.api.persistencemanager.flags;
+
+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> Set IgnoreCache To True
+ *<BR>
+ *<B>Keywords:cache
+ *<BR>
+ *<B>Assertion ID:</B> A12.5.3-2.
+ *<BR>
+ *<B>Assertion Description: </B>
+The PersistenceManager.setIgnoreCache method called with a value of true is a hint to the
+query engine that the user expects queries to be optimized to return approximate results by ignoring changed values in the
+cache. This is not testable, except to see whether the get/set works.
+
+
+ */
+
+public class SetIgnoreCacheToTrue extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.3-2 (SetIgnoreCacheToTrue) 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(SetIgnoreCacheToTrue.class);
+    }
+
+    /** */
+    public void test() {
+        pm = getPM();
+    
+        runTestSetIgnoreCacheToTrue(pm);
+        
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    public void runTestSetIgnoreCacheToTrue(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            PCPoint p1 = new PCPoint();
+            tx.begin();
+            pm.setIgnoreCache(true);
+            if (!pm.getIgnoreCache()) {
+                fail(ASSERTION_FAILED,
+                     "pm.getIgnoreCache() should return true after setting the flag to true.");
+            }
+            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/flags/SetIgnoreCacheToTrue.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/SetMultithreadedFalse.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/SetMultithreadedFalse.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/SetMultithreadedFalse.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/SetMultithreadedFalse.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.persistencemanager.flags;
+
+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> Set Multithreaded False
+ *<BR>
+ *<B>Keywords:</B> multithreaded
+ *<BR>
+ *<B>Assertion ID:</B> A12.7-2.
+ *<BR>
+ *<B>Assertion Description: </B>
+If PersistenceManager.setMultithreaded is called with a value of false, a value of false
+will be returned when getMultithreaded is called.
+
+ */
+
+public class SetMultithreadedFalse extends PersistenceManagerTest{
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.7-2 (SetMultithreadedFalse) 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(SetMultithreadedFalse.class);
+    }
+
+    /** */
+    public void test() {
+        pm = getPM();
+        
+        runTestSetMultithreadedFalse(pm);
+        
+        pm.close();
+        pm = null;
+    }
+    
+    /** */
+    private void runTestSetMultithreadedFalse(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            PCPoint p1 = new PCPoint();
+            tx.begin();
+            pm.setMultithreaded(false);
+            if (pm.getMultithreaded()) {
+                fail(ASSERTION_FAILED,
+                     "pm.getMultithreaded() should false true after setting the flag to false.");
+            }
+            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/flags/SetMultithreadedFalse.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/SetMultithreadedTrue.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/SetMultithreadedTrue.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/SetMultithreadedTrue.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/SetMultithreadedTrue.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,82 @@
+/*
+ * 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.flags;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.util.BatchTestRunner;
+import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest;
+
+/**
+ *<B>Title:</B> Set Multithreaded True
+ *<BR>
+ *<B>Keywords:</B> multithreaded
+ *<BR>
+ *<B>Assertion ID:</B> A12.7-1.
+ *<BR>
+ *<B>Assertion Description: </B>
+If PersistenceManager.setMultithreaded is called with a value of true, then the JDO
+implementation must perform synchronizations to support multiple application threads. A value of true will be returned
+when getMultithreaded is called. In testing, multi-threading should be turned on and then multi-threading tests should
+be run.
+ */
+
+public class SetMultithreadedTrue extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.7-1 (SetMultithreadedTrue) 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(SetMultithreadedTrue.class);
+    }
+
+    /** */
+    public void test() {
+        pm = getPM();
+        
+        runTestSetMultithreadedTrue(pm);
+        
+        pm.close();
+        pm = null;
+    }
+    
+    /** */
+    public void runTestSetMultithreadedTrue(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            pm.setMultithreaded(true);
+            if (!pm.getMultithreaded()) {
+                fail(ASSERTION_FAILED,
+                     "pm.getMultithreaded() should true true after setting the flag to true.");
+            }
+            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/flags/SetMultithreadedTrue.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/SettingFlagsWithTransactionInstance.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/SettingFlagsWithTransactionInstance.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/SettingFlagsWithTransactionInstance.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/flags/SettingFlagsWithTransactionInstance.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.api.persistencemanager.flags;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.util.BatchTestRunner;
+import org.apache.jdo.tck.api.persistencemanager.PersistenceManagerTest;
+
+/**
+ *<B>Title:</B> Setting Flags With Transaction instance
+ *<BR>
+ *<B>Keywords:
+ *<BR>
+ *<B>Assertion ID:</B> A12.5.2-3.
+ *<BR>
+ *<B>Assertion Description: </B>
+Even if the Transaction instance returned by PersistenceManager.currentTransaction
+cannot be used for transaction completion (due to external transaction management), it still can be used to set flags.
+
+ */
+
+public class SettingFlagsWithTransactionInstance extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.2-3 (SettingFlagsWithTransactionInstance) 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(SettingFlagsWithTransactionInstance.class);
+    }
+
+    /** */
+    public void test() {
+        pm = getPM();
+        
+        runTestSettingFlagsWithTransactionInstance(pm);
+        
+        pm.close();
+        pm = null;
+    }
+
+
+    /** */
+    private void runTestSettingFlagsWithTransactionInstance(PersistenceManager pm) {
+        Transaction tx = pm.currentTransaction();
+        tx.setNontransactionalRead(false);
+        tx.setNontransactionalWrite(false);
+        tx.setRetainValues(false);
+        tx.setOptimistic(false);
+    }
+}

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

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

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

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

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

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

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

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

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

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectByIdNoValidationInstanceNotInCacheNoTx.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectByIdNoValidationInstanceNotInCacheNoTx.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectByIdNoValidationInstanceNotInCacheNoTx.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectByIdNoValidationInstanceNotInCacheNoTx.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,89 @@
+/*
+ * 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 Object By Id No Validation Instance Not In Cache, No Tx
+ *<BR>
+ *<B>Keywords:</B> identity cache
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.6-4
+ *<BR>
+ *<B>Assertion Description: </B>
+If PersistenceManager.getObjectById is called with a value of false for the
+second parameter named validate, and there is not an instance already in the cache with the same JDO identity as the oid parameter, and there is no transaction in progress, then this method creates an instance with the specified JDO identity and returns it with a state of hollow or persistent-nontransactional, at the choice of the implementation.
+ */
+
+public class GetObjectByIdNoValidationInstanceNotInCacheNoTx extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.6-4 (GetObjectByIdNoValidationInstanceNotInCacheNoTx) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(GetObjectByIdNoValidationInstanceNotInCacheNoTx.class);
+    }
+
+    /** */
+    public void testGetObjectByIdNoValidationInstanceNotInCacheNoTx() {
+        pm = getPM();
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+
+            PCPoint p1 = new PCPoint (1,3);
+            pm.makePersistent(p1);
+            Object oid = pm.getObjectId(p1);
+            pm.evict(p1);
+            tx.commit();
+
+            /* get oid for p1, no transaction in progress */
+            Object obj = pm.getObjectById (oid, false);
+
+            int curr = currentState(p1);
+
+            if (curr == HOLLOW ||
+                curr == PERSISTENT_NONTRANSACTIONAL ||
+                curr == PERSISTENT_CLEAN ) {
+                // expected result
+            } 
+            else {
+                fail(ASSERTION_FAILED,
+                     "returned state mismatched - " +
+                     " Actual state " + curr);
+            }
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+        pm.close();
+        pm = null;
+    }
+}

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

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectByIdNoValidationInstanceNotInDatastore.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectByIdNoValidationInstanceNotInDatastore.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectByIdNoValidationInstanceNotInDatastore.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectByIdNoValidationInstanceNotInDatastore.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,82 @@
+/*
+ * 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 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 Object By Id No Validation Instance Not In Datastore
+ *<BR>
+ *<B>Keywords:</B> identity exception
+ *<BR>
+ *<B>Assertion ID:</B> A12.5.6-6.
+ *<BR>
+ *<B>Assertion Description: </B>
+If <code>PersistenceManager.getObjectById</code> is called with a value of
+<code>false</code> for the second parameter named <code>validate</code>,
+and the instance does not exist in the data store, a subsequent access
+of the fields of the instance will throw a <code>JDODatastoreException</code>
+if the instance does not exist at that time.
+
+ */
+
+public class GetObjectByIdNoValidationInstanceNotInDatastore extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.6-6 (GetIgnoreCGetObjectByIdNoValidationInstanceNotInDatastore) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(GetObjectByIdNoValidationInstanceNotInDatastore.class);
+    }
+
+    /** */
+    public void testGetObjectByIdNoValidationInstanceNotInDatastore() {
+        if (debug)
+            logger.debug ("\nSTART GetObjectByIdNoValidationInstanceNotInDatastore");
+        Object oid = null;
+        pm = getPM();
+        oid = createPCPointInstance(pm);
+        deletePCPointInstance(pm, oid);
+    
+        try {
+            PCPoint p1 = (PCPoint)pm.getObjectById(oid, false); // might throw exception here
+            if (debug)
+                logger.debug ("Got object in cache, even though not in datastore.");
+            p1.getX(); // if not thrown above, throws exception here
+            fail(ASSERTION_FAILED,
+                 "accessing unknown instance should throw JDOObjectNotFoundException");
+        } 
+        catch (JDOObjectNotFoundException ex) {
+            // expected exception
+        }
+        pm.close();
+        pm = null;
+        if (debug)
+            logger.debug ("END GetObjectByIdNoValidationInstanceNotInDatastore");
+   }
+}

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

Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectByIdNotResolved.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectByIdNotResolved.java?view=auto&rev=160090
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectByIdNotResolved.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/api/persistencemanager/getobject/GetObjectByIdNotResolved.java Mon Apr  4 12:41:23 2005
@@ -0,0 +1,86 @@
+/*
+ * 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.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 For Null Or Not Persistent
+ *<BR>
+ *<B>Keywords:</B> identity
+ *<BR>
+ *<B>Assertion IDs:</B> A12.5.6-1
+ *<BR>
+ *<B>Assertion Description: </B>
+In a call to PersistenceManager.getObjectById, if the PersistenceManager is
+unable to resolve the oid parameter to an ObjectId instance, then it throws a JDOUserException.
+ */
+
+public class GetObjectByIdNotResolved extends PersistenceManagerTest {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A12.5.6-1 (GetObjectByIdNotResolved) failed: ";
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(GetObjectByIdNotResolved.class);
+    }
+
+    /* passing null paramameter to getObjectId */
+    public void testGetObjectByIdNotResolved() {
+        pm = getPM();
+        if (debug) logger.debug(" *** testObjectByIdNotResolved *** ");
+        Transaction tx = pm.currentTransaction();
+        try {
+            tx.begin();
+            PCPoint p1 = new PCPoint (1,3);
+            pm.makePersistent(p1);
+            Object oid = pm.getObjectId(p1);
+            pm.deletePersistent(p1);
+            tx.commit();
+
+            tx.begin();
+            try {
+                PCPoint p2 = (PCPoint) pm.getObjectById(oid, true);
+                fail(ASSERTION_FAILED,
+                     "pm.getObjectById(oid, true) should throw JDOObjectNotFoundException, if oid refers to an non existing object");
+            } 
+            catch (JDOObjectNotFoundException e) {
+                // expected exception
+            }
+            tx.rollback();
+            tx = null;
+        }
+        finally {
+            if ((tx != null) && tx.isActive())
+                tx.rollback();
+        }
+        pm.close();
+        pm = null;
+    }
+}
+

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

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

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

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

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



Mime
View raw message