Author: clr
Date: Sun Aug 28 15:28:19 2005
New Revision: 263928
URL: http://svn.apache.org/viewcvs?rev=263928&view=rev
Log:
JDO-109 Added new methods to EqualityHelper to allow tracking where differences are found in an object graph; Changed company model to use properties in interface definitions.
Added:
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IAddress.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/ICompany.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IDentalInsurance.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IDepartment.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IEmployee.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IFullTimeEmployee.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IInsurance.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IMedicalInsurance.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IPartTimeEmployee.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IPerson.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IProject.java
Modified:
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/mapping/CompletenessTest.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/embedded/SecondClassObjectsTrackTheirChanges.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Address.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Company.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/DentalInsurance.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Department.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Employee.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/FullTimeEmployee.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Insurance.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/MedicalInsurance.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/PartTimeEmployee.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Person.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Project.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/icompany/IAddress.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/transactions/SetNontransactionalRead.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/transactions/WhenNontransactionalReadIsFalse.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/util/DeepEquality.java
incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/util/EqualityHelper.java
incubator/jdo/trunk/tck20/test/testdata/org/apache/jdo/tck/pc/company/company1-1Relationships.xml
incubator/jdo/trunk/tck20/test/testdata/org/apache/jdo/tck/pc/company/company1-MRelationships.xml
incubator/jdo/trunk/tck20/test/testdata/org/apache/jdo/tck/pc/company/companyAllRelationships.xml
incubator/jdo/trunk/tck20/test/testdata/org/apache/jdo/tck/pc/company/companyEmbedded.xml
incubator/jdo/trunk/tck20/test/testdata/org/apache/jdo/tck/pc/company/companyForQueryTests.xml
incubator/jdo/trunk/tck20/test/testdata/org/apache/jdo/tck/pc/company/companyM-MRelationships.xml
incubator/jdo/trunk/tck20/test/testdata/org/apache/jdo/tck/pc/company/companyNoRelationships.xml
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/mapping/CompletenessTest.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/mapping/CompletenessTest.java?rev=263928&r1=263927&r2=263928&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/mapping/CompletenessTest.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/mapping/CompletenessTest.java Sun Aug 28 15:28:19 2005
@@ -93,13 +93,18 @@
for (int i = 0; i < size; i++) {
DeepEquality expected = (DeepEquality) rootList.get(i);
Object oid = rootOids.get(i);
- DeepEquality persisted = (DeepEquality) pm.getObjectById(oid);
- if (!expected.deepCompareFields(persisted, new EqualityHelper())) {
+ Object persisted = pm.getObjectById(oid);
+ EqualityHelper equalityHelper = new EqualityHelper();
+ if (!expected.deepCompareFields(persisted, equalityHelper)) {
if (msg.length() > 0) {
msg.append("\n");
}
- msg.append(" Persistent instance " + persisted +
- " not equal to expected instance " + expected);
+ msg.append("Expected this instance:\n " +
+ expected + "\n" +
+ "Got persistent instance:" + "\n " +
+ persisted + "\n" +
+ "Detailed list of differences follows...\n");
+ msg.append(equalityHelper.getUnequalBuffer());
}
}
pm.currentTransaction().commit();
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/embedded/SecondClassObjectsTrackTheirChanges.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/embedded/SecondClassObjectsTrackTheirChanges.java?rev=263928&r1=263927&r2=263928&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/embedded/SecondClassObjectsTrackTheirChanges.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/models/embedded/SecondClassObjectsTrackTheirChanges.java Sun Aug 28 15:28:19 2005
@@ -73,7 +73,7 @@
pm.currentTransaction().begin();
makePersistentCleanInstance(comp);
- Address addr = comp.getAddress();
+ Address addr = (Address)comp.getAddress();
addr.setStreet("200 Orange Street"); // comp or addr should transition to persistent-dirty
int currComp = currentState(comp);
int currAddr = currentState(addr);
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Address.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Address.java?rev=263928&r1=263927&r2=263928&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Address.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Address.java Sun Aug 28 15:28:19 2005
@@ -17,6 +17,7 @@
package org.apache.jdo.tck.pc.company;
import java.io.Serializable;
+import java.util.Comparator;
import org.apache.jdo.tck.util.DeepEquality;
import org.apache.jdo.tck.util.EqualityHelper;
@@ -25,7 +26,7 @@
* This class represents a postal address.
*/
public class Address
- implements Serializable, Comparable, DeepEquality {
+ implements IAddress, Serializable, Comparable, Comparator, DeepEquality {
private long addrid;
private String street;
@@ -65,6 +66,14 @@
return addrid;
}
+ /**
+ * Set the id associated with this object.
+ * @param id the id.
+ */
+ public void setAddrid(long id) {
+ throw new IllegalStateException("Id is already set.");
+ }
+
/**
* Get the street component of the address.
* @return The street component of the address.
@@ -85,7 +94,7 @@
* Get the city.
* @return The city component of the address.
*/
- public String getCity(String city) {
+ public String getCity() {
return city;
}
@@ -179,18 +188,27 @@
* @throws ClassCastException if the specified instances' type prevents
* it from being compared to this instance.
*/
- public boolean deepCompareFields(DeepEquality other,
+ public boolean deepCompareFields(Object 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);
+ IAddress otherAddress = (IAddress)other;
+ String where = "Address<" + addrid + ">";
+ return
+ helper.equals(addrid, otherAddress.getAddrid(), where + ".addrid") &
+ helper.equals(street, otherAddress.getStreet(), where + ".street") &
+ helper.equals(city, otherAddress.getCity(), where + ".city") &
+ helper.equals(state, otherAddress.getState(), where + ".state") &
+ helper.equals(zipcode, otherAddress.getZipcode(), where + ".zipcode") &
+ helper.equals(country, otherAddress.getCountry(), where + ".country");
}
/**
+ * Compare two instances. This is a method in Comparator.
+ */
+ public int compare(Object o1, Object o2) {
+ return ((Address)o1).compareTo(o2);
+ }
+
+ /**
* 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.
@@ -201,7 +219,7 @@
* it from being compared to this Object.
*/
public int compareTo(Object o) {
- return compareTo((Address)o);
+ return compareTo((IAddress)o);
}
/**
@@ -214,8 +232,8 @@
* object is less than, equal to, or greater than the specified Address
* object.
*/
- public int compareTo(Address other) {
- long otherId = other.addrid;
+ public int compareTo(IAddress other) {
+ long otherId = other.getAddrid();
return (addrid < otherId ? -1 : (addrid == otherId ? 0 : 1));
}
@@ -226,12 +244,12 @@
* argument; <code>false</code> otherwise.
*/
public boolean equals(Object obj) {
- if (obj instanceof Address) {
- return compareTo((Address)obj) == 0;
+ if (obj instanceof IAddress) {
+ return compareTo((IAddress)obj) == 0;
}
return false;
}
-
+
/**
* Returns a hash code value for the object.
* @return a hash code value for this object.
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Company.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Company.java?rev=263928&r1=263927&r2=263928&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Company.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Company.java Sun Aug 28 15:28:19 2005
@@ -23,6 +23,7 @@
import java.text.SimpleDateFormat;
import java.util.Collections;
+import java.util.Comparator;
import java.util.Set;
import java.util.HashSet;
import java.util.Date;
@@ -34,7 +35,7 @@
* This class represents information about a company.
*/
public class Company
- implements Serializable, Comparable, DeepEquality {
+ implements ICompany, Serializable, Comparable, Comparator, DeepEquality {
private long companyid;
private String name;
@@ -67,9 +68,9 @@
* @param founded The date the company was founded.
* @param addr The company's address.
*/
- public Company(long companyid, String name, Date founded, Address addr) {
+ public Company(long companyid, String name, Date founded, IAddress addr) {
this(companyid, name, founded);
- this.address = addr;
+ this.address = (Address)addr;
}
/**
@@ -81,12 +82,11 @@
}
/**
- * Set the company id. This is only for the interface and should
- * not normally be used.
- * @param companyid the id
+ * Set the id associated with this object.
+ * @param id the id.
*/
- public void setCompanyid(long companyid) {
- this.companyid = companyid;
+ public void setCompanyid(long id) {
+ throw new IllegalStateException("Id is already set.");
}
/**
@@ -125,7 +125,7 @@
* Get the address of the company.
* @return The primary address of the company.
*/
- public Address getAddress() {
+ public IAddress getAddress() {
return address;
}
@@ -133,8 +133,8 @@
* Set the primary address for the company.
* @param address The address to set for the company.
*/
- public void setAddress(Address address) {
- this.address = address;
+ public void setAddress(IAddress address) {
+ this.address = (Address)address;
}
/**
@@ -213,17 +213,26 @@
* @throws ClassCastException if the specified instances' type prevents
* it from being compared to this instance.
*/
- public boolean deepCompareFields(DeepEquality other,
+ public boolean deepCompareFields(Object other,
EqualityHelper helper) {
- Company otherCompany = (Company)other;
- return (companyid == otherCompany.getCompanyid()) &&
- helper.equals(name, otherCompany.getName()) &&
- helper.equals(founded, otherCompany.getFounded()) &&
- helper.deepEquals(address, otherCompany.getAddress()) &&
- helper.deepEquals(departments, otherCompany.getDepartments());
+ ICompany otherCompany = (ICompany)other;
+ String where = "Company<" + companyid + ">";
+ return
+ helper.equals(companyid, otherCompany.getCompanyid(), where + ".companyid") &
+ helper.equals(name, otherCompany.getName(), where + ".name") &
+ helper.equals(founded, otherCompany.getFounded(), where + ".founded") &
+ helper.deepEquals(address, otherCompany.getAddress(), where + ".address") &
+ helper.deepEquals(departments, otherCompany.getDepartments(), where + ".departments");
}
/**
+ * Compare two instances. This is a method in Comparator.
+ */
+ public int compare(Object o1, Object o2) {
+ return ((Company)o1).compareTo(o2);
+ }
+
+ /**
* 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.
@@ -234,7 +243,7 @@
* it from being compared to this Object.
*/
public int compareTo(Object o) {
- return compareTo((Company)o);
+ return compareTo((ICompany)o);
}
/**
@@ -247,7 +256,7 @@
* object is less than, equal to, or greater than the specified Company
* object.
*/
- public int compareTo(Company other) {
+ public int compareTo(ICompany other) {
long otherId = other.getCompanyid();
return (companyid < otherId ? -1 : (companyid == otherId ? 0 : 1));
}
@@ -259,8 +268,8 @@
* argument; <code>false</code> otherwise.
*/
public boolean equals(Object obj) {
- if (obj instanceof Company) {
- return compareTo((Company)obj) == 0;
+ if (obj instanceof ICompany) {
+ return compareTo((ICompany)obj) == 0;
}
return false;
}
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/DentalInsurance.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/DentalInsurance.java?rev=263928&r1=263927&r2=263928&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/DentalInsurance.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/DentalInsurance.java Sun Aug 28 15:28:19 2005
@@ -25,7 +25,7 @@
* This class represents a dental insurance carrier selection for a
* particular <code>Employee</code>.
*/
-public class DentalInsurance extends Insurance {
+public class DentalInsurance extends Insurance implements IDentalInsurance {
private BigDecimal lifetimeOrthoBenefit;
@@ -33,7 +33,7 @@
protected DentalInsurance() {}
/**
- * Initialize a <code>DentalInsurance</code> instance.
+ * Construct a <code>DentalInsurance</code> instance.
* @param insid The insurance instance identifier.
* @param carrier The insurance carrier.
* @param lifetimeOrthoBenefit The lifetimeOrthoBenefit.
@@ -45,7 +45,7 @@
}
/**
- * Initialize a <code>DentalInsurance</code> instance.
+ * Construct a <code>DentalInsurance</code> instance.
* @param insid The insurance instance identifier.
* @param carrier The insurance carrier.
* @param employee The employee associated with this insurance.
@@ -96,7 +96,7 @@
/**
* Returns <code>true</code> if all the fields of this instance are
- * deep equal to the coresponding fields of the specified Person.
+ * deep equal to the coresponding fields of the other Object.
* @param other the object with which to compare.
* @param helper EqualityHelper to keep track of instances that have
* already been processed.
@@ -105,12 +105,14 @@
* @throws ClassCastException if the specified instances' type prevents
* it from being compared to this instance.
*/
- public boolean deepCompareFields(DeepEquality other,
+ public boolean deepCompareFields(Object other,
EqualityHelper helper) {
- DentalInsurance otherIns = (DentalInsurance)other;
- return super.deepCompareFields(otherIns, helper) &&
+ IDentalInsurance otherIns = (IDentalInsurance)other;
+ String where = "DentalInsurance<" + getInsid() + ">";
+ return super.deepCompareFields(otherIns, helper) &
helper.equals(lifetimeOrthoBenefit,
- otherIns.lifetimeOrthoBenefit);
+ otherIns.getLifetimeOrthoBenefit(), where + ".lifetimeOrthoBenefit");
}
+
}
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Department.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Department.java?rev=263928&r1=263927&r2=263928&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Department.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Department.java Sun Aug 28 15:28:19 2005
@@ -21,6 +21,7 @@
import java.io.IOException;
import java.util.Collections;
+import java.util.Comparator;
import java.util.HashSet;
import java.util.Set;
@@ -31,7 +32,7 @@
* This class represents a department within a company.
*/
public class Department
- implements Serializable, Comparable, DeepEquality {
+ implements IDepartment, Serializable, Comparable, Comparator, DeepEquality {
private long deptid;
private String name;
@@ -44,7 +45,7 @@
protected Department() {}
/**
- * Initialize a <code>Department</code> instance.
+ * Construct a <code>Department</code> instance.
* @param deptid The department id.
* @param name The name of the department.
*/
@@ -54,31 +55,39 @@
}
/**
- * Initialize a <code>Department</code> instance.
+ * Construct 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) {
+ public Department(long deptid, String name, ICompany company) {
this.deptid = deptid;
this.name = name;
- this.company = company;
+ this.company = (Company)company;
}
/**
- * Initialize a <code>Department</code> instance.
+ * Construct 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) {
+ public Department(long deptid, String name, ICompany company,
+ IEmployee employeeOfTheMonth) {
this.deptid = deptid;
this.name = name;
- this.company = company;
- this.employeeOfTheMonth = employeeOfTheMonth;
+ this.company = (Company)company;
+ this.employeeOfTheMonth = (Employee)employeeOfTheMonth;
+ }
+
+ /**
+ * Set the id associated with this object.
+ * @param id the id.
+ */
+ public void setDeptid(long id) {
+ throw new IllegalStateException("Id is already set.");
}
/**
@@ -109,7 +118,7 @@
* Get the company associated with the department.
* @return The company.
*/
- public Company getCompany() {
+ public ICompany getCompany() {
return company;
}
@@ -117,15 +126,15 @@
* Set the company for the department.
* @param company The company to associate with the department.
*/
- public void setCompany(Company company) {
- this.company = company;
+ public void setCompany(ICompany company) {
+ this.company = (Company)company;
}
/**
* Get the employee of the month associated with the department.
* @return The employee of the month.
*/
- public Employee getEmployeeOfTheMonth() {
+ public IEmployee getEmployeeOfTheMonth() {
return employeeOfTheMonth;
}
@@ -134,8 +143,8 @@
* @param employeeOfTheMonth The employee of the month to
* associate with the department.
*/
- public void setEmployeeOfTheMonth(Employee employeeOfTheMonth) {
- this.employeeOfTheMonth = employeeOfTheMonth;
+ public void setEmployeeOfTheMonth(IEmployee employeeOfTheMonth) {
+ this.employeeOfTheMonth = (Employee)employeeOfTheMonth;
}
/**
@@ -220,7 +229,7 @@
/**
* Returns <code>true</code> if all the fields of this instance are
- * deep equal to the coresponding fields of the specified Person.
+ * deep equal to the coresponding fields of the other Department.
* @param other the object with which to compare.
* @param helper EqualityHelper to keep track of instances that have
* already been processed.
@@ -229,15 +238,17 @@
* @throws ClassCastException if the specified instances' type prevents
* it from being compared to this instance.
*/
- public boolean deepCompareFields(DeepEquality other,
+ public boolean deepCompareFields(Object 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);
+ String where = "Department<" + deptid + ">";
+ return
+ helper.equals(deptid, otherDept.getDeptid(), where + ".deptid") &
+ helper.equals(name, otherDept.getName(), where + ".name") &
+ helper.deepEquals(company, otherDept.getCompany(), where + ".company") &
+ helper.deepEquals(employeeOfTheMonth, otherDept.getEmployeeOfTheMonth(), where + ".employeeOfTheMonth") &
+ helper.deepEquals(employees, otherDept.getEmployees(), where + ".employees") &
+ helper.deepEquals(fundedEmps, otherDept.getFundedEmps(), where + ".fundedEmps");
}
/**
@@ -270,7 +281,14 @@
* it from being compared to this Object.
*/
public int compareTo(Object o) {
- return compareTo((Department)o);
+ return compareTo((IDepartment)o);
+ }
+
+ /**
+ * Compare two instances. This is a method in Comparator.
+ */
+ public int compare(Object o1, Object o2) {
+ return ((Department)o1).compareTo(o2);
}
/**
@@ -283,8 +301,8 @@
* object is less than, equal to, or greater than the specified
* Department object.
*/
- public int compareTo(Department other) {
- long otherId = other.deptid;
+ public int compareTo(IDepartment other) {
+ long otherId = other.getDeptid();
return (deptid < otherId ? -1 : (deptid == otherId ? 0 : 1));
}
@@ -295,8 +313,8 @@
* argument; <code>false</code> otherwise.
*/
public boolean equals(Object obj) {
- if (obj instanceof Department) {
- return compareTo((Department)obj) == 0;
+ if (obj instanceof IDepartment) {
+ return compareTo((IDepartment)obj) == 0;
}
return false;
}
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Employee.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Employee.java?rev=263928&r1=263927&r2=263928&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Employee.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Employee.java Sun Aug 28 15:28:19 2005
@@ -30,7 +30,7 @@
/**
* This class represents an employee.
*/
-public abstract class Employee extends Person {
+public abstract class Employee extends Person implements IEmployee {
private Date hiredate;
private double weeklyhours;
@@ -51,7 +51,7 @@
protected Employee() {}
/**
- * Initialize an <code>Employee</code> instance.
+ * Construct 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.
@@ -67,7 +67,7 @@
}
/**
- * Initialize an <code>Employee</code> instance.
+ * Construct 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.
@@ -77,7 +77,7 @@
* @param hiredate The date that the employee was hired.
*/
public Employee(long personid, String firstname, String lastname,
- String middlename, Date birthdate, Address address,
+ String middlename, Date birthdate, IAddress address,
Date hiredate) {
super(personid, firstname, lastname, middlename, birthdate, address);
this.hiredate = hiredate;
@@ -190,7 +190,7 @@
* Get the dental insurance of the employee.
* @return The employee's dental insurance.
*/
- public DentalInsurance getDentalInsurance() {
+ public IDentalInsurance getDentalInsurance() {
return dentalInsurance;
}
@@ -199,14 +199,14 @@
* @param dentalInsurance The dental insurance object to associate with
* the employee.
*/
- public void setDentalInsurance(DentalInsurance dentalInsurance) {
- this.dentalInsurance = dentalInsurance;
+ public void setDentalInsurance(IDentalInsurance dentalInsurance) {
+ this.dentalInsurance = (DentalInsurance)dentalInsurance;
}
/**
* Get the medical insurance of the employee.
* @return The employee's medical insurance.
*/
- public MedicalInsurance getMedicalInsurance() {
+ public IMedicalInsurance getMedicalInsurance() {
return medicalInsurance;
}
@@ -215,15 +215,15 @@
* @param medicalInsurance The medical insurance object to associate
* with the employee.
*/
- public void setMedicalInsurance(MedicalInsurance medicalInsurance) {
- this.medicalInsurance = medicalInsurance;
+ public void setMedicalInsurance(IMedicalInsurance medicalInsurance) {
+ this.medicalInsurance = (MedicalInsurance)medicalInsurance;
}
/**
* Get the employee's department.
* @return The department associated with the employee.
*/
- public Department getDepartment() {
+ public IDepartment getDepartment() {
return department;
}
@@ -231,15 +231,15 @@
* Set the employee's department.
* @param department The department.
*/
- public void setDepartment(Department department) {
- this.department = department;
+ public void setDepartment(IDepartment department) {
+ this.department = (Department)department;
}
/**
* Get the employee's funding department.
* @return The funding department associated with the employee.
*/
- public Department getFundingDept() {
+ public IDepartment getFundingDept() {
return fundingDept;
}
@@ -247,15 +247,15 @@
* Set the employee's funding department.
* @param department The funding department.
*/
- public void setFundingDept(Department department) {
- this.fundingDept = department;
+ public void setFundingDept(IDepartment department) {
+ this.fundingDept = (Department)department;
}
/**
* Get the employee's manager.
* @return The employee's manager.
*/
- public Employee getManager() {
+ public IEmployee getManager() {
return manager;
}
@@ -263,8 +263,8 @@
* Set the employee's manager.
* @param manager The employee's manager.
*/
- public void setManager(Employee manager) {
- this.manager = manager;
+ public void setManager(IEmployee manager) {
+ this.manager = (Employee)manager;
}
/**
@@ -309,59 +309,50 @@
}
/**
- * Set the mentor for this employee and also set the inverse protege
- * relationship.
+ * Set the mentor for this employee.
* @param mentor The mentor for this employee.
*/
- public void setMentor(Employee mentor) {
- this.mentor = mentor;
- mentor.protege = this;
+ public void setMentor(IEmployee mentor) {
+ this.mentor = (Employee)mentor;
}
/**
* Get the mentor for this employee.
* @return The mentor.
*/
- public Employee getMentor() {
+ public IEmployee getMentor() {
return mentor;
}
- /* This setter is required by the SpringFramework
- used with the CompletenessTest */
/**
- * Set the protege for this employee and also set the inverse mentor
- * relationship.
+ * Set the protege for this employee.
* @param protege The protege for this employee.
*/
- public void setProtege(Employee protege) {
- this.protege = protege;
- protege.mentor = this;
+ public void setProtege(IEmployee protege) {
+ this.protege = (Employee)protege;
}
/**
* Get the protege of this employee.
* @return The protege of this employee.
*/
- public Employee getProtege() {
+ public IEmployee getProtege() {
return protege;
}
- /* This setter is required by the SpringFramework
- used with the CompletenessTest */
/**
* Set the HR advisor for this employee.
* @param hradvisor The hradvisor for this employee.
*/
- public void setHradvisor(Employee hradvisor) {
- this.hradvisor = hradvisor;
+ public void setHradvisor(IEmployee hradvisor) {
+ this.hradvisor = (Employee)hradvisor;
}
-
/**
* Get the HR advisor for the employee.
* @return The HR advisor.
*/
- public Employee getHradvisor() {
+ public IEmployee getHradvisor() {
return hradvisor;
}
@@ -449,24 +440,25 @@
* @throws ClassCastException if the specified instances' type prevents
* it from being compared to this instance.
*/
- public boolean deepCompareFields(DeepEquality other,
+ public boolean deepCompareFields(Object 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);
+ IEmployee otherEmp = (IEmployee)other;
+ String where = "Employee<" + getPersonid() + ">";
+ return super.deepCompareFields(otherEmp, helper) &
+ helper.equals(hiredate, otherEmp.getHiredate(), where + ".hiredate") &
+ helper.closeEnough(weeklyhours, otherEmp.getWeeklyhours(), where + ".weeklyhours") &
+ helper.deepEquals(dentalInsurance, otherEmp.getDentalInsurance(), where + ".dentalInsurance") &
+ helper.deepEquals(medicalInsurance, otherEmp.getMedicalInsurance(), where + ".medicalInsurance") &
+ helper.deepEquals(department, otherEmp.getDepartment(), where + ".department") &
+ helper.deepEquals(fundingDept, otherEmp.getFundingDept(), where + ".fundingDept") &
+ helper.deepEquals(manager, otherEmp.getManager(), where + ".manager") &
+ helper.deepEquals(mentor, otherEmp.getMentor(), where + ".mentor") &
+ helper.deepEquals(protege, otherEmp.getProtege(), where + ".protege") &
+ helper.deepEquals(hradvisor, otherEmp.getHradvisor(), where + ".hradvisor") &
+ helper.deepEquals(reviewedProjects, otherEmp.getReviewedProjects(), where + ".reviewedProjects") &
+ helper.deepEquals(projects, otherEmp.getProjects(), where + ".projects") &
+ helper.deepEquals(team, otherEmp.getTeam(), where + ".team") &
+ helper.deepEquals(hradvisees, otherEmp.getHradvisees(), where + ".hradvisees");
}
}
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/FullTimeEmployee.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/FullTimeEmployee.java?rev=263928&r1=263927&r2=263928&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/FullTimeEmployee.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/FullTimeEmployee.java Sun Aug 28 15:28:19 2005
@@ -24,7 +24,7 @@
/**
* This class represents a full-time employee.
*/
-public class FullTimeEmployee extends Employee {
+public class FullTimeEmployee extends Employee implements IFullTimeEmployee {
private double salary;
@@ -32,7 +32,7 @@
protected FullTimeEmployee() {}
/**
- * Initialize a full-time employee.
+ * Construct a full-time employee.
* @param personid The person identifier.
* @param first The person's first name.
* @param last The person's last name.
@@ -49,7 +49,7 @@
}
/**
- * Initialize a full-time employee.
+ * Construct a full-time employee.
* @param personid The person identifier.
* @param first The person's first name.
* @param last The person's last name.
@@ -60,7 +60,7 @@
* @param sal The salary of the full-time employee.
*/
public FullTimeEmployee(long personid, String first, String last,
- String middle, Date born, Address addr,
+ String middle, Date born, IAddress addr,
Date hired, double sal) {
super(personid, first, last, middle, born, addr, hired);
salary = sal;
@@ -113,11 +113,12 @@
* @throws ClassCastException if the specified instances' type prevents
* it from being compared to this instance.
*/
- public boolean deepCompareFields(DeepEquality other,
+ public boolean deepCompareFields(Object other,
EqualityHelper helper) {
FullTimeEmployee otherEmp = (FullTimeEmployee)other;
- return super.deepCompareFields(otherEmp, helper) &&
- helper.closeEnough(salary, otherEmp.salary);
+ String where = "FullTimeEmployee<" + getPersonid() + ">";
+ return super.deepCompareFields(otherEmp, helper) &
+ helper.closeEnough(salary, otherEmp.getSalary(), where + ".salary");
}
}
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IAddress.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IAddress.java?rev=263928&view=auto
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IAddress.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IAddress.java Sun Aug 28 15:28:19 2005
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+/**
+ * This interface represents the persistent state of Address.
+ * Javadoc was deliberately omitted because it would distract from
+ * the purpose of the interface.
+ */
+public interface IAddress {
+
+ long getAddrid();
+ String getStreet();
+ String getCity();
+ String getState();
+ String getZipcode();
+ String getCountry();
+
+ void setAddrid(long addrid);
+ void setStreet(String street);
+ void setCity(String city);
+ void setState(String state);
+ void setZipcode(String zipcode);
+ void setCountry(String country);
+}
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/ICompany.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/ICompany.java?rev=263928&view=auto
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/ICompany.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/ICompany.java Sun Aug 28 15:28:19 2005
@@ -0,0 +1,40 @@
+/*
+ * 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 java.util.Set;
+
+/**
+ * This interface represents the persistent state of Company.
+ * Javadoc was deliberately omitted because it would distract from
+ * the purpose of the interface.
+ */
+public interface ICompany {
+
+ IAddress getAddress();
+ long getCompanyid();
+ Set getDepartments();
+ Date getFounded();
+ String getName();
+
+ void setAddress(IAddress a);
+ void setCompanyid(long id);
+ void setDepartments(Set depts);
+ void setFounded(Date date);
+ void setName(String string);
+}
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IDentalInsurance.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IDentalInsurance.java?rev=263928&view=auto
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IDentalInsurance.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IDentalInsurance.java Sun Aug 28 15:28:19 2005
@@ -0,0 +1,30 @@
+/*
+ * 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;
+
+/**
+ * This interface represents the persistent state of DentalInsurance.
+ * Javadoc was deliberately omitted because it would distract from
+ * the purpose of the interface.
+ */
+public interface IDentalInsurance extends IInsurance {
+
+ BigDecimal getLifetimeOrthoBenefit();
+ void setLifetimeOrthoBenefit(BigDecimal lifetimeOrthoBenefit);
+}
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IDepartment.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IDepartment.java?rev=263928&view=auto
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IDepartment.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IDepartment.java Sun Aug 28 15:28:19 2005
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.pc.company;
+
+import java.util.Set;
+
+/**
+ * This interface represents the persistent state of Department.
+ * Javadoc was deliberately omitted because it would distract from
+ * the purpose of the interface.
+ */
+public interface IDepartment {
+
+ long getDeptid();
+ String getName();
+ ICompany getCompany();
+ IEmployee getEmployeeOfTheMonth();
+ Set getEmployees();
+ Set getFundedEmps();
+
+ void setDeptid(long deptid);
+ void setName(String name);
+ void setCompany(ICompany company);
+ void setEmployeeOfTheMonth(IEmployee employeeOfTheMonth);
+ void setEmployees(Set employees);
+ void setFundedEmps(Set employees);
+
+}
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IEmployee.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IEmployee.java?rev=263928&view=auto
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IEmployee.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IEmployee.java Sun Aug 28 15:28:19 2005
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.pc.company;
+
+import java.util.Date;
+import java.util.Set;
+
+/**
+ * This interface represents the persistent state of Employee.
+ * Javadoc was deliberately omitted because it would distract from
+ * the purpose of the interface.
+ */
+public interface IEmployee extends IPerson {
+
+ Date getHiredate();
+ double getWeeklyhours();
+ Set getReviewedProjects();
+ Set getProjects();
+ IDentalInsurance getDentalInsurance();
+ IMedicalInsurance getMedicalInsurance();
+ IDepartment getDepartment();
+ IDepartment getFundingDept();
+ IEmployee getManager();
+ Set getTeam();
+ IEmployee getMentor();
+ IEmployee getProtege();
+ IEmployee getHradvisor();
+ Set getHradvisees();
+
+ void setHiredate(Date hiredate);
+ void setWeeklyhours(double weeklyhours);
+ void setReviewedProjects(Set reviewedProjects);
+ void setProjects(Set projects);
+ void setDentalInsurance(IDentalInsurance dentalInsurance);
+ void setMedicalInsurance(IMedicalInsurance medicalInsurance);
+ void setDepartment(IDepartment department);
+ void setFundingDept(IDepartment department);
+ void setManager(IEmployee manager);
+ void setTeam(Set team);
+ void setMentor(IEmployee mentor);
+ void setProtege(IEmployee protege);
+ void setHradvisor(IEmployee hradvisor);
+ void setHradvisees(Set hradvisees);
+
+}
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IFullTimeEmployee.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IFullTimeEmployee.java?rev=263928&view=auto
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IFullTimeEmployee.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IFullTimeEmployee.java Sun Aug 28 15:28:19 2005
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+/**
+ * This interface represents the persistent state of FullTimeEmployee.
+ * Javadoc was deliberately omitted because it would distract from
+ * the purpose of the interface.
+ */
+public interface IFullTimeEmployee extends IEmployee {
+
+ double getSalary();
+ void setSalary(double salary);
+}
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IInsurance.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IInsurance.java?rev=263928&view=auto
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IInsurance.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IInsurance.java Sun Aug 28 15:28:19 2005
@@ -0,0 +1,33 @@
+/*
+ * 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;
+
+/**
+ * This interface represents the persistent state of Insurance.
+ * Javadoc was deliberately omitted because it would distract from
+ * the purpose of the interface.
+ */
+public interface IInsurance {
+
+ long getInsid();
+ String getCarrier();
+ IEmployee getEmployee();
+
+ void setInsid(long insid);
+ void setCarrier(String carrier);
+ void setEmployee(IEmployee employee);
+}
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IMedicalInsurance.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IMedicalInsurance.java?rev=263928&view=auto
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IMedicalInsurance.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IMedicalInsurance.java Sun Aug 28 15:28:19 2005
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+/**
+ * This interface represents the persistent state of MedicalInsurance.
+ * Javadoc was deliberately omitted because it would distract from
+ * the purpose of the interface.
+ */
+public interface IMedicalInsurance extends IInsurance{
+
+ String getPlanType();
+ void setPlanType(String planType);
+}
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IPartTimeEmployee.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IPartTimeEmployee.java?rev=263928&view=auto
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IPartTimeEmployee.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IPartTimeEmployee.java Sun Aug 28 15:28:19 2005
@@ -0,0 +1,28 @@
+/*
+ * 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;
+
+/**
+ * This interface represents the persistent state of PartTimeEmployee.
+ * Javadoc was deliberately omitted because it would distract from
+ * the purpose of the interface.
+ */
+public interface IPartTimeEmployee extends IEmployee {
+
+ double getWage();
+ void setWage(double wage);
+}
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IPerson.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IPerson.java?rev=263928&view=auto
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IPerson.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IPerson.java Sun Aug 28 15:28:19 2005
@@ -0,0 +1,45 @@
+/*
+ * 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 java.util.Map;
+
+/**
+ * This interface represents the persistent state of Person.
+ * Javadoc was deliberately omitted because it would distract from
+ * the purpose of the interface.
+ */
+public interface IPerson {
+
+ long getPersonid();
+ String getLastname();
+ String getFirstname();
+ String getMiddlename();
+ IAddress getAddress();
+ Date getBirthdate();
+ Map getPhoneNumbers();
+
+ void setPersonid(long personid);
+ void setLastname(String lastname);
+ void setFirstname(String firstname);
+ void setMiddlename(String middlename);
+ void setAddress(IAddress address);
+ void setBirthdate(Date birthdate);
+ void setPhoneNumbers(Map phoneNumbers);
+
+}
Added: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IProject.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IProject.java?rev=263928&view=auto
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IProject.java (added)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/IProject.java Sun Aug 28 15:28:19 2005
@@ -0,0 +1,40 @@
+/*
+ * 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 java.util.Set;
+
+/**
+ * This interface represents the persistent state of Project.
+ * Javadoc was deliberately omitted because it would distract from
+ * the purpose of the interface.
+ */
+public interface IProject {
+
+ long getProjid();
+ String getName();
+ BigDecimal getBudget();
+ Set getReviewers();
+ Set getMembers();
+
+ void setProjid(long projid);
+ void setName(String name);
+ void setBudget(BigDecimal budget);
+ void setReviewers(Set reviewers);
+ void setMembers(Set employees);
+
+}
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Insurance.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Insurance.java?rev=263928&r1=263927&r2=263928&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Insurance.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Insurance.java Sun Aug 28 15:28:19 2005
@@ -18,6 +18,8 @@
import java.io.Serializable;
+import java.util.Comparator;
+
import org.apache.jdo.tck.util.DeepEquality;
import org.apache.jdo.tck.util.EqualityHelper;
@@ -26,7 +28,7 @@
* <code>Employee</code>.
*/
public abstract class Insurance
- implements Serializable, Comparable, DeepEquality {
+ implements IInsurance, Serializable, Comparable, Comparator, DeepEquality {
private long insid;
private String carrier;
@@ -36,7 +38,7 @@
protected Insurance() {}
/**
- * Initialize an <code>Insurance</code> instance.
+ * Construct an <code>Insurance</code> instance.
* @param insid The insurance instance identifier.
* @param carrier The insurance carrier.
*/
@@ -46,15 +48,15 @@
}
/**
- * Initialize an <code>Insurance</code> instance.
+ * Construct 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) {
+ protected Insurance(long insid, String carrier, IEmployee employee) {
this.insid = insid;
this.carrier = carrier;
- this.employee = employee;
+ this.employee = (Employee)employee;
}
/**
@@ -70,7 +72,7 @@
* @param insid The insurance ID value.
*/
public void setInsid(long insid) {
- this.insid = insid;
+ throw new IllegalStateException("Id is already set.");
}
/**
@@ -93,7 +95,7 @@
* Get the associated employee.
* @return The employee for this insurance.
*/
- public Employee getEmployee() {
+ public IEmployee getEmployee() {
return employee;
}
@@ -101,8 +103,8 @@
* Set the associated employee.
* @param employee The associated employee.
*/
- public void setEmployee(Employee employee) {
- this.employee = employee;
+ public void setEmployee(IEmployee employee) {
+ this.employee = (Employee)employee;
}
/**
@@ -126,7 +128,7 @@
/**
* Returns <code>true</code> if all the fields of this instance are
- * deep equal to the coresponding fields of the specified Person.
+ * deep equal to the coresponding fields of the other Object.
* @param other the object with which to compare.
* @param helper EqualityHelper to keep track of instances that have
* already been processed.
@@ -135,15 +137,24 @@
* @throws ClassCastException if the specified instances' type prevents
* it from being compared to this instance.
*/
- public boolean deepCompareFields(DeepEquality other,
+ public boolean deepCompareFields(Object other,
EqualityHelper helper) {
- Insurance otherInd = (Insurance)other;
- return (insid == otherInd.insid) &&
- helper.equals(carrier, otherInd.carrier) &&
- helper.deepEquals(employee, otherInd.employee);
+ IInsurance otherIns = (IInsurance)other;
+ String where = "Insurance<" + insid + ">";
+ return
+ helper.equals(insid, otherIns.getInsid(), where + ".insid") &
+ helper.equals(carrier, otherIns.getCarrier(), where + ".carrier") &
+ helper.deepEquals(employee, otherIns.getEmployee(), where + ".employee");
}
/**
+ * Compare two instances. This is a method in Comparator.
+ */
+ public int compare(Object o1, Object o2) {
+ return ((Insurance)o1).compareTo(o2);
+ }
+
+ /**
* 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.
@@ -154,7 +165,7 @@
* it from being compared to this Object.
*/
public int compareTo(Object o) {
- return compareTo((Insurance)o);
+ return compareTo((IInsurance)o);
}
/**
@@ -167,8 +178,8 @@
* object is less than, equal to, or greater than the specified
* Insurance object.
*/
- public int compareTo(Insurance other) {
- long otherId = other.insid;
+ public int compareTo(IInsurance other) {
+ long otherId = other.getInsid();
return (insid < otherId ? -1 : (insid == otherId ? 0 : 1));
}
@@ -180,8 +191,8 @@
* argument; <code>false</code> otherwise.
*/
public boolean equals(Object obj) {
- if (obj instanceof Insurance) {
- return compareTo((Insurance)obj) == 0;
+ if (obj instanceof IInsurance) {
+ return compareTo((IInsurance)obj) == 0;
}
return false;
}
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/MedicalInsurance.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/MedicalInsurance.java?rev=263928&r1=263927&r2=263928&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/MedicalInsurance.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/MedicalInsurance.java Sun Aug 28 15:28:19 2005
@@ -25,7 +25,7 @@
* This class represents a dental insurance carrier selection for a
* particular <code>Employee</code>.
*/
-public class MedicalInsurance extends Insurance {
+public class MedicalInsurance extends Insurance implements IMedicalInsurance {
private String planType; // possible values: "PPO", "EPO", "NPO"
@@ -33,7 +33,7 @@
protected MedicalInsurance() {}
/**
- * Initialize a <code>MedicalInsurance</code> instance.
+ * Construct a <code>MedicalInsurance</code> instance.
* @param insid The insurance instance identifier.
* @param carrier The insurance carrier.
* @param planType The planType.
@@ -46,14 +46,14 @@
}
/**
- * Initialize a <code>MedicalInsurance</code> instance.
+ * Construct 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)
+ IEmployee employee, String planType)
{
super(insid, carrier, employee);
this.planType = planType;
@@ -96,28 +96,9 @@
return rc.toString();
}
- /**
- * 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.
+ * deep equal to the coresponding fields of the other Object.
* @param other the object with which to compare.
* @param helper EqualityHelper to keep track of instances that have
* already been processed.
@@ -126,11 +107,12 @@
* @throws ClassCastException if the specified instances' type prevents
* it from being compared to this instance.
*/
- public boolean deepCompareFields(DeepEquality other,
+ public boolean deepCompareFields(Object other,
EqualityHelper helper) {
- MedicalInsurance otherIns = (MedicalInsurance)other;
- return super.deepCompareFields(otherIns, helper) &&
- helper.equals(planType, otherIns.planType);
+ IMedicalInsurance otherIns = (IMedicalInsurance)other;
+ String where = "MedicalInsurance<" + getInsid() + ">";
+ return super.deepCompareFields(otherIns, helper) &
+ helper.equals(planType, otherIns.getPlanType(), where + ".planType");
}
}
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/PartTimeEmployee.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/PartTimeEmployee.java?rev=263928&r1=263927&r2=263928&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/PartTimeEmployee.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/PartTimeEmployee.java Sun Aug 28 15:28:19 2005
@@ -24,14 +24,14 @@
/**
* This class represents a part-time employee.
*/
-public class PartTimeEmployee extends Employee {
+public class PartTimeEmployee extends Employee implements IPartTimeEmployee {
private double wage;
/** This is the JDO-required no-args constructor. */
protected PartTimeEmployee() {}
/**
- * Initialize a part-time employee.
+ * Construct 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.
@@ -48,7 +48,7 @@
}
/**
- * Initialize a part-time employee.
+ * Construct 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.
@@ -59,7 +59,7 @@
* @param wage The person's wage.
*/
public PartTimeEmployee(long personid, String first, String last,
- String middle, Date born, Address addr,
+ String middle, Date born, IAddress addr,
Date hired, double wage ) {
super(personid, first, last, middle, born, addr, hired);
this.wage = wage;
@@ -112,10 +112,11 @@
* @throws ClassCastException if the specified instances' type prevents
* it from being compared to this instance.
*/
- public boolean deepCompareFields(PartTimeEmployee other,
+ public boolean deepCompareFields(Object other,
EqualityHelper helper) {
- PartTimeEmployee otherEmp = (PartTimeEmployee)other;
- return super.deepCompareFields(otherEmp, helper) &&
- helper.closeEnough(wage, otherEmp.wage);
+ IPartTimeEmployee otherEmp = (IPartTimeEmployee)other;
+ String where = "PartTimeEmployee<" + getPersonid() + ">";
+ return super.deepCompareFields(otherEmp, helper) &
+ helper.closeEnough(wage, otherEmp.getWage(), where + ".wage");
}
}
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Person.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Person.java?rev=263928&r1=263927&r2=263928&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Person.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Person.java Sun Aug 28 15:28:19 2005
@@ -22,6 +22,7 @@
import java.text.SimpleDateFormat;
import java.util.Collections;
+import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -33,7 +34,7 @@
* This class represents a person.
*/
public class Person
- implements Serializable, Comparable, DeepEquality {
+ implements IPerson, Serializable, Comparable, Comparator, DeepEquality {
private long personid;
private String firstname;
@@ -53,7 +54,7 @@
protected Person() {}
/**
- * Initialize a <code>Person</code> instance.
+ * Construct a <code>Person</code> instance.
* @param personid The person identifier.
* @param firstname The person's first name.
* @param lastname The person's last name.
@@ -70,7 +71,7 @@
}
/**
- * Initialize a <code>Person</code> instance.
+ * Construct a <code>Person</code> instance.
* @param personid The person identifier.
* @param firstname The person's first name.
* @param lastname The person's last name.
@@ -79,9 +80,17 @@
* @param address The person's address.
*/
public Person(long personid, String firstname, String lastname,
- String middlename, Date birthdate, Address address) {
+ String middlename, Date birthdate, IAddress address) {
this(personid, firstname, lastname, middlename, birthdate);
- this.address = address;
+ this.address = (Address)address;
+ }
+
+ /**
+ * Set the id associated with this object.
+ * @param id the id.
+ */
+ public void setPersonid(long id) {
+ throw new IllegalStateException("Id is already set.");
}
/**
@@ -152,7 +161,7 @@
* Get the address.
* @return The address.
*/
- public Address getAddress() {
+ public IAddress getAddress() {
return address;
}
@@ -160,8 +169,8 @@
* Set the address.
* @param address The address.
*/
- public void setAddress(Address address) {
- this.address = address;
+ public void setAddress(IAddress address) {
+ this.address = (Address)address;
}
/**
@@ -264,19 +273,28 @@
* @throws ClassCastException if the specified instances' type prevents
* it from being compared to this instance.
*/
- public boolean deepCompareFields(DeepEquality other,
+ public boolean deepCompareFields(Object other,
EqualityHelper helper) {
- Person otherPerson = (Person)other;
- return (personid == otherPerson.personid) &&
- helper.equals(firstname, otherPerson.firstname) &&
- helper.equals(lastname, otherPerson.lastname) &&
- helper.equals(middlename, otherPerson.middlename) &&
- helper.equals(birthdate, otherPerson.birthdate) &&
- helper.deepEquals(address, otherPerson.address) &&
- helper.deepEquals(phoneNumbers, otherPerson.phoneNumbers);
+ IPerson otherPerson = (IPerson)other;
+ String where = "Person<" + personid + ">";
+ return
+ helper.equals(personid, otherPerson.getPersonid(), where + ".personid") &
+ helper.equals(firstname, otherPerson.getFirstname(), where + ".firstname") &
+ helper.equals(lastname, otherPerson.getLastname(), where + ".lastname") &
+ helper.equals(middlename, otherPerson.getMiddlename(), where + ".middlename") &
+ helper.equals(birthdate, otherPerson.getBirthdate(), where + ".birthdate") &
+ helper.deepEquals(address, otherPerson.getAddress(), where + ".address") &
+ helper.deepEquals(phoneNumbers, otherPerson.getPhoneNumbers(), where + ".phoneNumbers");
}
- /**
+ /**
+ * Compare two instances. This is a method in Comparator.
+ */
+ public int compare(Object o1, Object o2) {
+ return ((Person)o1).compareTo(o2);
+ }
+
+ /**
* 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.
@@ -287,7 +305,7 @@
* it from being compared to this Object.
*/
public int compareTo(Object o) {
- return compareTo((Person)o);
+ return compareTo((IPerson)o);
}
/**
@@ -300,8 +318,8 @@
* object is less than, equal to, or greater than the specified Person
* object.
*/
- public int compareTo(Person other) {
- long otherId = other.personid;
+ public int compareTo(IPerson other) {
+ long otherId = other.getPersonid();
return (personid < otherId ? -1 : (personid == otherId ? 0 : 1));
}
@@ -313,8 +331,8 @@
* argument; <code>false</code> otherwise.
*/
public boolean equals(Object obj) {
- if (obj instanceof Person) {
- return compareTo((Person)obj) == 0;
+ if (obj instanceof IPerson) {
+ return compareTo((IPerson)obj) == 0;
}
return false;
}
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Project.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Project.java?rev=263928&r1=263927&r2=263928&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Project.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/company/Project.java Sun Aug 28 15:28:19 2005
@@ -21,6 +21,7 @@
import java.io.IOException;
import java.util.Collections;
+import java.util.Comparator;
import java.util.Set;
import java.util.HashSet;
import java.math.BigDecimal;
@@ -33,7 +34,7 @@
* employees working on it.
*/
public class Project
- implements Serializable, Comparable, DeepEquality {
+ implements IProject, Serializable, Comparable, Comparator, DeepEquality {
private long projid;
private String name;
@@ -57,6 +58,14 @@
}
/**
+ * Set the id associated with this object.
+ * @param id the id.
+ */
+ public void setProjid(long id) {
+ throw new IllegalStateException("Id is already set.");
+ }
+
+ /**
* Get the project ID.
* @return The project ID.
*/
@@ -204,17 +213,26 @@
* @throws ClassCastException if the specified instances' type prevents
* it from being compared to this instance.
*/
- public boolean deepCompareFields(DeepEquality other,
+ public boolean deepCompareFields(Object other,
EqualityHelper helper) {
- Project otherProject = (Project)other;
- return (projid == otherProject.projid) &&
- helper.equals(name, otherProject.name) &&
- helper.equals(budget, otherProject.budget) &&
- helper.deepEquals(reviewers, otherProject.reviewers) &&
- helper.deepEquals(members, otherProject.members);
+ IProject otherProject = (IProject)other;
+ String where = "Project<" + projid + ">";
+ return
+ helper.equals(projid, otherProject.getProjid(), where + ".projid") &
+ helper.equals(name, otherProject.getName(), where + ".name") &
+ helper.equals(budget, otherProject.getBudget(), where + ".budget") &
+ helper.deepEquals(reviewers, otherProject.getReviewers(), where + ".reviewers") &
+ helper.deepEquals(members, otherProject.getMembers(), where + ".members");
}
/**
+ * Compare two instances. This is a method in Comparator.
+ */
+ public int compare(Object o1, Object o2) {
+ return ((Project)o1).compareTo(o2);
+ }
+
+ /**
* 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.
@@ -225,7 +243,7 @@
* it from being compared to this Object.
*/
public int compareTo(Object o) {
- return compareTo((Project)o);
+ return compareTo((IProject)o);
}
/**
@@ -238,12 +256,11 @@
* object is less than, equal to, or greater than the specified Project
* object.
*/
- public int compareTo(Project other) {
- long otherId = other.projid;
+ public int compareTo(IProject other) {
+ long otherId = other.getProjid();
return (projid < otherId ? -1 : (projid == otherId ? 0 : 1));
}
-
-
+
/**
* Indicates whether some other object is "equal to" this one.
* @param obj the object with which to compare.
@@ -251,8 +268,8 @@
* argument; <code>false</code> otherwise.
*/
public boolean equals(Object obj) {
- if (obj instanceof Project) {
- return compareTo((Project)obj) == 0;
+ if (obj instanceof IProject) {
+ return compareTo((IProject)obj) == 0;
}
return false;
}
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/icompany/IAddress.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/icompany/IAddress.java?rev=263928&r1=263927&r2=263928&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/icompany/IAddress.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/pc/icompany/IAddress.java Sun Aug 28 15:28:19 2005
@@ -30,6 +30,7 @@
String getZipcode();
String getCountry();
+ void setAddrid(long addrid);
void setStreet(String street);
void setCity(String city);
void setState(String state);
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/transactions/SetNontransactionalRead.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/transactions/SetNontransactionalRead.java?rev=263928&r1=263927&r2=263928&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/transactions/SetNontransactionalRead.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/transactions/SetNontransactionalRead.java Sun Aug 28 15:28:19 2005
@@ -127,7 +127,7 @@
}
// navigate from department to company
- c = d.getCompany();
+ c = (Company)d.getCompany();
if (c == null) {
fail("Navigating from department to company outside of a transaction returns null.");
}
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/transactions/WhenNontransactionalReadIsFalse.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/transactions/WhenNontransactionalReadIsFalse.java?rev=263928&r1=263927&r2=263928&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/transactions/WhenNontransactionalReadIsFalse.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/transactions/WhenNontransactionalReadIsFalse.java Sun Aug 28 15:28:19 2005
@@ -122,7 +122,7 @@
}
try {
// navigate from department to company
- c = d.getCompany();
+ c = (Company)d.getCompany();
fail(ASSERTION_FAILED,
"Navigation permitted outside an active transaction when NontransactionalRead is false.");
} catch (JDOUserException juex) {
Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/util/DeepEquality.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/util/DeepEquality.java?rev=263928&r1=263927&r2=263928&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/util/DeepEquality.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/util/DeepEquality.java Sun Aug 28 15:28:19 2005
@@ -16,6 +16,8 @@
package org.apache.jdo.tck.util;
+import java.util.Comparator;
+
/**
* This <code>DeepEquality</code> interface defines a method indicating
* whether some other object is "deep equal to" this object.
@@ -54,7 +56,11 @@
/**
* Returns <code>true</code> if all the fields of this instance are
- * deep equal to the corresponding fields of the specified Employee.
+ * deep equal to the corresponding fields of the other Object. This
+ * means that all non-relationship fields are equal to the
+ * corresponging fields in the other Object, and all relationship
+ * fields are deep equal. Recursion is stopped in the equality helper
+ * method that compares objects.
* @param other the object with which to compare.
* @param helper EqualityHelper to keep track of instances that have
* already been processed.
@@ -63,5 +69,6 @@
* @throws ClassCastException if the specified instances' type prevents
* it from being compared to this instance.
*/
- public boolean deepCompareFields(DeepEquality other, EqualityHelper helper);
+ public boolean deepCompareFields(Object other, EqualityHelper helper);
+
}
|