You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by mc...@apache.org on 2008/01/04 23:42:34 UTC

svn commit: r609039 [1/2] - in /db/jdo/trunk/tck2-legacy: ./ src/conf/ src/java/org/apache/jdo/tck/ src/java/org/apache/jdo/tck/api/persistencemanager/ src/java/org/apache/jdo/tck/mapping/ src/java/org/apache/jdo/tck/pc/company/ src/java/org/apache/jdo...

Author: mcaisse
Date: Fri Jan  4 14:42:33 2008
New Revision: 609039

URL: http://svn.apache.org/viewvc?rev=609039&view=rev
Log:
JDO-453 JDO-497 Merge changes from tck2.

Added:
    db/jdo/trunk/tck2-legacy/src/conf/relationshipAllRelationships.conf
    db/jdo/trunk/tck2-legacy/src/conf/relationshipNoRelationships.conf
    db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/AbstractRelationshipTest.java   (with props)
    db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/Relationship1To1AllRelationships.java   (with props)
    db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/Relationship1To1NoRelationships.java   (with props)
    db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/Relationship1ToManyAllRelationships.java   (with props)
    db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/Relationship1ToManyNoRelationships.java   (with props)
    db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/RelationshipManyToManyAllRelationships.java   (with props)
    db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/RelationshipManyToManyNoRelationships.java   (with props)
    db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/RelationshipNegative1To1Test.java   (with props)
    db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/RelationshipNegative1ToManyTest.java   (with props)
    db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/pc/newInstance/AAddress_bad.java   (with props)
    db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/pc/newInstance/Address_bad.java   (with props)
    db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/pc/newInstance/IAddress_bad.java   (with props)
    db/jdo/trunk/tck2-legacy/src/jdo/applicationidentity/org/apache/jdo/tck/pc/newInstance/AAddress_bad.jdo   (with props)
    db/jdo/trunk/tck2-legacy/src/jdo/applicationidentity/org/apache/jdo/tck/pc/newInstance/Address_bad.jdo   (with props)
    db/jdo/trunk/tck2-legacy/src/jdo/applicationidentity/org/apache/jdo/tck/pc/newInstance/IAddress_bad.jdo   (with props)
    db/jdo/trunk/tck2-legacy/src/jdo/datastoreidentity/org/apache/jdo/tck/pc/newInstance/AAddress_bad.jdo   (with props)
    db/jdo/trunk/tck2-legacy/src/jdo/datastoreidentity/org/apache/jdo/tck/pc/newInstance/Address_bad.jdo   (with props)
    db/jdo/trunk/tck2-legacy/src/jdo/datastoreidentity/org/apache/jdo/tck/pc/newInstance/IAddress_bad.jdo   (with props)
Modified:
    db/jdo/trunk/tck2-legacy/project.properties
    db/jdo/trunk/tck2-legacy/src/conf/configurations.list
    db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/JDO_Test.java
    db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanager/NewInstance.java
    db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/pc/company/Project.java
    db/jdo/trunk/tck2-legacy/src/orm/applicationidentity/org/apache/jdo/tck/pc/newInstance/package-standard.orm
    db/jdo/trunk/tck2-legacy/src/orm/datastoreidentity/org/apache/jdo/tck/pc/newInstance/package-standard.orm

Modified: db/jdo/trunk/tck2-legacy/project.properties
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2-legacy/project.properties?rev=609039&r1=609038&r2=609039&view=diff
==============================================================================
--- db/jdo/trunk/tck2-legacy/project.properties (original)
+++ db/jdo/trunk/tck2-legacy/project.properties Fri Jan  4 14:42:33 2008
@@ -147,6 +147,9 @@
     org/apache/jdo/tck/pc/newInstance/Address.java \
     org/apache/jdo/tck/pc/newInstance/AAddress.java \
     org/apache/jdo/tck/pc/newInstance/IAddress.java \
+    org/apache/jdo/tck/pc/newInstance/Address_bad.java \
+    org/apache/jdo/tck/pc/newInstance/AAddress_bad.java \
+    org/apache/jdo/tck/pc/newInstance/IAddress_bad.java \
     org/apache/jdo/tck/pc/order/Order.java \
     org/apache/jdo/tck/pc/order/OrderItem.java \
     org/apache/jdo/tck/pc/fieldtypes/AllTypes.java \
@@ -292,6 +295,9 @@
     org/apache/jdo/tck/pc/newInstance/Address.class \
     org/apache/jdo/tck/pc/newInstance/AAddress.class \
     org/apache/jdo/tck/pc/newInstance/IAddress.class \
+    org/apache/jdo/tck/pc/newInstance/Address_bad.class \
+    org/apache/jdo/tck/pc/newInstance/AAddress_bad.class \
+    org/apache/jdo/tck/pc/newInstance/IAddress_bad.class \
     org/apache/jdo/tck/pc/order/Order.class \
     org/apache/jdo/tck/pc/order/OrderItem.class \
     org/apache/jdo/tck/pc/fieldtypes/AllTypes.class \
@@ -473,6 +479,9 @@
     org/apache/jdo/tck/pc/newInstance/Address.jdo \
     org/apache/jdo/tck/pc/newInstance/AAddress.jdo \
     org/apache/jdo/tck/pc/newInstance/IAddress.jdo \
+    org/apache/jdo/tck/pc/newInstance/Address_bad.jdo \
+    org/apache/jdo/tck/pc/newInstance/AAddress_bad.jdo \
+    org/apache/jdo/tck/pc/newInstance/IAddress_bad.jdo \
     org/apache/jdo/tck/pc/query/package.jdo \
     org/apache/jdo/tck/pc/singlefieldidentity/package.jdo \
     org/apache/jdo/tck/pc/shoppingcart/package.jdo \

Modified: db/jdo/trunk/tck2-legacy/src/conf/configurations.list
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2-legacy/src/conf/configurations.list?rev=609039&r1=609038&r2=609039&view=diff
==============================================================================
--- db/jdo/trunk/tck2-legacy/src/conf/configurations.list (original)
+++ db/jdo/trunk/tck2-legacy/src/conf/configurations.list Fri Jan  4 14:42:33 2008
@@ -42,6 +42,8 @@
                  inheritance2.conf \
                  inheritance3.conf \
                  inheritance4.conf \
+                 relationshipAllRelationships.conf \
+                 relationshipNoRelationships.conf \
                  schemaAttributeClass.conf \
                  schemaAttributeOrm.conf \
                  schemaAttributePackage.conf \

Added: db/jdo/trunk/tck2-legacy/src/conf/relationshipAllRelationships.conf
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2-legacy/src/conf/relationshipAllRelationships.conf?rev=609039&view=auto
==============================================================================
--- db/jdo/trunk/tck2-legacy/src/conf/relationshipAllRelationships.conf (added)
+++ db/jdo/trunk/tck2-legacy/src/conf/relationshipAllRelationships.conf Fri Jan  4 14:42:33 2008
@@ -0,0 +1,27 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+jdo.tck.description = Managed relationship tests with standard mapping, \
+ basic testdata with all relationships. 
+jdo.tck.mapping.companyfactory = 
+jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyAllRelationships.xml
+jdo.tck.mapping = 0
+jdo.tck.requiredOptions =
+jdo.tck.classes = org.apache.jdo.tck.mapping.Relationship1To1AllRelationships \
+    org.apache.jdo.tck.mapping.Relationship1ToManyAllRelationships \
+    org.apache.jdo.tck.mapping.RelationshipManyToManyAllRelationships \
+    org.apache.jdo.tck.mapping.RelationshipNegative1To1Test
+
+

Added: db/jdo/trunk/tck2-legacy/src/conf/relationshipNoRelationships.conf
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2-legacy/src/conf/relationshipNoRelationships.conf?rev=609039&view=auto
==============================================================================
--- db/jdo/trunk/tck2-legacy/src/conf/relationshipNoRelationships.conf (added)
+++ db/jdo/trunk/tck2-legacy/src/conf/relationshipNoRelationships.conf Fri Jan  4 14:42:33 2008
@@ -0,0 +1,26 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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.
+
+jdo.tck.description = Managed relationship tests with standard mapping, \
+ basic testdata with no relationships. 
+jdo.tck.mapping.companyfactory =
+jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyNoRelationships.xml
+jdo.tck.mapping = 0
+jdo.tck.requiredOptions =
+jdo.tck.classes = org.apache.jdo.tck.mapping.Relationship1To1NoRelationships \
+    org.apache.jdo.tck.mapping.Relationship1ToManyNoRelationships \
+    org.apache.jdo.tck.mapping.RelationshipManyToManyNoRelationships \
+    org.apache.jdo.tck.mapping.RelationshipNegative1ToManyTest 
+

Modified: db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/JDO_Test.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/JDO_Test.java?rev=609039&r1=609038&r2=609039&view=diff
==============================================================================
--- db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/JDO_Test.java (original)
+++ db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/JDO_Test.java Fri Jan  4 14:42:33 2008
@@ -1081,6 +1081,15 @@
         messages.append(NL);
     }
     
+    /** Appends to error messages.
+     */
+    protected static synchronized void deferredAssertTrue(boolean test,
+        String context, String message) {
+        if (!test) {
+            appendMessage(context + ": " +message);
+        }
+    }
+
     /**
      * Returns collected error messages, or <code>null</code> if there
      * are none, and clears the buffer.

Modified: db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanager/NewInstance.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanager/NewInstance.java?rev=609039&r1=609038&r2=609039&view=diff
==============================================================================
--- db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanager/NewInstance.java (original)
+++ db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/api/persistencemanager/NewInstance.java Fri Jan  4 14:42:33 2008
@@ -23,6 +23,9 @@
 import org.apache.jdo.tck.pc.newInstance.AAddress;
 import org.apache.jdo.tck.pc.newInstance.Address;
 import org.apache.jdo.tck.pc.newInstance.IAddress;
+import org.apache.jdo.tck.pc.newInstance.AAddress_bad;
+import org.apache.jdo.tck.pc.newInstance.Address_bad;
+import org.apache.jdo.tck.pc.newInstance.IAddress_bad;
 import org.apache.jdo.tck.util.BatchTestRunner;
 
 /**
@@ -30,21 +33,21 @@
  *<BR>
  *<B>Keywords:</B>
  *<BR>
- *<B>Assertion IDs:</B> A12.6.6-1
+ *<B>Assertion IDs:</B> A12.6.6-2
  *<BR>
  *<B>Assertion Description: </B>
-[The parameter must be one of the following:
-- an abstract class that is declared in the metadata as persistence-capable, in which all abstract methods are declared as persistent properties, or
-- an interface that is declared in the metadata as persistence-capable, in which all methods are declared as persistent properties, or
-- a concrete class that is declared in the metadata as persistence-capable. In this case, the concrete class must declare a public no-args constructor.
-If the parameter does not satisfy the above requirements, JDOUserException is thrown.
+ * Persistent properties declared in the interface are defined as those that have both a get and a set method
+ * or both an is and a set method, named according to the JavaBeans naming conventions, and
+ * of a type supported as a persistent type.
+ * The implementing class will provide a suitable implementation for all property access methods and
+ * will throw JDOUserException for all other methods of the interface.
  */
 
 public class NewInstance extends PersistenceManagerTest {
     
     /** */
     private static final String ASSERTION_FAILED = 
-        "Assertion A12.5.7-9 (NewInstance) failed: ";
+        "Assertion A12.6.6-2 (NewInstance) failed: ";
     
     /**
      * The <code>main</code> is called when the class
@@ -55,68 +58,82 @@
         BatchTestRunner.run(NewInstance.class);
     }
     
-    /** */
-    public void testNewInstance() {
+    /** test newInstance (Class pcInterface) */
+    public void testNewInstanceInterface() {
         pm = getPM();   
+        try {
+            pm.newInstance(IAddress.class);
+        } catch (Exception e) {
+            fail("Unexpected exception thrown. "
+                + e.getMessage());
+        }
+    }
 
-        /* positive tests */
-        runTestNewInstanceInterface(pm);
-        runTestNewInstanceAbstractClass(pm);
-        runTestNewInstanceClass(pm);
-
-        /* negative tests */
+    /** test newInstance (Class pcAbstractClass) */
+    public void testNewInstanceAbstractClass() {
+        pm = getPM();   
+        try {
+            pm.newInstance(AAddress.class);
+        } catch (Exception e) {
+            fail("Unexpected exception thrown. "
+                + e.getMessage());
+        }
+    }
 
-        pm.close();
-        pm = null;
+    /** test newInstance (Class pcClass) */
+    public void testNewInstanceClass() {
+        pm = getPM();   
+        try {
+            pm.newInstance(Address.class);
+        } catch (Exception e) {
+            fail("Unexpected exception thrown. "
+                + e.getMessage());
+        }
     }
 
     /** test newInstance (Class pcInterface) */
-    private void runTestNewInstanceInterface(PersistenceManager pm) {
-            IAddress iaddress = (IAddress)pm.newInstance(IAddress.class);
-//        Transaction tx = pm.currentTransaction();
-//        try {
-//            tx = pm.currentTransaction();
-//            tx.begin();
-//            tx.commit();
-            if (debug) logger.debug(" \nPASSED in testNewInstance()");
-//        }
-//        finally {
-//            if (tx.isActive())
-//                tx.rollback();
-//        }        
+    public void testNewInstanceInterfaceBad() {
+        pm = getPM();   
+        try {
+            pm.newInstance(IAddress_bad.class);
+            fail("Expected JDOUserException but no exception thrown.  "
+                + "Interface contains a method that is not property.");
+        } catch (javax.jdo.JDOUserException jdoe) {
+            // Expected exception
+        } catch (Exception e) {
+            fail("Expected JDOUserException but " + e.getMessage()
+                + " thrown instead.");
+        }
     }
 
     /** test newInstance (Class pcAbstractClass) */
-    private void runTestNewInstanceAbstractClass(PersistenceManager pm) {
-        pm.newInstance(AAddress.class);
-        Transaction tx = pm.currentTransaction();
- //       try {
- //           tx.begin();
-//
-//
-//            tx.commit();
-//            if (debug) logger.debug(" \nPASSED in testNewInstance()");
-//        } 
-//        finally {
-//            if (tx.isActive())
-//                tx.rollback();
-//        }   
-    }
-
-        /** test newInstance (Class pcClass) */
-    private void runTestNewInstanceClass(PersistenceManager pm) {
-        pm.newInstance(Address.class);
-        Transaction tx = pm.currentTransaction();
-//        try {
-//            tx.begin();
-//
-//            tx.commit();
-//            if (debug) logger.debug(" \nPASSED in testNewInstance()");
-//        }
-//        finally {
-//            if (tx.isActive())
-//                tx.rollback();
-//        }
+    public void testNewInstanceAbstractClassBad() {
+        pm = getPM();   
+        try {
+            pm.newInstance(AAddress_bad.class);
+            fail("Expected JDOUserException but no exception thrown.  "
+                + "Abstract class contains a method that is not property.");
+        } catch (javax.jdo.JDOUserException jdoe) {
+            // Expected exception
+        } catch (Exception e) {
+            fail("Expected JDOUserException but " + e.getMessage()
+                + "t hrown instead.");
+        }
+    }
+
+    /** test newInstance (Class pcClass) */
+    public void testNewInstanceClassBad() {
+        pm = getPM();   
+        try {
+            pm.newInstance(Address_bad.class);
+            fail("Expected JDOUserException but no exception thrown.  "
+                + "Class contains non-public no-args constructor.");
+        } catch (javax.jdo.JDOUserException jdoe) {
+            // Expected exception
+        } catch (Exception e) {
+            fail("Expected JDOUserException but " + e.getMessage()
+                + " thrown instead.");
+        }
     }
 
 }

Added: db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/AbstractRelationshipTest.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/AbstractRelationshipTest.java?rev=609039&view=auto
==============================================================================
--- db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/AbstractRelationshipTest.java (added)
+++ db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/AbstractRelationshipTest.java Fri Jan  4 14:42:33 2008
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.mapping;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.company.CompanyFactoryRegistry;
+import org.apache.jdo.tck.pc.company.CompanyModelReader;
+
+/*
+ * Abstract class for managed relationship tests
+ */
+public class AbstractRelationshipTest extends JDO_Test {
+    
+    /** */
+    protected List rootOids;
+    
+    /** */
+    protected final String inputFilename = System.getProperty("jdo.tck.testdata");
+    
+    protected CompanyModelReader reader = null;
+    
+    protected Map oidMap = new HashMap();
+    
+    /** */
+    protected final boolean isTestToBePerformed = isTestToBePerformed();
+    
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        if (isTestToBePerformed) {
+            getPM();
+            CompanyFactoryRegistry.registerFactory(pm);
+            reader = new CompanyModelReader(inputFilename);
+            addTearDownClass(reader.getTearDownClassesFromFactory());
+            // persist test data
+            pm.currentTransaction().begin();
+            List rootList = reader.getRootList();
+            pm.makePersistentAll(rootList);
+            rootOids = new ArrayList();
+            for (Iterator i = rootList.iterator(); i.hasNext(); ) {
+                Object pc = i.next();
+                rootOids.add(pm.getObjectId(pc));
+            }
+            // DO THIS
+            // in xmlBeanFactory String[] getBeanDefinitionNames()
+            oidMap.put("emp1", pm.getObjectId(reader.getEmployee("emp1")));
+            oidMap.put("emp2", pm.getObjectId(reader.getEmployee("emp2")));
+            oidMap.put("emp4", pm.getObjectId(reader.getEmployee("emp4")));
+            oidMap.put("medicalIns1",
+                pm.getObjectId(reader.getMedicalInsurance("medicalIns1")));
+            oidMap.put("medicalIns2",
+                pm.getObjectId(reader.getMedicalInsurance("medicalIns2")));
+            oidMap.put("dept1", pm.getObjectId(reader.getDepartment("dept1")));
+            oidMap.put("dept2", pm.getObjectId(reader.getDepartment("dept2")));
+            oidMap.put("proj1", pm.getObjectId(reader.getProject("proj1")));
+            oidMap.put("proj2", pm.getObjectId(reader.getProject("proj2")));
+             
+            pm.currentTransaction().commit();
+            cleanupPM();
+        }
+    }
+    
+    protected Object getOidByName(String name) {
+        return oidMap.get((Object)name);
+    }
+    
+}

Propchange: db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/AbstractRelationshipTest.java
------------------------------------------------------------------------------
    svn:eol-style = LF

Added: db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/Relationship1To1AllRelationships.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/Relationship1To1AllRelationships.java?rev=609039&view=auto
==============================================================================
--- db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/Relationship1To1AllRelationships.java (added)
+++ db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/Relationship1To1AllRelationships.java Fri Jan  4 14:42:33 2008
@@ -0,0 +1,419 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.mapping;
+
+import java.util.Date;
+import org.apache.jdo.tck.pc.company.FullTimeEmployee;
+import org.apache.jdo.tck.pc.company.IEmployee;
+import org.apache.jdo.tck.pc.company.IMedicalInsurance;
+import org.apache.jdo.tck.pc.company.MedicalInsurance;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+
+/**
+ *<B>Title:</B>Relationship1To1AllRelationships
+ *<BR>
+ *<B>Keywords:</B> mapping, managed relationships
+ *<BR>
+ *<B>Assertion ID:</B> A15.3-14
+ *<BR>
+ *<B>Assertion Description: Regardless of which side changes the relationship,
+ * flush (whether done as part of commit or explicitly by the user) will modify
+ * the datastore to reflect the change and will update the memory model
+ * for consistency...</B>
+ */
+
+public class Relationship1To1AllRelationships extends AbstractRelationshipTest {
+    
+    String testMethod = null;
+    protected String ASSERTION_FAILED =
+        "Assertion A15-3.14 (Relationship1To1AllRelationships) 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(Relationship1To1AllRelationships.class);
+    }
+    
+    Object emp1Oid = null;
+    Object emp2Oid = null;
+    Object medIns1Oid = null;
+    Object medIns2Oid = null;
+    IEmployee emp1 = null;
+    IEmployee emp2 = null;
+    IMedicalInsurance medIns1 = null;
+    IMedicalInsurance medIns2 = null;
+    
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        super.localSetUp();
+        if (isTestToBePerformed) {
+            getPM();
+            pm.currentTransaction().begin();
+            
+            emp1Oid = getOidByName("emp1");
+            emp2Oid = getOidByName("emp2");
+            medIns1Oid = getOidByName("medicalIns1");
+            medIns2Oid = getOidByName("medicalIns2");
+            emp1 = (IEmployee)pm.getObjectById(emp1Oid);
+            emp2 = (IEmployee)pm.getObjectById(emp2Oid);
+            medIns1 = (IMedicalInsurance)pm.getObjectById(medIns1Oid);
+            medIns2 = (IMedicalInsurance)pm.getObjectById(medIns2Oid);
+            
+            // Preconditions
+            assertTrue(ASSERTION_FAILED + testMethod +
+                ": Test aborted, precondition is false; " +
+                "expected emp.getMedicalInsurance()to be medicalIns1",
+                emp1.getMedicalInsurance() == medIns1);
+            assertTrue(ASSERTION_FAILED + testMethod +
+                ": Test aborted, precondition is false; " +
+                "expected ins.getEmployee() to be emp1",
+                medIns1.getEmployee() == emp1);
+            assertTrue(ASSERTION_FAILED + testMethod +
+                ": Test aborted, precondition is false; " +
+                "expected emp.getMedicalInsurance()to be medicalIns1",
+                emp2.getMedicalInsurance() == medIns2);
+            assertTrue(ASSERTION_FAILED + testMethod +
+                ": Test aborted, precondition is false; " +
+                "expected ins.getEmployee() to be emp1",
+                medIns2.getEmployee() == emp2);
+        }
+    }
+    
+    /** */
+    public void testSetToExistingFromMappedSide() {
+        testMethod = "testSetToExistingFromMappedSide";
+        if (isTestToBePerformed) {
+            
+            // Set relationship
+            medIns1.setEmployee(emp2);
+            pm.flush();
+            
+            // Postcondition
+            deferredAssertTrue(emp2.getMedicalInsurance() == medIns1,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush");
+            deferredAssertTrue(emp1.getMedicalInsurance() == null,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "previous relationship (emp1) not nulled on flush");
+            deferredAssertTrue(medIns2.getEmployee() == null,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "previous relationship (medIns2) not nulled on flush");
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            emp1 = (IEmployee)pm.getObjectById(emp1Oid);
+            emp2 = (IEmployee)pm.getObjectById(emp2Oid);
+            medIns1 = (IMedicalInsurance)pm.getObjectById(medIns1Oid);
+            medIns2 = (IMedicalInsurance)pm.getObjectById(medIns2Oid);
+            deferredAssertTrue(emp2.getMedicalInsurance() == medIns1,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set in new pm");
+            deferredAssertTrue(emp1.getMedicalInsurance() == null,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "previous relationship (emp1) not nulled in new pm");
+            deferredAssertTrue(medIns2.getEmployee() == null,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "previous relationship (medIns2) not nulled in new pm");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+    
+    /** */
+    public void testSetToExistingFromMappedBySide() {
+        testMethod = "testSetToExistingFromMappedBySide";
+        if (isTestToBePerformed) {
+            
+            // Set relationship
+            emp1.setMedicalInsurance(medIns2);
+            pm.flush();
+            
+            // Postcondition
+            deferredAssertTrue(medIns2.getEmployee() == emp1,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush.");
+            deferredAssertTrue(medIns1.getEmployee() == null,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "previous relationship (medIns1) not nulled on flush.");
+            deferredAssertTrue(emp2.getMedicalInsurance() == null,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "previous relationship (emp2) not nulled on flush");
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            emp1 = (IEmployee)pm.getObjectById(emp1Oid);
+            emp2 = (IEmployee)pm.getObjectById(emp2Oid);
+            medIns1 = (IMedicalInsurance)pm.getObjectById(medIns1Oid);
+            medIns2 = (IMedicalInsurance)pm.getObjectById(medIns2Oid);
+            deferredAssertTrue(medIns2.getEmployee() == emp1,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set in new pm.");
+            deferredAssertTrue(medIns1.getEmployee() == null,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "previous relationship (medIns1) not nulled in new pm.");
+            deferredAssertTrue(emp2.getMedicalInsurance() == null,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "previous relationship (emp2) not nulled in new pm.");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+    
+    /** */
+    public void testSetToNullFromMappedSide() {
+        testMethod = "testSetToNullFromMappedSide";
+        if (isTestToBePerformed) {
+            
+            // Set relationship
+            medIns1.setEmployee(null);
+            pm.flush();
+            
+            // Postcondition
+            deferredAssertTrue(emp1.getMedicalInsurance() == null,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush");
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            emp1 = (IEmployee)pm.getObjectById(emp1Oid);
+            deferredAssertTrue(
+                emp1.getMedicalInsurance() == null,
+                ASSERTION_FAILED + testMethod,
+                "In new transaction, postcondition is false; " +
+                "other side of relationship is not set.");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+    
+    /** */
+    public void testSetToNullFromMappedBySide() {
+        testMethod = "testSetToNullFromMappedBySide";
+        if (isTestToBePerformed) {
+            
+            // Set relationship
+            emp1.setMedicalInsurance(null);
+            pm.flush();
+            
+            // Postcondition
+            deferredAssertTrue(medIns1.getEmployee() == null,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush");
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            //emp1 = (IEmployee)pm.getObjectById(emp1Oid);
+            medIns1 = (IMedicalInsurance)pm.getObjectById(medIns1Oid);
+            deferredAssertTrue(
+                medIns1.getEmployee() == null,
+                ASSERTION_FAILED + testMethod,
+                "In new transaction, postcondition is false; " +
+                "other side of relationship is not set.");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+    
+    /** */
+    public void testSetToNewFromMappedSide() {
+        testMethod = "testSetToNewFromMappedSide";
+        if (isTestToBePerformed) {
+            
+            // Set relationship
+            IEmployee empNew = new FullTimeEmployee(99, "Matthew", "", "Adams",
+                new Date(0L), new Date(10000L), 125000);
+            pm.makePersistent(empNew);
+            medIns1.setEmployee(empNew);
+            Object empNewOid = pm.getObjectId((Object)empNew);
+            pm.flush();
+            
+            assertFalse(testMethod + ": Test aborted, precondition is false; " +
+                "expected empNewOid to be non-null", empNewOid == null);
+            
+            // Postcondition
+            deferredAssertTrue(empNew.getMedicalInsurance() == medIns1,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush");
+            deferredAssertTrue(emp1.getMedicalInsurance() == null,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "previous relationship (emp1) not nulled on flush");
+            
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            emp1 = (IEmployee)pm.getObjectById(emp1Oid);
+            empNew = (IEmployee)pm.getObjectById(empNewOid);
+            medIns1 = (IMedicalInsurance)pm.getObjectById(medIns1Oid);
+            deferredAssertTrue(empNew.getMedicalInsurance() == medIns1,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set in new pm");
+            deferredAssertTrue(emp1.getMedicalInsurance() == null,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "previous relationship (emp1) not nulled in new pm");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+    
+    /** */
+    public void testSetToNewFromMappedBySide() {
+        testMethod = "testSetToNewFromMappedBySide";
+        if (isTestToBePerformed) {
+            
+            // Set relationship
+            IMedicalInsurance medInsNew = new MedicalInsurance(99L,
+                "Ameriblast", "B");
+            pm.makePersistent(medInsNew);
+            emp1.setMedicalInsurance(medInsNew);
+            Object medInsNewOid = pm.getObjectId((Object)medInsNew);
+            pm.flush();
+            
+            assertFalse(testMethod + ": Test aborted, precondition is false; " +
+                "expected medInsNewOid to be non-null", medInsNewOid == null);
+            
+            // Postcondition
+            deferredAssertTrue(medInsNew.getEmployee() == emp1,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush.");
+            deferredAssertTrue(medIns1.getEmployee() == null,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "previous relationship (medIns1) not nulled on flush.");
+            
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            emp1 = (IEmployee)pm.getObjectById(emp1Oid);
+            medInsNew = (IMedicalInsurance)pm.getObjectById(medInsNewOid);
+            medIns1 = (IMedicalInsurance)pm.getObjectById(medIns1Oid);
+            deferredAssertTrue(medInsNew.getEmployee() == emp1,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set in new pm");
+            deferredAssertTrue(medIns1.getEmployee() == null,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "previous relationship (medIns1) not nulled in new pm");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+    /** */
+    public void testDeleteFromMappedSide() {
+        testMethod = "testDeleteFromMappedSide";
+        if (isTestToBePerformed) {
+            // Set relationship
+            pm.deletePersistent(medIns1);
+            pm.flush();
+            
+            // Postcondition
+            deferredAssertTrue(emp1.getMedicalInsurance() == null,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush");
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            emp1 = (IEmployee)pm.getObjectById(emp1Oid);
+            deferredAssertTrue(
+                emp1.getMedicalInsurance() == null,
+                ASSERTION_FAILED + testMethod,
+                "In new transaction, postcondition is false; " +
+                "other side of relationship is not set.");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+    
+    /** */
+    public void testDeleteFromMappedBySide() {
+        testMethod = "testDeleteFromMappedBySide";
+        if (isTestToBePerformed) {
+            // Set relationship
+            pm.deletePersistent(emp1);
+            pm.flush();
+            
+            // Postcondition
+            deferredAssertTrue(medIns1.getEmployee() == null,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush");
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            medIns1 = (IMedicalInsurance)pm.getObjectById(medIns1Oid);
+            deferredAssertTrue(
+                medIns1.getEmployee() == null,
+                ASSERTION_FAILED + testMethod,
+                "In new transaction, postcondition is false; " +
+                "other side of relationship is not set.");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+    
+}

Propchange: db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/Relationship1To1AllRelationships.java
------------------------------------------------------------------------------
    svn:eol-style = LF

Added: db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/Relationship1To1NoRelationships.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/Relationship1To1NoRelationships.java?rev=609039&view=auto
==============================================================================
--- db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/Relationship1To1NoRelationships.java (added)
+++ db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/Relationship1To1NoRelationships.java Fri Jan  4 14:42:33 2008
@@ -0,0 +1,227 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.mapping;
+
+import java.util.Date;
+import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.pc.company.FullTimeEmployee;
+import org.apache.jdo.tck.pc.company.MedicalInsurance;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+
+/**
+ *<B>Title:</B>Relationship1To1NoRelationships
+ *<BR>
+ *<B>Keywords:</B> mapping, managed relationships
+ *<BR>
+ *<B>Assertion ID:</B> A15.3-14
+ *<BR>
+ *<B>Assertion Description: Regardless of which side changes the relationship,
+ * flush (whether done as part of commit or explicitly by the user) will modify
+ * the datastore to reflect the change and will update the memory model
+ * for consistency...</B>
+ */
+
+public class Relationship1To1NoRelationships extends AbstractRelationshipTest {
+    
+    String testMethod = null;
+    protected String ASSERTION_FAILED =
+        "Assertion A15-3.14 (Relationship1To1NoRelationships) failed: ";
+    
+    Object emp1Oid = null;
+    Object emp2Oid = null;
+    Object medIns1Oid = null;
+    Object medIns2Oid = null;
+    Employee emp1 = null;
+    Employee emp2 = null;
+    MedicalInsurance medIns1 = null;
+    MedicalInsurance medIns2 = null;
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(Relationship1To1NoRelationships.class);
+    }
+    
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        super.localSetUp();
+        if (isTestToBePerformed) {
+            getPM();
+            pm.currentTransaction().begin();
+            
+            emp1Oid = getOidByName("emp1");
+            medIns1Oid = getOidByName("medicalIns1");
+            emp1 = (Employee)pm.getObjectById(emp1Oid);
+            medIns1 = (MedicalInsurance)pm.getObjectById(medIns1Oid);
+            
+            // Preconditions
+            assertTrue(ASSERTION_FAILED +
+                ": Test aborted, precondition is false; " +
+                "expected emp.getMedicalInsurance()to be null",
+                emp1.getMedicalInsurance() == null);
+            assertTrue(ASSERTION_FAILED +
+                ": Test aborted, precondition is false; " +
+                "expected ins.getEmployee() to be null",
+                medIns1.getEmployee() == null);
+        }
+    }
+    
+    /** */
+    public void testSetToExistingFromMappedSide() {
+        testMethod = "testSetToExistingFromMappedSide";
+        if (isTestToBePerformed) {
+            
+            // Set relationship
+            medIns1.setEmployee(emp1);
+            pm.flush();
+            
+            // Postcondition
+            deferredAssertTrue(emp1.getMedicalInsurance() == medIns1,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush");
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            emp1 = (Employee)pm.getObjectById(emp1Oid);
+            medIns1 = (MedicalInsurance)pm.getObjectById(medIns1Oid);
+            deferredAssertTrue(
+                emp1.getMedicalInsurance() == medIns1,
+                ASSERTION_FAILED + testMethod,
+                "In new transaction, postcondition is false; " +
+                "other side of relationship is not set.");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+    
+    /** */
+    public void testSetToExistingFromMappedBySide() {
+        testMethod = "testSetToExistingFromMappedBySide";
+        if (isTestToBePerformed) {
+            
+            // Set relationship
+            emp1.setMedicalInsurance(medIns1);
+            pm.flush();
+            
+            // Postcondition
+            deferredAssertTrue(medIns1.getEmployee() == emp1,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush");
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            emp1 = (Employee)pm.getObjectById(emp1Oid);
+            medIns1 = (MedicalInsurance)pm.getObjectById(medIns1Oid);
+            deferredAssertTrue(
+                medIns1.getEmployee() == emp1,
+                ASSERTION_FAILED + testMethod,
+                "In new transaction, postcondition is false; " +
+                "other side of relationship is not set.");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+    
+    /** */
+    public void testSetToNewFromMappedSide() {
+        testMethod = "testSetToNewFromMappedSide";
+        if (isTestToBePerformed) {
+            
+            // Set relationship
+            Employee empNew = new FullTimeEmployee(99, "Matthew", "", "Adams",
+                new Date(0L), new Date(10000L), 125000);
+            pm.makePersistent(empNew);
+            medIns1.setEmployee(empNew);
+            Object empNewOid = pm.getObjectId((Object)empNew);
+            pm.flush();
+            
+            // Postcondition
+            deferredAssertTrue(empNew.getMedicalInsurance() == medIns1,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush");
+            
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            emp1 = (Employee)pm.getObjectById(emp1Oid);
+            empNew = (Employee)pm.getObjectById(empNewOid);
+            medIns1 = (MedicalInsurance)pm.getObjectById(medIns1Oid);
+            deferredAssertTrue(empNew.getMedicalInsurance() == medIns1,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set in new pm");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+    
+    /** */
+    public void testSetToNewFromMappedBySide() {
+        testMethod = "testSetToNewFromMappedBySide";
+        if (isTestToBePerformed) {
+            
+            // Set relationship
+            MedicalInsurance medInsNew = new MedicalInsurance(99L,
+                "Ameriblast", "B");
+            pm.makePersistent(medInsNew);
+            emp1.setMedicalInsurance(medInsNew);
+            Object medInsNewOid = pm.getObjectId((Object)medInsNew);
+            pm.flush();
+            
+            // Postcondition
+            deferredAssertTrue(medInsNew.getEmployee() == emp1,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush.");
+            
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            emp1 = (Employee)pm.getObjectById(emp1Oid);
+            medInsNew = (MedicalInsurance)pm.getObjectById(medInsNewOid);
+            medIns1 = (MedicalInsurance)pm.getObjectById(medIns1Oid);
+            deferredAssertTrue(medInsNew.getEmployee() == emp1,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set in new pm");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+}

Propchange: db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/Relationship1To1NoRelationships.java
------------------------------------------------------------------------------
    svn:eol-style = LF

Added: db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/Relationship1ToManyAllRelationships.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/Relationship1ToManyAllRelationships.java?rev=609039&view=auto
==============================================================================
--- db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/Relationship1ToManyAllRelationships.java (added)
+++ db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/Relationship1ToManyAllRelationships.java Fri Jan  4 14:42:33 2008
@@ -0,0 +1,464 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.mapping;
+
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+import org.apache.jdo.tck.pc.company.Department;
+import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.pc.company.FullTimeEmployee;
+import org.apache.jdo.tck.pc.company.IDepartment;
+import org.apache.jdo.tck.pc.company.IEmployee;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+
+/**
+ *<B>Title:</B>Relationship1ToManyAllRelationships
+ *<BR>
+ *<B>Keywords:</B> mapping, managed relationships
+ *<BR>
+ *<B>Assertion ID:</B> A15.3-14
+ *<BR>
+ *<B>Assertion Description: Regardless of which side changes the relationship,
+ * flush (whether done as part of commit or explicitly by the user) will modify
+ * the datastore to reflect the change and will update the memory model
+ * for consistency...</B>
+ */
+
+public class Relationship1ToManyAllRelationships extends AbstractRelationshipTest {
+    
+    String testMethod = null;
+    protected String ASSERTION_FAILED =
+        "Assertion A15-3.14 (Relationship1ToManyAllRelationships) failed: ";
+    
+    Object emp1Oid = null;
+    Object dept1Oid = null;
+    Object dept2Oid = null;
+    Employee emp1 = null;
+    Department dept1 = null;
+    Department dept2 = null;
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(Relationship1ToManyAllRelationships.class);
+    }
+    
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        super.localSetUp();
+        if (isTestToBePerformed) {
+            getPM();
+            pm.currentTransaction().begin();
+            
+            emp1Oid = getOidByName("emp1");
+            dept1Oid = getOidByName("dept1");
+            dept2Oid = getOidByName("dept2");
+            emp1 = (Employee)pm.getObjectById(emp1Oid);
+            dept1 = (Department)pm.getObjectById(dept1Oid);
+            dept2 = (Department)pm.getObjectById(dept2Oid);
+            
+            // Preconditions
+            assertTrue(ASSERTION_FAILED +
+                ": Test aborted, precondition is false; " +
+                "expected emp.getDepartment()to be dept1",
+                emp1.getDepartment() == dept1);
+            assertTrue(ASSERTION_FAILED +
+                ": Test aborted, precondition is false; " +
+                "expected dept.getEmployees() to contain emp1",
+                dept1.getEmployees().contains(emp1));
+        }
+    }
+    
+    /** */
+    public void testSetToExistingFromMappedSide() {
+        testMethod = "testSetToExistingFromMappedSide";
+        if (isTestToBePerformed) {
+            
+            // Set relationship
+            emp1.setDepartment(dept2);
+            pm.flush();
+            
+            // Postcondition
+            deferredAssertTrue(dept2.getEmployees().contains(emp1),
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush");
+            deferredAssertTrue(!dept1.getEmployees().contains(emp1),
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; reference emp1 not removed "
+                + "from previous relationship (dept1.employees)");
+            
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            emp1 = (Employee)pm.getObjectById(emp1Oid);
+            dept1 = (Department)pm.getObjectById(dept1Oid);
+            dept2 = (Department)pm.getObjectById(dept2Oid);
+            deferredAssertTrue(dept2.getEmployees().contains(emp1),
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set in new pm");
+            deferredAssertTrue(!dept1.getEmployees().contains(emp1),
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; reference emp1 not removed "
+                + "from previous relationship (dept1.employees)");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+    
+        
+    /** */
+    public void testAddExistingFromMappedbySide() {
+        testMethod = "testAddExistingFromMappedbySide";
+        if (isTestToBePerformed) {
+            
+            // Set relationship
+            Object emp4Oid = getOidByName("emp4");
+            Employee emp4 = (Employee)pm.getObjectById(emp4Oid);
+            Object dept2Oid = getOidByName("dept2");
+            Department dept2 = (Department)pm.getObjectById(dept2Oid);
+
+            dept1.addEmployee(emp4);
+            pm.flush();
+            
+            // Postcondition
+            deferredAssertTrue(emp4.getDepartment() == dept1,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush");
+            deferredAssertTrue(!dept2.getEmployees().contains(emp4),
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "previous relationship not unset on flush");
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            emp4 = (Employee)pm.getObjectById(emp4Oid);
+            dept1 = (Department)pm.getObjectById(dept1Oid);
+            dept2 = (Department)pm.getObjectById(dept2Oid);
+            deferredAssertTrue(emp4.getDepartment() == dept1,
+                ASSERTION_FAILED + testMethod,
+                "In new transaction, postcondition is false; " +
+                "other side of relationship is not set.");
+            deferredAssertTrue(!dept2.getEmployees().contains(emp4),
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "previous relationship not unset on flush");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+
+    /** */
+    public void testReplaceFromMappedbySide() {
+        testMethod = "testReplaceFromMappedbySide";
+        if (isTestToBePerformed) {
+            
+            // Set relationship
+            Object emp4Oid = getOidByName("emp4");
+            Employee emp4 = (Employee)pm.getObjectById(emp4Oid);
+            Object dept2Oid = getOidByName("dept2");
+            Department dept2 = (Department)pm.getObjectById(dept2Oid);
+
+            Set emps = new HashSet();
+            emps.add(emp4);
+            dept1.setEmployees(emps);
+            pm.flush();
+            
+            // Postcondition
+            deferredAssertTrue(emp4.getDepartment() == dept1,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush");
+            deferredAssertTrue(!dept2.getEmployees().contains(emp4),
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "previous relationship not unset on flush");
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            emp4 = (Employee)pm.getObjectById(emp4Oid);
+            dept1 = (Department)pm.getObjectById(dept1Oid);
+            dept2 = (Department)pm.getObjectById(dept2Oid);
+            deferredAssertTrue(emp4.getDepartment() == dept1,
+                ASSERTION_FAILED + testMethod,
+                "In new transaction, postcondition is false; " +
+                "other side of relationship is not set.");
+            deferredAssertTrue(!dept2.getEmployees().contains(emp4),
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "previous relationship not unset on flush");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+
+    /** */
+    public void testAddNewFromMappedbySide() {
+        testMethod = "testAddNewFromMappedbySide";
+        if (isTestToBePerformed) {
+            
+            // Set relationship
+            Employee empNew = new FullTimeEmployee(101, "Jenny", "Merriwether",
+                "White", new Date(500L), new Date(10000L), 135000);
+            pm.makePersistent(empNew);
+            Object empNewOid = pm.getObjectId((Object)empNew);
+
+            dept1.addEmployee(empNew);
+            pm.flush();
+            
+            // Postcondition
+            deferredAssertTrue(empNew.getDepartment() == dept1,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush");
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            empNew = (Employee)pm.getObjectById(empNewOid);
+            dept1 = (Department)pm.getObjectById(dept1Oid);
+            deferredAssertTrue(empNew.getDepartment() == dept1,
+                ASSERTION_FAILED + testMethod,
+                "In new transaction, postcondition is false; " +
+                "other side of relationship is not set.");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+
+    /** */
+    public void testSetToNullFromMappedSide() {
+        testMethod = "testSetToNullFromMappedSide";
+        if (isTestToBePerformed) {
+            // Set relationship
+            emp1.setDepartment(null);
+            pm.flush();
+            
+            // Postcondition
+            deferredAssertTrue(!dept1.getEmployees().contains(emp1),
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush");
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            emp1 = (Employee)pm.getObjectById(emp1Oid);
+            dept1 = (Department)pm.getObjectById(dept1Oid);
+            deferredAssertTrue(
+                !dept1.getEmployees().contains(emp1),
+                ASSERTION_FAILED + testMethod,
+                "In new transaction, postcondition is false; " +
+                "other side of relationship is not set.");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+    
+    /** */
+    public void testSetToNullFromMappedbySide() {
+        testMethod = "testSetToNullFromMappedbySide";
+        if (isTestToBePerformed) {
+            
+            // Set relationship
+            dept1.setEmployees(null);
+            pm.flush();
+            
+            // Postcondition
+            deferredAssertTrue(emp1.getDepartment() == null,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush");
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            emp1 = (Employee)pm.getObjectById(emp1Oid);
+            deferredAssertTrue(
+                emp1.getDepartment() == null,
+                ASSERTION_FAILED + testMethod,
+                "In new transaction, postcondition is false; " +
+                "other side of relationship is not set.");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+    
+    /** */
+    public void testSetToNewFromMappedSide() {
+        testMethod = "testSetToNewFromMappedSide";
+        if (isTestToBePerformed) {
+            
+            // Set relationship
+            IDepartment deptNew = new Department(99L, "The New Department");
+            pm.makePersistent(deptNew);
+            emp1.setDepartment(deptNew);
+            Object deptNewOid = pm.getObjectId((Object)deptNew);
+            pm.flush();
+            
+            assertFalse(testMethod + ": Test aborted, precondition is false; " +
+                "expected deptNewOid to be non-null", deptNewOid == null);
+            
+            // Postcondition
+            deferredAssertTrue(deptNew.getEmployees().contains(emp1),
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush");
+            deferredAssertTrue(!dept1.getEmployees().contains(emp1),
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "previous relationship (dept1) not nulled on flush");
+            
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            emp1 = (Employee)pm.getObjectById(emp1Oid);
+            deptNew = (Department)pm.getObjectById(deptNewOid);
+            dept1 = (Department)pm.getObjectById(dept1Oid);
+            deferredAssertTrue(deptNew.getEmployees().contains(emp1),
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set in new pm");
+            deferredAssertTrue(!dept1.getEmployees().contains(emp1),
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "previous relationship (dept1) not nulled in new pm");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+    
+    /** */
+    public void testRemoveFromMappedbySide() {
+        testMethod = "testRemoveFromMappedbySide";
+        if (isTestToBePerformed) {
+            
+            // Set relationship
+            dept1.removeEmployee(emp1);
+            pm.flush();
+            
+            // Postcondition
+            deferredAssertTrue(emp1.getDepartment() == null,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush");
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            emp1 = (Employee)pm.getObjectById(emp1Oid);
+            deferredAssertTrue(
+                emp1.getDepartment() == null,
+                ASSERTION_FAILED + testMethod,
+                "In new transaction, postcondition is false; " +
+                "other side of relationship is not set.");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+    
+    /** */
+    public void testDeleteFromMappedSide() {
+        testMethod = "testDeleteFromMappedSide";
+        if (isTestToBePerformed) {
+            // Set relationship
+            pm.deletePersistent(emp1);
+            pm.flush();
+            
+            // Postcondition
+            deferredAssertTrue(!dept1.getEmployees().contains(emp1),
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush");
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            dept1 = (Department)pm.getObjectById(dept1Oid);
+            deferredAssertTrue(
+                !dept1.getEmployees().contains(emp1),
+                ASSERTION_FAILED + testMethod,
+                "In new transaction, postcondition is false; " +
+                "other side of relationship is not set.");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+    
+    /** */
+    public void testDeleteFromMappedbySide() {
+        testMethod = "testDeleteFromMappedbySide";
+        if (isTestToBePerformed) {
+            
+            // Set relationship
+            pm.deletePersistent(dept1);
+            pm.flush();
+            
+            // Postcondition
+            deferredAssertTrue(emp1.getDepartment() == null,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush");
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            emp1 = (Employee)pm.getObjectById(emp1Oid);
+            deferredAssertTrue(
+                emp1.getDepartment() == null,
+                ASSERTION_FAILED + testMethod,
+                "In new transaction, postcondition is false; " +
+                "other side of relationship is not set.");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+}

Propchange: db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/Relationship1ToManyAllRelationships.java
------------------------------------------------------------------------------
    svn:eol-style = LF

Added: db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/Relationship1ToManyNoRelationships.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/Relationship1ToManyNoRelationships.java?rev=609039&view=auto
==============================================================================
--- db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/Relationship1ToManyNoRelationships.java (added)
+++ db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/Relationship1ToManyNoRelationships.java Fri Jan  4 14:42:33 2008
@@ -0,0 +1,250 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.mapping;
+
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+import org.apache.jdo.tck.pc.company.Department;
+import org.apache.jdo.tck.pc.company.Employee;
+import org.apache.jdo.tck.pc.company.FullTimeEmployee;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+
+/**
+ *<B>Title:</B>Relationship1ToManyNoRelationships
+ *<BR>
+ *<B>Keywords:</B> mapping, managed relationships
+ *<BR>
+ *<B>Assertion ID:</B> A15.3-14
+ *<BR>
+ *<B>Assertion Description: Regardless of which side changes the relationship,
+ * flush (whether done as part of commit or explicitly by the user) will modify
+ * the datastore to reflect the change and will update the memory model
+ * for consistency...</B>
+ */
+
+public class Relationship1ToManyNoRelationships extends AbstractRelationshipTest {
+    
+    String testMethod = null;
+    protected String ASSERTION_FAILED =
+        "Assertion A15-3.14 (Relationship1ToManyNoRelationships) failed: ";
+    
+    Object emp1Oid = null;
+    Object dept1Oid = null;
+    Object dept2Oid = null;
+    Employee emp1 = null;
+    Department dept1 = null;
+    Department dept2 = null;
+    
+    /**
+     * The <code>main</code> is called when the class
+     * is directly executed from the command line.
+     * @param args The arguments passed to the program.
+     */
+    public static void main(String[] args) {
+        BatchTestRunner.run(Relationship1ToManyNoRelationships.class);
+    }
+    
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        super.localSetUp();
+        if (isTestToBePerformed) {
+            getPM();
+            pm.currentTransaction().begin();
+            
+            emp1Oid = getOidByName("emp1");
+            dept1Oid = getOidByName("dept1");
+            dept2Oid = getOidByName("dept2");
+            emp1 = (Employee)pm.getObjectById(emp1Oid);
+            dept1 = (Department)pm.getObjectById(dept1Oid);
+            dept2 = (Department)pm.getObjectById(dept2Oid);
+            
+            // Preconditions
+            assertTrue(ASSERTION_FAILED +
+                ": Test aborted, precondition is false; " +
+                "expected emp.getDepartment()to be null",
+                emp1.getDepartment() == null);
+            assertTrue(ASSERTION_FAILED + testMethod +
+                ": Test aborted, precondition is false; " +
+                "expected dept.getEmployees() to be empty",
+                dept1.getEmployees().isEmpty());
+        }
+    }
+    
+    /** */
+    public void testSetToExistingFromMappedSide() {
+        testMethod = "testSetToExistingFromMappedSide";
+        if (isTestToBePerformed) {
+            
+            // Set relationship
+            emp1.setDepartment(dept1);
+            pm.flush();
+            
+            // Postcondition
+            deferredAssertTrue(dept1.getEmployees().contains(emp1),
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush");
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            emp1 = (Employee)pm.getObjectById(emp1Oid);
+            dept1 = (Department)pm.getObjectById(dept1Oid);
+            deferredAssertTrue(
+                dept1.getEmployees().contains(emp1),
+                ASSERTION_FAILED + testMethod,
+                "In new transaction, postcondition is false; " +
+                "other side of relationship is not set.");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+    
+    /** */
+    public void testAddExistingFromMappedbySide() {
+        testMethod = "testSetToExistingFromMappedbySide";
+        if (isTestToBePerformed) {
+            
+            // Set relationship
+            Set emps = new HashSet();
+            emps.add(emp1);
+            dept1.setEmployees(emps);
+            pm.flush();
+            
+            // Postcondition
+            deferredAssertTrue(emp1.getDepartment() == dept1,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush");
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            emp1 = (Employee)pm.getObjectById(emp1Oid);
+            dept1 = (Department)pm.getObjectById(dept1Oid);
+            deferredAssertTrue(
+                emp1.getDepartment() == dept1,
+                ASSERTION_FAILED + testMethod,
+                "In new transaction, postcondition is false; " +
+                "other side of relationship is not set.");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+    
+    /** */
+    public void testSetToNewFromMappedSide() {
+        testMethod = "testSetToNewFromMappedSide";
+        if (isTestToBePerformed) {
+            
+            // Set relationship
+            Department deptNew = new Department(99L, "The New Department");
+            emp1.setDepartment(deptNew);
+            pm.makePersistent(deptNew);
+            Object deptNewOid = pm.getObjectId((Object)deptNew);
+            pm.flush();
+            
+            assertFalse(testMethod + ": Test aborted, precondition is false; " +
+                "expected deptNewOid to be non-null", deptNewOid == null);
+            
+            // Postcondition
+            deferredAssertTrue(deptNew.getEmployees().contains(emp1),
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush");
+            deferredAssertTrue(!dept1.getEmployees().contains(emp1),
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "previous relationship (dept1) not nulled on flush");
+            
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            emp1 = (Employee)pm.getObjectById(emp1Oid);
+            deptNew = (Department)pm.getObjectById(deptNewOid);
+            dept1 = (Department)pm.getObjectById(dept1Oid);
+            deferredAssertTrue(deptNew.getEmployees().contains(emp1),
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set in new pm");
+            deferredAssertTrue(!dept1.getEmployees().contains(emp1),
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "previous relationship (dept1) not nulled in new pm");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+    
+    /** */
+    public void testSetToNewFromMappedbySide() {
+        testMethod = "testSetToNewFromMappedbySide";
+        if (isTestToBePerformed) {
+            
+            // Set relationship
+            Set emps = new HashSet();
+            Employee empNew = new FullTimeEmployee(101, "Jenny", "Merriwether",
+                "White", new Date(500L), new Date(10000L), 135000);
+            pm.makePersistent(empNew);
+            emps.add(empNew);
+            dept1.setEmployees(emps);
+            Object empNewOid = pm.getObjectId((Object)empNew);
+            pm.flush();
+            
+            // Postcondition
+            deferredAssertTrue(empNew.getDepartment() == dept1,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set on flush");
+            deferredAssertTrue(emp1.getDepartment() == null,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "previous relationship not nulled on flush");
+            pm.currentTransaction().commit();
+            cleanupPM();
+            getPM();
+            
+            pm.currentTransaction().begin();
+            empNew = (Employee)pm.getObjectById(empNewOid);
+            emp1 = (Employee)pm.getObjectById(emp1Oid);
+            dept1 = (Department)pm.getObjectById(dept1Oid);
+            deferredAssertTrue(empNew.getDepartment() == dept1,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "other side of relationship not set in new pm");
+            deferredAssertTrue(emp1.getDepartment() == null,
+                ASSERTION_FAILED + testMethod,
+                "Postcondition is false; "
+                + "previous relationship not nulled in new pm");
+            pm.currentTransaction().commit();
+            
+            failOnError();
+        }
+    }
+}

Propchange: db/jdo/trunk/tck2-legacy/src/java/org/apache/jdo/tck/mapping/Relationship1ToManyNoRelationships.java
------------------------------------------------------------------------------
    svn:eol-style = LF