You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jdo-commits@db.apache.org by mc...@apache.org on 2006/09/08 22:37:09 UTC
svn commit: r441641 [1/2] - in /db/jdo/trunk/tck20/src:
java/org/apache/jdo/tck/mapping/
java/org/apache/jdo/tck/pc/companyMapWithoutJoin/
jdo/applicationidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/
jdo/datastoreidentity/org/apache/jdo/tck/pc/...
Author: mcaisse
Date: Fri Sep 8 13:37:08 2006
New Revision: 441641
URL: http://svn.apache.org/viewvc?view=rev&rev=441641
Log:
JDO-193 Test for Map without join table
Added:
db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/mapping/CompletenessTestMap.java
db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/
db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Company.java
db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactory.java
db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactoryAbstractImpl.java
db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactoryConcreteClass.java
db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactoryPMClass.java
db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactoryPMInterface.java
db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactoryRegistry.java
db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java
db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Department.java
db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Employee.java
db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/FullTimeEmployee.java
db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/ICompany.java
db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IDepartment.java
db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IEmployee.java
db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IFullTimeEmployee.java
db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IPartTimeEmployee.java
db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IPerson.java
db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/PartTimeEmployee.java
db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Person.java
db/jdo/trunk/tck20/src/jdo/applicationidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/
db/jdo/trunk/tck20/src/jdo/applicationidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/package.jdo
db/jdo/trunk/tck20/src/jdo/datastoreidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/
db/jdo/trunk/tck20/src/jdo/datastoreidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/package.jdo
db/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/
db/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/package-standard9.orm
db/jdo/trunk/tck20/src/orm/datastoreidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/
db/jdo/trunk/tck20/src/orm/datastoreidentity/org/apache/jdo/tck/pc/companyMapWithoutJoin/package-standard9.orm
db/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema9.sql
db/jdo/trunk/tck20/src/sql/derby/datastoreidentity/schema9.sql
Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/mapping/CompletenessTestMap.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/mapping/CompletenessTestMap.java?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/mapping/CompletenessTestMap.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/mapping/CompletenessTestMap.java Fri Sep 8 13:37:08 2006
@@ -0,0 +1,128 @@
+/*
+ * 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.mapping;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.companyMapWithoutJoin.CompanyFactoryRegistry;
+import org.apache.jdo.tck.pc.companyMapWithoutJoin.CompanyModelReader;
+import org.apache.jdo.tck.util.BatchTestRunner;
+import org.apache.jdo.tck.util.DeepEquality;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+//import org.springframework.beans.factory.xml.XmlBeanFactory;
+
+/**
+ *<B>Title:</B>Completeness Test Map
+ *<BR>
+ *<B>Keywords:</B> mapping
+ *<BR>
+ *<B>Assertion ID:</B> A18.[not identified]
+ *<BR>
+ *<B>Assertion Description: </B>
+ */
+
+public class CompletenessTestMap extends JDO_Test {
+
+ /** */
+ private static final String ASSERTION_FAILED =
+ "Assertion A18-[not identified] failed: ";
+
+ /** */
+ private final boolean isTestToBePerformed = isTestToBePerformed();
+
+ /** */
+ protected List rootOids;
+
+ /** */
+ protected final String inputFilename = System.getProperty("jdo.tck.testdata");
+
+ /**
+ * 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(CompletenessTestMap.class);
+ }
+
+ /**
+ * @see JDO_Test#localSetUp()
+ */
+ protected void localSetUp() {
+ if (isTestToBePerformed) {
+ getPM();
+ CompanyFactoryRegistry.registerFactory(pm);
+ CompanyModelReader reader = new CompanyModelReader(inputFilename);
+ addTearDownClass(reader.getTearDownClassesFromFactory());
+ // persist test data
+ pm.currentTransaction().begin();
+ List rootList = reader.getRootList();
+ pm.makePersistentAll(rootList);
+ rootOids = new ArrayList();
+ for (Iterator i = rootList.iterator(); i.hasNext(); ) {
+ Object pc = i.next();
+ rootOids.add(pm.getObjectId(pc));
+ }
+ pm.currentTransaction().commit();
+ cleanupPM();
+ }
+ }
+
+ /** */
+ public void test() {
+ if (isTestToBePerformed) {
+ // register the default factory
+ CompanyFactoryRegistry.registerFactory();
+ // get new obj graph to compare persistent graph with
+ CompanyModelReader reader = new CompanyModelReader(inputFilename);
+ List rootList = reader.getRootList();
+
+ getPM();
+ pm.currentTransaction().begin();
+ // compare persisted and new
+ int size = rootList.size();
+ StringBuffer msg = new StringBuffer();
+ for (int i = 0; i < size; i++) {
+ DeepEquality expected = (DeepEquality) rootList.get(i);
+ Object oid = rootOids.get(i);
+ Object persisted = pm.getObjectById(oid);
+ EqualityHelper equalityHelper = new EqualityHelper();
+ if (!expected.deepCompareFields(persisted, equalityHelper)) {
+ if (msg.length() > 0) {
+ msg.append("\n");
+ }
+ 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();
+ // fail test if at least one of the instances is not the expected one
+ if (msg.length() > 0) {
+ fail("CompletenessTestMap failed; see list of failures below:",
+ msg.toString());
+ }
+ }
+ }
+}
Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Company.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Company.java?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Company.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Company.java Fri Sep 8 13:37:08 2006
@@ -0,0 +1,331 @@
+/*
+ * 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.companyMapWithoutJoin;
+
+import java.io.Serializable;
+import java.io.ObjectInputStream;
+import java.io.IOException;
+
+import java.text.SimpleDateFormat;
+
+import java.util.Collections;
+import java.util.Comparator;
+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 ICompany, Serializable, Comparable, Comparator, DeepEquality {
+
+ private long companyid;
+ private String name;
+ private Date founded;
+ private transient Set departments = new HashSet(); // element type is Department
+
+ protected static SimpleDateFormat formatter =
+ new SimpleDateFormat("d/MMM/yyyy");
+
+ /** This is the JDO-required no-args constructor. The TCK relies on
+ * this constructor for testing PersistenceManager.newInstance(PCClass).
+ */
+ public 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.
+ */
+ public Company(long companyid, String name, Date founded) {
+ this.companyid = companyid;
+ this.name = name;
+ this.founded = founded;
+ }
+
+ /**
+ * Get the company id.
+ * @return The company id.
+ */
+ public long getCompanyid() {
+ return companyid;
+ }
+
+ /**
+ * Set the id associated with this object.
+ * @param id the id.
+ */
+ public void setCompanyid(long id) {
+ if (this.companyid != 0)
+ throw new IllegalStateException("Id is already set.");
+ this.companyid = id;
+ }
+
+ /**
+ * 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 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 a String representation of a <code>Company</code> object.
+ * @return a String representation of a <code>Company</code> object.
+ */
+ public String toString() {
+ return "Company(" + getFieldRepr()+ ")";
+ }
+
+ /**
+ * Returns a String representation of the non-relationship fields.
+ * @return a String representation of the non-relationship fields.
+ */
+ protected String getFieldRepr() {
+ StringBuffer rc = new StringBuffer();
+ rc.append(companyid);
+ rc.append(", name ").append(name);
+ rc.append(", founded ").append(formatter.format(founded));
+ return rc.toString();
+ }
+
+ /**
+ * 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(Object other,
+ EqualityHelper helper) {
+ 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(departments, otherCompany.getDepartments(), where + ".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((ICompany)o);
+ }
+
+ /**
+ * Compare two instances. This is a method in Comparator.
+ */
+ public int compare(Object o1, Object o2) {
+ return compare((ICompany)o1, (ICompany)o2);
+ }
+
+ /**
+ * 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(ICompany other) {
+ return compare(this, other);
+ }
+
+ /**
+ * Compares its two ICompany arguments for order. Returns a negative
+ * integer, zero, or a positive integer as the first argument is less
+ * than, equal to, or greater than the second.
+ * @param o1 the first ICompany object to be compared.
+ * @param o2 the second ICompany object to be compared.
+ * @return a negative integer, zero, or a positive integer as the first
+ * object is less than, equal to, or greater than the second object.
+ */
+ public static int compare(ICompany o1, ICompany o2) {
+ return EqualityHelper.compare(o1.getCompanyid(), o2.getCompanyid());
+ }
+
+ /**
+ * 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 ICompany) {
+ return compareTo((ICompany)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 Oid(String s) { companyid = Long.parseLong(justTheId(s)); }
+
+ public String toString() { return this.getClass().getName() + ": " + 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;
+ }
+
+ protected static String justTheId(String str) {
+ return str.substring(str.indexOf(':') + 1);
+ }
+
+ /** */
+ 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: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactory.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactory.java?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactory.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactory.java Fri Sep 8 13:37:08 2006
@@ -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.
+ */
+
+/*
+ * CompanyFactory.java
+ *
+ */
+
+package org.apache.jdo.tck.pc.companyMapWithoutJoin;
+
+import java.math.BigDecimal;
+
+import java.util.Date;
+
+/**
+ * This interface is implemented by a factory class that can create
+ * Company model instances. The factory instance is registered with
+ * CompanyFactoryRegistry.
+ */
+public interface CompanyFactory {
+ ICompany newCompany(long companyid, String name, Date founded);
+ IDepartment newDepartment(long deptid, String name);
+ IDepartment newDepartment(long deptid,
+ String name, ICompany company);
+ IFullTimeEmployee newFullTimeEmployee(long personid,
+ String first, String last, String middle,
+ Date born, Date hired, String role, double sal);
+ IPartTimeEmployee newPartTimeEmployee(long personid,
+ String first, String last, String middle,
+ Date born, Date hired, String role, double wage);
+ Class[] getTearDownClasses();
+}
Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactoryAbstractImpl.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactoryAbstractImpl.java?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactoryAbstractImpl.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactoryAbstractImpl.java Fri Sep 8 13:37:08 2006
@@ -0,0 +1,109 @@
+/*
+ * 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.companyMapWithoutJoin;
+
+import javax.jdo.PersistenceManager;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/*
+ * This class provides an implementation of CompanyFactory that sets all
+ * of the properties of the instance and defines abstract methods to
+ * construct the instance itself. It is intended to be subclassed by
+ * classes that implement only the methods to construct the instance.
+ */
+public abstract class CompanyFactoryAbstractImpl implements CompanyFactory {
+
+ protected PersistenceManager pm;
+
+ /** Logger */
+ protected Log logger =
+ LogFactory.getFactory().getInstance("org.apache.jdo.tck");
+
+ /** true if debug logging is enabled. */
+ protected boolean debug = logger.isDebugEnabled();
+
+ /** Creates a new instance of CompanyFactoryAbstractImpl */
+ public CompanyFactoryAbstractImpl(PersistenceManager pm) {
+ this.pm = pm;
+ }
+
+ abstract ICompany newCompany();
+ abstract IDepartment newDepartment();
+ abstract IFullTimeEmployee newFullTimeEmployee();
+ abstract IPartTimeEmployee newPartTimeEmployee();
+
+ public ICompany newCompany(long companyid, String name,
+ java.util.Date founded) {
+ ICompany result = newCompany();
+ if (debug) logger.debug("newCompany returned" + result);
+ result.setCompanyid(companyid);
+ result.setName(name);
+ result.setFounded(founded);
+ return result;
+ }
+
+ public IDepartment newDepartment(long deptid, String name) {
+ IDepartment result = newDepartment();
+ if (debug) logger.debug("newDepartment returned" + result);
+ result.setDeptid(deptid);
+ result.setName(name);
+ return result;
+ }
+
+
+ public IDepartment newDepartment(long deptid, String name, ICompany company) {
+ IDepartment result = newDepartment();
+ if (debug) logger.debug("newDepartment returned" + result);
+ result.setDeptid(deptid);
+ result.setName(name);
+ result.setCompany(company);
+ return result;
+ }
+
+ public IFullTimeEmployee newFullTimeEmployee(long personid, String first,
+ String last, String middle, java.util.Date born,
+ java.util.Date hired, String role, double sal) {
+ IFullTimeEmployee result = newFullTimeEmployee();
+ if (debug) logger.debug("newFullTimeEmployee returned" + result);
+ result.setPersonid(personid);
+ result.setFirstname(first);
+ result.setLastname(last);
+ result.setMiddlename(middle);
+ result.setBirthdate(born);
+ result.setHiredate(hired);
+ result.setSalary(sal);
+ return result;
+ }
+
+ public IPartTimeEmployee newPartTimeEmployee(long personid, String first,
+ String last, String middle, java.util.Date born,
+ java.util.Date hired, String role, double wage) {
+ IPartTimeEmployee result = newPartTimeEmployee();
+ if (debug) logger.debug("newPartTimeEmployee returned" + result);
+ result.setPersonid(personid);
+ result.setFirstname(first);
+ result.setLastname(last);
+ result.setMiddlename(middle);
+ result.setBirthdate(born);
+ result.setHiredate(hired);
+ result.setWage(wage);
+ return result;
+ }
+
+}
Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactoryConcreteClass.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactoryConcreteClass.java?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactoryConcreteClass.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactoryConcreteClass.java Fri Sep 8 13:37:08 2006
@@ -0,0 +1,81 @@
+/*
+ * 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.companyMapWithoutJoin;
+
+import java.math.BigDecimal;
+
+import java.util.Date;
+
+import javax.jdo.PersistenceManager;
+
+/*
+ * This class is the company factory that uses constructors of the
+ * concrete classes.
+ */
+public class CompanyFactoryConcreteClass implements CompanyFactory {
+
+ /** */
+ public static final Class[] tearDownClasses = new Class[] {
+ PartTimeEmployee.class, FullTimeEmployee.class,
+ Department.class, Company.class
+ };
+
+ public CompanyFactoryConcreteClass(PersistenceManager pm) {
+ }
+
+ public CompanyFactoryConcreteClass() {
+ }
+
+ public ICompany newCompany(long companyid,
+ String name, Date founded) {
+ return new Company(companyid, name, founded);
+ }
+
+ public IDepartment newDepartment(long deptid, String name) {
+ return new Department(deptid, name);
+ }
+
+ public IDepartment newDepartment(long deptid,
+ String name, ICompany company) {
+ return new Department(deptid, name, company);
+ }
+
+ public IFullTimeEmployee newFullTimeEmployee(long personid,
+ String first, String last, String middle,
+ Date born, Date hired, String role, double sal) {
+ return new FullTimeEmployee(personid, first, last, middle,
+ born, hired, role, sal);
+ }
+
+ public IPartTimeEmployee newPartTimeEmployee(long personid,
+ String first, String last, String middle,
+ Date born, Date hired, String role, double wage) {
+ return new PartTimeEmployee(personid, first, last, middle,
+ born, hired, role, wage);
+ }
+
+ public IPerson newPerson(long personid,
+ String firstname, String lastname, String middlename,
+ Date birthdate) {
+ return new Person(personid, firstname, lastname, middlename,
+ birthdate);
+ }
+
+ public Class[] getTearDownClasses() {
+ return tearDownClasses;
+ }
+}
Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactoryPMClass.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactoryPMClass.java?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactoryPMClass.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactoryPMClass.java Fri Sep 8 13:37:08 2006
@@ -0,0 +1,62 @@
+/*
+ * 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.companyMapWithoutJoin;
+
+import javax.jdo.PersistenceManager;
+
+/*
+ * CompanyFactoryPMInterface.java
+ *
+ * This class uses the PersistenceManager.newInstance method with the concrete
+ * class as a parameter.
+ */
+public class CompanyFactoryPMClass
+ extends CompanyFactoryAbstractImpl {
+
+ /** */
+ public static final Class[] tearDownClasses = new Class[] {
+ PartTimeEmployee.class, FullTimeEmployee.class,
+ Department.class, Company.class
+ };
+
+ /**
+ * Creates a new instance of CompanyFactoryPMClass
+ */
+ public CompanyFactoryPMClass(PersistenceManager pm) {
+ super(pm);
+ }
+
+ ICompany newCompany() {
+ return (ICompany)pm.newInstance(Company.class);
+ }
+
+ IDepartment newDepartment() {
+ return (IDepartment)pm.newInstance(Department.class);
+ }
+
+ IFullTimeEmployee newFullTimeEmployee() {
+ return (IFullTimeEmployee)pm.newInstance(FullTimeEmployee.class);
+ }
+
+ IPartTimeEmployee newPartTimeEmployee() {
+ return (IPartTimeEmployee)pm.newInstance(PartTimeEmployee.class);
+ }
+
+ public Class[] getTearDownClasses() {
+ return tearDownClasses;
+ }
+}
Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactoryPMInterface.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactoryPMInterface.java?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactoryPMInterface.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactoryPMInterface.java Fri Sep 8 13:37:08 2006
@@ -0,0 +1,62 @@
+/*
+ * 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.companyMapWithoutJoin;
+
+import javax.jdo.PersistenceManager;
+
+/*
+ * CompanyFactoryPMInterface.java
+ *
+ * Created on August 29, 2005, 9:56 PM
+ *
+ */
+public class CompanyFactoryPMInterface
+ extends CompanyFactoryAbstractImpl {
+
+ /** */
+ public static final Class[] tearDownClasses = new Class[] {
+ IPartTimeEmployee.class, IFullTimeEmployee.class,
+ IDepartment.class, ICompany.class
+ };
+
+ /**
+ * Creates a new instance of CompanyFactoryPMInterface
+ */
+ public CompanyFactoryPMInterface(PersistenceManager pm) {
+ super(pm);
+ }
+
+ ICompany newCompany() {
+ return (ICompany)pm.newInstance(ICompany.class);
+ }
+
+ IDepartment newDepartment() {
+ return (IDepartment)pm.newInstance(IDepartment.class);
+ }
+
+ IFullTimeEmployee newFullTimeEmployee() {
+ return (IFullTimeEmployee)pm.newInstance(IFullTimeEmployee.class);
+ }
+
+ IPartTimeEmployee newPartTimeEmployee() {
+ return (IPartTimeEmployee)pm.newInstance(IPartTimeEmployee.class);
+ }
+
+ public Class[] getTearDownClasses() {
+ return tearDownClasses;
+ }
+}
Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactoryRegistry.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactoryRegistry.java?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactoryRegistry.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyFactoryRegistry.java Fri Sep 8 13:37:08 2006
@@ -0,0 +1,139 @@
+/*
+ * 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.companyMapWithoutJoin;
+
+import java.lang.reflect.Constructor;
+
+import java.math.BigDecimal;
+
+import java.util.Date;
+
+import javax.jdo.PersistenceManager;
+
+/*
+ * This is the registry for company factories. It is used for the
+ * CompletenessTest to create instances from input xml test data files.
+ * Factory instances that implement CompanyFactory interface are
+ * registered (using the singleton pattern).
+ * <P>Several registration methods are available. The default factory,
+ * which creates instances by construction, is automatically
+ * registered during class initialization. The default factory can
+ * also be registered by using the no-args method registerFactory().
+ * <P>Non-default factories can be registered using the registerFactory
+ * method taking the factory as an argument. Non-default factories that
+ * have a single constructor argument PersistenceManager can be
+ * registered using either the method that explicitly names the class,
+ * or with the method that takes the class name from a system property.
+ */
+public class CompanyFactoryRegistry {
+
+ /** The system property for factory name
+ */
+ final static String FACTORY_PROPERTY_NAME =
+ "jdo.tck.mapping.companyfactory";
+
+ /** The factory name if the system property is not set.
+ */
+ final static String DEFAULT_FACTORY_CLASS_NAME =
+ "org.apache.jdo.tck.pc.company.CompanyFactoryConcreteClass";
+
+ /**
+ * The default factory class name
+ */
+ final static String FACTORY_CLASS_NAME;
+
+ static {
+ String prop = System.getProperty(FACTORY_PROPERTY_NAME);
+ if ((prop == null) || (prop.length() == 0))
+ prop = DEFAULT_FACTORY_CLASS_NAME;
+ FACTORY_CLASS_NAME = prop;
+ }
+
+ /**
+ * This is the default company factory singleton. This is statically
+ * loaded regardless of the setting of the system property.
+ */
+ final static CompanyFactory SINGLETON = new CompanyFactoryConcreteClass();
+
+ /**
+ * This is the currently registered factory.
+ */
+ static CompanyFactory instance = SINGLETON;
+
+ /**
+ * Creates a new instance of CompanyFactoryRegistry
+ */
+ private CompanyFactoryRegistry() {
+ }
+
+ /**
+ * Get the currently registered factory.
+ * @return the factory
+ */
+ public static CompanyFactory getInstance() {
+ return instance;
+ }
+
+ /** Register the default factory.
+ */
+ public static void registerFactory() {
+ instance = SINGLETON;
+ }
+
+ /** Register a factory using the default factory name from the
+ * system property. The factory must be available in the current
+ * class path and have a public constructor
+ * taking a PersistenceManager as a parameter.
+ * @param pm the PersistenceManager
+ */
+ public static void registerFactory(PersistenceManager pm) {
+ registerFactory(FACTORY_CLASS_NAME, pm);
+ }
+
+ /** Register a factory using the specified factoryName
+ * parameter. The factory class must be loadable by the current context
+ * classloader and have a public constructor
+ * taking a PersistenceManager as a parameter.
+ * @param factoryClassName the fully-qualified class name of the factory
+ * @param pm the PersistenceManager
+ */
+ public static void registerFactory(String factoryClassName,
+ PersistenceManager pm) {
+ CompanyFactory factory = null;
+ try {
+ if (factoryClassName != null) {
+ Class factoryClass = Class.forName(factoryClassName);
+ Constructor ctor = factoryClass.getConstructor(new Class[]
+ {PersistenceManager.class});
+ factory = (CompanyFactory)
+ ctor.newInstance(new Object[]{pm});
+ }
+ registerFactory(factory);
+ } catch (Exception ex) {
+ throw new RuntimeException ("Unable to construct CompanyFactory " +
+ factoryClassName, ex);
+ }
+ }
+
+ /** Register the factory.
+ * @param factory the factory
+ */
+ public static void registerFactory(CompanyFactory factory) {
+ instance = factory!=null?factory:SINGLETON;
+ }
+
+}
Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java Fri Sep 8 13:37:08 2006
@@ -0,0 +1,196 @@
+/*
+ * 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.companyMapWithoutJoin;
+
+import java.io.InputStream;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+import java.util.TimeZone;
+
+import org.apache.jdo.tck.util.ConversionHelper;
+import org.springframework.beans.factory.xml.XmlBeanFactory;
+import org.springframework.beans.propertyeditors.CustomDateEditor;
+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";
+
+ /** The name of the root list bean. */
+ public static final String ROOT_LIST_NAME = "root";
+
+ /** The bean-factory name in the xml input files.
+ */
+ public static final String BEAN_FACTORY_NAME = "companyFactory";
+
+ /** The company factory instance. */
+ private CompanyFactory companyFactory;
+
+ /**
+ * 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();
+ }
+
+ /**
+ * Returns a list of root objects. The method expects to find a bean
+ * called "root" of type list in the xml and returns it.
+ * @return a list of root instances
+ */
+ public List getRootList() {
+ return (List)getBean(ROOT_LIST_NAME);
+ }
+
+ /**
+ * 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);
+ companyFactory = CompanyFactoryRegistry.getInstance();
+ addSingleton(BEAN_FACTORY_NAME, companyFactory);
+ }
+
+ // Convenience methods
+
+ /**
+ * 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 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 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);
+ }
+
+ /**
+ * @return Returns the tearDownClasses.
+ */
+ public Class[] getTearDownClassesFromFactory() {
+ return companyFactory.getTearDownClasses();
+ }
+
+ /**
+ * @return Returns the tearDownClasses.
+ */
+ public static Class[] getTearDownClasses() {
+ return CompanyFactoryConcreteClass.tearDownClasses;
+ }
+
+ public static Date stringToUtilDate(String value) {
+ return ConversionHelper.toUtilDate(DATE_PATTERN, "America/New_York", Locale.US, value);
+ }
+}
+
Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Department.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Department.java?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Department.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Department.java Fri Sep 8 13:37:08 2006
@@ -0,0 +1,341 @@
+/*
+ * 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.companyMapWithoutJoin;
+
+import java.io.Serializable;
+import java.io.ObjectInputStream;
+import java.io.IOException;
+
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Map;
+
+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 IDepartment, Serializable, Comparable, Comparator, DeepEquality {
+
+ public static final int RECOMMENDED_NO_OF_EMPS = 2;
+
+ private long deptid;
+ private String name;
+ private Company company;
+ private Map roles;
+
+ /** This is the JDO-required no-args constructor. The TCK relies on
+ * this constructor for testing PersistenceManager.newInstance(PCClass).
+ */
+ public Department() {}
+
+ /**
+ * Construct 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;
+ }
+
+ /**
+ * 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, ICompany company) {
+ this.deptid = deptid;
+ this.name = name;
+ this.company = (Company)company;
+ }
+
+ /**
+ * 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 roles Map of employees and their roles
+ */
+ public Department(long deptid, String name, Company company,
+ Map roles) {
+ this.deptid = deptid;
+ this.name = name;
+ this.company = (Company)company;
+ this.roles = roles;
+ }
+
+ /**
+ * Set the id associated with this object.
+ * @param id the id.
+ */
+ public void setDeptid(long id) {
+ if (this.deptid != 0)
+ throw new IllegalStateException("Id is already set.");
+ this.deptid = id;
+ }
+
+ /**
+ * 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 ICompany getCompany() {
+ return company;
+ }
+
+ /**
+ * Set the company for the department.
+ * @param company The company to associate with the department.
+ */
+ public void setCompany(ICompany company) {
+ this.company = (Company)company;
+ }
+
+ /**
+ * Get the roles in the department as an unmodifiable set.
+ ******************* FIX??
+ * @return The set of employees in the department, as an unmodifiable
+ * set.
+ */
+ public Map getRoles() {
+ return roles;
+ }
+
+ /**
+ * Add an role to the department.
+ * @param emp The role to add to the department.
+ */
+ public void addRole(String role, Employee emp) {
+ roles.put(role, emp);
+ }
+
+ /**
+ * Remove an role from the department.
+ * @param emp The role to remove from the department.
+ */
+ public void removeRole(String key) {
+ roles.remove(key);
+ }
+
+ /**
+ * Set the roles to be in this department.
+ * @param roles The roles for this department.
+ */
+ public void setRoles(Map roles) {
+ this.roles = roles;
+ }
+
+ /**
+ * Returns <code>true</code> if all the fields of this instance are
+ * 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.
+ * @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(Object other,
+ EqualityHelper helper) {
+ IDepartment otherDept = (IDepartment)other;
+ String where = "Department<" + deptid + ">";
+ return
+ helper.equals(deptid, otherDept.getDeptid(), where + ".deptid") &
+ helper.equals(name, otherDept.getName(), where + ".name") &
+ helper.deepEquals(roles, otherDept.getRoles(), where + ".roles") &
+ helper.deepEquals(company, otherDept.getCompany(), where + ".company") ;
+ }
+
+ /**
+ * Returns a String representation of a <code>Department</code> object.
+ * @return a String representation of a <code>Department</code> object.
+ */
+ public String toString() {
+ return "Department(" + getFieldRepr()+ ")";
+ }
+
+ /**
+ * Returns a String representation of the non-relationship fields.
+ * @return a String representation of the non-relationship fields.
+ */
+ protected String getFieldRepr() {
+ StringBuffer rc = new StringBuffer();
+ rc.append(deptid);
+ rc.append(", name ").append(name);
+ return rc.toString();
+ }
+
+ /**
+ * 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((IDepartment)o);
+ }
+
+ /**
+ * Compare two instances. This is a method in Comparator.
+ */
+ public int compare(Object o1, Object o2) {
+ return compare((IDepartment)o1, (IDepartment)o2);
+ }
+
+ /**
+ * 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(IDepartment other) {
+ return compare(this, other);
+ }
+
+ /**
+ * Compares its two IDepartment arguments for order. Returns a negative
+ * integer, zero, or a positive integer as the first argument is less
+ * than, equal to, or greater than the second.
+ * @param o1 the first IDepartment object to be compared.
+ * @param o2 the second IDepartment object to be compared.
+ * @return a negative integer, zero, or a positive integer as the first
+ * object is less than, equal to, or greater than the second object.
+ */
+ public static int compare(IDepartment o1, IDepartment o2) {
+ return EqualityHelper.compare(o1.getDeptid(), o2.getDeptid());
+ }
+
+ /**
+ * 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 IDepartment) {
+ return compareTo((IDepartment)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 Oid(String s) { deptid = Long.parseLong(justTheId(s)); }
+
+ public String toString() { return this.getClass().getName() + ": " + 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 );
+ }
+
+ protected static String justTheId(String str) {
+ return str.substring(str.indexOf(':') + 1);
+ }
+
+ /** */
+ 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: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Employee.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Employee.java?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Employee.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Employee.java Fri Sep 8 13:37:08 2006
@@ -0,0 +1,338 @@
+/*
+ * 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.companyMapWithoutJoin;
+
+import java.io.ObjectInputStream;
+import java.io.IOException;
+
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Map;
+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 implements IEmployee {
+
+ private Date hiredate;
+ private double weeklyhours;
+ private Department department;
+ private Department fundingDept;
+ private String role;
+ private Employee manager;
+ private Employee mentor;
+ private Employee protege;
+ private Employee hradvisor;
+ 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() {}
+
+ /**
+ * 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.
+ * @param middlename The middle name of the employee.
+ * @param birthdate The birth date of the employee.
+ * @param hiredate The date that the employee was hired.
+ */
+ public Employee(long personid, String firstname, String lastname,
+ String middlename, Date birthdate,
+ Date hiredate, String role) {
+ super(personid, firstname, lastname, middlename, birthdate);
+ this.hiredate = hiredate;
+ this.role = role;
+ }
+
+ /**
+ * 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 employee's department.
+ * @return The department associated with the employee.
+ */
+ public IDepartment getDepartment() {
+ return department;
+ }
+
+ /**
+ * Set the employee's department.
+ * @param department The 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 IDepartment getFundingDept() {
+ return fundingDept;
+ }
+
+ /**
+ * Set the employee's funding department.
+ * @param department The funding department.
+ */
+ public void setFundingDept(IDepartment department) {
+ this.fundingDept = (Department)department;
+ }
+
+ /**
+ * Get the employee's manager.
+ * @return The employee's manager.
+ */
+ public IEmployee getManager() {
+ return manager;
+ }
+
+ /**
+ * Set the employee's manager.
+ * @param manager The employee's manager.
+ */
+ public void setManager(IEmployee manager) {
+ this.manager = (Employee)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.
+ * @param mentor The mentor for this employee.
+ */
+ public void setMentor(IEmployee mentor) {
+ this.mentor = (Employee)mentor;
+ }
+
+ /**
+ * Get the mentor for this employee.
+ * @return The mentor.
+ */
+ public IEmployee getMentor() {
+ return mentor;
+ }
+
+ /**
+ * Set the protege for this employee.
+ * @param protege The protege for this employee.
+ */
+ public void setProtege(IEmployee protege) {
+ this.protege = (Employee)protege;
+ }
+
+ /**
+ * Get the protege of this employee.
+ * @return The protege of this employee.
+ */
+ public IEmployee getProtege() {
+ return protege;
+ }
+
+ /**
+ * Set the HR advisor for this employee.
+ * @param hradvisor The hradvisor for this employee.
+ */
+ public void setHradvisor(IEmployee hradvisor) {
+ this.hradvisor = (Employee)hradvisor;
+ }
+
+ /**
+ * Get the HR advisor for the employee.
+ * @return The HR advisor.
+ */
+ public IEmployee 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();
+ team = new HashSet();
+ hradvisees = new HashSet();
+ }
+
+ /**
+ * Return a String representation of a <code>Employee</code> object.
+ * @return a String representation of a <code>Employee</code> object.
+ */
+ public String toString() {
+ return "Employee(" + getFieldRepr() + ")";
+ }
+
+ /**
+ * Returns a String representation of the non-relationship fields.
+ * @return a String representation of the non-relationship fields.
+ */
+ protected String getFieldRepr() {
+ StringBuffer rc = new StringBuffer();
+ rc.append(super.getFieldRepr());
+ rc.append(", hired ").append(formatter.format(hiredate));
+ rc.append(", weeklyhours ").append(weeklyhours);
+ return rc.toString();
+ }
+
+ /**
+ * 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(Object other,
+ EqualityHelper helper) {
+ 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(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(team, otherEmp.getTeam(), where + ".team") &
+ helper.deepEquals(hradvisees, otherEmp.getHradvisees(), where + ".hradvisees");
+ }
+
+}
+
Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/FullTimeEmployee.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/FullTimeEmployee.java?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/FullTimeEmployee.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/FullTimeEmployee.java Fri Sep 8 13:37:08 2006
@@ -0,0 +1,108 @@
+/*
+ * 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.companyMapWithoutJoin;
+
+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 implements IFullTimeEmployee {
+
+ private double salary;
+
+ /** This is the JDO-required no-args constructor. The TCK relies on
+ * this constructor for testing PersistenceManager.newInstance(PCClass).
+ */
+ public FullTimeEmployee() {}
+
+ /**
+ * Construct 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 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,
+ Date hired, String role, double sal) {
+ super(personid, first, last, middle, born, hired, role);
+ 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;
+ }
+
+ /**
+ * Return a String representation of a <code>FullTimeEmployee</code> object.
+ * @return a String representation of a <code>FullTimeEmployee</code> object.
+ */
+ public String toString() {
+ return "FullTimeEmployee(" + getFieldRepr() + ")";
+ }
+
+ /**
+ * Returns a String representation of the non-relationship fields.
+ * @return a String representation of the non-relationship fields.
+ */
+ public String getFieldRepr() {
+ StringBuffer rc = new StringBuffer();
+ rc.append(super.getFieldRepr());
+ rc.append(", $").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(Object other,
+ EqualityHelper helper) {
+ IFullTimeEmployee otherEmp = (IFullTimeEmployee)other;
+ String where = "FullTimeEmployee<" + getPersonid() + ">";
+ return super.deepCompareFields(otherEmp, helper) &
+ helper.closeEnough(salary, otherEmp.getSalary(), where + ".salary");
+ }
+
+}
Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/ICompany.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/ICompany.java?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/ICompany.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/ICompany.java Fri Sep 8 13:37:08 2006
@@ -0,0 +1,38 @@
+/*
+ * 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.companyMapWithoutJoin;
+
+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 {
+
+ long getCompanyid();
+ Set getDepartments();
+ Date getFounded();
+ String getName();
+
+ void setCompanyid(long id);
+ void setDepartments(Set depts);
+ void setFounded(Date date);
+ void setName(String string);
+}
Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IDepartment.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IDepartment.java?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IDepartment.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IDepartment.java Fri Sep 8 13:37:08 2006
@@ -0,0 +1,37 @@
+/*
+ * 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.companyMapWithoutJoin;
+
+import java.util.Map;
+
+/**
+ * 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();
+ Map getRoles();
+
+ void setDeptid(long deptid);
+ void setName(String name);
+ void setCompany(ICompany company);
+ void setRoles(Map roles);
+}
Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IEmployee.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IEmployee.java?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IEmployee.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IEmployee.java Fri Sep 8 13:37:08 2006
@@ -0,0 +1,51 @@
+/*
+ * 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.companyMapWithoutJoin;
+
+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();
+ 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 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: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IFullTimeEmployee.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IFullTimeEmployee.java?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IFullTimeEmployee.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IFullTimeEmployee.java Fri Sep 8 13:37:08 2006
@@ -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.companyMapWithoutJoin;
+
+/**
+ * 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: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IPartTimeEmployee.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IPartTimeEmployee.java?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IPartTimeEmployee.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IPartTimeEmployee.java Fri Sep 8 13:37:08 2006
@@ -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.companyMapWithoutJoin;
+
+/**
+ * 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: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IPerson.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IPerson.java?view=auto&rev=441641
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IPerson.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IPerson.java Fri Sep 8 13:37:08 2006
@@ -0,0 +1,41 @@
+/*
+ * 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.companyMapWithoutJoin;
+
+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();
+ Date getBirthdate();
+
+ void setPersonid(long personid);
+ void setLastname(String lastname);
+ void setFirstname(String firstname);
+ void setMiddlename(String middlename);
+ void setBirthdate(Date birthdate);
+
+}