Index: src/java/org/apache/jdo/tck/pc/company/CompanyFactoryAbstractImpl.java =================================================================== --- src/java/org/apache/jdo/tck/pc/company/CompanyFactoryAbstractImpl.java (revision 398031) +++ src/java/org/apache/jdo/tck/pc/company/CompanyFactoryAbstractImpl.java (working copy) @@ -16,6 +16,10 @@ package org.apache.jdo.tck.pc.company; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + import javax.jdo.PersistenceManager; import org.apache.commons.logging.Log; @@ -43,6 +47,16 @@ this.pm = pm; } + /** All instances created using one of the factory methods + */ + protected Collection allInstances = new ArrayList(); + + /** Get all instances created with this factory + */ + public List getAllInstances() { + return new ArrayList(allInstances); + } + abstract IAddress newAddress(); abstract ICompany newCompany(); abstract IDentalInsurance newDentalInsurance(); @@ -66,6 +80,7 @@ public ICompany newCompany(long companyid, String name, java.util.Date founded) { ICompany result = newCompany(); + allInstances.add(result); if (debug) logger.debug("newCompany returned" + result); result.setCompanyid(companyid); result.setName(name); @@ -75,6 +90,7 @@ public ICompany newCompany(long companyid, String name, java.util.Date founded, IAddress addr) { ICompany result = newCompany(); + allInstances.add(result); if (debug) logger.debug("newCompany returned" + result); result.setCompanyid(companyid); result.setName(name); @@ -85,6 +101,7 @@ public IDentalInsurance newDentalInsurance(long insid, String carrier, java.math.BigDecimal lifetimeOrthoBenefit) { IDentalInsurance result = newDentalInsurance(); + allInstances.add(result); if (debug) logger.debug("newDentalInsurance returned" + result); result.setInsid(insid); result.setCarrier(carrier); @@ -94,6 +111,7 @@ public IDentalInsurance newDentalInsurance(long insid, String carrier, IEmployee employee, java.math.BigDecimal lifetimeOrthoBenefit) { IDentalInsurance result = newDentalInsurance(); + allInstances.add(result); if (debug) logger.debug("newDentalInsurance returned" + result); result.setInsid(insid); result.setCarrier(carrier); @@ -104,6 +122,7 @@ public IDepartment newDepartment(long deptid, String name) { IDepartment result = newDepartment(); + allInstances.add(result); if (debug) logger.debug("newDepartment returned" + result); result.setDeptid(deptid); result.setName(name); @@ -112,6 +131,7 @@ public IDepartment newDepartment(long deptid, String name, ICompany company) { IDepartment result = newDepartment(); + allInstances.add(result); if (debug) logger.debug("newDepartment returned" + result); result.setDeptid(deptid); result.setName(name); @@ -121,6 +141,7 @@ public IDepartment newDepartment(long deptid, String name, ICompany company, IEmployee employeeOfTheMonth) { IDepartment result = newDepartment(); + allInstances.add(result); if (debug) logger.debug("newDepartment returned" + result); result.setDeptid(deptid); result.setName(name); @@ -131,6 +152,7 @@ public IFullTimeEmployee newFullTimeEmployee(long personid, String first, String last, String middle, java.util.Date born, java.util.Date hired, double sal) { IFullTimeEmployee result = newFullTimeEmployee(); + allInstances.add(result); if (debug) logger.debug("newFullTimeEmployee returned" + result); result.setPersonid(personid); result.setFirstname(first); @@ -144,6 +166,7 @@ public IFullTimeEmployee newFullTimeEmployee(long personid, String first, String last, String middle, java.util.Date born, IAddress addr, java.util.Date hired, double sal) { IFullTimeEmployee result = newFullTimeEmployee(); + allInstances.add(result); if (debug) logger.debug("newFullTimeEmployee returned" + result); result.setPersonid(personid); result.setFirstname(first); @@ -158,6 +181,7 @@ public IMedicalInsurance newMedicalInsurance(long insid, String carrier, String planType) { IMedicalInsurance result = newMedicalInsurance(); + allInstances.add(result); if (debug) logger.debug("newMedicalInsurance returned" + result); result.setInsid(insid); result.setCarrier(carrier); @@ -167,6 +191,7 @@ public IMedicalInsurance newMedicalInsurance(long insid, String carrier, IEmployee employee, String planType) { IMedicalInsurance result = newMedicalInsurance(); + allInstances.add(result); if (debug) logger.debug("newMedicalInsurance returned" + result); result.setInsid(insid); result.setCarrier(carrier); @@ -177,6 +202,7 @@ public IPartTimeEmployee newPartTimeEmployee(long personid, String first, String last, String middle, java.util.Date born, java.util.Date hired, double wage) { IPartTimeEmployee result = newPartTimeEmployee(); + allInstances.add(result); if (debug) logger.debug("newPartTimeEmployee returned" + result); result.setPersonid(personid); result.setFirstname(first); @@ -190,6 +216,7 @@ public IPartTimeEmployee newPartTimeEmployee(long personid, String first, String last, String middle, java.util.Date born, IAddress addr, java.util.Date hired, double wage) { IPartTimeEmployee result = newPartTimeEmployee(); + allInstances.add(result); if (debug) logger.debug("newPartTimeEmployee returned" + result); result.setPersonid(personid); result.setFirstname(first); @@ -204,6 +231,7 @@ public IProject newProject(long projid, String name, java.math.BigDecimal budget) { IProject result = newProject(); + allInstances.add(result); if (debug) logger.debug("newProject returned" + result); result.setProjid(projid); result.setName(name); Index: src/java/org/apache/jdo/tck/pc/company/CompanyFactoryConcreteClass.java =================================================================== --- src/java/org/apache/jdo/tck/pc/company/CompanyFactoryConcreteClass.java (revision 398031) +++ src/java/org/apache/jdo/tck/pc/company/CompanyFactoryConcreteClass.java (working copy) @@ -17,8 +17,11 @@ package org.apache.jdo.tck.pc.company; import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Collection; import java.util.Date; +import java.util.List; import javax.jdo.PersistenceManager; @@ -28,10 +31,19 @@ */ public class CompanyFactoryConcreteClass implements CompanyFactory { + /** All instances created using one of the factory methods + */ + protected Collection allInstances = new ArrayList(); + + /** Get all instances created with this factory + */ + public List getAllInstances() { + return new ArrayList(allInstances); + } + /** */ public static final Class[] tearDownClasses = new Class[] { DentalInsurance.class, MedicalInsurance.class, - Person.class, Employee.class, PartTimeEmployee.class, FullTimeEmployee.class, Project.class, Department.class, Company.class }; @@ -44,100 +56,133 @@ public ICompany newCompany(long companyid, String name, Date founded) { - return new Company(companyid, name, founded); + ICompany result = new Company(companyid, name, founded); + allInstances.add(result); + return result; } public ICompany newCompany(long companyid, String name, Date founded, IAddress addr) { - return new Company(companyid, name, founded, addr); + ICompany result = new Company(companyid, name, founded, addr); + allInstances.add(result); + return result; } public IAddress newAddress(long addrid, String street, String city, String state, String zipcode, String country) { - return new Address(addrid, street, city, state, zipcode, country); + IAddress result = new Address(addrid, street, city, state, zipcode, country); + return result; } public IDentalInsurance newDentalInsurance(long insid, String carrier, BigDecimal lifetimeOrthoBenefit) { - return new DentalInsurance(insid, carrier, lifetimeOrthoBenefit); + IDentalInsurance result = new DentalInsurance(insid, carrier, lifetimeOrthoBenefit); + allInstances.add(result); + return result; } public IDentalInsurance newDentalInsurance(long insid, String carrier, IEmployee employee, BigDecimal lifetimeOrthoBenefit) { - return new DentalInsurance(insid, carrier, lifetimeOrthoBenefit); + IDentalInsurance result = new DentalInsurance(insid, carrier, lifetimeOrthoBenefit); + allInstances.add(result); + return result; } public IDepartment newDepartment(long deptid, String name) { - return new Department(deptid, name); + IDepartment result = new Department(deptid, name); + allInstances.add(result); + return result; } public IDepartment newDepartment(long deptid, String name, ICompany company) { - return new Department(deptid, name, company); + IDepartment result = new Department(deptid, name, company); + allInstances.add(result); + return result; } public IDepartment newDepartment(long deptid, String name, ICompany company, IEmployee employeeOfTheMonth) { - return new Department(deptid, name, company, employeeOfTheMonth); + IDepartment result = new Department(deptid, name, company, employeeOfTheMonth); + allInstances.add(result); + return result; } public IFullTimeEmployee newFullTimeEmployee(long personid, String first, String last, String middle, Date born, Date hired, double sal) { - return new FullTimeEmployee(personid, first, last, middle, + IFullTimeEmployee result = new FullTimeEmployee(personid, first, last, middle, born, hired, sal); + allInstances.add(result); + return result; } public IFullTimeEmployee newFullTimeEmployee(long personid, String first, String last, String middle, Date born, IAddress addr, Date hired, double sal) { - return new FullTimeEmployee(personid, first, last, middle, + IFullTimeEmployee result = new FullTimeEmployee(personid, first, last, middle, born, addr, hired, sal); + allInstances.add(result); + return result; } public IMedicalInsurance newMedicalInsurance(long insid, String carrier, String planType) { - return new MedicalInsurance(insid, carrier, planType); + IMedicalInsurance result = new MedicalInsurance(insid, carrier, planType); + allInstances.add(result); + return result; } public IMedicalInsurance newMedicalInsurance(long insid, String carrier, IEmployee employee, String planType) { - return new MedicalInsurance(insid, carrier, planType); + IMedicalInsurance result = new MedicalInsurance(insid, carrier, planType); + allInstances.add(result); + return result; } public IPartTimeEmployee newPartTimeEmployee(long personid, String first, String last, String middle, Date born, Date hired, double wage ) { - return new PartTimeEmployee(personid, first, last, middle, + IPartTimeEmployee result = new PartTimeEmployee(personid, first, last, middle, born, hired, wage); + allInstances.add(result); + return result; } public IPartTimeEmployee newPartTimeEmployee(long personid, String first, String last, String middle, Date born, IAddress addr, Date hired, double wage) { - return new PartTimeEmployee(personid, first, last, middle, + IPartTimeEmployee result = new PartTimeEmployee(personid, first, last, middle, born, addr, hired, wage); + allInstances.add(result); + return result; } public IPerson newPerson(long personid, String firstname, String lastname, String middlename, Date birthdate) { - return new Person(personid, firstname, lastname, middlename, + IPerson result = new Person(personid, firstname, lastname, middlename, birthdate); + allInstances.add(result); + return result; } public IPerson newPerson(long personid, String firstname, String lastname, String middlename, Date birthdate, IAddress address) { - return new Person(personid, firstname, lastname, middlename, + IPerson result = new Person(personid, firstname, lastname, middlename, birthdate, address); + allInstances.add(result); + return result; } public IProject newProject(long projid, String name, BigDecimal budget) { - return new Project(projid, name, budget); + IProject result = new Project(projid, name, budget); + allInstances.add(result); + return result; } public Class[] getTearDownClasses() { Index: src/java/org/apache/jdo/tck/pc/company/CompanyFactoryPMInterface.java =================================================================== --- src/java/org/apache/jdo/tck/pc/company/CompanyFactoryPMInterface.java (revision 398031) +++ src/java/org/apache/jdo/tck/pc/company/CompanyFactoryPMInterface.java (working copy) @@ -30,7 +30,6 @@ /** */ public static final Class[] tearDownClasses = new Class[] { IDentalInsurance.class, IMedicalInsurance.class, - IPerson.class, IEmployee.class, IPartTimeEmployee.class, IFullTimeEmployee.class, IProject.class, IDepartment.class, ICompany.class }; Index: src/java/org/apache/jdo/tck/pc/company/CompanyFactoryPMClass.java =================================================================== --- src/java/org/apache/jdo/tck/pc/company/CompanyFactoryPMClass.java (revision 398031) +++ src/java/org/apache/jdo/tck/pc/company/CompanyFactoryPMClass.java (working copy) @@ -29,8 +29,7 @@ /** */ public static final Class[] tearDownClasses = new Class[] { - DentalInsurance.class, IMedicalInsurance.class, - Person.class, Employee.class, + DentalInsurance.class, MedicalInsurance.class, PartTimeEmployee.class, FullTimeEmployee.class, Project.class, Department.class, Company.class }; Index: src/java/org/apache/jdo/tck/pc/company/CompanyFactory.java =================================================================== --- src/java/org/apache/jdo/tck/pc/company/CompanyFactory.java (revision 398031) +++ src/java/org/apache/jdo/tck/pc/company/CompanyFactory.java (working copy) @@ -23,7 +23,9 @@ import java.math.BigDecimal; +import java.util.Collection; import java.util.Date; +import java.util.List; /** * This interface is implemented by a factory class that can create @@ -64,4 +66,5 @@ Date born, IAddress addr, Date hired, double wage); IProject newProject(long projid, String name, BigDecimal budget); Class[] getTearDownClasses(); + List getAllInstances(); } Index: src/java/org/apache/jdo/tck/mapping/CompletenessTest.java =================================================================== --- src/java/org/apache/jdo/tck/mapping/CompletenessTest.java (revision 398031) +++ src/java/org/apache/jdo/tck/mapping/CompletenessTest.java (working copy) @@ -75,10 +75,10 @@ CompanyFactoryRegistry.registerFactory(); // get new obj graph to compare persistent graph with reader = new CompanyModelReader(inputFilename); - addTearDownClass(reader.getTearDownClassesFromFactory()); getPM(); CompanyFactoryRegistry.registerFactory(pm); CompanyModelReader reader = new CompanyModelReader(inputFilename); + addTearDownClass(reader.getTearDownClassesFromFactory()); // persist test data pm.currentTransaction().begin(); List rootList = reader.getRootList();