db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject svn commit: r158179 [17/61] - in incubator/jdo/trunk/tck11: ./ assertions/ iut_jars/ test/ test/conf/ test/java/ test/java/org/ test/java/org/apache/ test/java/org/apache/jdo/ test/java/org/apache/jdo/tck/ test/java/org/apache/jdo/tck/api/ test/java/org/apache/jdo/tck/api/instancecallbacks/ test/java/org/apache/jdo/tck/api/jdohelper/ test/java/org/apache/jdo/tck/api/persistencemanager/ test/java/org/apache/jdo/tck/api/persistencemanagerfactory/ test/java/org/apache/jdo/tck/enhancement/ test/java/org/apache/jdo/tck/extents/ test/java/org/apache/jdo/tck/lifecycle/ test/java/org/apache/jdo/tck/lifecycle/nontransactional/ test/java/org/apache/jdo/tck/models/ test/java/org/apache/jdo/tck/models/embedded/ test/java/org/apache/jdo/tck/models/fieldtypes/ test/java/org/apache/jdo/tck/models/inheritance/ test/java/org/apache/jdo/tck/pc/ test/java/org/apache/jdo/tck/pc/company/ test/java/org/apache/jdo/tck/pc/fieldtypes/ test/java/org/apache/jdo/tck/pc/inheritance/ test/java/org/apache/jdo/tck/pc/instancecallbacks/ test/java/org/apache/jdo/tck/pc/lifecycle/ test/java/org/apache/jdo/tck/pc/mylib/ test/java/org/apache/jdo/tck/query/ test/java/org/apache/jdo/tck/query/operators/ test/java/org/apache/jdo/tck/transactions/ test/java/org/apache/jdo/tck/util/ test/jdo/ test/jdo/applicationidentity/ test/jdo/applicationidentity/org/ test/jdo/applicationidentity/org/apache/ test/jdo/applicationidentity/org/apache/jdo/ test/jdo/applicationidentity/org/apache/jdo/tck/ test/jdo/applicationidentity/org/apache/jdo/tck/pc/ test/jdo/applicationidentity/org/apache/jdo/tck/pc/company/ test/jdo/applicationidentity/org/apache/jdo/tck/pc/fieldtypes/ test/jdo/applicationidentity/org/apache/jdo/tck/pc/inheritance/ test/jdo/applicationidentity/org/apache/jdo/tck/pc/instancecallbacks/ test/jdo/applicationidentity/org/apache/jdo/tck/pc/lifecycle/ test/jdo/applicationidentity/org/apache/jdo/tck/pc/mylib/ test/jdo/datastoreidentity/ test/jdo/datastoreidentity/org/ test/jdo/datastoreidentity/org/apache/ test/jdo/datastoreidentity/org/apache/jdo/ test/jdo/datastoreidentity/org/apache/jdo/tck/ test/jdo/datastoreidentity/org/apache/jdo/tck/pc/ test/jdo/datastoreidentity/org/apache/jdo/tck/pc/company/ test/jdo/datastoreidentity/org/apache/jdo/tck/pc/fieldtypes/ test/jdo/datastoreidentity/org/apache/jdo/tck/pc/inheritance/ test/jdo/datastoreidentity/org/apache/jdo/tck/pc/instancecallbacks/ test/jdo/datastoreidentity/org/apache/jdo/tck/pc/lifecycle/ test/jdo/datastoreidentity/org/apache/jdo/tck/pc/mylib/
Date Sat, 19 Mar 2005 01:09:46 GMT
Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/models/inheritance/TestParts.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/models/inheritance/TestParts.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/models/inheritance/TestParts.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/models/inheritance/TestParts.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+
+package org.apache.jdo.tck.models.inheritance;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.inheritance.Constants;
+
+/**
+ * The test data is in arrays, making it easy to change values.  The Inheritance test classes refer to the
+ * data via array index and the checkXXXX() routines carry an index value--indicating the expected value.
+ * If those attributes are references and should be other than null, as is the case with thirdObj, then the
+ * test code inserts the reference into the data array.
+ *
+ * Each test class follows the same pattern:
+ * 1.  Persistent and transient object are created in the first transaction.
+ * 2.  A second transaction is started, the first persistent object retrieved and checking is done on
+ *     its attribute values.
+ * 3.  A rollback is performed and value comparisions are made on the transient instances that were created.
+ * 4.  A third transation is started and the first persistent object again retrieved and checking is done on
+ *     its attribute values.
+ */
+public abstract class TestParts extends JDO_Test {
+    
+    //                                     0     1     2     3     4     5     6     7     8     9     10    11
+    static final Object[] secondObj_V = { null, null, null, null, null, null, null, null, null, null, null, null};
+	static final Object[] thirdObj_V =  { null, null, null, null, null, null, null, null, null, null, null, null};
+	static final Object[] fourthObj_V = { null, null, null, null, null, null, null, null, null, null, null, null};
+    
+    static String persistentAfterCommit = "Read object back after committed to Database.  ";
+    static String persistentAfterRollback = "Read object back after rollback.  ";
+    static String transientAfterRollback = "Object reverted to transient after rollback.  ";
+    
+    /** */
+    void checkPersistentAreCorrect(String assertion, String title, int index, 
+                                   double doubleB, int intB, short shortF, 
+                                   Object thirdObj, int intH) {
+        if(doubleB != Constants.doubleB_V[index]) {
+            fail(assertion, 
+                 title + "Persistent attribute doubleB is " + doubleB + 
+                 ", it should be " + Constants.doubleB_V[index]);
+        }
+        if(intB != Constants.intB_V[index]) {
+            fail(assertion, 
+            	 title + "Persistent attribute intB is " + intB + 
+                 ", it should be " + Constants.intB_V[index]);
+        }
+        if(shortF != Constants.shortF_V[index]) {
+            fail(assertion, 
+                 title + "Persistent attribute shortF is " + shortF + 
+                 ", it should be " + Constants.shortF_V[index]);
+        }
+        if(thirdObj != TestParts.thirdObj_V[index]) {
+            fail(assertion, 
+                 title + "Persistent attribute thirdObj is " + thirdObj + 
+                 ", it should be " + TestParts.thirdObj_V[index]);
+        }
+        if(intH != Constants.intH_V[index]) {
+            fail(assertion, 
+                 title + "Persistent attribute intH is " + intH + 
+                 ", it should be " + Constants.intH_V[index]);
+        }
+    }
+
+    /** */
+    void checkTransactionalAreCorrect(String assertion, String title, int index, 
+                                      float floatE, Object secondObj) {
+                    
+        if(floatE != Constants.floatE_V[index]) {
+            fail(assertion, 
+                 title + "Transactional attribute floatE is " + floatE + 
+                 ", it should be " + Constants.floatE_V[index]);
+        }
+        if(secondObj != TestParts.secondObj_V[index]) {
+            fail(assertion, 
+                 title + "Transactional attribute secondObj is " + secondObj + 
+                 ", it should be " + TestParts.secondObj_V[index]);
+        }
+    }
+    
+    /** */
+    void checkNonpersistentAreCorrect(String assertion, String title, int index, 
+                                      int intA, char charC, boolean booleanD, 
+                                      short shortG, Object fourthObj) {
+        if(intA != Constants.intA_V[index]) {
+            fail(assertion, 
+                 title + "In non-persistent class, attribute intA is " + intA + 
+                 ", it should be " + Constants.intA_V[index]);
+        }
+        if(charC != Constants.charC_V[index]) {
+            fail(assertion, 
+                 title + "In non-persistent class, attribute charC is " + charC + 
+                 ", it should be " + Constants.charC_V[index]);
+        }
+        if(booleanD != Constants.booleanD_V[index]) {
+            fail(assertion, 
+                 title + "In non-persistent class, attribute booleanD is " + booleanD + 
+                 ", it should be " + Constants.booleanD_V[index]);
+        }
+        if(shortG != Constants.shortG_V[index]) {
+            fail(assertion, 
+                 title + "In non-persistent class, attribute shortG is " + shortG + 
+                 ", it should be " + Constants.shortG_V[index]);
+        }
+        if(fourthObj != TestParts.fourthObj_V[index]) {
+            fail(assertion, 
+                 title + "In non-persistent class, attribute fourthObj is " + fourthObj + 
+                 ", it should be " + TestParts.fourthObj_V[index]);
+        }
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/models/inheritance/TransactionalFieldsAreTransactionalInSubclasses.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/models/inheritance/TransactionalFieldsAreTransactionalInSubclasses.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/models/inheritance/TransactionalFieldsAreTransactionalInSubclasses.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/models/inheritance/TransactionalFieldsAreTransactionalInSubclasses.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+
+package org.apache.jdo.tck.models.inheritance;
+
+import java.util.Iterator;
+
+import javax.jdo.Extent;
+import javax.jdo.PersistenceManager;
+import javax.jdo.Transaction;
+
+import org.apache.jdo.tck.pc.inheritance.AllPersist4;
+import org.apache.jdo.tck.pc.inheritance.Constants;
+import org.apache.jdo.tck.util.BatchTestRunner;
+
+/**
+ *<B>Title:</B> Transactional Fields are Transactional in Subclasses
+ *<BR>
+ *<B>Keywords:</B> inheritance
+ *<BR>
+ *<B>Assertion ID:</B> A6.5-5.
+ *<BR>
+ *<B>Assertion Description: </B>
+Fields marked as transactional in persistence-capable classes
+will be transactional in subclasses.
+
+ */
+
+public class TransactionalFieldsAreTransactionalInSubclasses extends TestParts {
+    
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A6.5-5 (TransactionalFieldsAreTransactionalInSubclasses) 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(TransactionalFieldsAreTransactionalInSubclasses.class);
+    }
+
+    /** */
+    public void test() {
+        pm = getPM();
+         
+        runTest(pm);
+
+        pm.close();
+        pm = null;
+    }
+
+    /** */
+    void runTest(PersistenceManager pm)
+    {
+        Transaction t = pm.currentTransaction();
+        try {
+            t.setRestoreValues(true);
+        
+            t.begin();
+            removeAllInstances(pm); // always start fresh with no instances
+            t.commit();
+            t.begin();
+            // create new objects and make persistent
+            AllPersist4 c = new AllPersist4(Constants.intA_V[8], Constants.doubleB_V[8], Constants.intB_V[8], Constants.charC_V[8], Constants.booleanD_V[8], Constants.floatE_V[8], Constants.shortF_V[8], Constants.shortG_V[8], Constants.intH_V[8]);
+            AllPersist4 d = new AllPersist4(Constants.intA_V[9], Constants.doubleB_V[9], Constants.intB_V[9], Constants.charC_V[9], Constants.booleanD_V[9], Constants.floatE_V[9], Constants.shortF_V[9], Constants.shortG_V[9], Constants.intH_V[9]);
+            c.thirdObj = d;
+            c.fourthObj = d;
+            TestParts.thirdObj_V[8] = d;
+            TestParts.fourthObj_V[8] = d;
+            pm.makePersistent(c);
+        
+            // change values of newly persistent object
+            c.intA = Constants.intA_V[10];
+            c.charC = Constants.charC_V[10];
+            c.booleanD = Constants.booleanD_V[10];
+            c.shortG = Constants.shortG_V[10];
+            c.fourthObj = null;
+            c.floatE = Constants.floatE_V[10];
+            c.secondObj = d;
+            c.doubleB = Constants.doubleB_V[10];
+            c.intB = Constants.intB_V[10];
+            c.shortF = Constants.shortF_V[10];
+            c.thirdObj = null;
+            c.intH = Constants.intH_V[10];
+        
+            t.rollback();
+            t = null;
+
+            // verify objects revert back to transient after rollback
+            checkTransactionalAreCorrect(ASSERTION_FAILED, transientAfterRollback, 8, c.floatE, c.secondObj);
+        }
+        finally {
+            if ((t != null) && t.isActive())
+                t.rollback();
+        }    
+    }
+
+    void removeAllInstances(PersistenceManager pm)
+    {
+        AllPersist4 a = new AllPersist4(0, 0.0, 0, '0', false, 0.0f, (short)0, (short)0, 0);
+        pm.makePersistent(a); // guarantee the class is registered; this will be removed
+        Extent e = pm.getExtent(AllPersist4.class, true);
+        Iterator i = e.iterator();
+        while( i.hasNext() ){
+            pm.deletePersistent(i.next());
+        }        
+    }
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Address.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Address.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Address.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Address.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,272 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.pc.company;
+
+import java.io.Serializable;
+
+import org.apache.jdo.tck.util.DeepEquality;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+/**
+ * This class represents a postal address.
+ */
+public class Address 
+    implements Serializable, Comparable, DeepEquality {
+
+    private long    addrid;
+    private String  street;
+    private String  city;
+    private String  state;
+    private String  zipcode;
+    private String  country;
+
+    /** This is the JDO-required no-args constructor */
+    protected Address() {}
+
+    /**
+     * This constructor initializes the <code>Address</code> components.
+     * @param addrid The address ID.
+     * @param street The street address.
+     * @param city The city.
+     * @param state The state.
+     * @param zipcode The zip code.
+     * @param country The zip country.
+     */
+    public Address(long addrid, String street, String city, 
+                   String state, String zipcode, String country)
+    {
+        this.addrid = addrid;
+        this.street = street;
+        this.city = city;
+        this.state = state;
+        this.zipcode = zipcode;
+        this.country = country;
+    }
+
+    /**
+     * Get the addrid associated with this object.
+     * @return the addrid.
+     */
+    public long getAddrid() {
+        return addrid;
+    }
+
+    /** 
+     * Get the street component of the address.
+     * @return The street component of the address.
+     */
+    public String getStreet() {
+        return street;
+    }
+
+    /**
+     * Set the street component of the address.
+     * @param street The street component.
+     */
+    public void setStreet(String street) {
+        this.street = street;
+    }
+
+    /**
+     * Get the city.
+     * @return The city component of the address.
+     */
+    public String getCity(String city) {
+        return city;
+    }
+
+    /**
+     * Set the city component of the address.
+     * @param city The city.
+     */
+    public void setCity(String city) {
+        this.city = city;
+    }
+    
+    /**
+     * Get the state component of the address.
+     * @return The state.
+     */
+    public String getState() {
+        return state;
+    }
+
+    /**
+     * Set the state component of the address.
+     * @param state The state.
+     */
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    /**
+     * Get the zipcode component of the address.
+     * @return The zipcode.
+     */
+    public String getZipcode() {
+        return zipcode;
+    }
+
+    /**
+     * Set the zip code component of the address.
+     * @param zipcode The zipcode.
+     */
+    public void setZipcode(String zipcode) {
+        this.zipcode = zipcode;
+    }
+
+    /**
+     * Get the country component of the address.
+     * @return The country.
+     */
+    public String getCountry() {
+        return country;
+    }
+
+    /**
+     * Set the country component of the address.
+     * @param country The country.
+     */
+    public void setCountry(String country) {
+        this.country = country;
+    }
+
+    /** 
+     * Returns <code>true</code> if all the fields of this instance are
+     * deep equal to the coresponding fields of the specified Person.
+     * @param other the object with which to compare.
+     * @param helper EqualityHelper to keep track of instances that have
+     * already been processed. 
+     * @return <code>true</code> if all the fields are deep equal;
+     * <code>false</code> otherwise.  
+     * @throws ClassCastException if the specified instances' type prevents
+     * it from being compared to this instance. 
+     */
+    public boolean deepCompareFields(DeepEquality other, 
+                                     EqualityHelper helper) {
+        Address otherAddress = (Address)other;
+        return (addrid == otherAddress.addrid) &&
+            helper.equals(street, otherAddress.street) &&
+            helper.equals(city, otherAddress.city) &&
+            helper.equals(state, otherAddress.state) &&
+            helper.equals(zipcode, otherAddress.zipcode) &&
+            helper.equals(country, otherAddress.country);
+    }
+    
+    /** 
+     * Compares this object with the specified object for order. Returns a
+     * negative integer, zero, or a positive integer as this object is less
+     * than, equal to, or greater than the specified object. 
+     * @param o The Object to be compared. 
+     * @return a negative integer, zero, or a positive integer as this 
+     * object is less than, equal to, or greater than the specified object. 
+     * @throws ClassCastException - if the specified object's type prevents
+     * it from being compared to this Object. 
+     */
+    public int compareTo(Object o) {
+        return compareTo((Address)o);
+    }
+
+    /** 
+     * Compares this object with the specified Address object for
+     * order. Returns a negative integer, zero, or a positive integer as
+     * this object is less than, equal to, or greater than the specified
+     * object.  
+     * @param other The Address object to be compared. 
+     * @return a negative integer, zero, or a positive integer as this
+     * object is less than, equal to, or greater than the specified Address
+     * object. 
+     */
+    public int compareTo(Address other) {
+        long otherId = other.addrid;
+        return (addrid < otherId ? -1 : (addrid == otherId ? 0 : 1));
+    }
+    
+    /** 
+     * Indicates whether some other object is "equal to" this one.
+     * @param obj the object with which to compare.
+     * @return <code>true</code> if this object is the same as the obj
+     * argument; <code>false</code> otherwise. 
+     */
+    public boolean equals(Object obj) {
+        if (obj instanceof Address) {
+            return compareTo((Address)obj) == 0;
+        }
+        return false;
+    }
+        
+    /**
+     * Returns a hash code value for the object. 
+     * @return a hash code value for this object.
+     */
+    public int hashCode() {
+        return (int)addrid;
+    }
+    
+    /**
+     * This class is used to represent the application identifier 
+     * for the <code>Address</code> class.
+     */
+    public static class Oid implements Serializable, Comparable {
+
+        /**
+         * This is the identifier field for <code>Address</code> and must
+         * correspond in type and name to the field in
+         * <code>Address</code>. 
+         */
+        public long addrid;
+        
+        /** The required public, no-arg constructor. */
+        public Oid()
+        {
+            addrid = 0;
+        }
+
+        /**
+         * A constructor to initialize the identifier field.
+         * @param addrid the id of the Adress.
+         */
+        public Oid(long addrid) {
+            this.addrid = addrid;
+        }
+
+        /** */
+        public boolean equals(java.lang.Object obj) {
+            if( obj==null || !this.getClass().equals(obj.getClass()) )
+                return( false );
+            Oid o = (Oid) obj;
+            if( this.addrid != o.addrid ) return( false );
+            return( true );
+        }
+
+        /** */
+        public int hashCode() {
+            return( (int) addrid );
+        }
+
+        /** */
+        public int compareTo(Object obj) {
+            // may throw ClassCastException which the user must handle
+            Oid other = (Oid) obj;
+            if( addrid < other.addrid ) return -1;
+            if( addrid > other.addrid ) return 1;
+            return 0;
+        }
+
+    }
+
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Company.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Company.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Company.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Company.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,283 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.pc.company;
+
+import java.io.Serializable;
+import java.io.ObjectInputStream;
+import java.io.IOException;
+
+import java.util.Collections;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Date;
+
+import org.apache.jdo.tck.util.DeepEquality;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+/**
+ * This class represents information about a company.
+ */
+public class Company 
+    implements Serializable, Comparable, DeepEquality {
+
+    private long        companyid;
+    private String      name;
+    private Date        founded;
+    private Address     address;
+    private transient Set departments = new HashSet(); // element type is Department
+
+    /** This is the JDO-required no-args constructor */
+    protected Company() {}
+
+    /** 
+     * Initialize the <code>Company</code> instance.
+     * @param companyid The company id.
+     * @param name The company name.
+     * @param founded The date the company was founded.
+     * @param addr The company's address.
+     */
+    public Company(long companyid, String name, Date founded, Address addr) {
+        this.companyid = companyid;
+        this.name = name;
+        this.founded = founded;
+        this.address = addr;
+    }
+
+    /**
+     * Get the company id.
+     * @return The company id.
+     */
+    public long getCompanyid() {
+        return companyid;
+    }
+
+    /**
+     * Get the name of the company.
+     * @return The name of the company.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Set the  name of the company.
+     * @param name The value to use for the name of the company.
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * Get the date that the company was founded.
+     * @return The date the company was founded.
+     */
+    public Date getFounded() {
+        return founded;
+    }
+
+    /**
+     * Set the date that the company was founded.
+     * @param founded The date to set that the company was founded.
+     */
+    public void setFounded(Date founded) {
+        this.founded = founded;
+    }
+
+    /**
+     * Get the address of the company.
+     * @return The primary address of the company.
+     */
+    public Address getAddress() {
+        return address;
+    }
+    
+    /**
+     * Set the primary address for the company.
+     * @param address The address to set for the company.
+     */
+    public void setAddress(Address address) {
+        this.address = address;
+    }
+
+    /**
+     * Get the departments contained in the company.
+     * @return An unmodifiable <code>Set</code> that contains all the
+     * <code>Department</code>s of the company.
+     */
+    public Set getDepartments() {
+        return Collections.unmodifiableSet(departments);
+    }
+
+    /**
+     * Add a <code>Department</code> instance to the company.
+     * @param dept The <code>Department</code> instance to add.
+     */
+    public void addDepartment(Department dept) {
+        departments.add(dept);
+    }
+
+    /**
+     * Remove a <code>Department</code> instance from the company.
+     * @param dept The <code>Department</code> instance to remove.
+     */
+    public void removeDepartment(Department dept) {
+        departments.remove(dept);
+    }
+
+    /**
+     * Initialize the set of <code>Department</code>s in the company to the 
+     * parameter. 
+     * @param departments The set of <code>Department</code>s for the
+     * company. 
+     */
+    public void setDepartments(Set departments) {
+        // workaround: create a new HashSet, because fostore does not
+        // support LinkedHashSet
+        this.departments = 
+            (departments != null) ? new HashSet(departments) : null;
+    }
+    
+    /** Serialization support: initialize transient fields. */
+    private void readObject(ObjectInputStream in)
+        throws IOException, ClassNotFoundException {
+        in.defaultReadObject();
+        departments = new HashSet();
+    }
+
+    /** 
+     * Returns <code>true</code> if all the fields of this instance are
+     * deep equal to the coresponding fields of the specified Person.
+     * @param other the object with which to compare.
+     * @param helper EqualityHelper to keep track of instances that have
+     * already been processed. 
+     * @return <code>true</code> if all the fields are deep equal;
+     * <code>false</code> otherwise.  
+     * @throws ClassCastException if the specified instances' type prevents
+     * it from being compared to this instance. 
+     */
+    public boolean deepCompareFields(DeepEquality other, 
+                                     EqualityHelper helper) {
+        Company otherCompany = (Company)other;
+        return (companyid == otherCompany.companyid) &&
+            helper.equals(name, otherCompany.name) &&
+            helper.equals(founded, otherCompany.founded) &&
+            helper.deepEquals(address, otherCompany.address) &&
+            helper.deepEquals(departments, otherCompany.departments);
+    }
+    
+    /** 
+     * Compares this object with the specified object for order. Returns a
+     * negative integer, zero, or a positive integer as this object is less
+     * than, equal to, or greater than the specified object. 
+     * @param o The Object to be compared. 
+     * @return a negative integer, zero, or a positive integer as this 
+     * object is less than, equal to, or greater than the specified object. 
+     * @throws ClassCastException - if the specified object's type prevents
+     * it from being compared to this Object. 
+     */
+    public int compareTo(Object o) {
+        return compareTo((Company)o);
+    }
+
+    /** 
+     * Compares this object with the specified Company object for
+     * order. Returns a negative integer, zero, or a positive integer as
+     * this object is less than, equal to, or greater than the specified
+     * object.  
+     * @param other The Company object to be compared. 
+     * @return a negative integer, zero, or a positive integer as this
+     * object is less than, equal to, or greater than the specified Company
+     * object. 
+     */
+    public int compareTo(Company other) {
+        long otherId = other.companyid;
+        return (companyid < otherId ? -1 : (companyid == otherId ? 0 : 1));
+    }
+    
+    /** 
+     * Indicates whether some other object is "equal to" this one.
+     * @param obj the object with which to compare.
+     * @return <code>true</code> if this object is the same as the obj
+     * argument; <code>false</code> otherwise. 
+     */
+    public boolean equals(Object obj) {
+        if (obj instanceof Company) {
+            return compareTo((Company)obj) == 0;
+        }
+        return false;
+    }
+        
+    /**
+     * Returns a hash code value for the object. 
+     * @return a hash code value for this object.
+     */
+    public int hashCode() {
+        return (int)companyid;
+    }
+    
+    /**
+     * The class to be used as the application identifier
+     * for the <code>Company</code> class. It consists of both the company 
+     * name and the date that the company was founded.
+     */
+    public static class Oid implements Serializable, Comparable {
+
+        /**
+         * This field is part of the identifier and should match in name
+         * and type with a field in the <code>Company</code> class.
+         */
+        public long companyid;
+
+        /** The required public no-arg constructor. */
+        public Oid() { }
+
+        /**
+         * Initialize the identifier.
+         * @param companyid The id of the company.
+         */
+        public Oid(long companyid) {
+            this.companyid = companyid;
+        }
+        
+        /** */
+        public boolean equals(Object obj) {
+            if (obj==null || !this.getClass().equals(obj.getClass())) 
+                return false;
+            Oid o = (Oid) obj;
+            if (this.companyid != o.companyid) 
+                return false;
+            return true;
+        }
+
+        /** */
+        public int hashCode() {
+            return (int)companyid;
+        }
+
+        /** */
+        public int compareTo(Object obj) {
+            // may throw ClassCastException which the user must handle
+            Oid other = (Oid) obj;
+            if( companyid < other.companyid ) return -1;
+            if( companyid > other.companyid ) return 1;
+            return 0;
+        }
+        
+    }
+
+}
+

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,216 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.pc.company;
+
+import java.io.InputStream;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
+import java.util.TimeZone;
+
+import org.springframework.beans.propertyeditors.CustomDateEditor;
+import org.springframework.beans.factory.xml.XmlBeanFactory;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.InputStreamResource;
+
+/**
+ * Utility class to create a graph of company model instances from an xml
+ * representation. 
+ *
+ * @author Michael Bouschen
+ */
+public class CompanyModelReader extends XmlBeanFactory {
+
+    /** The format of date values in the xml representation */
+    public static final String DATE_PATTERN = "d/MMM/yyyy";
+    
+    /** 
+     * Create a CompanyModelReader for the specified resourceName. 
+     * @param resourceName the name of the resource
+     */
+    public CompanyModelReader(String resourceName) {
+        // Use the class loader of the Company class to find the resource
+        this(resourceName, Company.class.getClassLoader());
+    }
+
+    /** 
+     * Create a CompanyModelReader for the specified resourceName. 
+     * @param resourceName the name of the resource
+     */
+    public CompanyModelReader(String resourceName, ClassLoader classLoader) {
+        super(new ClassPathResource(resourceName, classLoader));
+        configureFactory();
+    }
+
+    /**
+     * Create a CompanyModelReader for the specified InputStream.
+     * @param stream the input stream
+     */
+    public CompanyModelReader(InputStream stream) {
+        super(new InputStreamResource(stream));
+        configureFactory();
+    }
+    
+    /** 
+     * Configure the CompanyModelReader, e.g. register CustomEditor classes
+     * to convert the string representation of a property into an instance
+     * of the right type.
+     */
+    private void configureFactory() {
+        SimpleDateFormat formatter = new SimpleDateFormat(DATE_PATTERN, Locale.US);
+        formatter.setTimeZone(TimeZone.getTimeZone("America/New_York"));
+        CustomDateEditor dateEditor = 
+            new CustomDateEditor(formatter, true);
+        registerCustomEditor(Date.class, dateEditor);
+    }
+    
+    // Convenience methods
+
+    /** 
+     * Convenience method returning an Address instance for the specified
+     * name. The method returns <code>null</code> if there is no Address
+     * bean with the specified name. 
+     * @param name the name of the bean to return.
+     * @return the instance of the bean or <code>null</code> if there no
+     * Address bean.
+     */
+    public Address getAddress(String name) {
+        return (Address)getBean(name, Address.class);
+    }
+
+    /** 
+     * Convenience method returning a Company instance for the specified 
+     * name. The method returns <code>null</code> if there is no Company
+     * bean with the specified name. 
+     * @param name the name of the bean to return.
+     * @return the instance of the bean or <code>null</code> if there no
+     * Company bean.
+     */
+    public Company getCompany(String name) {
+        return (Company)getBean(name, Company.class);
+    }
+
+    /** 
+     * Convenience method returning a DentalInsurance instance for the
+     * specified name. The method returns <code>null</code> if there is no
+     * DentalInsurance bean with the specified name. 
+     * @param name the name of the bean to return.
+     * @return the instance of the bean or <code>null</code> if there no
+     * DentalInsurance bean.
+     */
+    public DentalInsurance getDentalInsurance(String name) {
+        return (DentalInsurance)getBean(name, DentalInsurance.class);
+    }
+
+    /** 
+     * Convenience method returning a Department instance for the specified
+     * name. The method returns <code>null</code> if there is no Department
+     * bean with the specified name. 
+     * @param name the name of the bean to return.
+     * @return the instance of the bean or <code>null</code> if there no
+     * Department bean.
+     */
+    public Department getDepartment(String name) {
+        return (Department)getBean(name, Department.class);
+    }
+
+    /** 
+     * Convenience method returning an Employee instance for the specified
+     * name. The method returns <code>null</code> if there is no Employee
+     * bean with the specified name. 
+     * @param name the name of the bean to return.
+     * @return the instance of the bean or <code>null</code> if there no
+     * Employee bean.
+     */
+    public Employee getEmployee(String name) {
+        return (Employee)getBean(name, Employee.class);
+    }
+
+    /** 
+     * Convenience method returning a FullTimeEmployee instance for the
+     * specified name. The method returns <code>null</code> if there is no
+     * FullTimeEmployee bean with the specified name. 
+     * @param name the name of the bean to return.
+     * @return the instance of the bean or <code>null</code> if there no
+     * FullTimeEmployee bean.
+     */
+    public FullTimeEmployee getFullTimeEmployee(String name) {
+        return (FullTimeEmployee)getBean(name, FullTimeEmployee.class);
+    }
+
+    /** 
+     * Convenience method returning an Insurance instance for the specified
+     * name. The method returns <code>null</code> if there is no Insurance
+     * bean with the specified name. 
+     * @param name the name of the bean to return.
+     * @return the instance of the bean or <code>null</code> if there no
+     * Insurance bean.
+     */
+    public Insurance getInsurance(String name) {
+        return (Insurance)getBean(name, Insurance.class);
+    }
+
+    /** 
+     * Convenience method returning a MedicalInsurance instance for the
+     * specified name. The method returns <code>null</code> if there is no
+     * MedicalInsurance bean with the specified name. 
+     * @param name the name of the bean to return.
+     * @return the instance of the bean or <code>null</code> if there no
+     * MedicalInsurance bean.
+     */
+    public MedicalInsurance getMedicalInsurance(String name) {
+        return (MedicalInsurance)getBean(name, MedicalInsurance.class);
+    }
+
+    /** 
+     * Convenience method returning a PartTimeEmployee instance for the
+     * specified name. The method returns <code>null</code> if there is no
+     * PartTimeEmployee bean with the specified name. 
+     * @param name the name of the bean to return.
+     * @return the instance of the bean or <code>null</code> if there no
+     * PartTimeEmployee bean.
+     */
+    public PartTimeEmployee getPartTimeEmployee(String name) {
+        return (PartTimeEmployee)getBean(name, PartTimeEmployee.class);
+    }
+
+    /** 
+     * Convenience method returning a Person instance for the specified
+     * name. The method returns <code>null</code> if there is no Person
+     * bean with the specified name. 
+     * @param name the name of the bean to return.
+     * @return the instance of the bean or <code>null</code> if there no
+     * Person bean.
+     */
+    public Person getPerson(String name) {
+        return (Person)getBean(name, Person.class);
+    }
+
+    /** 
+     * Convenience method returning a Project instance for the specified
+     * name. The method returns <code>null</code> if there is no Project
+     * bean with the specified name. 
+     * @param name the name of the bean to return.
+     * @return the instance of the bean or <code>null</code> if there no
+     * Project bean.
+     */
+    public Project getProject(String name) {
+        return (Project)getBean(name, Project.class);
+    }
+    
+}
+

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/DentalInsurance.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/DentalInsurance.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/DentalInsurance.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/DentalInsurance.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.pc.company;
+
+import java.math.BigDecimal;
+
+import org.apache.jdo.tck.util.DeepEquality;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+/**
+ * This class represents a dental insurance carrier selection for a
+ * particular <code>Employee</code>.
+ */
+public class DentalInsurance extends Insurance {
+
+    private BigDecimal lifetimeOrthoBenefit;
+
+    /** This is the JDO-required no-args constructor */
+    protected DentalInsurance() {}
+
+    /**
+     * Initialize a <code>DentalInsurance</code> instance.
+     * @param insid The insurance instance identifier.
+     * @param carrier The insurance carrier.
+     * @param lifetimeOrthoBenefit The lifetimeOrthoBenefit.
+     */
+    public DentalInsurance(long insid, String carrier, 
+                           BigDecimal lifetimeOrthoBenefit) {
+        super(insid, carrier);
+        this.lifetimeOrthoBenefit = lifetimeOrthoBenefit;
+    }
+
+    /**
+     * Initialize a <code>DentalInsurance</code> instance.
+     * @param insid The insurance instance identifier.
+     * @param carrier The insurance carrier.
+     * @param employee The employee associated with this insurance.
+     * @param lifetimeOrthoBenefit The lifetimeOrthoBenefit.
+     */
+    public DentalInsurance(long insid, String carrier, Employee employee,
+                           BigDecimal lifetimeOrthoBenefit) {
+        super(insid, carrier, employee);
+        this.lifetimeOrthoBenefit = lifetimeOrthoBenefit;
+    }
+
+    /**
+     * Get the insurance lifetimeOrthoBenefit.
+     * @return The insurance lifetimeOrthoBenefit.
+     */
+    public BigDecimal getLifetimeOrthoBenefit() {
+        return lifetimeOrthoBenefit;
+    }
+
+    /**
+     * Set the insurance lifetimeOrthoBenefit.
+     * @param lifetimeOrthoBenefit The insurance lifetimeOrthoBenefit.
+     */
+    public void setLifetimeOrthoBenefit(BigDecimal lifetimeOrthoBenefit) {
+        this.lifetimeOrthoBenefit = lifetimeOrthoBenefit;
+    }
+
+    /** 
+     * Returns <code>true</code> if all the fields of this instance are
+     * deep equal to the coresponding fields of the specified Person.
+     * @param other the object with which to compare.
+     * @param helper EqualityHelper to keep track of instances that have
+     * already been processed. 
+     * @return <code>true</code> if all the fields are deep equal;
+     * <code>false</code> otherwise.  
+     * @throws ClassCastException if the specified instances' type prevents
+     * it from being compared to this instance. 
+     */
+    public boolean deepCompareFields(DeepEquality other, 
+                                     EqualityHelper helper) {
+        DentalInsurance otherIns = (DentalInsurance)other;
+        return super.deepCompareFields(otherIns, helper) &&
+            helper.equals(lifetimeOrthoBenefit, 
+                          otherIns.lifetimeOrthoBenefit);
+    }
+}
+

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Department.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Department.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Department.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Department.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,346 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.pc.company;
+
+import java.io.Serializable;
+import java.io.ObjectInputStream;
+import java.io.IOException;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.jdo.tck.util.DeepEquality;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+/**
+ * This class represents a department within a company.
+ */
+public class Department
+    implements Serializable, Comparable, DeepEquality {
+
+    private long    deptid;
+    private String  name;
+    private Company company;
+    private Employee employeeOfTheMonth;
+    private transient Set employees = new HashSet(); // element type is Employee
+    private transient Set fundedEmps = new HashSet(); // element type is Employee
+
+    /** This is the JDO-required no-args constructor */
+    protected Department() {}
+
+    /**
+     * Initialize a <code>Department</code> instance.
+     * @param deptid The department id.
+     * @param name The name of the department.
+     */
+    public Department(long deptid, String name) {
+        this.deptid = deptid;
+        this.name = name;
+    }
+
+    /**
+     * Initialize a <code>Department</code> instance.
+     * @param deptid The department id.
+     * @param name The name of the department.
+     * @param company The company that the department is associated with. 
+     */
+    public Department(long deptid, String name, Company company) {
+        this.deptid = deptid;
+        this.name = name;
+        this.company = company;
+    }
+
+    /**
+     * Initialize a <code>Department</code> instance.
+     * @param deptid The department id.
+     * @param name The name of the department.
+     * @param company The company that the department is associated with.
+     * @param employeeOfTheMonth The employee of the month the
+     * department is associated with.
+     */
+    public Department(long deptid, String name, Company company, 
+                      Employee employeeOfTheMonth) {
+        this.deptid = deptid;
+        this.name = name;
+        this.company = company;
+        this.employeeOfTheMonth = employeeOfTheMonth;
+    }
+
+    /**
+     * Get the department id.
+     * @return The department id.
+     */
+    public long getDeptid() {
+        return deptid;
+    }
+
+    /**
+     * Get the name of the department.
+     * @return The name of the department.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Set the name of the department.
+     * @param name The name to set for the department.
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * Get the company associated with the department.
+     * @return The company.
+     */
+    public Company getCompany() {
+        return company;
+    }
+
+    /**
+     * Set the company for the department.
+     * @param company The company to associate with the department.
+     */
+    public void setCompany(Company company) {
+        this.company = company;
+    }
+
+    /**
+     * Get the employee of the month associated with the department.
+     * @return The employee of the month.
+     */
+    public Employee getEmployeeOfTheMonth() {
+        return employeeOfTheMonth;
+    }
+
+    /**
+     * Set the employee of the month for the department.
+     * @param employeeOfTheMonth The employee of the month to
+     * associate with the department. 
+     */
+    public void setEmployeeOfTheMonth(Employee employeeOfTheMonth) {
+        this.employeeOfTheMonth = employeeOfTheMonth;
+    }
+
+    /**
+     * Get the employees in the department as an unmodifiable set.
+     * @return The set of employees in the department, as an unmodifiable
+     * set. 
+     */
+    public Set getEmployees() {
+        return Collections.unmodifiableSet(employees);
+    }
+
+    /**
+     * Add an employee to the department.
+     * @param emp The employee to add to the department.
+     */
+    public void addEmployee(Employee emp) {
+        employees.add(emp);
+    }
+
+    /**
+     * Remove an employee from the department.
+     * @param emp The employee to remove from the department.
+     */
+    public void removeEmployee(Employee emp) {
+        employees.remove(emp);
+    }
+
+    /**
+     * Set the employees to be in this department.
+     * @param employees The set of employees for this department.
+     */
+    public void setEmployees(Set employees) {
+        // workaround: create a new HashSet, because fostore does not
+        // support LinkedHashSet
+        this.employees = (employees != null) ? new HashSet(employees) : null;
+    }
+
+    /**
+     * Get the funded employees in the department as an unmodifiable set.
+     * @return The set of funded employees in the department, as an
+     * unmodifiable set. 
+     */
+    public Set getFundedEmps() {
+        return Collections.unmodifiableSet(fundedEmps);
+    }
+
+    /**
+     * Add an employee to the collection of funded employees of this
+     * department. 
+     * @param emp The employee to add to the department.
+     */
+    public void addFundedEmp(Employee emp) {
+        fundedEmps.add(emp);
+    }
+
+    /**
+     * Remove an employee from collection of funded employees of this
+     * department. 
+     * @param emp The employee to remove from the department.
+     */
+    public void removeFundedEmp(Employee emp) {
+        fundedEmps.remove(emp);
+    }
+
+    /**
+     * Set the funded employees to be in this department.
+     * @param employees The set of funded employees for this department. 
+     */
+    public void setFundedEmps(Set employees) {
+        // workaround: create a new HashSet, because fostore does not
+        // support LinkedHashSet
+        this.fundedEmps = (fundedEmps != null) ? new HashSet(employees) : null;
+    }
+
+    /** Serialization support: initialize transient fields. */
+    private void readObject(ObjectInputStream in)
+        throws IOException, ClassNotFoundException {
+        in.defaultReadObject();
+        employees = new HashSet();
+        fundedEmps = new HashSet();
+    }
+
+    /** 
+     * Returns <code>true</code> if all the fields of this instance are
+     * deep equal to the coresponding fields of the specified Person.
+     * @param other the object with which to compare.
+     * @param helper EqualityHelper to keep track of instances that have
+     * already been processed. 
+     * @return <code>true</code> if all the fields are deep equal;
+     * <code>false</code> otherwise.  
+     * @throws ClassCastException if the specified instances' type prevents
+     * it from being compared to this instance. 
+     */
+    public boolean deepCompareFields(DeepEquality other, 
+                                     EqualityHelper helper) {
+        Department otherDept = (Department)other;
+        return (deptid == otherDept.deptid) && 
+            helper.equals(name, otherDept.name) &&
+            helper.deepEquals(company, otherDept.company) &&
+            helper.deepEquals(employeeOfTheMonth, otherDept.employeeOfTheMonth) &&
+            helper.deepEquals(employees, otherDept.employees) &&
+            helper.deepEquals(fundedEmps, otherDept.fundedEmps);
+    }
+    
+    /** 
+     * Compares this object with the specified object for order. Returns a
+     * negative integer, zero, or a positive integer as this object is less
+     * than, equal to, or greater than the specified object. 
+     * @param o The Object to be compared. 
+     * @return a negative integer, zero, or a positive integer as this 
+     * object is less than, equal to, or greater than the specified object. 
+     * @throws ClassCastException - if the specified object's type prevents
+     * it from being compared to this Object. 
+     */
+    public int compareTo(Object o) {
+        return compareTo((Department)o);
+    }
+
+    /** 
+     * Compares this object with the specified Department object for
+     * order. Returns a negative integer, zero, or a positive integer as
+     * this object is less than, equal to, or greater than the specified
+     * object.  
+     * @param other The Department object to be compared. 
+     * @return a negative integer, zero, or a positive integer as this
+     * object is less than, equal to, or greater than the specified
+     * Department object. 
+     */
+    public int compareTo(Department other) {
+        long otherId = other.deptid;
+        return (deptid < otherId ? -1 : (deptid == otherId ? 0 : 1));
+    }
+    
+    /** 
+     * Indicates whether some other object is "equal to" this one.
+     * @param obj the object with which to compare.
+     * @return <code>true</code> if this object is the same as the obj
+     * argument; <code>false</code> otherwise. 
+     */
+    public boolean equals(Object obj) {
+        if (obj instanceof Department) {
+            return compareTo((Department)obj) == 0;
+        }
+        return false;
+    }
+        
+    /**
+     * Returns a hash code value for the object. 
+     * @return a hash code value for this object.
+     */
+    public int hashCode() {
+        return (int)deptid;
+    }
+
+    /**
+     * The application identity class associated with the
+     * <code>Department</code> class. 
+     */
+    public static class Oid implements Serializable, Comparable {
+
+        /**
+         * This field represents the application identifier field 
+         * for the <code>Department</code> class. 
+         * It must match in name and type with the field in the
+         * <code>Department</code> class. 
+         */
+        public long deptid;
+
+        /**
+         * The required public, no-arg constructor.
+         */
+        public Oid() { }
+
+        /**
+         * A constructor to initialize the identifier field.
+         * @param deptid the deptid of the Department.
+         */
+        public Oid(long deptid) {
+            this.deptid = deptid;
+        }
+
+        /** */
+        public boolean equals(java.lang.Object obj) {
+            if( obj==null || !this.getClass().equals(obj.getClass()) )
+                return( false );
+            Oid o = (Oid) obj;
+            if( this.deptid != o.deptid ) return( false );
+            return( true );
+        }
+
+        /** */
+        public int hashCode() {
+            return( (int) deptid );
+        }
+
+        /** */
+        public int compareTo(Object obj) {
+            // may throw ClassCastException which the user must handle
+            Oid other = (Oid) obj;
+            if( deptid < other.deptid ) return -1;
+            if( deptid > other.deptid ) return 1;
+            return 0;
+        }
+
+    }
+
+}
+

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Employee.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Employee.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Employee.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Employee.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,414 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.pc.company;
+
+import java.io.ObjectInputStream;
+import java.io.IOException;
+
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.jdo.tck.util.DeepEquality;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+/**
+ * This class represents an employee.
+ */
+public abstract class Employee extends Person {
+
+    private Date             hiredate;
+    private double           weeklyhours;
+    private DentalInsurance  dentalInsurance;
+    private MedicalInsurance medicalInsurance;
+    private Department       department;
+    private Department       fundingDept;
+    private Employee         manager;
+    private Employee         mentor;
+    private Employee         protege;
+    private Employee         hradvisor;
+    private transient Set reviewedProjects = new HashSet(); // element-type is Project
+    private transient Set projects = new HashSet();         // element-type is Project
+    private transient Set team = new HashSet();             // element-type is Employee
+    private transient Set hradvisees = new HashSet();       // element-type is Employee
+
+    /** This is the JDO-required no-args constructor */
+    protected Employee() {}
+
+    /**
+     * Initialize an <code>Employee</code> instance.
+     * @param personid The identifier for the person.
+     * @param firstname The first name of the employee.
+     * @param lastname The last name of the employee.
+     * @param middlename The middle name of the employee.
+     * @param birthdate The birth date of the employee.
+     * @param address The address of the employee.
+     * @param hiredate The date that the employee was hired.
+     */
+    public Employee(long personid, String firstname, String lastname, 
+                    String middlename, Date birthdate, Address address,
+                    Date hiredate) {
+        super(personid, firstname, lastname, middlename, birthdate, address);
+        this.hiredate = hiredate;
+    }
+
+    /**
+     * Get the date that the employee was hired.
+     * @return The date the employee was hired.
+     */
+    public Date getHiredate() {
+        return hiredate;
+    }
+
+    /**
+     * Set the date that the employee was hired.
+     * @param hiredate The date the employee was hired.
+     */
+    public void setHiredate(Date hiredate) {
+        this.hiredate = hiredate;
+    }
+
+    /**
+     * Get the weekly hours of the employee.
+     * @return The number of hours per week that the employee works.
+     */
+    public double getWeeklyhours() {
+        return weeklyhours;
+    }
+
+    /**
+     * Set the number of hours per week that the employee works.
+     * @param weeklyhours The number of hours per week that the employee
+     * works. 
+     */
+    public void setWeeklyhours(double weeklyhours) {
+        this.weeklyhours = weeklyhours;
+    }
+
+    /**
+     * Get the reviewed projects.
+     * @return The reviewed projects as an unmodifiable set.
+     */
+    public Set getReviewedProjects() {
+        return Collections.unmodifiableSet(reviewedProjects);
+    }
+
+    /**
+     * Add a reviewed project.
+     * @param project A reviewed project.
+     */
+    public void addReviewedProjects(Project project) {
+        reviewedProjects.add(project);
+    }
+
+    /**
+     * Remove a reviewed project.
+     * @param project A reviewed project.
+     */
+    public void removeReviewedProject(Project project) {
+        reviewedProjects.remove(project);
+    }
+
+    /**
+     * Set the reviewed projects for the employee.
+     * @param reviewedProjects The set of reviewed projects.
+     */
+    public void setReviewedProjects(Set reviewedProjects) {
+        // workaround: create a new HashSet, because fostore does not
+        // support LinkedHashSet
+        this.reviewedProjects = 
+            (reviewedProjects != null) ? new HashSet(reviewedProjects) : null;
+    }
+
+    /**
+     * Get the employee's projects.
+     * @return The employee's projects are returned as an unmodifiable
+     * set. 
+     */
+    public Set getProjects() {
+        return Collections.unmodifiableSet(projects);
+    }
+
+    /**
+     * Add a project for the employee.
+     * @param project The project.
+     */
+    public void addProject(Project project) {
+        projects.add(project);
+    }
+
+    /**
+     * Remove a project from an employee's set of projects.
+     * @param project The project.
+     */
+    public void removeProject(Project project) {
+        projects.remove(project);
+    }
+
+    /**
+     * Set the projects for the employee.
+     * @param projects The set of projects of the employee.
+     */
+    public void setProjects(Set projects) {
+        // workaround: create a new HashSet, because fostore does not
+        // support LinkedHashSet
+        this.projects = (projects != null) ? new HashSet(projects) : null;
+    }
+    
+    /**
+     * Get the dental insurance of the employee.
+     * @return The employee's dental insurance.
+     */
+    public DentalInsurance getDentalInsurance() {
+        return dentalInsurance;
+    }
+
+    /**
+     * Set the dental insurance object for the employee.
+     * @param dentalInsurance The dental insurance object to associate with
+     * the employee. 
+     */
+    public void setDentalInsurance(DentalInsurance dentalInsurance) {
+        this.dentalInsurance = dentalInsurance;
+    }
+    /**
+     * Get the medical insurance of the employee.
+     * @return The employee's medical insurance.
+     */
+    public MedicalInsurance getMedicalInsurance() {
+        return medicalInsurance;
+    }
+
+    /**
+     * Set the medical insurance object for the employee.
+     * @param medicalInsurance The medical insurance object to associate
+     * with the employee. 
+     */
+    public void setMedicalInsurance(MedicalInsurance medicalInsurance) {
+        this.medicalInsurance = medicalInsurance;
+    }
+
+    /**
+     * Get the employee's department.
+     * @return The department associated with the employee.
+     */
+    public Department getDepartment() {
+        return department;
+    }
+
+    /**
+     * Set the employee's department.
+     * @param department The department.
+     */
+    public void setDepartment(Department department) {
+        this.department = department;
+    }
+
+    /**
+     * Get the employee's funding department.
+     * @return The funding department associated with the employee.
+     */
+    public Department getFundingDept() {
+        return fundingDept;
+    }
+
+    /**
+     * Set the employee's funding department.
+     * @param department The funding department.
+     */
+    public void setFundingDept(Department department) {
+        this.fundingDept = department;
+    }
+
+    /**
+     * Get the employee's manager.
+     * @return The employee's manager.
+     */
+    public Employee getManager() {
+        return manager;
+    }
+
+    /**
+     * Set the employee's manager.
+     * @param manager The employee's manager.
+     */
+    public void setManager(Employee manager) {
+        this.manager = manager;
+    }
+
+    /**
+     * Get the employee's team.
+     * @return The set of <code>Employee</code>s on this employee's team,
+     * returned as an unmodifiable set. 
+     */
+    public Set getTeam() {
+        return Collections.unmodifiableSet(team);
+    }
+
+    /**
+     * Add an <code>Employee</code> to this employee's team.
+     * This method sets both sides of the relationship, modifying
+     * this employees team to include parameter emp and modifying
+     * emp to set its manager attribute to this object.
+     * @param emp The <code>Employee</code> to add to the team.
+     */
+    public void addToTeam(Employee emp) {
+        team.add(emp);
+        emp.manager = this;
+    }
+
+    /**
+     * Remove an <code>Employee</code> from this employee's team.
+     * This method will also set the <code>emp</code> manager to null.
+     * @param emp The <code>Employee</code> to remove from the team.
+     */
+    public void removeFromTeam(Employee emp) {
+        team.remove(emp);
+        emp.manager = null;
+    }
+
+    /**
+     * Set the employee's team.
+     * @param team The set of <code>Employee</code>s.
+     */
+    public void setTeam(Set team) {
+        // workaround: create a new HashSet, because fostore does not
+        // support LinkedHashSet
+        this.team = (team != null) ? new HashSet(team) : null;
+    }
+
+    /**
+     * Set the mentor for this employee and also set the inverse protege
+     * relationship. 
+     * @param mentor The mentor for this employee.
+     */
+    public void setMentor(Employee mentor) {
+        this.mentor = mentor;
+        mentor.protege = this;
+    }
+
+    /**
+     * Get the mentor for this employee.
+     * @return The mentor.
+     */
+    public Employee getMentor() {
+        return mentor;
+    }
+
+    /**
+     * Get the protege of this employee.
+     * @return The protege of this employee.
+     */
+    public Employee getProtege() {
+        return protege;
+    }
+
+    /**
+     * Get the HR advisor for the employee.
+     * @return The HR advisor.
+     */
+    public Employee getHradvisor() {
+        return hradvisor;
+    }
+
+    /**
+     * Get the HR advisees of this HR advisor.
+     * @return An unmodifiable <code>Set</code> containing the
+     * <code>Employee</code>s that are HR advisees of this employee.
+     */
+    public Set getHradvisees() {
+        return Collections.unmodifiableSet(hradvisees);
+    }
+
+    /**
+     * Add an <code>Employee</code> as an advisee of this HR advisor. 
+     * This method also sets the <code>emp</code> hradvisor to reference
+     * this object. In other words, both sides of the relationship are
+     * set. 
+     * @param emp The employee to add as an advisee.
+     */
+    public void addAdvisee(Employee emp) {
+        hradvisees.add(emp);
+        emp.hradvisor = this;
+    }
+
+    /**
+     * Remove an <code>Employee</code> as an advisee of this HR advisor.
+     * This method also sets the <code>emp</code> hradvisor to null.
+     * In other words, both sides of the relationship are set.
+     * @param emp The employee to add as an HR advisee.
+     */
+    public void removeAdvisee(Employee emp) {
+        hradvisees.remove(emp);
+        emp.hradvisor = null;
+    }
+
+    /**
+     * Set the HR advisees of this HR advisor.
+     * @param hradvisees The <code>Employee</code>s that are HR advisees of
+     * this employee. 
+     */
+    public void setHradvisees(Set hradvisees) {
+        // workaround: create a new HashSet, because fostore does not
+        // support LinkedHashSet
+        this.hradvisees = (hradvisees != null) ? new HashSet(hradvisees) : null;
+    }
+
+    /** Serialization support: initialize transient fields. */
+    private void readObject(ObjectInputStream in)
+        throws IOException, ClassNotFoundException {
+        in.defaultReadObject();
+        reviewedProjects = new HashSet();
+        projects = new HashSet();
+        team = new HashSet();
+        hradvisees = new HashSet();
+    }
+
+    /** 
+     * Returns <code>true</code> if all the fields of this instance are
+     * deep equal to the corresponding fields of the specified Employee.
+     * @param other the object with which to compare.
+     * @param helper EqualityHelper to keep track of instances that have
+     * already been processed. 
+     * @return <code>true</code> if all the fields are deep equal;
+     * <code>false</code> otherwise.  
+     * @throws ClassCastException if the specified instances' type prevents
+     * it from being compared to this instance. 
+     */
+    public boolean deepCompareFields(DeepEquality other, 
+                                     EqualityHelper helper) {
+        Employee otherEmp = (Employee)other;
+        return super.deepCompareFields(otherEmp, helper) &&
+            helper.equals(hiredate, otherEmp.hiredate) &&
+            helper.closeEnough(weeklyhours, otherEmp.weeklyhours) &&
+            helper.deepEquals(dentalInsurance, otherEmp.dentalInsurance) &&
+            helper.deepEquals(medicalInsurance, otherEmp.medicalInsurance) &&
+            helper.deepEquals(department, otherEmp.department) &&
+            helper.deepEquals(fundingDept, otherEmp.fundingDept) &&
+            helper.deepEquals(manager, otherEmp.manager) &&
+            helper.deepEquals(mentor, otherEmp.mentor) &&
+            helper.deepEquals(protege, otherEmp.protege) &&
+            helper.deepEquals(hradvisor, otherEmp.hradvisor) &&
+            helper.deepEquals(reviewedProjects, otherEmp.reviewedProjects) &&
+            helper.deepEquals(projects, otherEmp.projects) &&
+            helper.deepEquals(team, otherEmp.team) &&
+            helper.deepEquals(hradvisees, otherEmp.hradvisees);
+    }
+
+}
+

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/FullTimeEmployee.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/FullTimeEmployee.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/FullTimeEmployee.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/FullTimeEmployee.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.pc.company;
+
+import java.util.Date;
+
+import org.apache.jdo.tck.util.DeepEquality;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+/**
+ * This class represents a full-time employee.
+ */
+public class FullTimeEmployee extends Employee {
+
+    private double  salary;
+
+    /** This is the JDO-required no-args constructor */
+    protected FullTimeEmployee() {}
+
+    /**
+     * Initialize a full-time employee.
+     * @param personid The person identifier.
+     * @param first The person's first name.
+     * @param last The person's last name.
+     * @param middle The person's middle name.
+     * @param born The person's birthdate.
+     * @param addr The person's address.
+     * @param hired The date that the person was hired.
+     * @param sal The salary of the full-time employee.
+     */
+    public FullTimeEmployee(long personid, String first, String last,
+                            String middle, Date born, Address addr, 
+                            Date hired, double sal) {
+        super(personid, first, last, middle, born, addr, hired);
+        salary = sal;
+    }
+
+    /**
+     * Get the salary of the full time employee.
+     * @return The salary of the full time employee.
+     */
+    public double getSalary() {
+        return salary;
+    }
+    
+    /**
+     * Set the salary for the full-time employee.
+     * @param salary The salary to set for the full-time employee.
+     */
+    public void setSalary(double salary) {
+        this.salary = salary;
+    }
+    
+    /** */
+    public String toString() {
+        StringBuffer rc = new StringBuffer("FullTimeEmployee: ");
+        rc.append(super.toString());
+        rc.append(" $" + salary);
+        return rc.toString();
+    }
+
+    /** 
+     * Returns <code>true</code> if all the fields of this instance are
+     * deep equal to the coresponding fields of the specified
+     * FullTimeEmployee. 
+     * @param other the object with which to compare.
+     * @param helper EqualityHelper to keep track of instances that have
+     * already been processed. 
+     * @return <code>true</code> if all the fields are deep equal;
+     * <code>false</code> otherwise.  
+     * @throws ClassCastException if the specified instances' type prevents
+     * it from being compared to this instance. 
+     */
+    public boolean deepCompareFields(DeepEquality other, 
+                                     EqualityHelper helper) {
+        FullTimeEmployee otherEmp = (FullTimeEmployee)other;
+        return super.deepCompareFields(otherEmp, helper) &&
+            helper.closeEnough(salary, otherEmp.salary);
+    }
+    
+}

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Insurance.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Insurance.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Insurance.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/Insurance.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,230 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.pc.company;
+
+import java.io.Serializable;
+
+import org.apache.jdo.tck.util.DeepEquality;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+/**
+ * This class represents an insurance carrier selection for a particular
+ * <code>Employee</code>.
+ */
+public abstract class Insurance 
+    implements Serializable, Comparable, DeepEquality  {
+
+    private long     insid;
+    private String   carrier;
+    private Employee employee;
+
+    /** This is the JDO-required no-args constructor. */
+    protected Insurance() {}
+
+    /**
+     * Initialize an <code>Insurance</code> instance.
+     * @param insid The insurance instance identifier.
+     * @param carrier The insurance carrier.
+     */
+    protected Insurance(long insid, String carrier) {
+        this.insid = insid;
+        this.carrier = carrier;
+    }
+
+    /**
+     * Initialize an <code>Insurance</code> instance.
+     * @param insid The insurance instance identifier.
+     * @param carrier The insurance carrier.
+     * @param employee The employee associated with this insurance. 
+     */
+    protected Insurance(long insid, String carrier, Employee employee) {
+        this.insid = insid;
+        this.carrier = carrier;
+        this.employee = employee;
+    }
+
+    /**
+     * Get the insurance ID.
+     * @return the insurance ID.
+     */
+    public long getInsid() {
+        return insid;
+    }
+
+    /**
+     * Set the insurance ID.
+     * @param insid The insurance ID value.
+     */
+    public void setInsid(long insid) {
+        this.insid = insid;
+    }
+
+    /**
+     * Get the insurance carrier.
+     * @return The insurance carrier.
+     */
+    public String getCarrier() {
+        return carrier;
+    }
+
+    /**
+     * Set the insurance carrier.
+     * @param carrier The insurance carrier.
+     */
+    public void setCarrier(String carrier) {
+        this.carrier = carrier;
+    }
+    
+    /**
+     * Get the associated employee.
+     * @return The employee for this insurance.
+     */
+    public Employee getEmployee() {
+        return employee;
+    }
+
+    /**
+     * Set the associated employee.
+     * @param employee The associated employee.
+     */
+    public void setEmployee(Employee employee) {
+        this.employee = employee;
+    }
+
+    /** 
+     * Returns <code>true</code> if all the fields of this instance are
+     * deep equal to the coresponding fields of the specified Person.
+     * @param other the object with which to compare.
+     * @param helper EqualityHelper to keep track of instances that have
+     * already been processed. 
+     * @return <code>true</code> if all the fields are deep equal;
+     * <code>false</code> otherwise.  
+     * @throws ClassCastException if the specified instances' type prevents
+     * it from being compared to this instance. 
+     */
+    public boolean deepCompareFields(DeepEquality other, 
+                                     EqualityHelper helper) {
+        Insurance otherInd = (Insurance)other;
+        return (insid == otherInd.insid) && 
+            helper.equals(carrier, otherInd.carrier) && 
+            helper.deepEquals(employee, otherInd.employee);
+    }
+    
+    /** 
+     * Compares this object with the specified object for order. Returns a
+     * negative integer, zero, or a positive integer as this object is less
+     * than, equal to, or greater than the specified object. 
+     * @param o The Object to be compared. 
+     * @return a negative integer, zero, or a positive integer as this 
+     * object is less than, equal to, or greater than the specified object. 
+     * @throws ClassCastException - if the specified object's type prevents
+     * it from being compared to this Object. 
+     */
+    public int compareTo(Object o) {
+        return compareTo((Insurance)o);
+    }
+
+    /** 
+     * Compares this object with the specified Insurance object for
+     * order. Returns a negative integer, zero, or a positive integer as
+     * this object is less than, equal to, or greater than the specified
+     * object.  
+     * @param other The Insurance object to be compared. 
+     * @return a negative integer, zero, or a positive integer as this
+     * object is less than, equal to, or greater than the specified
+     * Insurance object. 
+     */
+    public int compareTo(Insurance other) {
+        long otherId = other.insid;
+        return (insid < otherId ? -1 : (insid == otherId ? 0 : 1));
+    }
+    
+    
+    /** 
+     * Indicates whether some other object is "equal to" this one.
+     * @param obj the object with which to compare.
+     * @return <code>true</code> if this object is the same as the obj
+     * argument; <code>false</code> otherwise. 
+     */
+    public boolean equals(Object obj) {
+        if (obj instanceof Insurance) {
+            return compareTo((Insurance)obj) == 0;
+        }
+        return false;
+    }
+        
+    /**
+     * Returns a hash code value for the object. 
+     * @return a hash code value for this object.
+     */
+    public int hashCode() {
+        return (int)insid;
+    }
+
+    /**
+     * This class is used to represent the application
+     * identifier for the <code>Insurance</code> class.
+     */
+    public static class Oid implements Serializable, Comparable 
+    {
+        /**
+         * This field represents the application identifier for the
+         * <code>Insurance</code> class. It must match the field in the
+         * <code>Insurance</code> class in both name and type. 
+         */
+        public long insid;
+        
+        /**
+         * The required public no-args constructor.
+         */
+        public Oid() { }
+
+        /**
+         * Initialize with an insurance identifier.
+         * @param insid the insurance ID.
+         */
+        public Oid(long insid) {
+            this.insid = insid;
+        }
+
+        /** */
+        public boolean equals(java.lang.Object obj) {
+            if( obj==null || !this.getClass().equals(obj.getClass()) )
+                return( false );
+            Oid o=(Oid) obj;
+            if( this.insid!=o.insid ) return( false );
+            return( true );
+        }
+
+        /** */
+        public int hashCode() {
+            return( (int) insid );
+        }
+
+        /** */
+        public int compareTo(Object obj) {
+            // may throw ClassCastException which the user must handle
+            Oid other = (Oid) obj;
+            if( insid < other.insid ) return -1;
+            if( insid > other.insid ) return 1;
+            return 0;
+        }
+
+    }
+
+}
+

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/MedicalInsurance.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/MedicalInsurance.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/MedicalInsurance.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/MedicalInsurance.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,115 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.pc.company;
+
+import java.io.Serializable;
+
+import org.apache.jdo.tck.util.DeepEquality;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+/**
+ * This class represents a dental insurance carrier selection for a
+ * particular <code>Employee</code>.
+ */
+public class MedicalInsurance extends Insurance {
+
+    private String planType; // possible values: "PPO", "EPO", "NPO" 
+
+    /** This is the JDO-required no-args constructor */
+    protected MedicalInsurance() {}
+
+    /**
+     * Initialize a <code>MedicalInsurance</code> instance.
+     * @param insid The insurance instance identifier.
+     * @param carrier The insurance carrier.
+     * @param planType The planType.
+     */
+    public MedicalInsurance(long insid, String carrier, 
+                            String planType)
+    {
+        super(insid, carrier);
+        this.planType = planType;
+    }
+
+    /**
+     * Initialize a <code>MedicalInsurance</code> instance.
+     * @param insid The insurance instance identifier.
+     * @param carrier The insurance carrier.
+     * @param employee The employee associated with this insurance.
+     * @param planType The planType.
+     */
+    public MedicalInsurance(long insid, String carrier, 
+                            Employee employee, String planType)
+    {
+        super(insid, carrier, employee);
+        this.planType = planType;
+    }
+
+    /**
+     * Get the insurance planType.
+     * @return The insurance planType.
+     */
+    public String getPlanType() {
+        return planType;
+    }
+
+    /**
+     * Set the insurance planType.
+     * @param planType The insurance planType.
+     */
+    public void setPlanType(String planType) {
+        this.planType = planType;
+    }
+
+    /**
+     * Indicates whether some other object is "deep equal to" this one.
+     * @param other the object with which to compare.
+     * @param helper EqualityHelper to keep track of instances that have
+     * already been processed. 
+     * @return <code>true</code> if this object is deep equal to the
+     * specified object; <code>false</code> otherwise. 
+     */
+    public boolean deepEquals(DeepEquality other, EqualityHelper helper) {
+        if (this == other)
+            return true;
+        if (!(other instanceof MedicalInsurance))
+            return false;
+        if (helper.isProcessed(this))
+            return true;
+        helper.markProcessed(this);
+        return deepCompareFields((MedicalInsurance)other, helper);
+    }
+    
+    /** 
+     * Returns <code>true</code> if all the fields of this instance are
+     * deep equal to the coresponding fields of the specified Person.
+     * @param other the object with which to compare.
+     * @param helper EqualityHelper to keep track of instances that have
+     * already been processed. 
+     * @return <code>true</code> if all the fields are deep equal;
+     * <code>false</code> otherwise.  
+     * @throws ClassCastException if the specified instances' type prevents
+     * it from being compared to this instance. 
+     */
+    public boolean deepCompareFields(DeepEquality other, 
+                                     EqualityHelper helper) {
+        MedicalInsurance otherIns = (MedicalInsurance)other;
+        return super.deepCompareFields(otherIns, helper) &&
+            helper.equals(planType, otherIns.planType);
+    }
+}
+

Added: incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/PartTimeEmployee.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/PartTimeEmployee.java?view=auto&rev=158179
==============================================================================
--- incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/PartTimeEmployee.java (added)
+++ incubator/jdo/trunk/tck11/test/java/org/apache/jdo/tck/pc/company/PartTimeEmployee.java Fri Mar 18 17:07:39 2005
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.pc.company;
+
+import java.util.Date;
+
+import org.apache.jdo.tck.util.DeepEquality;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+/**
+ * This class represents a part-time employee.
+ */
+public class PartTimeEmployee extends Employee {
+    private double wage;
+
+    /** This is the JDO-required no-args constructor. */
+    protected PartTimeEmployee() {}
+
+    /**
+     * Initialize a part-time employee.
+     * @param personid The identifier for the person.
+     * @param first The person's first name.
+     * @param last The person's last name.
+     * @param middle The person's middle name.
+     * @param born The person's birthdate.
+     * @param addr The person's address.
+     * @param hired The date the person was hired.
+     * @param wage The person's wage.
+     */
+    public PartTimeEmployee(long personid, String first, String last,
+                            String middle, Date born, Address addr, 
+                            Date hired, double wage ) {
+        super(personid, first, last, middle, born, addr, hired);
+        this.wage = wage;
+    }
+
+    /**
+     * Get the wage of the part-time employee.
+     * @return The wage of the part-time employee.
+     */
+    public double getWage() {
+        return wage;
+    }
+
+    /**
+     * Set the wage of the part-time employee.
+     * @param wage The wage of the part-time employee.
+     */
+    public void setWage(double wage) {
+        this.wage = wage;
+    }
+
+    /** */
+    public String toString() {
+        StringBuffer rc = new StringBuffer("PartTimeEmployee: ");
+        rc.append(super.toString());
+        rc.append(" $" + wage);
+        return rc.toString();
+    }
+
+    /** 
+     * Returns <code>true</code> if all the fields of this instance are
+     * deep equal to the coresponding fields of the specified
+     * PartTimeEmployee. 
+     * @param other the object with which to compare.
+     * @param helper EqualityHelper to keep track of instances that have
+     * already been processed. 
+     * @return <code>true</code> if all the fields are deep equal;
+     * <code>false</code> otherwise.  
+     * @throws ClassCastException if the specified instances' type prevents
+     * it from being compared to this instance. 
+     */
+    public boolean deepCompareFields(PartTimeEmployee other, 
+                                        EqualityHelper helper) {
+        PartTimeEmployee otherEmp = (PartTimeEmployee)other;
+        return super.deepCompareFields(otherEmp, helper) &&
+            helper.closeEnough(wage, otherEmp.wage);
+    }
+}



Mime
View raw message