db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcai...@apache.org
Subject svn commit: r508529 - in /db/jdo/trunk/tck20: ./ assertions/ src/conf/ src/java/org/apache/jdo/tck/mapping/ src/java/org/apache/jdo/tck/pc/order/ src/jdo/applicationidentity/org/apache/jdo/tck/pc/order/ src/orm/applicationidentity/org/apache/jdo/tck/pc...
Date Fri, 16 Feb 2007 18:25:54 GMT
Author: mcaisse
Date: Fri Feb 16 10:25:53 2007
New Revision: 508529

URL: http://svn.apache.org/viewvc?view=rev&rev=508529
Log:
JDO-457 test for compound identity

Added:
    db/jdo/trunk/tck20/src/conf/compoundIdentity.conf
    db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/mapping/CompletenessTestOrder.java
    db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/
    db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/Order.java   (with props)
    db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactory.java   (with props)
    db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryAbstractImpl.java   (with props)
    db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryConcreteClass.java   (with props)
    db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryPMClass.java   (with props)
    db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryPMInterface.java   (with props)
    db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryRegistry.java   (with props)
    db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderItem.java   (with props)
    db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderModelReader.java   (with props)
    db/jdo/trunk/tck20/src/jdo/applicationidentity/org/apache/jdo/tck/pc/order/
    db/jdo/trunk/tck20/src/jdo/applicationidentity/org/apache/jdo/tck/pc/order/package.jdo
    db/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/pc/order/
    db/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/pc/order/package-standard.orm
    db/jdo/trunk/tck20/src/testdata/org/apache/jdo/tck/pc/order/
    db/jdo/trunk/tck20/src/testdata/org/apache/jdo/tck/pc/order/order.xml
Modified:
    db/jdo/trunk/tck20/assertions/JdoTckAssertionsTable.sxc
    db/jdo/trunk/tck20/project.properties
    db/jdo/trunk/tck20/src/conf/configurations.list
    db/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema.sql

Modified: db/jdo/trunk/tck20/assertions/JdoTckAssertionsTable.sxc
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/assertions/JdoTckAssertionsTable.sxc?view=diff&rev=508529&r1=508528&r2=508529
==============================================================================
Binary files - no diff available.

Modified: db/jdo/trunk/tck20/project.properties
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/project.properties?view=diff&rev=508529&r1=508528&r2=508529
==============================================================================
--- db/jdo/trunk/tck20/project.properties (original)
+++ db/jdo/trunk/tck20/project.properties Fri Feb 16 10:25:53 2007
@@ -143,6 +143,8 @@
     org/apache/jdo/tck/pc/companyListWithoutJoin/IFullTimeEmployee.java \
     org/apache/jdo/tck/pc/companyListWithoutJoin/IInsurance.java \
     org/apache/jdo/tck/pc/companyListWithoutJoin/IPartTimeEmployee.java \
+    org/apache/jdo/tck/pc/order/Order.java \
+    org/apache/jdo/tck/pc/order/OrderItem.java \
     org/apache/jdo/tck/pc/fieldtypes/AllTypes.java \
     org/apache/jdo/tck/pc/fieldtypes/ArrayCollections.java \
     org/apache/jdo/tck/pc/fieldtypes/ArrayListCollections.java \
@@ -283,6 +285,8 @@
     org/apache/jdo/tck/pc/companyListWithoutJoin/IEmployee.class \
     org/apache/jdo/tck/pc/companyListWithoutJoin/IFullTimeEmployee.class \
     org/apache/jdo/tck/pc/companyListWithoutJoin/IPartTimeEmployee.class \
+    org/apache/jdo/tck/pc/order/Order.class \
+    org/apache/jdo/tck/pc/order/OrderItem.class \
     org/apache/jdo/tck/pc/fieldtypes/AllTypes.class \
     org/apache/jdo/tck/pc/fieldtypes/ArrayCollections.class \
     org/apache/jdo/tck/pc/fieldtypes/ArrayListCollections.class \
@@ -411,6 +415,7 @@
     org/apache/jdo/tck/pc/company/package.jdo \
     org/apache/jdo/tck/pc/companyMapWithoutJoin/package.jdo \
     org/apache/jdo/tck/pc/companyListWithoutJoin/package.jdo \
+    org/apache/jdo/tck/pc/order/package.jdo \
     org/apache/jdo/tck/pc/fieldtypes/AllTypes.jdo \
     org/apache/jdo/tck/pc/fieldtypes/ArrayCollections.jdo \
     org/apache/jdo/tck/pc/fieldtypes/ArrayListCollections.jdo \

Added: db/jdo/trunk/tck20/src/conf/compoundIdentity.conf
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/conf/compoundIdentity.conf?view=auto&rev=508529
==============================================================================
--- db/jdo/trunk/tck20/src/conf/compoundIdentity.conf (added)
+++ db/jdo/trunk/tck20/src/conf/compoundIdentity.conf Fri Feb 16 10:25:53 2007
@@ -0,0 +1,21 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+jdo.tck.description = Completeness test with standard mapping using order model for compound identity testing
+jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.order.OrderFactoryPMClass
+jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTestOrder
+jdo.tck.testdata = org/apache/jdo/tck/pc/order/order.xml
+jdo.tck.mapping = 0
+jdo.tck.requiredOptions =

Modified: db/jdo/trunk/tck20/src/conf/configurations.list
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/conf/configurations.list?view=diff&rev=508529&r1=508528&r2=508529
==============================================================================
--- db/jdo/trunk/tck20/src/conf/configurations.list (original)
+++ db/jdo/trunk/tck20/src/conf/configurations.list Fri Feb 16 10:25:53 2007
@@ -44,4 +44,5 @@
                  inheritance4.conf \
                  schemaAttributeClass.conf \
                  schemaAttributeOrm.conf \
-                 schemaAttributePackage.conf
+                 schemaAttributePackage.conf \
+                 compoundIdentity.conf

Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/mapping/CompletenessTestOrder.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/mapping/CompletenessTestOrder.java?view=auto&rev=508529
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/mapping/CompletenessTestOrder.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/mapping/CompletenessTestOrder.java Fri Feb 16 10:25:53 2007
@@ -0,0 +1,127 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.mapping;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.jdo.tck.JDO_Test;
+import org.apache.jdo.tck.pc.order.OrderFactoryRegistry;
+import org.apache.jdo.tck.pc.order.OrderModelReader;
+import org.apache.jdo.tck.util.BatchTestRunner;
+import org.apache.jdo.tck.util.DeepEquality;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+/**
+ *<B>Title:</B>Completeness Test for the Order model
+ *<BR>
+ *<B>Keywords:</B> mapping compound identity
+ *<BR>
+ *<B>Assertion ID:</B> A5.4.1-5
+ *<BR>
+ *<B>Assertion Description: Compound identity is a special case of application identity. References to other persistence-capable classes can be defined as key fields. In this case, the object id class contains a field that is of the type of the object id of the relationship field.</B>
+ */
+
+public class CompletenessTestOrder extends JDO_Test {
+
+    /** */
+    private static final String ASSERTION_FAILED = 
+        "Assertion A5.4.1-5[Compound identity is a special case of application identity. References to other persistence-capable classes can be defined as key fields. In this case, the object id class contains a field that is of the type of the object id of the relationship field.] failed: ";
+    
+    /** */
+
+    /** */
+    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(CompletenessTestOrder.class);
+    }
+
+    /**
+     * @see JDO_Test#localSetUp()
+     */
+    protected void localSetUp() {
+        if (runsWithApplicationIdentity()) {
+            getPM();
+            OrderFactoryRegistry.registerFactory(pm);
+            OrderModelReader reader = new OrderModelReader(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 (runsWithApplicationIdentity()) {
+            // register the default factory
+            OrderFactoryRegistry.registerFactory();
+            // get new obj graph to compare persistent graph with
+            OrderModelReader reader = new OrderModelReader(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("CompletenessTestOrder failed; see list of failures below:", 
+                        msg.toString());
+            }
+        }
+    }
+}

Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/Order.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/Order.java?view=auto&rev=508529
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/Order.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/Order.java Fri Feb 16 10:25:53 2007
@@ -0,0 +1,203 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.pc.order;
+
+import java.io.Serializable;
+import java.util.Comparator;
+import java.util.Set;
+
+import org.apache.jdo.tck.util.DeepEquality;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+public class Order implements Serializable, Comparable, Comparator, DeepEquality {
+    long orderId;
+    Set items;
+    long customerId;
+
+    public Order() {}
+
+    public Order(long orderId, long customerId) {
+        this.orderId = orderId;
+        this.customerId = customerId;
+    }
+
+    public Order(long orderId, Set items, long customerId) {
+        this.orderId = orderId;
+        this.items = items;
+        this.customerId = customerId;
+    }
+
+    public long getOrderId() {
+        return orderId;
+    }
+    
+    public void setOrderId(long orderId) {
+        this.orderId = orderId;
+    }
+    
+    public Set getItems() {
+        return items;
+    }
+    
+    public void setItems(Set items) {
+        this.items = items;
+    }
+
+    public long getCustomerId() {
+        return customerId;
+    }
+    
+    public void setCustomerId(long customerId) {
+        this.customerId = customerId;
+    }
+    
+    /** 
+     * 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) {
+        Order otherOrder = (Order)other;
+        String where = "Order<" + orderId + ">";
+        return 
+            helper.equals(orderId, otherOrder.getOrderId(), where + ".order") &
+            helper.equals(items, otherOrder.getItems(), where + ".items") &
+            helper.equals(customerId, otherOrder.getCustomerId(),
+                    where + ".customerId");
+    }
+    
+    /** 
+     * 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((Order)o);
+    }
+
+    /** 
+     * Compare two instances. This is a method in Comparator.
+     */
+    public int compare(Object o1, Object o2) {
+        return compare((Order)o1, (Order)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(Order other) {
+        return compare(this, other);
+    }
+
+    /**
+     * Compares its two Order 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 Order object to be compared. 
+     * @param o2 the second Order 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(Order o1, Order o2) {
+        return EqualityHelper.compare(o1.getOrderId(), o2.getOrderId());
+    }
+    
+    /** 
+     * 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 Order) {
+            return compareTo((Order)obj) == 0;
+        }
+        return false;
+    }
+
+    /**
+     * The class to be used as the application identifier
+     * for the <code>Order</code> class. It consists of both the orderId 
+     * field.
+     */
+    public static class OrderOid implements Serializable, Comparable {
+        public long orderId;
+
+        /** The required public no-arg constructor. */
+        public OrderOid() { }
+
+        public OrderOid(String s) {
+            orderId = Long.parseLong(justTheOrder(s)); 
+        }
+
+        public String toString() {
+            return this.getClass().getName() + "order:" 
+                + String.valueOf(orderId);
+        }
+        
+        /** */
+        public boolean equals(Object obj) {
+            if (obj == null || !this.getClass().equals(obj.getClass())) 
+                return false;
+            OrderOid o = (OrderOid) obj;
+            if (this.orderId != o.orderId) {
+                return false;
+            }
+            return true;
+        }
+
+        /** */
+        public int hashCode() {
+            return (int)orderId;
+        }
+        
+        protected static String justTheOrder(String str) {
+            return str.substring(str.indexOf(':') + 1);
+        }
+
+        /** */
+        public int compareTo(Object obj) {
+            // may throw ClassCastException which the user must handle
+            OrderOid other = (OrderOid) obj;
+            if( orderId < other.orderId ) return -1;
+            if( orderId > other.orderId ) return 1;
+            return 0;
+        }
+
+    }
+}
+

Propchange: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/Order.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactory.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactory.java?view=auto&rev=508529
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactory.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactory.java Fri Feb 16 10:25:53 2007
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+/*
+ * OrderFactory.java
+ *
+ */
+
+package org.apache.jdo.tck.pc.order;
+
+import java.math.BigDecimal;
+
+import java.util.Date;
+import java.util.Set;
+
+/**
+ * This interface is implemented by a factory class that can create 
+ * Order model instances. The factory instance is registered with 
+ * OrderFactoryRegistry.
+ */
+public interface OrderFactory {
+    Order newOrder(long orderId, Set items, long customerId);
+    Order newOrder(long orderId, long customerId);
+    OrderItem newOrderItem(Order order, long item, String description,
+                int quantity);
+
+    Class[] getTearDownClasses();
+}

Propchange: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryAbstractImpl.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryAbstractImpl.java?view=auto&rev=508529
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryAbstractImpl.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryAbstractImpl.java Fri Feb 16 10:25:53 2007
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.pc.order;
+
+import javax.jdo.PersistenceManager;
+
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/*
+ * This class provides an implementation of OrderFactory 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 OrderFactoryAbstractImpl implements OrderFactory {
+    
+    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 OrderFactoryAbstractImpl */
+    public OrderFactoryAbstractImpl(PersistenceManager pm) {
+        this.pm = pm;
+    }
+
+    abstract Order newOrder();
+    abstract OrderItem newOrderItem();
+
+    public Order newOrder(long orderId, long customerId) {
+        Order result = newOrder();
+        if (debug) logger.debug("newOrder returned" + result);
+        result.setOrderId(orderId);
+        result.setCustomerId(customerId);
+        return result;
+    }
+
+    public Order newOrder(long orderId, Set items, long customerId) {
+        Order result = newOrder();
+        if (debug) logger.debug("newOrder returned" + result);
+        result.setOrderId(orderId);
+        result.setItems(items);
+        result.setCustomerId(customerId);
+        return result;
+    }
+
+    public OrderItem newOrderItem(Order order, long item, String description,
+            int quantity) {
+        OrderItem result = newOrderItem();
+        if (debug) logger.debug("newOrderItem returned" + result);
+        result.setOrder(order);
+        result.setItem(item);
+        result.setDescription(description);
+        result.setQuantity(quantity);
+        return result;
+    }
+}

Propchange: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryAbstractImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryConcreteClass.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryConcreteClass.java?view=auto&rev=508529
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryConcreteClass.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryConcreteClass.java Fri Feb 16 10:25:53 2007
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.pc.order;
+
+import java.util.Set;
+
+import javax.jdo.PersistenceManager;
+
+/*
+ * This class is the order factory that uses constructors of the
+ * concrete classes.
+ */
+public  class OrderFactoryConcreteClass implements OrderFactory {
+
+    /** */
+    public static final Class[] tearDownClasses = new Class[] {
+        Order.class, OrderItem.class
+    };
+
+    public OrderFactoryConcreteClass(PersistenceManager pm) {
+    }
+
+    public OrderFactoryConcreteClass() {
+    }
+
+    public Order newOrder(long orderId, long customerId) { 
+        return new Order(orderId, customerId);
+    }
+
+    public Order newOrder(long orderId, Set items, long customerId) { 
+        return new Order(orderId, items, customerId);
+    }
+
+    public OrderItem newOrderItem(Order order, long item, String description,
+            int quantity) {
+        return new OrderItem(order, item, description, quantity);
+    }
+
+    public Class[] getTearDownClasses() {
+        return tearDownClasses;
+    }
+}

Propchange: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryConcreteClass.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryPMClass.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryPMClass.java?view=auto&rev=508529
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryPMClass.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryPMClass.java Fri Feb 16 10:25:53 2007
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.pc.order;
+
+import javax.jdo.PersistenceManager;
+
+/*
+ * OrderFactoryPMClass.java
+ *
+ * This class uses the PersistenceManager.newInstance method with the concrete
+ * class as a parameter. 
+ */
+public class OrderFactoryPMClass 
+        extends OrderFactoryAbstractImpl {
+    
+    /** */
+    public static final Class[] tearDownClasses = new Class[] {
+        Order.class, OrderItem.class
+    };
+
+    /**
+     * Creates a new instance of OrderFactoryPMClass 
+     */
+    public OrderFactoryPMClass(PersistenceManager pm) {
+        super(pm);
+    }
+    
+    public Order newOrder() {
+        return (Order)pm.newInstance(Order.class);
+    }
+    
+    public OrderItem newOrderItem() {
+        return (OrderItem)pm.newInstance(OrderItem.class);
+    }
+    
+    public Class[] getTearDownClasses() {
+        return tearDownClasses;
+    }
+}

Propchange: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryPMClass.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryPMInterface.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryPMInterface.java?view=auto&rev=508529
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryPMInterface.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryPMInterface.java Fri Feb 16 10:25:53 2007
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jdo.tck.pc.order;
+
+import javax.jdo.PersistenceManager;
+
+/*
+ * OrderFactoryPMInterface.java
+ *
+ */
+public class OrderFactoryPMInterface 
+        extends OrderFactoryAbstractImpl {
+    
+    /** */
+    public static final Class[] tearDownClasses = new Class[] {
+        Order.class, OrderItem.class
+    };
+
+    /**
+     * Creates a new instance of OrderFactoryPMInterface 
+     */
+    public OrderFactoryPMInterface(PersistenceManager pm) {
+        super(pm);
+    }
+    
+    Order newOrder() {
+        return (Order)pm.newInstance(Order.class);
+    }
+    
+    OrderItem newOrderItem() {
+        return (OrderItem)pm.newInstance(OrderItem.class);
+    }
+    
+    public Class[] getTearDownClasses() {
+        return tearDownClasses;
+    }
+}

Propchange: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryPMInterface.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryRegistry.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryRegistry.java?view=auto&rev=508529
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryRegistry.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryRegistry.java Fri Feb 16 10:25:53 2007
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.pc.order;
+
+import java.lang.reflect.Constructor;
+
+import javax.jdo.PersistenceManager;
+
+/*
+ * This is the registry for order factories. It is used for the
+ * CompletenessTest to create instances from input xml test data files.
+ * Factory instances that implement OrderFactory 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 OrderFactoryRegistry {
+
+    /** The system property for factory name
+      *
+      * NOTE:  SHOULD BE RENAMED!!
+     */
+    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.order.OrderFactoryConcreteClass";
+
+    /**
+     * 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 order factory singleton. This is statically
+     * loaded regardless of the setting of the system property.
+     */
+    final static OrderFactory SINGLETON = new OrderFactoryConcreteClass();
+    
+    /** 
+     * This is the currently registered factory.
+     */
+    static OrderFactory instance = SINGLETON;
+    
+    /**
+     * Creates a new instance of OrderFactoryRegistry 
+     */
+    private OrderFactoryRegistry() {
+    }
+
+    /** 
+     * Get the currently registered factory.
+     * @return the factory
+     */
+    public static OrderFactory 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) {
+        OrderFactory factory = null;
+        try {
+            if (factoryClassName != null) {
+                Class factoryClass = Class.forName(factoryClassName);
+                Constructor ctor = factoryClass.getConstructor(new Class[]
+                    {PersistenceManager.class});
+                factory = (OrderFactory)
+                    ctor.newInstance(new Object[]{pm});
+            }
+            registerFactory(factory);
+        } catch (Exception ex) {
+            throw new RuntimeException ("Unable to construct OrderFactory " +
+                    factoryClassName, ex);
+        }
+    }
+
+    /** Register the factory.
+     * @param factory the factory
+     */
+    public static void registerFactory(OrderFactory factory) {
+        instance = factory!=null?factory:SINGLETON;
+    }
+
+}

Propchange: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderFactoryRegistry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderItem.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderItem.java?view=auto&rev=508529
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderItem.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderItem.java Fri Feb 16 10:25:53 2007
@@ -0,0 +1,228 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.pc.order;
+
+import java.io.Serializable;
+import java.util.Comparator;
+
+import org.apache.jdo.tck.util.DeepEquality;
+import org.apache.jdo.tck.util.EqualityHelper;
+
+public class OrderItem implements Serializable, Comparable, Comparator, DeepEquality {
+
+    Order order;
+    long item;
+    String description;
+    int quantity;
+
+    public OrderItem() {
+    }
+
+    public OrderItem(Order order, long item, String description, int quantity) {
+        this.order = order;
+        this.item = item;
+        this.description = description;
+        this.quantity = quantity;
+    }
+
+    public Order getOrder() {
+        return order;
+    }
+
+    public void setOrder (Order order) {
+        this.order = order;
+    }
+
+    public long getItem() {
+        return item;
+    }
+
+    public void setItem (long item) {
+        this.item = item;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription (String description) {
+        this.description = description;
+    }
+
+    public int getQuantity() {
+        return quantity;
+    }
+
+    public void setQuantity (int quantity) {
+        this.quantity = quantity;
+    }
+
+    /** 
+     * 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) {
+        OrderItem otherOrderItem = (OrderItem)other;
+        String where = "OrderItem<" + order.getOrderId() + "," + item + ">";
+        return 
+            helper.equals(order, otherOrderItem.getOrder(), where + ".order") &
+            helper.equals(item, otherOrderItem.getItem(), where + ".item");
+    }
+    
+    /** 
+     * 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((OrderItem)o);
+    }
+
+    /** 
+     * Compare two instances. This is a method in Comparator.
+     */
+    public int compare(Object o1, Object o2) {
+        return compare((OrderItem)o1, (OrderItem)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(OrderItem other) {
+        return compare(this, other);
+    }
+
+    /**
+     * Compares its two OrderItem 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 OrderItem object to be compared. 
+     * @param o2 the second OrderItem 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(OrderItem o1, OrderItem o2) {
+        int retval = o1.getOrder().compareTo(o2.getOrder());
+        if (retval != 0) {
+            return retval;
+        }
+        return EqualityHelper.compare(o1.getItem(), o2.getItem());
+    }
+    
+    /** 
+     * 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 OrderItem) {
+            return compareTo((OrderItem)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)(order.orderId + item);
+    }
+
+    /**
+     * The class to be used as the application identifier
+     * for the <code>OrderItem</code> class. It consists of both the order 
+     * and the item fields.
+     */
+    public static class OrderItemOid implements Serializable, Comparable {
+        public Order.OrderOid order; //matches order field name and OrderId type
+        public long item; // matches item field name and type
+
+        /** The required public no-arg constructor. */
+        public OrderItemOid() { }
+
+        public OrderItemOid(String s) {
+            order = new Order.OrderOid();
+            order.orderId = Long.parseLong(justTheOrder(s)); 
+            item = Long.parseLong(justTheItem(s)); 
+        }
+
+        public String toString() {
+            return this.getClass().getName() + "order:"
+                + order.orderId + ",item:" + item;
+        }
+        
+        /** */
+        public boolean equals(Object obj) {
+            if (obj==null || !this.getClass().equals(obj.getClass())) 
+                return false;
+            OrderItemOid o = (OrderItemOid) obj;
+            if ((this.order != o.order) || (this.item != o.item)) {
+                return false;
+            }
+            return true;
+        }
+
+        /** */
+        public int hashCode() {
+            return (int)(item + order.orderId);
+        }
+        
+        protected static String justTheOrder(String str) {
+            return str.substring(str.indexOf("order:") + 6,
+                    str.indexOf(",item:"));
+        }
+
+        protected static String justTheItem(String str) {
+            return str.substring(str.indexOf("item:") + 5);
+        }
+
+        /** */
+        public int compareTo(Object obj) {
+            // may throw ClassCastException which the user must handle
+            OrderItemOid other = (OrderItemOid) obj;
+            if( order.orderId < other.order.orderId ) return -1;
+            if( order.orderId > other.order.orderId ) return 1;
+            if( item < other.item ) return -1;
+            if( item > other.item ) return 1;
+            return 0;
+        }
+    }
+}
+

Propchange: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderItem.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderModelReader.java
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderModelReader.java?view=auto&rev=508529
==============================================================================
--- db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderModelReader.java (added)
+++ db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderModelReader.java Fri Feb 16 10:25:53 2007
@@ -0,0 +1,150 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+ 
+package org.apache.jdo.tck.pc.order;
+
+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 order model instances from an xml
+ * representation. 
+ *
+ */
+public class OrderModelReader 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 = "orderFactory";
+
+    /** The order factory instance. */
+    private OrderFactory orderFactory;
+
+    /** 
+     * Create a OrderModelReader for the specified resourceName. 
+     * @param resourceName the name of the resource
+     */
+    public OrderModelReader(String resourceName) {
+        // Use the class loader of the Order class to find the resource
+        this(resourceName, Order.class.getClassLoader());
+    }
+
+    /** 
+     * Create a OrderModelReader for the specified resourceName. 
+     * @param resourceName the name of the resource
+     */
+    public OrderModelReader(String resourceName, ClassLoader classLoader) {
+        super(new ClassPathResource(resourceName, classLoader));
+        configureFactory();
+    }
+
+    /**
+     * Create a OrderModelReader for the specified InputStream.
+     * @param stream the input stream
+     */
+    public OrderModelReader(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 OrderModelReader, 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);
+        orderFactory = OrderFactoryRegistry.getInstance();
+        addSingleton(BEAN_FACTORY_NAME, orderFactory);
+    }
+    
+    // Convenience methods
+
+    /** 
+     * Convenience method returning a Order instance for the specified 
+     * name. The method returns <code>null</code> if there is no Order
+     * 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
+     * Order bean.
+     */
+    public Order getOrder(String name) {
+        return (Order)getBean(name, Order.class);
+    }
+
+    /** 
+     * Convenience method returning a OrderItem 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 OrderItem getOrderItem(String name) {
+        return (OrderItem)getBean(name, OrderItem.class);
+    }
+
+    /**
+     * @return Returns the tearDownClasses.
+     */
+    public Class[] getTearDownClassesFromFactory() {
+        return orderFactory.getTearDownClasses();
+    }
+    
+    /**
+     * @return Returns the tearDownClasses.
+     */
+    public static Class[] getTearDownClasses() {
+        return OrderFactoryConcreteClass.tearDownClasses;
+    }
+
+    public static Date stringToUtilDate(String value) {
+        return ConversionHelper.toUtilDate(DATE_PATTERN, "America/New_York",
+                Locale.US, value);
+    }
+}
+

Propchange: db/jdo/trunk/tck20/src/java/org/apache/jdo/tck/pc/order/OrderModelReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: db/jdo/trunk/tck20/src/jdo/applicationidentity/org/apache/jdo/tck/pc/order/package.jdo
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/jdo/applicationidentity/org/apache/jdo/tck/pc/order/package.jdo?view=auto&rev=508529
==============================================================================
--- db/jdo/trunk/tck20/src/jdo/applicationidentity/org/apache/jdo/tck/pc/order/package.jdo (added)
+++ db/jdo/trunk/tck20/src/jdo/applicationidentity/org/apache/jdo/tck/pc/order/package.jdo Fri Feb 16 10:25:53 2007
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<jdo xmlns="http://java.sun.com/xml/ns/jdo/jdo"
+     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+     xsi:schemaLocation="http://java.sun.com/xml/ns/jdo/jdo 
+	http://java.sun.com/xml/ns/jdo/jdo_2_0.xsd">
+<!--
+This file contains the schema information when an implementation
+has application identity.
+-->
+    <package name="org.apache.jdo.tck.pc.order">
+
+        <class name="Order"
+            identity-type="application"
+            objectid-class="org.apache.jdo.tck.pc.order.Order$OrderOid">
+            <field name="orderId" primary-key="true"/>
+            <field name="items" persistence-modifier="persistent">
+                <collection
+                    element-type="org.apache.jdo.tck.pc.order.OrderItem"/>
+            </field>
+        </class>
+
+        <class name="OrderItem"
+            identity-type="application"
+            objectid-class="org.apache.jdo.tck.pc.order.OrderItem$OrderItemOid">
+            <field name="order" primary-key="true"/>
+            <field name="item" primary-key="true"/>
+        </class>
+
+    </package>
+</jdo>

Added: db/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/pc/order/package-standard.orm
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/pc/order/package-standard.orm?view=auto&rev=508529
==============================================================================
--- db/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/pc/order/package-standard.orm (added)
+++ db/jdo/trunk/tck20/src/orm/applicationidentity/org/apache/jdo/tck/pc/order/package-standard.orm Fri Feb 16 10:25:53 2007
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<orm xmlns="http://java.sun.com/xml/ns/jdo/orm"
+     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+     xsi:schemaLocation="http://java.sun.com/xml/ns/jdo/orm 
+	http://java.sun.com/xml/ns/jdo/orm_2_0.xsd">
+<!--
+This file contains the schema information when an implementation
+has application identity.
+-->
+    <package name="org.apache.jdo.tck.pc.order">
+
+        <class name="Order" table="Orders">
+            <field name="orderId" column="ID"/>
+            <field name="customerId" column="CUSTOMERID"/>
+            <field name="items" mapped-by="order"/>
+        </class>
+
+        <class name="OrderItem" table="Item">
+            <field name="item" column="ID"/>
+            <field name="order" column="ORDERID">
+                <foreign-key/>
+            </field>
+            <field name="description" column="DESCRIPTION"/>
+            <field name="quantity" column="QUANTITY"/>
+        </class>
+    </package>
+</orm>

Modified: db/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema.sql
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema.sql?view=diff&rev=508529&r1=508528&r2=508529
==============================================================================
--- db/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema.sql (original)
+++ db/jdo/trunk/tck20/src/sql/derby/applicationidentity/schema.sql Fri Feb 16 10:25:53 2007
@@ -21,6 +21,27 @@
 SET SCHEMA applicationidentity0;
 
 -------------------------
+-- order
+-------------------------
+DROP TABLE Item;
+DROP TABLE Orders;
+
+CREATE TABLE Orders (
+    ID BIGINT NOT NULL,
+    CUSTOMERID BIGINT,
+    CONSTRAINT ORDER_CONST PRIMARY KEY (ID)
+);
+
+CREATE TABLE Item (
+    ID BIGINT NOT NULL,
+    ORDERID BIGINT,
+    DESCRIPTION VARCHAR(64),
+    QUANTITY INT,
+    CONSTRAINT ITEM_ORDER_FK FOREIGN KEY (ORDERID) REFERENCES Orders(ID),
+    CONSTRAINT ITEM_CONST PRIMARY KEY (ID, ORDERID)
+);
+
+-------------------------
 -- mylib
 -------------------------
 

Added: db/jdo/trunk/tck20/src/testdata/org/apache/jdo/tck/pc/order/order.xml
URL: http://svn.apache.org/viewvc/db/jdo/trunk/tck20/src/testdata/org/apache/jdo/tck/pc/order/order.xml?view=auto&rev=508529
==============================================================================
--- db/jdo/trunk/tck20/src/testdata/org/apache/jdo/tck/pc/order/order.xml (added)
+++ db/jdo/trunk/tck20/src/testdata/org/apache/jdo/tck/pc/order/order.xml Fri Feb 16 10:25:53 2007
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+
+<beans>
+    <description>Order instances for CompletenessTest of compound identity</description>
+
+    <bean id="root" class="java.util.ArrayList">
+        <constructor-arg index="0">
+            <list>
+                <ref local="order1"/>
+            </list>
+        </constructor-arg>
+    </bean>
+
+    <bean id="order1" factory-bean="orderFactory" factory-method="newOrder">
+        <constructor-arg index="0" type="long"><value>1</value></constructor-arg>
+        <constructor-arg index="1" type="long"><value>3</value></constructor-arg>
+        <property name="items">
+            <set>
+                <ref local="item1"/>
+                <ref local="item2"/>
+            </set>
+        </property>
+    </bean>
+
+    <bean id="item1" factory-bean="orderFactory" factory-method="newOrderItem">
+        <constructor-arg index="0" type="org.apache.jdo.tck.pc.order.Order">
+            <ref local="order1"/></constructor-arg>
+        <constructor-arg index="1" type="long" ><value>1</value>
+        </constructor-arg>
+        <constructor-arg index="2" type="java.lang.String" >
+            <value>SunRay</value></constructor-arg>
+        <constructor-arg index="3" type="int" ><value>15</value>
+        </constructor-arg>
+    </bean>
+
+    <bean id="item2" factory-bean="orderFactory" factory-method="newOrderItem">
+        <constructor-arg index="0" type="org.apache.jdo.tck.pc.order.Order">
+            <ref local="order1"/></constructor-arg>
+        <constructor-arg index="1" type="long" ><value>1</value>
+        </constructor-arg>
+        <constructor-arg index="2" type="java.lang.String" >
+            <value>Sun Ultra 40</value></constructor-arg>
+        <constructor-arg index="3" type="int" ><value>3</value>
+        </constructor-arg>
+    </bean>
+
+</beans>
+



Mime
View raw message