db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r158176 [67/79] - in incubator/jdo/trunk/ri11: ./ src/ src/conf/ src/java/ src/java/org/ src/java/org/apache/ src/java/org/apache/jdo/ src/java/org/apache/jdo/ejb/ src/java/org/apache/jdo/enhancer/ src/java/org/apache/jdo/impl/ src/java/org/apache/jdo/impl/enhancer/ src/java/org/apache/jdo/impl/enhancer/classfile/ src/java/org/apache/jdo/impl/enhancer/core/ src/java/org/apache/jdo/impl/enhancer/generator/ src/java/org/apache/jdo/impl/enhancer/meta/ src/java/org/apache/jdo/impl/enhancer/meta/model/ src/java/org/apache/jdo/impl/enhancer/meta/prop/ src/java/org/apache/jdo/impl/enhancer/meta/util/ src/java/org/apache/jdo/impl/enhancer/util/ src/java/org/apache/jdo/impl/fostore/ src/java/org/apache/jdo/impl/jdoql/ src/java/org/apache/jdo/impl/jdoql/jdoqlc/ src/java/org/apache/jdo/impl/jdoql/scope/ src/java/org/apache/jdo/impl/jdoql/tree/ src/java/org/apache/jdo/impl/model/ src/java/org/apache/jdo/impl/model/java/ src/java/org/apache/jdo/impl/model/java/runtime/ src/java/org/apache/jdo/impl/model/jdo/ src/java/org/apache/jdo/impl/model/jdo/caching/ src/java/org/apache/jdo/impl/model/jdo/util/ src/java/org/apache/jdo/impl/model/jdo/xml/ src/java/org/apache/jdo/impl/pm/ src/java/org/apache/jdo/impl/sco/ src/java/org/apache/jdo/impl/state/ src/java/org/apache/jdo/jdoql/ src/java/org/apache/jdo/jdoql/tree/ src/java/org/apache/jdo/model/ src/java/org/apache/jdo/model/java/ src/java/org/apache/jdo/model/jdo/ src/java/org/apache/jdo/pm/ src/java/org/apache/jdo/sco/ src/java/org/apache/jdo/state/ src/java/org/apache/jdo/store/ src/java/org/apache/jdo/util/ test/ test/conf/ test/enhancer/ test/enhancer/sempdept/ test/enhancer/sempdept/src/ test/enhancer/sempdept/src/empdept/ test/fsuid2/ test/fsuid2/org/ test/fsuid2/org/apache/ test/fsuid2/org/apache/jdo/ test/fsuid2/org/apache/jdo/pc/ test/java/ test/java/org/ test/java/org/apache/ test/java/org/apache/jdo/ test/java/org/apache/jdo/impl/ test/java/org/apache/jdo/impl/fostore/ test/java/org/apache/jdo/pc/ test/java/org/apache/jdo/pc/appid/ test/java/org/apache/jdo/pc/empdept/ test/java/org/apache/jdo/pc/serializable/ test/java/org/apache/jdo/pc/xempdept/ test/java/org/apache/jdo/test/ test/java/org/apache/jdo/test/query/ test/java/org/apache/jdo/test/util/ test/jdo/ test/jdo/org/ test/jdo/org/apache/ test/jdo/org/apache/jdo/ test/jdo/org/apache/jdo/pc/ test/jdo/org/apache/jdo/pc/appid/ test/jdo/org/apache/jdo/pc/empdept/ test/jdo/org/apache/jdo/pc/serializable/ test/jdo/org/apache/jdo/pc/xempdept/ xdocs/
Date Sat, 19 Mar 2005 01:06:15 GMT
Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_LifeCycle_Opt.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_LifeCycle_Opt.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_LifeCycle_Opt.java (added)
+++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_LifeCycle_Opt.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,347 @@
+/*
+ * 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.
+ */
+
+/*
+ * Test_LifeCycle_Opt.java
+ *
+ * Created on August 14, 2001, 3:42 PM
+ */
+
+package org.apache.jdo.test;
+
+import org.apache.jdo.test.util.JDORITestRunner;
+
+/**
+ * Tests LifeCycle state transitions for optimistic transactions with
+ * retainValues flag set to true.
+ *
+ * @author  Marina Vatkina
+ * @version
+ */
+public class Test_LifeCycle_Opt extends Test_LifeCycle{
+
+    /** */
+    public static void main(String args[]) {
+        JDORITestRunner.run(Test_LifeCycle_Opt.class);
+    }
+
+    /** Creates new Test_LifeCycle_Opt */
+    public Test_LifeCycle_Opt() {
+        int i = 0;
+	cases.clear();
+        cases.add (new Case (i++, "Transient: makeTransient, read, write", new int[] { // 0
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,GET_OBJECT_ID, ASSERT_TRANSIENT //
+            ,MAKE_TRANSIENT, ASSERT_TRANSIENT // A5.9-5
+            ,READ_FIELD, ASSERT_TRANSIENT // A5.9-13
+            ,WRITE_FIELD, ASSERT_TRANSIENT // A5.9-16
+            ,DELETE_PERSISTENT, CATCH_JDO_USER_EXCEPTION // A5.9-2
+            ,MAKE_NONTRANSACTIONAL, CATCH_JDO_USER_EXCEPTION // A5.9-4
+            ,EVICT, ASSERT_TRANSIENT // A5.9-12
+            ,REFRESH, ASSERT_TRANSIENT // A5.9-11
+            }));
+        cases.add (new Case (i++, "Transient: read, write, commit, rollback", new int[] { // 1
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,READ_FIELD, ASSERT_TRANSIENT // A5.9-15
+            ,WRITE_FIELD, ASSERT_TRANSIENT // A5.9-17
+            ,MAKE_DIRTY, ASSERT_TRANSIENT // A5.9-17
+            ,COMMIT_TRANSACTION, ASSERT_TRANSIENT // A5.9-6
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT // A5.9-8
+            }));
+        cases.add (new Case (i++, "Transient: makeTransactional, read, commit, rollback", new int[] { // 2
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_TRANSACTIONAL, ASSERT_TRANSIENT_CLEAN
+            ,MAKE_TRANSACTIONAL, ASSERT_TRANSIENT_CLEAN // A5.9-88
+            ,READ_FIELD, ASSERT_TRANSIENT_CLEAN // A5.9-99
+            ,MAKE_TRANSIENT, ASSERT_TRANSIENT_CLEAN // A5.9-93
+            ,DELETE_PERSISTENT, CATCH_JDO_USER_EXCEPTION // A5.9-87
+            ,EVICT, ASSERT_TRANSIENT_CLEAN // A5.9-97
+            ,REFRESH, ASSERT_TRANSIENT_CLEAN // A5.9-96
+            ,COMMIT_TRANSACTION, ASSERT_TRANSIENT_CLEAN // A5.9-92
+            ,EVICT, ASSERT_TRANSIENT_CLEAN // A5.9-97
+            ,REFRESH, ASSERT_TRANSIENT_CLEAN // A5.9-96
+            ,READ_FIELD, ASSERT_TRANSIENT_CLEAN // A5.9-98
+            ,WRITE_FIELD, ASSERT_TRANSIENT_CLEAN // A5.9-101
+            ,MAKE_DIRTY, ASSERT_TRANSIENT_CLEAN // A5.9-101
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT_CLEAN
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT_CLEAN // A5.9-94
+            }));
+        cases.add (new Case (i++, "TransientClean: read, write, makeTransactional, makeTransient, commit, rollback", new int[] { // 3
+            ASSERT_TRANSIENT_CLEAN
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT_CLEAN
+            ,WRITE_FIELD, ASSERT_TRANSIENT_DIRTY // A5.9-102
+            ,MAKE_DIRTY, ASSERT_TRANSIENT_DIRTY // A5.9-102
+            ,READ_FIELD, ASSERT_TRANSIENT_DIRTY // A5.9-116
+            ,EVICT, ASSERT_TRANSIENT_DIRTY // A5.9-114
+            ,REFRESH, ASSERT_TRANSIENT_DIRTY // A5.9-113
+            ,MAKE_TRANSACTIONAL, ASSERT_TRANSIENT_DIRTY // A5.9-105
+            ,MAKE_NONTRANSACTIONAL, CATCH_JDO_USER_EXCEPTION // A5.9-106
+            ,MAKE_TRANSIENT, ASSERT_TRANSIENT_DIRTY // A5.9-107
+            ,DELETE_PERSISTENT, CATCH_JDO_USER_EXCEPTION // A5.9-104
+            ,COMMIT_TRANSACTION, ASSERT_TRANSIENT_CLEAN // A5.9-109
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT_CLEAN
+            ,MAKE_DIRTY, ASSERT_TRANSIENT_DIRTY // A5.9-119
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT_CLEAN // A5.9-111
+            }));
+        cases.add (new Case (i++, "TransientClean: makeTransactional, makeNonTransactional, commit, rollback", new int[] { // 4
+            ASSERT_TRANSIENT_CLEAN
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT_CLEAN
+            ,MAKE_TRANSACTIONAL, ASSERT_TRANSIENT_CLEAN // A5.9-88
+            ,MAKE_NONTRANSACTIONAL, ASSERT_TRANSIENT // A5.9-89
+            ,COMMIT_TRANSACTION, ASSERT_TRANSIENT // A5.9-6
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_TRANSACTIONAL, ASSERT_TRANSIENT_CLEAN
+            ,MAKE_NONTRANSACTIONAL, ASSERT_TRANSIENT // A5.9-89
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT // A5.9-8
+            }));
+        cases.add (new Case (i++, "Transient: makeTransactional, makePersistent, rollback", new int[] { // 5
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_TRANSACTIONAL, ASSERT_TRANSIENT_CLEAN
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW // A5.9-86
+            ,EVICT, ASSERT_PERSISTENT_NEW // A5.9-29
+            ,REFRESH, ASSERT_PERSISTENT_NEW // A5.9-28
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT // A5.9-26
+            }));
+        cases.add (new Case (i++, "Transient: makeTransactional, write, makePersistent, rollback", new int[] { // 6
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_TRANSACTIONAL, ASSERT_TRANSIENT_CLEAN
+            ,WRITE_FIELD, ASSERT_TRANSIENT_DIRTY // A5.9-102
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW // A5.9-103
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT // A5.9-26
+            }));
+        cases.add (new Case (i++, "Transient: makePersistent, rollback", new int[] { // 7
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION , ASSERT_TRANSIENT
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW // A5.9-1
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW // A5.9-18
+            ,GET_OBJECT_ID, ASSERT_PERSISTENT_NEW // A5.9-18
+            ,MAKE_TRANSACTIONAL, ASSERT_PERSISTENT_NEW // A5.9-20
+            ,MAKE_NONTRANSACTIONAL, CATCH_JDO_USER_EXCEPTION // A5.9-21
+            ,MAKE_TRANSIENT, CATCH_JDO_USER_EXCEPTION // A5.9-22
+            ,READ_FIELD, ASSERT_PERSISTENT_NEW // A5.9-31
+            ,WRITE_FIELD, ASSERT_PERSISTENT_NEW // A5.9-34
+            ,MAKE_DIRTY, ASSERT_PERSISTENT_NEW // A5.9-34
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT  // A5.9-25
+            }));
+        cases.add (new Case (i++, "Transient: makePersistent, delete, rollback", new int[] { // 8
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW
+            ,DELETE_PERSISTENT, ASSERT_PERSISTENT_NEW_DELETED // A5.9-19
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW_DELETED // A5.9-120
+            ,DELETE_PERSISTENT, ASSERT_PERSISTENT_NEW_DELETED // A5.9-121
+            ,MAKE_TRANSACTIONAL, ASSERT_PERSISTENT_NEW_DELETED // A5.9-122
+            ,EVICT, ASSERT_PERSISTENT_NEW_DELETED // A5.9-131
+            ,REFRESH, ASSERT_PERSISTENT_NEW_DELETED // A5.9-130
+            ,MAKE_TRANSIENT, CATCH_JDO_USER_EXCEPTION // A5.9-124
+            ,MAKE_NONTRANSACTIONAL, CATCH_JDO_USER_EXCEPTION // A5.9-123
+            ,READ_FIELD, CATCH_JDO_USER_EXCEPTION // A5.9-133
+            ,WRITE_FIELD, CATCH_JDO_USER_EXCEPTION // A5.9-136
+            ,MAKE_DIRTY, CATCH_JDO_USER_EXCEPTION // A5.9-136
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT // A5.9-127
+            }));
+        cases.add (new Case (i++, "Transient: makePersistent, delete, commit", new int[] { // 9
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW
+            ,DELETE_PERSISTENT, ASSERT_PERSISTENT_NEW_DELETED // A5.9-19
+            ,COMMIT_TRANSACTION, ASSERT_TRANSIENT // A5.9-125
+            }));
+        cases.add (new Case (i++, "Transient: makePersistent, commit", new int[] { // 10
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW
+            ,COMMIT_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-23
+            }));
+        cases.add (new Case (i++, "PersistentDirty: makePersistent, makeTransactional, commit", new int[] { // 11
+            ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,BEGIN_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,WRITE_FIELD, ASSERT_PERSISTENT_DIRTY // A5.9-170
+            ,EVICT, ASSERT_PERSISTENT_DIRTY // A5.9-63
+            ,WRITE_FIELD, ASSERT_PERSISTENT_DIRTY // A5.9-68
+            ,MAKE_DIRTY, ASSERT_PERSISTENT_DIRTY // A5.9-68
+            ,READ_FIELD, ASSERT_PERSISTENT_DIRTY // A5.9-65
+            ,MAKE_TRANSACTIONAL, ASSERT_PERSISTENT_DIRTY // A5.9-54
+            ,MAKE_NONTRANSACTIONAL, CATCH_JDO_USER_EXCEPTION // A5.9-55
+            ,MAKE_TRANSIENT, CATCH_JDO_USER_EXCEPTION // A5.9-56
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_DIRTY // A5.9-52
+            ,COMMIT_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-57
+            }));
+        cases.add (new Case (i++, "Nontransactional: makeNontransactional, read, write", new int[] { // 12
+            ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,MAKE_NONTRANSACTIONAL, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-157
+            ,READ_FIELD, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-166
+            ,WRITE_FIELD, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-169
+            ,MAKE_DIRTY, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-169
+            }));
+        cases.add (new Case (i++, "Nontransactional: makePersistent, makeTransactional", new int[] { // 13
+            ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,MAKE_PERSISTENT, CATCH_JDO_USER_EXCEPTION // A12.5.7-1
+            ,BEGIN_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,REFRESH, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-164
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-154
+            ,MAKE_TRANSACTIONAL, ASSERT_PERSISTENT_CLEAN // A5.9-156
+            ,READ_FIELD, ASSERT_PERSISTENT_CLEAN // A5.9-48
+            ,MAKE_DIRTY, ASSERT_PERSISTENT_DIRTY // A5.9-51
+            ,COMMIT_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-41
+            }));
+        cases.add (new Case (i++, "PersistentDirty: rollback", new int[] { // 14
+            ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,BEGIN_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,READ_FIELD, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-167
+            ,MAKE_DIRTY, ASSERT_PERSISTENT_DIRTY // A5.9-51
+            ,ROLLBACK_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-59
+            }));
+        cases.add (new Case (i++, "PersistentDirty: commit", new int[] { // 15
+            ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,BEGIN_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,READ_FIELD, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-167
+            ,MAKE_DIRTY, ASSERT_PERSISTENT_DIRTY // A5.9-51
+            ,COMMIT_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-41
+            }));
+        cases.add (new Case (i++, "PersistentDirty: refresh", new int[] { // 16
+            ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,BEGIN_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,READ_FIELD, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-167
+            ,WRITE_FIELD, ASSERT_PERSISTENT_DIRTY // A5.9-51
+            ,REFRESH, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-62
+            ,ROLLBACK_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-59
+            }));
+        cases.add (new Case (i++, "PersistentNonTransactional: makePersistent, makeTransactional", new int[] { // 17
+            ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,BEGIN_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,READ_FIELD, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-167
+            ,READ_FIELD, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-167
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-154
+            ,MAKE_TRANSACTIONAL, ASSERT_PERSISTENT_CLEAN // A5.9-37
+            ,COMMIT_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-40
+            }));
+        cases.add (new Case (i++, "PersistentNonTransactional: makeNontransactional", new int[] { // 18
+            ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,BEGIN_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,READ_FIELD, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-167
+            ,MAKE_NONTRANSACTIONAL, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-38
+            ,COMMIT_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-160
+            }));
+        cases.add (new Case (i++, "PersistentDeleted: rollback", new int[] { // 19
+            ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,BEGIN_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,READ_FIELD, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-167
+            ,DELETE_PERSISTENT, ASSERT_PERSISTENT_DELETED // A5.9-36
+            ,EVICT, ASSERT_PERSISTENT_DELETED // A5.9-148
+            ,REFRESH, ASSERT_PERSISTENT_DELETED // A5.9-147
+            ,READ_FIELD, CATCH_JDO_USER_EXCEPTION // A5.9-134
+            ,ROLLBACK_TRANSACTION ,ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-145
+            }));
+        cases.add (new Case (i++, "PersistentDeleted: makePersistent, makeTransactional, commit", new int[] { // 20
+            ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,BEGIN_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,GET_OBJECT_ID, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,DELETE_PERSISTENT, ASSERT_PERSISTENT_DELETED // A5.9-155
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_DELETED // A5.9-137
+            ,DELETE_PERSISTENT, ASSERT_PERSISTENT_DELETED // A5.9-138
+            ,MAKE_TRANSACTIONAL, ASSERT_PERSISTENT_DELETED // A5.9-139
+            ,MAKE_NONTRANSACTIONAL, CATCH_JDO_USER_EXCEPTION // A5.9-140
+            ,MAKE_TRANSIENT, CATCH_JDO_USER_EXCEPTION // A5.9-141
+            ,READ_FIELD, CATCH_JDO_USER_EXCEPTION // A5.9-151
+            ,WRITE_FIELD, CATCH_JDO_USER_EXCEPTION // A5.9-153
+            ,MAKE_DIRTY, CATCH_JDO_USER_EXCEPTION // A5.9-153
+            ,COMMIT_TRANSACTION, ASSERT_TRANSIENT // A5.9-142
+            }));
+        cases.add (new Case (i++, "Transient: getObjectById(false), getObjectById(true), makePersistent, commit", new int[] { // 21
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,GET_OBJECT_BY_ID_WOUT_VALIDATE, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,READ_FIELD, CATCH_JDO_DATASTORE_EXCEPTION
+            ,GET_OBJECT_BY_ID_WITH_VALIDATE, CATCH_JDO_DATASTORE_EXCEPTION
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW
+            ,GET_OBJECT_ID, ASSERT_PERSISTENT_NEW
+            ,COMMIT_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-23
+            }));
+        cases.add (new Case (i++, "Nontransactional: getObjectById(false), getObjectById(true)", new int[] { // 22
+            ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,BEGIN_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,GET_OBJECT_BY_ID_WOUT_VALIDATE, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,GET_OBJECT_BY_ID_WITH_VALIDATE, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,COMMIT_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-23
+            }));
+        cases.add (new Case (i++, "Nontransactional: makeTransient, commit, rollback", new int[] { // 23
+            ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,BEGIN_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,MAKE_TRANSIENT, ASSERT_TRANSIENT // A5.9-158
+            ,COMMIT_TRANSACTION, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW
+            ,COMMIT_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-23
+            ,BEGIN_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,MAKE_TRANSIENT, ASSERT_TRANSIENT // A5.9-158
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW
+            ,COMMIT_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-23
+            ,MAKE_TRANSIENT, ASSERT_TRANSIENT // A5.9-158
+            }));
+        cases.add (new Case (i++, "Nontransactional: evict", new int[] { // 24
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW
+            ,COMMIT_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-23
+            ,REFRESH, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-164
+            ,EVICT, ASSERT_HOLLOW // A5.9-165
+            ,EVICT, ASSERT_HOLLOW // A5.9-80
+            ,REFRESH, ASSERT_HOLLOW // A5.9-79
+            ,BEGIN_TRANSACTION, ASSERT_HOLLOW
+            ,READ_FIELD, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,EVICT, ASSERT_HOLLOW // A5.9-80
+            ,REFRESH, ASSERT_HOLLOW // A5.9-79
+            ,COMMIT_TRANSACTION, ASSERT_HOLLOW // A5.9-23
+            }));
+        cases.add (new Case (i++, "PersistentClean: evict", new int[] { // 25
+            ASSERT_HOLLOW
+            ,BEGIN_TRANSACTION, ASSERT_HOLLOW
+            ,READ_FIELD, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,MAKE_TRANSACTIONAL, ASSERT_PERSISTENT_CLEAN // A5.9-37
+            ,REFRESH, ASSERT_PERSISTENT_CLEAN // A5.9-45
+            ,EVICT, ASSERT_HOLLOW // A5.9-46
+            ,COMMIT_TRANSACTION, ASSERT_HOLLOW // A5.9-23
+            }));
+        cases.add (new Case (i++, "Hollow: makeDirty", new int[] { // 26
+            ASSERT_HOLLOW
+            ,BEGIN_TRANSACTION, ASSERT_HOLLOW
+            ,MAKE_DIRTY, ASSERT_PERSISTENT_DIRTY // A5.9-85
+            ,COMMIT_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-23
+            ,BEGIN_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,EVICT, ASSERT_HOLLOW // A5.9-80
+            ,COMMIT_TRANSACTION, ASSERT_HOLLOW // A5.9-23
+            ,MAKE_DIRTY, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-84
+            }));
+    }
+
+    /**
+     * Initializes JDO startup properties with default values.
+     * Sub classes can overwrite this method in order to change those default
+     * values.
+     */
+    protected void initProperties()
+    {   super.initProperties();
+        properties.setProperty( "javax.jdo.option.Optimistic", "true" );
+    }
+}

Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_LifeCycle_RetF.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_LifeCycle_RetF.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_LifeCycle_RetF.java (added)
+++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_LifeCycle_RetF.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,239 @@
+/*
+ * 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.
+ */
+
+/*
+ * Test_LifeCycle_RetF.java
+ *
+ * Created on August 17, 2001, 3:42 PM
+ */
+
+/*
+ * Test_LifeCycle_RetF.java
+ *
+ * Created on Aug 17, 2001
+ */
+
+package org.apache.jdo.test;
+
+import org.apache.jdo.test.util.JDORITestRunner;
+
+/**
+ * Tests LifeCycle state transitions for datastore transactions with
+ * retainValues flag set to false.
+ *
+ * @author  Marina Vatkina
+ * @version
+ */
+public class Test_LifeCycle_RetF extends Test_LifeCycle{
+
+    /** */
+    public static void main(String args[]) {
+        JDORITestRunner.run(Test_LifeCycle_RetF.class);
+    }
+
+    /** Creates new Test_LifeCycle_RetF */
+    public Test_LifeCycle_RetF() {
+        int i = 0;
+	cases.clear();
+        cases.add (new Case (i++, "Transient: read, write, commit, rollback", new int[] {
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,READ_FIELD, ASSERT_TRANSIENT // A5.9-15
+            ,WRITE_FIELD, ASSERT_TRANSIENT // A5.9-17
+            ,COMMIT_TRANSACTION, ASSERT_TRANSIENT // A5.9-6
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT // A5.9-8
+            }));
+        cases.add (new Case (i++, "Transient: makeTransactional, read, commit, rollback", new int[] {
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_TRANSACTIONAL, ASSERT_TRANSIENT_CLEAN
+            ,READ_FIELD, ASSERT_TRANSIENT_CLEAN // A5.9-99
+            ,MAKE_TRANSIENT, ASSERT_TRANSIENT_CLEAN // A5.9-90
+            ,COMMIT_TRANSACTION, ASSERT_TRANSIENT_CLEAN // A5.9-91
+            ,READ_FIELD, ASSERT_TRANSIENT_CLEAN // A5.9-98
+            ,WRITE_FIELD, ASSERT_TRANSIENT_CLEAN // A5.9-101
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT_CLEAN
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT_CLEAN // A5.9-93
+            }));
+        cases.add (new Case (i++, "TransientClean: read, write, commit, rollback", new int[] {
+            ASSERT_TRANSIENT_CLEAN
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT_CLEAN
+            ,WRITE_FIELD, ASSERT_TRANSIENT_DIRTY // A5.9-102
+            ,READ_FIELD, ASSERT_TRANSIENT_DIRTY // A5.9-116
+            ,COMMIT_TRANSACTION, ASSERT_TRANSIENT_CLEAN // A5.9-108
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT_CLEAN
+            ,WRITE_FIELD, ASSERT_TRANSIENT_DIRTY // A5.9-119
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT_CLEAN // A5.9-110
+            }));
+        cases.add (new Case (i++, "TransientClean: makeTransactional, makeNonTransactional, commit, rollback", new int[] {
+            ASSERT_TRANSIENT_CLEAN
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT_CLEAN
+            ,MAKE_TRANSACTIONAL, ASSERT_TRANSIENT_CLEAN // A5.9-88
+            ,MAKE_NONTRANSACTIONAL, ASSERT_TRANSIENT // A5.9-89
+            ,COMMIT_TRANSACTION, ASSERT_TRANSIENT // A5.9-6
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_TRANSACTIONAL, ASSERT_TRANSIENT_CLEAN
+            ,MAKE_NONTRANSACTIONAL, ASSERT_TRANSIENT // A5.9-89
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT // A5.9-8
+            }));
+        cases.add (new Case (i++, "Transient: makeTransactional, makePersistent, rollback", new int[] {
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_TRANSACTIONAL, ASSERT_TRANSIENT_CLEAN
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW // A5.9-86
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT // A5.9-26
+            }));
+        cases.add (new Case (i++, "Transient: makeTransactional, write, makePersistent, rollback", new int[] {
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_TRANSACTIONAL, ASSERT_TRANSIENT_CLEAN
+            ,WRITE_FIELD, ASSERT_TRANSIENT_DIRTY // A5.9-102
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW // A5.9-103
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT // A5.9-26
+            }));
+        cases.add (new Case (i++, "Transient: makePersistent, rollback", new int[] {
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION , ASSERT_TRANSIENT
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW // A5.9-1
+            ,READ_FIELD, ASSERT_PERSISTENT_NEW // A5.9-31
+            ,WRITE_FIELD, ASSERT_PERSISTENT_NEW // A5.9-34
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT  // A5.9-25
+            }));
+        cases.add (new Case (i++, "Transient: makePersistent, delete, rollback", new int[] {
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW
+            ,DELETE_PERSISTENT, ASSERT_PERSISTENT_NEW_DELETED // A5.9-19
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT // A5.9-127
+            }));
+        cases.add (new Case (i++, "Transient: makePersistent, delete, commit", new int[] {
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW
+            ,DELETE_PERSISTENT, ASSERT_PERSISTENT_NEW_DELETED // A5.9-19
+            ,COMMIT_TRANSACTION, ASSERT_TRANSIENT // A5.9-125
+            }));
+        cases.add (new Case (i++, "Transient: makePersistent, commit", new int[] {
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW
+            ,COMMIT_TRANSACTION, ASSERT_HOLLOW // A5.9-23
+            }));
+        cases.add (new Case (i++, "Hollow: makePersistent, makeTransactional, commit", new int[] {
+            ASSERT_HOLLOW
+            ,BEGIN_TRANSACTION, ASSERT_HOLLOW
+            ,MAKE_PERSISTENT, ASSERT_HOLLOW // A5.9-69
+            ,MAKE_TRANSACTIONAL, ASSERT_PERSISTENT_CLEAN // A5.9-71
+            ,COMMIT_TRANSACTION, ASSERT_HOLLOW // A5.9-57
+            }));
+        cases.add (new Case (i++, "Hollow: makeNontransactional, read", new int[] {
+            ASSERT_HOLLOW
+            ,MAKE_NONTRANSACTIONAL, ASSERT_HOLLOW // A5.9-72
+            ,READ_FIELD, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-81
+            ,BEGIN_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,WRITE_FIELD, ASSERT_PERSISTENT_DIRTY // A5.9-68
+            ,COMMIT_TRANSACTION, ASSERT_HOLLOW // A5.9-57
+            }));
+        cases.add (new Case (i++, "Nontransactional: commit, rollback", new int[] {
+            ASSERT_HOLLOW
+            ,READ_FIELD, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-81
+            ,BEGIN_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,COMMIT_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-159
+            ,BEGIN_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,ROLLBACK_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-161
+            ,BEGIN_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,WRITE_FIELD, ASSERT_PERSISTENT_DIRTY // A5.9-68
+            ,COMMIT_TRANSACTION, ASSERT_HOLLOW // A5.9-57
+            }));
+        cases.add (new Case (i++, "Hollow: commit, rollback", new int[] {
+            ASSERT_HOLLOW
+            ,BEGIN_TRANSACTION, ASSERT_HOLLOW
+            ,COMMIT_TRANSACTION, ASSERT_HOLLOW // A5.9-74
+            ,BEGIN_TRANSACTION, ASSERT_HOLLOW
+            ,ROLLBACK_TRANSACTION, ASSERT_HOLLOW // A5.9-76
+            }));
+        cases.add (new Case (i++, "Hollow: write, commit", new int[] {
+            ASSERT_HOLLOW
+            ,WRITE_FIELD, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-84
+            ,BEGIN_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,WRITE_FIELD, ASSERT_PERSISTENT_DIRTY // A5.9-68
+            ,COMMIT_TRANSACTION, ASSERT_HOLLOW // A5.9-57
+            }));
+        cases.add (new Case (i++, "Hollow: write, rollback", new int[] {
+            ASSERT_HOLLOW
+            ,BEGIN_TRANSACTION, ASSERT_HOLLOW
+            ,READ_FIELD, ASSERT_PERSISTENT_CLEAN // A5.9-83
+            ,WRITE_FIELD, ASSERT_PERSISTENT_DIRTY // A5.9-51
+            ,ROLLBACK_TRANSACTION, ASSERT_HOLLOW // A5.9-59
+            }));
+        cases.add (new Case (i++, "Hollow: deletePersistent, rollback", new int[] {
+            ASSERT_HOLLOW
+            ,BEGIN_TRANSACTION, ASSERT_HOLLOW
+            ,DELETE_PERSISTENT, ASSERT_PERSISTENT_DELETED // A5.9-70
+            ,ROLLBACK_TRANSACTION, ASSERT_HOLLOW // A5.9-145
+            }));
+        cases.add (new Case (i++, "Hollow: deletePersistent, commit", new int[] {
+            ASSERT_HOLLOW
+            ,BEGIN_TRANSACTION, ASSERT_HOLLOW
+            ,WRITE_FIELD, ASSERT_PERSISTENT_DIRTY // A5.9-85
+            ,DELETE_PERSISTENT, ASSERT_PERSISTENT_DELETED // A5.9-70
+            ,COMMIT_TRANSACTION, ASSERT_TRANSIENT // A5.9-142
+            }));
+        cases.add (new Case (i++, "Transient: getObjectById(false), getObjectById(true), makePersistent, commit", new int[] {
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW
+            ,GET_OBJECT_ID, ASSERT_PERSISTENT_NEW
+            ,COMMIT_TRANSACTION, ASSERT_HOLLOW // A5.9-23
+            }));
+        cases.add (new Case (i++, "Hollow: getObjectById(false), getObjectById(true)", new int[] {
+            ASSERT_HOLLOW
+            ,BEGIN_TRANSACTION, ASSERT_HOLLOW
+            ,GET_OBJECT_BY_ID_WOUT_VALIDATE, ASSERT_HOLLOW
+            ,GET_OBJECT_BY_ID_WITH_VALIDATE, ASSERT_PERSISTENT_CLEAN
+            ,COMMIT_TRANSACTION, ASSERT_HOLLOW // A5.9-23
+            }));
+        cases.add (new Case (i++, "Hollow: makeTransient, commit, rollback", new int[] {
+            ASSERT_HOLLOW
+            ,BEGIN_TRANSACTION, ASSERT_HOLLOW
+            ,MAKE_TRANSIENT, ASSERT_TRANSIENT // A5.9-73
+            ,COMMIT_TRANSACTION, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW
+            ,COMMIT_TRANSACTION, ASSERT_HOLLOW // A5.9-23
+            ,BEGIN_TRANSACTION, ASSERT_HOLLOW
+            ,MAKE_TRANSIENT, ASSERT_TRANSIENT // A5.9-158
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW
+            ,COMMIT_TRANSACTION, ASSERT_HOLLOW // A5.9-23
+            ,MAKE_TRANSIENT, ASSERT_TRANSIENT // A5.9-158
+            }));
+    }
+
+    /**
+     * Initializes JDO startup properties with default values.
+     * Sub classes can overwrite this method in order to change those default
+     * values.
+     */
+    protected void initProperties()
+    {   super.initProperties();
+        properties.setProperty( "javax.jdo.option.RetainValues", "false" );
+        properties.setProperty( "javax.jdo.option.RestoreValues", "false" );
+        properties.setProperty( "javax.jdo.option.Optimistic", "false" );
+    }
+}

Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_LifeCycle_RetFOpt.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_LifeCycle_RetFOpt.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_LifeCycle_RetFOpt.java (added)
+++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_LifeCycle_RetFOpt.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,274 @@
+/*
+ * 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.
+ */
+
+/*
+ * Test_LifeCycle_RetFOpt.java
+ *
+ * Created on August 17, 2001, 3:42 PM
+ */
+
+package org.apache.jdo.test;
+
+import org.apache.jdo.test.util.JDORITestRunner;
+
+/**
+ * Tests LifeCycle state transitions for optimistic transactions with
+ * retainValues flag set to false.
+ *
+ * @author  Marina Vatkina
+ * @version
+ */
+public class Test_LifeCycle_RetFOpt extends Test_LifeCycle{
+
+    /** */
+    public static void main(String args[]) {
+        JDORITestRunner.run(Test_LifeCycle_RetFOpt.class);
+    }
+
+    /** Creates new Test_LifeCycle_RetFOpt */
+    public Test_LifeCycle_RetFOpt() {
+        int i = 0;
+	cases.clear();
+        cases.add (new Case (i++, "Transient: makeTransient, read, write", new int[] {
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,GET_OBJECT_ID, ASSERT_TRANSIENT //
+            ,MAKE_TRANSIENT, ASSERT_TRANSIENT // A5.9-5
+            ,READ_FIELD, ASSERT_TRANSIENT // A5.9-13
+            ,WRITE_FIELD, ASSERT_TRANSIENT // A5.9-16
+            ,DELETE_PERSISTENT, CATCH_JDO_USER_EXCEPTION // A5.9-2
+            ,MAKE_NONTRANSACTIONAL, CATCH_JDO_USER_EXCEPTION // A5.9-4
+            }));
+        cases.add (new Case (i++, "Transient: read, write, commit, rollback", new int[] {
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,READ_FIELD, ASSERT_TRANSIENT // A5.9-15
+            ,WRITE_FIELD, ASSERT_TRANSIENT // A5.9-17
+            ,COMMIT_TRANSACTION, ASSERT_TRANSIENT // A5.9-6
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT // A5.9-8
+            }));
+        cases.add (new Case (i++, "Transient: makeTransactional, read, commit, rollback", new int[] {
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_TRANSACTIONAL, ASSERT_TRANSIENT_CLEAN
+            ,MAKE_TRANSACTIONAL, ASSERT_TRANSIENT_CLEAN // A5.9-88
+            ,READ_FIELD, ASSERT_TRANSIENT_CLEAN // A5.9-99
+            ,MAKE_TRANSIENT, ASSERT_TRANSIENT_CLEAN // A5.9-90
+            ,DELETE_PERSISTENT, CATCH_JDO_USER_EXCEPTION // A5.9-87
+            ,COMMIT_TRANSACTION, ASSERT_TRANSIENT_CLEAN // A5.9-92
+            ,READ_FIELD, ASSERT_TRANSIENT_CLEAN // A5.9-98
+            ,WRITE_FIELD, ASSERT_TRANSIENT_CLEAN // A5.9-101
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT_CLEAN
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT_CLEAN // A5.9-94
+            }));
+        cases.add (new Case (i++, "TransientClean: read, write, makeTransactional, makeTransient, commit, rollback", new int[] {
+            ASSERT_TRANSIENT_CLEAN
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT_CLEAN
+            ,WRITE_FIELD, ASSERT_TRANSIENT_DIRTY // A5.9-102
+            ,READ_FIELD, ASSERT_TRANSIENT_DIRTY // A5.9-116
+            ,MAKE_TRANSACTIONAL, ASSERT_TRANSIENT_DIRTY // A5.9-105
+            ,MAKE_NONTRANSACTIONAL, CATCH_JDO_USER_EXCEPTION // A5.9-106
+            ,MAKE_TRANSIENT, ASSERT_TRANSIENT_DIRTY // A5.9-107
+            ,DELETE_PERSISTENT, CATCH_JDO_USER_EXCEPTION // A5.9-104
+            ,COMMIT_TRANSACTION, ASSERT_TRANSIENT_CLEAN // A5.9-109
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT_CLEAN
+            ,WRITE_FIELD, ASSERT_TRANSIENT_DIRTY // A5.9-119
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT_CLEAN // A5.9-111
+            }));
+        cases.add (new Case (i++, "TransientClean: makeTransactional, makeNonTransactional, commit, rollback", new int[] {
+            ASSERT_TRANSIENT_CLEAN
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT_CLEAN
+            ,MAKE_TRANSACTIONAL, ASSERT_TRANSIENT_CLEAN // A5.9-88
+            ,MAKE_NONTRANSACTIONAL, ASSERT_TRANSIENT // A5.9-89
+            ,COMMIT_TRANSACTION, ASSERT_TRANSIENT // A5.9-6
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_TRANSACTIONAL, ASSERT_TRANSIENT_CLEAN
+            ,MAKE_NONTRANSACTIONAL, ASSERT_TRANSIENT // A5.9-89
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT // A5.9-8
+            }));
+        cases.add (new Case (i++, "Transient: makeTransactional, makePersistent, rollback", new int[] {
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_TRANSACTIONAL, ASSERT_TRANSIENT_CLEAN
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW // A5.9-86
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT // A5.9-26
+            }));
+        cases.add (new Case (i++, "Transient: makeTransactional, write, makePersistent, rollback", new int[] {
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_TRANSACTIONAL, ASSERT_TRANSIENT_CLEAN
+            ,WRITE_FIELD, ASSERT_TRANSIENT_DIRTY // A5.9-102
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW // A5.9-103
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT // A5.9-26
+            }));
+        cases.add (new Case (i++, "Transient: makePersistent, rollback", new int[] {
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION , ASSERT_TRANSIENT
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW // A5.9-1
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW // A5.9-18
+            ,GET_OBJECT_ID, ASSERT_PERSISTENT_NEW // A5.9-18
+            ,MAKE_TRANSACTIONAL, ASSERT_PERSISTENT_NEW // A5.9-20
+            ,MAKE_NONTRANSACTIONAL, CATCH_JDO_USER_EXCEPTION // A5.9-21
+            ,MAKE_TRANSIENT, CATCH_JDO_USER_EXCEPTION // A5.9-22
+            ,READ_FIELD, ASSERT_PERSISTENT_NEW // A5.9-31
+            ,WRITE_FIELD, ASSERT_PERSISTENT_NEW // A5.9-34
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT  // A5.9-25
+            }));
+        cases.add (new Case (i++, "Transient: makePersistent, delete, rollback", new int[] {
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW
+            ,DELETE_PERSISTENT, ASSERT_PERSISTENT_NEW_DELETED // A5.9-19
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW_DELETED // A5.9-120
+            ,DELETE_PERSISTENT, ASSERT_PERSISTENT_NEW_DELETED // A5.9-121
+            ,MAKE_TRANSACTIONAL, ASSERT_PERSISTENT_NEW_DELETED // A5.9-122
+            ,MAKE_TRANSIENT, CATCH_JDO_USER_EXCEPTION // A5.9-124
+            ,MAKE_NONTRANSACTIONAL, CATCH_JDO_USER_EXCEPTION // A5.9-123
+            ,READ_FIELD, CATCH_JDO_USER_EXCEPTION // A5.9-133
+            ,WRITE_FIELD, CATCH_JDO_USER_EXCEPTION // A5.9-136
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT // A5.9-127
+            }));
+        cases.add (new Case (i++, "Transient: makePersistent, delete, commit", new int[] {
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW
+            ,DELETE_PERSISTENT, ASSERT_PERSISTENT_NEW_DELETED // A5.9-19
+            ,COMMIT_TRANSACTION, ASSERT_TRANSIENT // A5.9-125
+            }));
+        cases.add (new Case (i++, "Transient: makePersistent, commit", new int[] {
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW
+            ,COMMIT_TRANSACTION, ASSERT_HOLLOW // A5.9-23
+            }));
+        cases.add (new Case (i++, "PersistentDirty: makePersistent, makeTransactional, commit", new int[] {
+            ASSERT_HOLLOW
+            ,BEGIN_TRANSACTION, ASSERT_HOLLOW
+            ,WRITE_FIELD, ASSERT_PERSISTENT_DIRTY // A5.9-170
+            ,WRITE_FIELD, ASSERT_PERSISTENT_DIRTY // A5.9-68
+            ,READ_FIELD, ASSERT_PERSISTENT_DIRTY // A5.9-65
+            ,MAKE_TRANSACTIONAL, ASSERT_PERSISTENT_DIRTY // A5.9-54
+            ,MAKE_NONTRANSACTIONAL, CATCH_JDO_USER_EXCEPTION // A5.9-55
+            ,MAKE_TRANSIENT, CATCH_JDO_USER_EXCEPTION // A5.9-56
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_DIRTY // A5.9-52
+            ,COMMIT_TRANSACTION, ASSERT_HOLLOW // A5.9-57
+            }));
+        cases.add (new Case (i++, "Hollow: makeNontransactional, read", new int[] {
+            ASSERT_HOLLOW
+            ,MAKE_NONTRANSACTIONAL, ASSERT_HOLLOW // A5.9-157
+            ,READ_FIELD, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-166
+            }));
+        cases.add (new Case (i++, "Nontransactional: makePersistent, makeTransactional", new int[] {
+            ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,MAKE_PERSISTENT, CATCH_JDO_USER_EXCEPTION // A12.5.7-1
+            ,BEGIN_TRANSACTION, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-154
+            ,MAKE_TRANSACTIONAL, ASSERT_PERSISTENT_CLEAN // A5.9-156
+            ,READ_FIELD, ASSERT_PERSISTENT_CLEAN // A5.9-48
+            ,COMMIT_TRANSACTION, ASSERT_HOLLOW // A5.9-41
+            }));
+        cases.add (new Case (i++, "PersistentDirty: rollback", new int[] {
+            ASSERT_HOLLOW
+            ,BEGIN_TRANSACTION, ASSERT_HOLLOW
+            ,READ_FIELD, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-167
+            ,WRITE_FIELD, ASSERT_PERSISTENT_DIRTY // A5.9-51
+            ,ROLLBACK_TRANSACTION, ASSERT_HOLLOW // A5.9-59
+            }));
+        cases.add (new Case (i++, "PersistentNonTransactional: makePersistent, makeTransactional", new int[] {
+            ASSERT_HOLLOW
+            ,BEGIN_TRANSACTION, ASSERT_HOLLOW
+            ,READ_FIELD, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-167
+            ,READ_FIELD, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-167
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-154
+            ,MAKE_TRANSACTIONAL, ASSERT_PERSISTENT_CLEAN // A5.9-37
+            ,COMMIT_TRANSACTION, ASSERT_HOLLOW // A5.9-40
+            }));
+        cases.add (new Case (i++, "PersistentNonTransactional: makeNontransactional", new int[] {
+            ASSERT_HOLLOW
+            ,BEGIN_TRANSACTION, ASSERT_HOLLOW
+            ,READ_FIELD, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-167
+            ,MAKE_NONTRANSACTIONAL, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-38
+            ,COMMIT_TRANSACTION, ASSERT_HOLLOW // A5.9-160
+            }));
+        cases.add (new Case (i++, "PersistentDeleted: rollback", new int[] {
+            ASSERT_HOLLOW
+            ,BEGIN_TRANSACTION, ASSERT_HOLLOW
+            ,READ_FIELD, ASSERT_PERSISTENT_NONTRANSACTIONAL // A5.9-167
+            ,DELETE_PERSISTENT, ASSERT_PERSISTENT_DELETED // A5.9-36
+            ,READ_FIELD, CATCH_JDO_USER_EXCEPTION // A5.9-134
+            ,ROLLBACK_TRANSACTION ,ASSERT_HOLLOW // A5.9-145
+            }));
+        cases.add (new Case (i++, "PersistentDeleted: makePersistent, makeTransactional, commit", new int[] {
+            ASSERT_HOLLOW
+            ,BEGIN_TRANSACTION, ASSERT_HOLLOW
+            ,GET_OBJECT_ID, ASSERT_HOLLOW
+            ,DELETE_PERSISTENT, ASSERT_PERSISTENT_DELETED // A5.9-155
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_DELETED // A5.9-137
+            ,DELETE_PERSISTENT, ASSERT_PERSISTENT_DELETED // A5.9-138
+            ,MAKE_TRANSACTIONAL, ASSERT_PERSISTENT_DELETED // A5.9-139
+            ,MAKE_NONTRANSACTIONAL, CATCH_JDO_USER_EXCEPTION // A5.9-140
+            ,MAKE_TRANSIENT, CATCH_JDO_USER_EXCEPTION // A5.9-141
+            ,READ_FIELD, CATCH_JDO_USER_EXCEPTION // A5.9-151
+            ,WRITE_FIELD, CATCH_JDO_USER_EXCEPTION // A5.9-153
+            ,COMMIT_TRANSACTION, ASSERT_TRANSIENT // A5.9-142
+            }));
+        cases.add (new Case (i++, "Transient: getObjectById(false), getObjectById(true), makePersistent, commit", new int[] {
+            CREATE_TRANSIENT, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,GET_OBJECT_BY_ID_WOUT_VALIDATE, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,READ_FIELD, CATCH_JDO_DATASTORE_EXCEPTION
+            ,GET_OBJECT_BY_ID_WITH_VALIDATE, CATCH_JDO_DATASTORE_EXCEPTION
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW
+            ,GET_OBJECT_ID, ASSERT_PERSISTENT_NEW
+            ,COMMIT_TRANSACTION, ASSERT_HOLLOW // A5.9-23
+            }));
+        cases.add (new Case (i++, "Nontransactional: getObjectById(false), getObjectById(true)", new int[] {
+            ASSERT_HOLLOW
+            ,BEGIN_TRANSACTION, ASSERT_HOLLOW
+            ,GET_OBJECT_BY_ID_WOUT_VALIDATE, ASSERT_HOLLOW
+            ,GET_OBJECT_BY_ID_WITH_VALIDATE, ASSERT_PERSISTENT_NONTRANSACTIONAL
+            ,COMMIT_TRANSACTION, ASSERT_HOLLOW // A5.9-23
+            }));
+        cases.add (new Case (i++, "Nontransactional: makeTransient, commit, rollback", new int[] {
+            ASSERT_HOLLOW
+            ,BEGIN_TRANSACTION, ASSERT_HOLLOW
+            ,MAKE_TRANSIENT, ASSERT_TRANSIENT // A5.9-158
+            ,COMMIT_TRANSACTION, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW
+            ,COMMIT_TRANSACTION, ASSERT_HOLLOW // A5.9-23
+            ,BEGIN_TRANSACTION, ASSERT_HOLLOW
+            ,MAKE_TRANSIENT, ASSERT_TRANSIENT // A5.9-158
+            ,ROLLBACK_TRANSACTION, ASSERT_TRANSIENT
+            ,BEGIN_TRANSACTION, ASSERT_TRANSIENT
+            ,MAKE_PERSISTENT, ASSERT_PERSISTENT_NEW
+            ,COMMIT_TRANSACTION, ASSERT_HOLLOW // A5.9-23
+            ,MAKE_TRANSIENT, ASSERT_TRANSIENT // A5.9-158
+            }));
+    }
+
+    /**
+     * Initializes JDO startup properties with default values.
+     * Sub classes can overwrite this method in order to change those default
+     * values.
+     */
+    protected void initProperties()
+    {   super.initProperties();
+        properties.setProperty( "javax.jdo.option.RetainValues", "false" );
+        properties.setProperty( "javax.jdo.option.RestoreValues", "false" );
+        properties.setProperty( "javax.jdo.option.Optimistic", "true" );
+    }
+}

Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_Many.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_Many.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_Many.java (added)
+++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_Many.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,46 @@
+/*
+ * 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.test;
+
+import org.apache.jdo.test.util.JDORITestRunner;
+
+/**
+* Tests that we can insert objects into a database.  
+*
+* @author Michael Bouschen
+*/
+public class Test_Many extends Test_Insert {
+    
+    /** */
+    public static void main(String args[]) {
+        JDORITestRunner.run(Test_Many.class);
+    }
+
+    /** */
+    protected int getDefaultInsert()
+    {
+        // MBO: 
+        // There is a problem when running with a SecurityManager.
+        // The test runs into a AccessControlException with 998 and 999.
+        // With 1000 and more the test runs into JDODataStoreException: 
+        // Object with id OID: 100-511 already exists in the database
+        // FOStore needs to add some more doPrivileged blocks (see
+        // corresponding bug report). 
+        // Switch back to 2000 as soon as teh bug is fixed.
+        return 990;
+    }
+}

Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_Navigate.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_Navigate.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_Navigate.java (added)
+++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_Navigate.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,116 @@
+/*
+ * 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.test;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.jdo.Extent;
+import javax.jdo.PersistenceManager;
+
+import org.apache.jdo.pc.PCDepartment;
+import org.apache.jdo.pc.PCEmployee;
+import org.apache.jdo.pc.PCInsurance;
+import org.apache.jdo.pc.PCProject;
+import org.apache.jdo.test.util.JDORITestRunner;
+
+/**
+* Test a PC that has some fields which are PC's.
+*/
+public class Test_Navigate extends Test_EmpDept {
+    
+    Map emps = new HashMap();
+    Map depts = new HashMap();
+    Map inss = new HashMap();
+    Map projs = new HashMap();
+    
+    /** */
+    public static void main(String args[]) {
+        JDORITestRunner.run(Test_Navigate.class);
+    }
+
+    /** */
+    protected void readObjects() {
+        getEmpExtent();
+    }
+
+    /** The above test inserted a bunch of instances and committed them.  We
+     * now try to load the extent of Employee and navigate to all associated
+     * instances.
+     */
+    protected void getEmpExtent() {
+        PersistenceManager pm = null;
+        try {
+            pm = pmf.getPersistenceManager();
+            if (debug) logger.debug("\ngetEmpExtent");
+            Extent extent = pm.getExtent (PCEmployee.class, false);
+            Iterator it = extent.iterator();
+            while (it.hasNext()) {
+                PCEmployee e = (PCEmployee)it.next();
+                checkEmployee(e);
+            }
+            PCEmployee scott = (PCEmployee) emps.get (new Long (1L));
+            PCEmployee ed = (PCEmployee) emps.get (new Long (100L));
+            PCDepartment board = (PCDepartment) depts.get (new Long (100L));
+            PCDepartment emg = (PCDepartment) depts.get (new Long (200L));
+            PCInsurance scottIns = (PCInsurance) inss.get (new Long (1000L));
+            PCInsurance edIns = (PCInsurance) inss.get (new Long (1001L));
+            PCProject solaris = (PCProject) projs.get (new Long (1L));
+            PCProject sparc = (PCProject) projs.get (new Long (2L));
+            assertScott(scott);
+            assertEd(ed);
+            assertBoard(board);
+            assertEmg(emg);
+            assertScottIns(scottIns);
+            assertEdIns(edIns);
+            assertSolaris(solaris);
+            assertSparc(sparc);
+        }
+        finally {
+            if (pm != null && !pm.isClosed())
+                pm.close();
+        }
+    }
+    
+    /** */
+    void checkEmployee (PCEmployee e) {
+        emps.put (new Long(e.getEmpid()), e);
+        for (Iterator it = e.getProjects().iterator(); it.hasNext();) {
+            PCProject proj = (PCProject)it.next();
+            checkProject (proj);
+        }
+        checkDepartment ((PCDepartment) e.getDepartment());
+        checkInsurance ((PCInsurance) e.getInsurance());
+    }
+    
+    /** */
+    void checkDepartment (PCDepartment d) {
+        depts.put (new Long(d.getDeptid()), d);
+    }
+    
+    /** */
+    void checkProject (PCProject p) {
+        projs.put (new Long(p.getProjid()), p);
+    }
+    
+    /** */
+    void checkInsurance (PCInsurance i) {
+        inss.put (new Long(i.getInsid()), i);
+    }
+    
+}

Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_NegAll.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_NegAll.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_NegAll.java (added)
+++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_NegAll.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,212 @@
+/*
+ * 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.test;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import javax.jdo.JDOUserException;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.pc.PCPoint;
+import org.apache.jdo.test.util.AbstractTest;
+import org.apache.jdo.test.util.JDORITestRunner;
+
+/**
+* Tests that we can do correct processing of collections and arrays
+* in PersistenceManager.xxxAll() calls.
+*
+* @author Marina Vatkina
+*/
+public class Test_NegAll extends AbstractTest {
+
+    Collection c = new ArrayList();
+    PersistenceManager pm = null;
+    Transaction tx = null;
+
+    /** */
+    public static void main(String args[]) {
+        JDORITestRunner.run(Test_NegAll.class);
+    }
+    
+    /** */
+    public void test() {
+        try {
+            // Add PC object that will fail makeTr() and makeNonTx()
+            // It will pass makeP() and deleteP()
+            c.add( new PCPoint(11, 111) );
+            
+            // Add NON-PC object that will fail all calls
+            c.add( new Point(12, 122) );
+            
+            pm = pmf.getPersistenceManager();
+            tx = pm.currentTransaction();
+            tx.begin();
+            
+            insertAll();
+            
+            // Add Transient PC object that will fail makeNonTx() and deleteP().
+            // It will pass makeTx() and MakeTr()
+            c.add( new PCPoint(13, 133) );
+            
+            makeTrAll();
+            makeNonTxAll();
+            deleteAll();
+            makeTxAll();
+            evictAll();
+            
+            tx.rollback(); 
+
+        }
+        finally {
+            if (tx != null && tx.isActive())
+                tx.rollback();
+            if (pm != null && !pm.isClosed())
+                pm.close();
+        }
+    }
+
+    // Tries to insert object with dups Ids
+    private void insertAll() {
+        if (debug) logger.debug("\nINSERT ALL");
+        try {
+            pm.makePersistentAll(c);
+            fail("ERROR ON INSERT ALL COLLECTION");
+        } catch (JDOUserException e) {
+            if (debug)
+                logger.debug("INSERT ALL COLLECTION Caught expected: " +
+                             e.getNestedExceptions().length + " exceptions");
+        }
+        try {
+            pm.makePersistentAll(c.toArray());
+            fail("ERROR ON INSERT ALL ARRAY");
+        } catch (JDOUserException e) {
+            if (debug)
+                logger.debug("INSERT ALL ARRAY Caught expected: " +
+                             e.getNestedExceptions().length + " exceptions");
+        }
+    }
+    
+    // Tries to make Transient P_NEW Objects
+    private void makeTrAll() {
+        if (debug) logger.debug("\nMAKE TR ALL");
+
+        try {
+            pm.makeTransientAll(c);
+            fail("ERROR ON MAKE TR ALL COLLECTION");
+        } catch (JDOUserException e) {
+            if (debug)
+                logger.debug("MAKE TR ALL Caught expected: " +
+                             e.getNestedExceptions().length + " exceptions");
+        }
+        try {
+            pm.makeTransientAll(c.toArray());
+            fail("ERROR ON MAKE TR ALL ARRAY");
+        } catch (JDOUserException e) {
+            if (debug)
+                logger.debug("MAKE TR ALL ARRAY Caught expected: " +
+                             e.getNestedExceptions().length + " exceptions");
+        }
+    }
+    
+    // Tries to make NonTransactional P_NEW Objects
+    private void makeNonTxAll() {
+        if (debug) logger.debug("\nMAKE NON-TX ALL");
+        try {
+            pm.makeNontransactionalAll(c);
+            fail("ERROR ON MAKE NON-TX ALL COLLECTION");
+        } catch (JDOUserException e) {
+            if (debug)
+                logger.debug("MAKE NON-TX ALL Caught expected: " +
+                             e.getNestedExceptions().length + " exceptions");
+        }
+        try {
+            pm.makeNontransactionalAll(c.toArray());
+            fail("ERROR ON MAKE NON-TX ALL ARRAY");
+        } catch (JDOUserException e) {
+            if (debug)
+                logger.debug("MAKE NON-TX ALL ARRAY Caught expected: " +
+                             e.getNestedExceptions().length + " exceptions");
+        }
+    }
+    
+    // Tries to delete Transient Objects
+    private void deleteAll() {
+        if (debug) logger.debug("\nDELETE ALL");
+        try {
+            pm.deletePersistentAll(c);
+            fail("ERROR ON DELETE ALL COLLECTION");
+        } catch (JDOUserException e) {
+            if (debug)
+                logger.debug("DELETE ALL COLLECTION Caught expected: " +
+                             e.getNestedExceptions().length + " exceptions");
+        }
+        try {
+            pm.deletePersistentAll(c.toArray());
+            fail("ERROR ON DELETE ALL ARRAY");
+        } catch (JDOUserException e) {
+            if (debug)
+                logger.debug("DELETE ALL ARRAY Caught expected: " +
+                             e.getNestedExceptions().length + " exceptions");
+        }
+    }
+    
+    // Tries to make Transactional nonExistent objects
+    private void makeTxAll() {
+        if (debug) logger.debug("\nMAKE TX ALL");
+        try {
+            pm.makeTransactionalAll(c);
+            fail("ERROR ON MAKE TX ALL COLLECTION");
+        } catch (JDOUserException e) {
+            if (debug)
+                logger.debug("MAKE TX ALL COLLECTION Caught expected: " +
+                             e.getNestedExceptions().length + " exceptions");
+        }
+        try {
+            pm.makeTransactionalAll(c.toArray());
+            fail("ERROR ON MAKE TX ALL ARRAY");
+        } catch (JDOUserException e) {
+            if (debug)
+                logger.debug("MAKE TX ALL ARRAY Caught expected: " +
+                             e.getNestedExceptions().length + " exceptions");
+        }
+    }
+    
+    // Tries to evict all instances.
+    private void evictAll() {
+        if (debug) logger.debug("\nEVICT ALL");
+        try {
+            pm.evictAll(c);
+            fail("ERROR ON EVICT ALL COLLECTION");
+        } catch (JDOUserException e) {
+            if (debug)
+                logger.debug("EVICT ALL COLLECTION Caught expected: " +
+                             e.getNestedExceptions().length + " exceptions");
+        }
+        try {
+            pm.evictAll(c.toArray());
+            fail("ERROR ON EVICT ALL ARRAY");
+        } catch (JDOUserException e) {
+            if (debug)
+                logger.debug("EVICT ALL ARRAY Caught expected: " +
+                             e.getNestedExceptions().length + " exceptions");
+        }
+        pm.evictAll();
+        if (debug) logger.debug("EVICT ALL.");
+    }
+}

Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_NonTxAccess.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_NonTxAccess.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_NonTxAccess.java (added)
+++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_NonTxAccess.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,170 @@
+/*
+ * 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.test;
+
+import java.util.Iterator;
+
+import javax.jdo.Extent;
+import javax.jdo.JDOUserException;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.pc.PCPoint;
+import org.apache.jdo.pc.PointFactory;
+import org.apache.jdo.test.util.AbstractTest;
+import org.apache.jdo.test.util.Factory;
+import org.apache.jdo.test.util.JDORITestRunner;
+
+/**
+* Tests nontransactional read/write access
+*
+* @author Marina Vatkina
+*/
+public class Test_NonTxAccess extends AbstractTest {
+
+    /** */
+    public static void main(String args[]) {
+        JDORITestRunner.run(Test_NonTxAccess.class);
+    }
+
+    /** */
+    public void testNonTxReadTrue() throws Exception {
+        insertObjects();
+        nonTxRead(false);
+        checkExtent(factory.getPCClass(), numInsert);
+        readObjects();
+    }
+
+    /** */
+    public void testNonTxReadFalse() throws Exception {
+        insertObjects();
+        nonTxRead(true);
+        checkExtent(factory.getPCClass(), numInsert);
+        readObjects();
+    }
+
+    /** */
+    public void testNonTxWriteTrue() throws Exception {
+        insertObjects();
+        nonTxWrite(false);
+        checkExtent(factory.getPCClass(), numInsert);
+        readObjects();
+    }
+
+    /** */
+    public void testNonTxWriteFalse() throws Exception {
+        insertObjects();
+        nonTxWrite(true);
+        checkExtent(factory.getPCClass(), numInsert);
+        readObjects();
+    }
+    
+    // Gets an extent of points, and accesses them.
+    protected void nonTxRead(boolean nontxRead) {
+        PersistenceManager pm = null;
+        Transaction tx = null;
+        try {
+            if (debug) logger.debug("\nREAD: " + nontxRead);
+
+            pm = pmf.getPersistenceManager();
+            tx = pm.currentTransaction();
+            tx.setNontransactionalRead(nontxRead);
+
+            // Print the object by accessing its fields
+            Extent ext = pm.getExtent(PCPoint.class, false);
+            int count = 0;
+            for (Iterator i = PCPoint.getSortedIterator(ext.iterator()); i.hasNext();) {
+                PCPoint p = (PCPoint)i.next();
+                p.getX(); // access the object
+                if (debug) logger.debug("Read: " + p);
+                if (!nontxRead)
+                    fail("Reading a pc instance should fail if non-tx read is false");
+            }
+        } 
+        catch (JDOUserException e) {
+            if (!nontxRead) {
+                if (debug) logger.debug("Caught expected exception on read");
+            } else {
+                throw e;
+            }
+        }
+        finally {
+            if (pm != null && !pm.isClosed())
+                pm.close();
+        }
+    }
+
+    // Gets an extent of points, and update them.
+    protected void nonTxWrite(boolean nontxWrite) {
+        PersistenceManager pm = null;
+        Transaction tx = null;
+        try {
+            if (debug) logger.debug("\nWRITE: " + nontxWrite);
+            
+            pm = pmf.getPersistenceManager();
+            tx = pm.currentTransaction();
+            tx.setNontransactionalRead(true);
+            tx.setNontransactionalWrite(nontxWrite);
+            
+            Extent ext = pm.getExtent(PCPoint.class, false);
+            
+            // Print the object by accessing its fields
+            int count = 0;
+            for (Iterator i = PCPoint.getSortedIterator(ext.iterator()); i.hasNext();) {
+                PCPoint p = (PCPoint)i.next();
+                try {
+                    p.setY(new Integer(1234));
+                    if (debug) logger.debug("Updated: " + p);
+                    assertEquals("Wrong value of p.y", new Integer(1234), p.getY());
+                    if (!nontxWrite)
+                        fail("Modifying a pc instance should fail if non-tx write is false");
+                } catch (JDOUserException e) {
+                    if (!nontxWrite) {
+                        if (debug)
+                            logger.debug("Caught expected exception on write");
+                    } else {
+                        throw e;
+                    } 
+                }
+            }
+        }
+        finally {
+            if (pm != null && !pm.isClosed())
+                pm.close();
+        }
+    }
+
+    /** */
+    protected Factory getFactory(int ignore) {
+        PointFactory rc = new PointFactory();
+        // do verify in any case
+        rc.setVerify(verify);
+        return rc;
+    }
+
+    /** */
+    protected int getDefaultInsert()
+    {
+        return 4;
+    }   
+
+    /** */
+    protected int getDefaultVerify() {
+        return 1;
+    }
+
+}

Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_ObjectId.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_ObjectId.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_ObjectId.java (added)
+++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_ObjectId.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,131 @@
+/*
+ * 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.test;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.pc.PCPoint;
+import org.apache.jdo.test.util.AbstractTest;
+import org.apache.jdo.test.util.JDORITestRunner;
+
+/**
+* Tests that getObjectId and getTransactionalObjectId return oids that
+* compares equal if no PK change happen and getObjectById returns the same
+* instance for all oids.
+*
+* @author Marina Vatkina
+*/
+public class Test_ObjectId extends AbstractTest {
+
+    PCPoint p = null;
+    PersistenceManager pm = null;
+    Transaction tx = null;
+    
+    Object oid1 = null;
+    Object toid1 = null;
+    Class cls1 = null;
+    
+    /** TBD */
+    public static void main(String args[]) {
+        JDORITestRunner.run(Test_ObjectId.class);
+    }
+    
+    /** */  
+    public void test() throws Exception {
+        try {
+            pm = pmf.getPersistenceManager();
+            tx = pm.currentTransaction();
+            
+            insertObject();
+            checkObjectId();
+            checkNegObjectId(); // bug fix for 4518855.
+            
+            pm.close();
+        } catch (Exception ex) {
+            logger.debug("caught " + ex);
+            ex.printStackTrace(System.err);
+        }
+    }
+
+    // Insert object to test
+    protected void insertObject() {
+        if (debug) logger.debug("\nINSERT");
+        p = new PCPoint(11, 111);
+        tx.begin();
+        pm.makePersistent(p);
+        tx.commit();
+        if (debug) logger.debug("Inserted: " + p);
+    }
+
+    // Fetches objectIds and corresponding PC instances, and compares them.
+    protected void checkObjectId() {
+        if (debug) logger.debug("\nGETOBJECTID");
+        oid1 = pm.getObjectId(p);
+        toid1 = pm.getTransactionalObjectId(p);
+        cls1 = pm.getObjectIdClass(p.getClass());
+        String ret = testOids();
+        if (debug) logger.debug("Outside a transaction: " + ret);
+        tx.begin();
+
+        ret = testOids();
+        if (debug) logger.debug("Inside a transaction: " + ret);
+
+        p.setY(new Integer(9876));
+
+        ret = testOids();
+        if (debug) logger.debug("After non-PK update: " + ret);
+
+        tx.commit();
+        
+        ret = testOids();
+        if (debug) logger.debug("After commit: " + ret);
+    }
+
+    // Test non-PC Oids are null
+    protected void checkNegObjectId() {
+        if (debug) logger.debug("Test null Object: " + pm.getObjectId(null));
+        if (debug) logger.debug("Test non-PC Object: " + pm.getObjectId(this));
+        p = new PCPoint(11, 111);
+        if (debug)
+            logger.debug("Test non-persistent Object: " + pm.getObjectId(p));
+        pm.makeTransactional(p);
+        if (debug)
+            logger.debug("Test non-persistent Object: " + pm.getObjectId(p));
+    }
+
+    // Test oids and instances. 
+    private String testOids()
+    {
+        Object oid2 = pm.getObjectId(p);
+        Object toid2 = pm.getTransactionalObjectId(p);
+        Class cls2 = pm.getObjectIdClass(p.getClass());
+        
+        assertTrue("New getObjectIdClass not equals getObjectIdClass!", cls1.equals(cls2));
+        assertTrue("getObjectId not equals getTransactionalObjectId!", oid2.equals(toid2));
+        assertTrue("New getObjectId not equals original getObjectId!", oid1.equals(oid2));
+        Object o = pm.getObjectById(oid1, false);
+        assertSame("Object got from original oid is not correct!", p, o);
+        o = pm.getObjectById(oid2, false);
+        assertSame("Object got from new oid is not correct!", p, o);
+        o = pm.getObjectById(toid1, false);
+        assertSame("Object got from original tx-oid is not correct!", p, o);
+        o = pm.getObjectById(toid2, false);
+        assertSame("Object got from new tx-oid is not correct!", p, o);
+        return "OK";
+    }
+}

Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_Optimistic.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_Optimistic.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_Optimistic.java (added)
+++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_Optimistic.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,220 @@
+/*
+ * 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.test;
+
+import javax.jdo.JDOException;
+import javax.jdo.JDOHelper;
+import javax.jdo.JDOOptimisticVerificationException;
+import javax.jdo.JDOUserException;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.pc.PCPoint;
+import org.apache.jdo.test.util.AbstractTest;
+import org.apache.jdo.test.util.JDORITestRunner;
+
+/**
+* Tests that we correctly verify instance values during an optimistic
+* transaction.  In this test we create instances, and then get their object
+* id's.  We then use those object id's to create objects in a second PM.  We
+* then modify the instances in the first PM, and commit them.  Then modify the
+* values in some of the instances in an optimistic transaction in the second
+* PM, and commit: this should fail, and we should get an exception which
+* contains two other exceptions, one for each of the instances which failed to
+* verify.
+*
+* @author Dave Bristor
+*/
+public class Test_Optimistic extends AbstractTest {
+
+    /** */
+    public static void main(String args[]) {
+        JDORITestRunner.run(Test_Optimistic.class);
+    }
+
+    /**
+     * Inserts some number of objects in the database
+     */
+    public void test() {
+        insertObjects();
+    }
+
+    // Gets an extent of points, and changes them.
+    protected void insertObjects() {
+        PersistenceManager pm1 = null;
+        PersistenceManager pm2 = null; 
+        PersistenceManager pm3 = null;
+        Transaction tx1 = null;
+        Transaction tx2 = null;
+        Transaction tx3 = null;
+        try {
+            pm1 = pmf.getPersistenceManager();
+            tx1 = pm1.currentTransaction();
+            if (debug) logger.debug("\nINSERT");
+
+            tx1.setOptimistic(false);
+            tx1.begin();
+            
+            PCPoint p1a = new PCPoint(3, 5);
+            pm1.makePersistent(p1a);
+            PCPoint p1b = new PCPoint(7, 9);
+            pm1.makePersistent(p1b);
+            PCPoint p1c = new PCPoint(4, 8);
+            pm1.makePersistent(p1c);
+            
+            Object oid_1a = JDOHelper.getObjectId(p1a);
+            if (debug) logger.debug("p1a " + p1a + ", oid=" + oid_1a);
+            Object oid_1b = JDOHelper.getObjectId(p1b);
+            if (debug) logger.debug("p1b " + p1b + ", oid=" + oid_1b);
+            Object oid_1c = JDOHelper.getObjectId(p1c);
+            if (debug) logger.debug("p1c " + p1c + ", oid=" + oid_1c);
+
+            tx1.commit();
+            
+            // Start tx2
+            pm2 = pmf.getPersistenceManager();
+            tx2 = pm2.currentTransaction();
+            tx2.setOptimistic(true);
+            tx2.begin();
+            
+            PCPoint p2a = (PCPoint)pm2.getObjectById(oid_1a, true);
+            PCPoint p2b = (PCPoint)pm2.getObjectById(oid_1b, true);
+            PCPoint p2c = (PCPoint)pm2.getObjectById(oid_1c, true);
+
+            if (debug)
+                printValues("p1X made persistent, p2X from getObjectById(getObjectId) technique",
+                            p1a, p1b, p1c, p2a, p2b, p2c);
+            
+            tx1 = pm1.currentTransaction();
+            tx1.setOptimistic(false);
+            tx1.begin();
+            p1a.setX(555);
+            p1b.setX(123);
+            // p1c.setX(blah blah); // intentionally, we do *not* change p1c
+            tx1.commit();
+            
+            if (debug) 
+                printValues("after change in Tx1 to p1X",
+                            p1a, p1b, p1c, p2a, p2b, p2c);
+            
+            p2a.setY(new Integer(7890)); // This should fail to verify
+            p2b.setY(new Integer(1212)); // Ditto p2a
+            p2c.setY(new Integer(1357)); // This should succeed (but roll back)
+            
+            if (debug) 
+                printValues("after changes in Tx2 to p1a & p1b",
+                            p1a, p1b, p1c, p2a, p2b, p2c);
+            
+            try {
+                tx2.commit();
+            } catch (JDOException ex) {
+                if (ex instanceof JDOOptimisticVerificationException) {
+                    JDOOptimisticVerificationException jex =
+                        (JDOOptimisticVerificationException)ex;
+                    Throwable nested[] = jex.getNestedExceptions();
+                    if (nested.length == 2) {                
+                        // XXX This might be improved: it *could* be a datastore
+                        // exception, but not one which is for the expected verify
+                        // failure.
+                        if (debug) 
+                            logger.debug("In optimistic transaction, caught expected exception");
+                    } else {
+                        fail("In optimistic transaction caught unexpected exception:" + ex);
+                    }
+                } else {
+                    fail("In optimistic transaction caught unexpected exception:" + ex);
+                }
+                try {
+                    if (tx2.isActive()) {
+                        // MBO: is this legal?
+                        if (debug) {
+                            logger.debug("Transaction tx2 active; rolling back");
+                            printValues("before rollback",
+                                        p1a, p1b, p1c, p2a, p2b, p2c);
+                        }
+                        tx2.rollback();
+                    } else {
+                        if (debug) logger.debug("Transaction tx2 rolled back");
+                    }
+                } catch (JDOUserException ex2) {
+                    // MBO: might not be necessary, see above
+                    fail("Can't rollback" + ex2);
+                }
+            } finally {
+                if (debug) printValues("finally", p1a, p1b, p1c, p2a, p2b, p2c);
+                assertPCPointEquals("In finally: unexpected value of p1a", 555, 5, p1a);
+                assertPCPointEquals("In finally: unexpected value of p1b", 123, 9, p1b);
+                assertPCPointEquals("In finally: unexpected value of p1c", 4, 8, p1c);
+                assertPCPointEquals("In finally: unexpected value of p2a", 3, 5, p2a);
+                assertPCPointEquals("In finally: unexpected value of p2b", 7, 9, p2b);
+                assertPCPointEquals("In finally: unexpected value of p2c", 4, 8, p2c);
+            }
+            
+            pm3 = pmf.getPersistenceManager();
+            tx3 = pm3.currentTransaction();
+            tx3.setOptimistic(false);
+            tx3.begin();
+            PCPoint p3a = (PCPoint)pm3.getObjectById(oid_1a, false);
+            PCPoint p3b = (PCPoint)pm3.getObjectById(oid_1b, false);
+            PCPoint p3c = (PCPoint)pm3.getObjectById(oid_1c, false);
+            if (debug)
+                printValues("values labelled p2X are really p3X in this list",
+                            p1a, p1b, p1c, p3a, p3b, p3c);
+            assertPCPointEquals("tx3: unexpected value of p1a", 555, 5, p1a);
+            assertPCPointEquals("tx3: unexpected value of p1b", 123, 9, p1b);
+            assertPCPointEquals("tx3: unexpected value of p1c", 4, 8, p1c);
+            assertPCPointEquals("tx3: unexpected value of p3a", 555, 5, p3a);
+            assertPCPointEquals("tx3: unexpected value of p3b", 123, 9, p3b);
+            assertPCPointEquals("tx3: unexpected value of p3c", 4, 8, p3c);
+            tx3.commit();
+        }
+        finally {
+            if (tx3 != null && tx3.isActive())
+                tx3.rollback();
+            if (pm3 != null && !pm3.isClosed())
+                pm3.close();
+            if (tx2 != null && tx2.isActive())
+                tx2.rollback();
+            if (pm2 != null && !pm2.isClosed())
+                pm2.close();
+            if (tx1 != null && tx1.isActive())
+                tx1.rollback();
+            if (pm1 != null && !pm1.isClosed())
+                pm1.close();
+        }
+    }
+    
+    private void printValues(
+        String str, PCPoint p1a, PCPoint p1b, PCPoint p1c,
+        PCPoint p2a, PCPoint p2b, PCPoint p2c) {
+
+        logger.debug(str);
+        logger.debug("p1a: " + p1a);
+        logger.debug("p1b: " + p1b);
+        logger.debug("p1c: " + p1c);
+        logger.debug("p2a: " + p2a);
+        logger.debug("p2b: " + p2b);
+        logger.debug("p2c: " + p2c);
+    }
+
+    private void assertPCPointEquals(String msg, int x, int y, PCPoint actual)
+    {
+        assertEquals(msg + " field x", x, actual.getX());
+        assertEquals(msg + " field y", new Integer(y), actual.getY());
+    }
+    
+}

Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_OptimisticNullNotNull.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_OptimisticNullNotNull.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_OptimisticNullNotNull.java (added)
+++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_OptimisticNullNotNull.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,90 @@
+/*
+ * 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.
+ */
+
+/*
+ * Test_OptimisticNullNotNull.java
+ *
+ * Created on May 7, 2003, 1:49 PM
+ */
+
+package org.apache.jdo.test;
+
+import java.util.Iterator;
+
+import javax.jdo.Extent;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.pc.PCPoint;
+import org.apache.jdo.pc.PCRect;
+import org.apache.jdo.pc.RectFactory;
+import org.apache.jdo.test.util.AbstractTest;
+import org.apache.jdo.test.util.Factory;
+import org.apache.jdo.test.util.JDORITestRunner;
+
+/**
+ *
+ * @author  Craig Russell
+ */
+public class Test_OptimisticNullNotNull extends AbstractTest {
+    
+    /** */
+    public static void main(String args[]) {
+        JDORITestRunner.run(Test_OptimisticNullNotNull.class);
+    }
+
+    /**
+     * Determines the kind of objects that are inserted.  Override this if
+     * you want to insert some other kind of object.
+     */
+    protected Factory getFactory(int verify) {
+        return new RectFactory();
+    }
+
+    /**
+     * Inserts some number of objects in the database
+     */
+    public void test() throws Exception {
+        insertObjects();
+        updateObjects();
+        updateObjects();
+    }
+
+    /**
+     * Updates all the PCRect instances in the database.
+     */
+    protected void updateObjects() {
+        int counter = 0;
+        if (debug) logger.debug("\nUPDATE");
+        PersistenceManager pm = pmf.getPersistenceManager();
+        Transaction tx = pm.currentTransaction();
+        tx.begin();
+        Extent rects = pm.getExtent(PCRect.class, false);
+        Iterator it = rects.iterator();
+        while (it.hasNext()) {
+            PCRect rect = (PCRect)it.next();
+            if (rect.getUpperLeft()==null) {
+                rect.setUpperLeft(new PCPoint(counter++, counter++));
+                rect.setLowerRight(new PCPoint(counter++, counter++));
+            } else {
+                rect.setUpperLeft(null);
+                rect.setLowerRight(null);
+            }
+        }
+        tx.commit();
+    }
+
+}

Added: incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_PCDerived.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_PCDerived.java?view=auto&rev=158176
==============================================================================
--- incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_PCDerived.java (added)
+++ incubator/jdo/trunk/ri11/test/java/org/apache/jdo/test/Test_PCDerived.java Fri Mar 18 17:02:29 2005
@@ -0,0 +1,42 @@
+/*
+ * 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.test;
+
+import org.apache.jdo.pc.PCDerived;
+import org.apache.jdo.test.util.AbstractTest;
+import org.apache.jdo.test.util.JDORITestRunner;
+
+public class Test_PCDerived extends AbstractTest {
+
+    /** */
+    public static void main(String args[]) {
+        JDORITestRunner.run(Test_PCDerived.class);
+    }
+    
+    /** */
+    protected void setUp() { }
+
+    /** */
+    protected void tearDown()  { }
+    
+
+    /** */
+    public void test() {
+        PCDerived d = new PCDerived();
+        d.s = "hello, world";
+    }
+}



Mime
View raw message