From c3dd53255fa67775fa54561f65342910b59d2d2b Mon Sep 17 00:00:00 2001 From: Tilmann Date: Thu, 27 Feb 2025 18:36:05 +0100 Subject: [PATCH 01/43] OrderTest w/o XML --- .../apache/jdo/tck/AbstractReaderTest.java | 31 ++- .../tck/mapping/CompletenessTestOrder.java | 6 +- .../order/DefaultListableInstanceFactory.java | 29 +++ .../org/apache/jdo/tck/pc/order/Order.java | 10 +- .../pc/order/OrderFactoryAbstractImpl.java | 7 + .../jdo/tck/pc/order/OrderModelReader2.java | 191 ++++++++++++++++++ 6 files changed, 269 insertions(+), 5 deletions(-) create mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/order/DefaultListableInstanceFactory.java create mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader2.java diff --git a/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java b/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java index e58504ad7..8b61fd4d5 100644 --- a/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java +++ b/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java @@ -24,6 +24,8 @@ import java.util.Map; import javax.jdo.JDOFatalInternalException; import javax.jdo.LegacyJava; + +import org.apache.jdo.tck.pc.order.DefaultListableInstanceFactory; import org.springframework.beans.factory.support.DefaultListableBeanFactory; /* @@ -55,7 +57,23 @@ protected Object getBean(final DefaultListableBeanFactory factory, final String } protected T getBean( - final DefaultListableBeanFactory factory, Class clazz, final String name) { + final DefaultListableBeanFactory factory, Class clazz, final String name) { + return doPrivileged(() -> factory.getBean(name, clazz)); + } + + /** + * Get the named bean from the bean factory. + * + * @param factory the bean factory + * @param name the name of the bean + * @return the named object + */ + protected Object getBean(final DefaultListableInstanceFactory factory, final String name) { + return doPrivileged(() -> factory.getBean(name)); + } + + protected T getBean( + final DefaultListableInstanceFactory factory, Class clazz, final String name) { return doPrivileged(() -> factory.getBean(name, clazz)); } @@ -82,6 +100,17 @@ protected List getRootList(DefaultListableBeanFactory factory) { return (List) getBean(factory, ROOT_NAME); } + /** + * Get the root object from the bean factory. + * + * @param factory the bean factory + * @return the List of objects + */ + @SuppressWarnings("unchecked") + protected List getRootList(DefaultListableInstanceFactory factory) { + return (List) getBean(factory, ROOT_NAME); + } + /** * Get the named object from the Map of objects. * diff --git a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestOrder.java b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestOrder.java index 0e4682753..dcc536232 100644 --- a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestOrder.java +++ b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestOrder.java @@ -21,7 +21,7 @@ import java.util.List; import org.apache.jdo.tck.AbstractReaderTest; import org.apache.jdo.tck.pc.order.OrderFactoryRegistry; -import org.apache.jdo.tck.pc.order.OrderModelReader; +import org.apache.jdo.tck.pc.order.OrderModelReader2; import org.apache.jdo.tck.util.DeepEquality; import org.apache.jdo.tck.util.EqualityHelper; import org.junit.jupiter.api.Test; @@ -48,7 +48,7 @@ protected void localSetUp() { if (runsWithApplicationIdentity()) { getPM(); OrderFactoryRegistry.registerFactory(pm); - OrderModelReader reader = new OrderModelReader(inputFilename); + OrderModelReader2 reader = new OrderModelReader2(inputFilename); addTearDownClass(reader.getTearDownClassesFromFactory()); // persist test data pm.currentTransaction().begin(); @@ -70,7 +70,7 @@ public void test() { // register the default factory OrderFactoryRegistry.registerFactory(); // get new obj graph to compare persistent graph with - OrderModelReader reader = new OrderModelReader(inputFilename); + OrderModelReader2 reader = new OrderModelReader2(inputFilename); List rootList = getRootList(reader); getPM(); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/order/DefaultListableInstanceFactory.java b/tck/src/main/java/org/apache/jdo/tck/pc/order/DefaultListableInstanceFactory.java new file mode 100644 index 000000000..0db98ac2c --- /dev/null +++ b/tck/src/main/java/org/apache/jdo/tck/pc/order/DefaultListableInstanceFactory.java @@ -0,0 +1,29 @@ +package org.apache.jdo.tck.pc.order; + +import java.util.HashMap; + +public class DefaultListableInstanceFactory { + + private final HashMap rootMap = new HashMap<>(); // TODO concurrent? + + public synchronized Object getBean(String name) { + if (!rootMap.containsKey(name)) { + throw new IllegalArgumentException("Not found: " + name); + } + if (rootMap.get(name) == null) { + throw new IllegalArgumentException("Not found2: " + name); + } + Object o = rootMap.get(name); + System.err.println("Found: " +name + " -->> " + o.getClass()); + // throw new IllegalStateException("Found: " +name + " -->> " + o.getClass()); + return rootMap.get(name); + } + + public T getBean(String name, Class clazz) { + return clazz.cast(getBean(name)); + } + + protected synchronized void register(String name, Object obj) { + rootMap.put(name, obj); + } +} diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/order/Order.java b/tck/src/main/java/org/apache/jdo/tck/pc/order/Order.java index b857b7624..9f6b8f8db 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/order/Order.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/order/Order.java @@ -19,6 +19,7 @@ import java.io.Serializable; import java.util.Comparator; +import java.util.HashSet; import java.util.Set; import org.apache.jdo.tck.util.DeepEquality; import org.apache.jdo.tck.util.EqualityHelper; @@ -28,7 +29,7 @@ public class Order implements Serializable, Comparable, Comparator private static final long serialVersionUID = 1L; long orderId; - Set items; + Set items = new HashSet<>(); long customerId; public Order() {} @@ -68,6 +69,13 @@ public void setCustomerId(long customerId) { this.customerId = customerId; } + public void addItem(OrderItem item) { + if (items == null) { + items = new HashSet<>(); + } + items.add(item); + } + /** * Returns true if all the fields of this instance are deep equal to the coresponding * fields of the specified Person. diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderFactoryAbstractImpl.java b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderFactoryAbstractImpl.java index 436e8eab7..6629b9c45 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderFactoryAbstractImpl.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderFactoryAbstractImpl.java @@ -59,6 +59,7 @@ public Order newOrder(long orderId, long customerId) { return result; } + @Deprecated // TODO (TZ) remove public Order newOrder(long orderId, Set items, long customerId) { Order result = newOrder(); result.setOrderId(orderId); @@ -71,6 +72,12 @@ public Order newOrder(long orderId, Set items, long customerId) { public OrderItem newOrderItem(Order order, long item, String description, int quantity) { OrderItem result = newOrderItem(); result.setOrder(order); + // TODO order.addItem(result); // TODO (TZ) This causes an error: + // org.datanucleus.exceptions.NucleusDataStoreException: + // Insert of object "org.apache.jdo.tck.pc.order.OrderItem@6d6fadb8" using statement + // "INSERT INTO APPLICATIONIDENTITY0.ITEM (DESCRIPTION,QUANTITY,ID,ORDERID) VALUES (?,?,?,?)" failed : + // The statement was aborted because it would have caused a duplicate key value in a unique or primary key + // constraint or unique index identified by 'ITEM_CONST' defined on 'ITEM'. result.setItem(item); result.setDescription(description); result.setQuantity(quantity); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader2.java b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader2.java new file mode 100644 index 000000000..d1ff7c2d9 --- /dev/null +++ b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader2.java @@ -0,0 +1,191 @@ +/* + * 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 + * + * https://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.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Locale; +import org.apache.jdo.tck.util.ConversionHelper; +import org.apache.jdo.tck.util.JDOCustomDateEditor; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; +import org.springframework.core.io.ClassPathResource; + +/** Utility class to create a graph of order model instances from an xml representation. */ +public class OrderModelReader2 extends DefaultListableInstanceFactory { + + private static final long serialVersionUID = 1L; + + /** 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; + + /** Bean definition reader */ + // private final XmlBeanDefinitionReader reader; + + /** + * Create a OrderModelReader for the specified resourceName. + * + * @param resourceName the name of the resource + */ + public OrderModelReader2(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 + * @param classLoader the ClassLOader for the lookup + */ + public OrderModelReader2(String resourceName, ClassLoader classLoader) { + super(); + configureFactory(); + // this.reader = new XmlBeanDefinitionReader(this); + // this.reader.loadBeanDefinitions(new ClassPathResource(resourceName, classLoader)); + init(); + } + + /** + * 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 + */ + @SuppressWarnings("unchecked") + public List getRootList() { + return (List) getBean(ROOT_LIST_NAME); + } + + private void init() { + + + +// +// +// +// +// +// +// + +// +// 1 +// 3 +// +// +// +// +// +// +// + + Order order1 = orderFactory.newOrder(1, 3); + + + + OrderItem item1 = orderFactory.newOrderItem(order1, 1, "SunRay", 15); +// +// +// +// 1 +// +// +// SunRay +// 15 +// +// + + OrderItem item2 = orderFactory.newOrderItem(order1, 1, "SUn Ultra 40", 3); +// +// +// +// 1 +// +// +// Sun Ultra 40 +// 3 +// +// + + List roots = new ArrayList<>(); + roots.add(order1); + + register("order1", order1); + register(ROOT_LIST_NAME, roots); + } + + /** + * 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() { + // registerCustomEditor(Date.class, JDOCustomDateEditor.class); + orderFactory = OrderFactoryRegistry.getInstance(); + // addSingleton(BEAN_FACTORY_NAME, orderFactory); + } + + // Convenience methods + + /** + * Convenience method returning a Order instance for the specified name. The method returns + * null 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 null if there no Order bean. + */ + public Order getOrder(String name) { + return getBean(name, Order.class); + } + + /** + * Convenience method returning a OrderItem instance for the specified name. The method returns + * null 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 null if there no Department bean. + */ + public OrderItem getOrderItem(String name) { + return 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(JDOCustomDateEditor.DATE_PATTERN, Locale.US, value); + } +} From f2db5834a4f7a2b028bd3642c6f65d0988e24b98 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Thu, 27 Feb 2025 18:36:28 +0100 Subject: [PATCH 02/43] MyLibTest w/o XML - WIP --- .../apache/jdo/tck/pc/mylib/MylibReader.java | 4 +- .../apache/jdo/tck/pc/mylib/MylibReader2.java | 148 ++++++++++++++++++ .../org/apache/jdo/tck/pc/mylib/PCClass.java | 8 + .../org/apache/jdo/tck/query/QueryTest.java | 15 +- 4 files changed, 166 insertions(+), 9 deletions(-) create mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader2.java diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java index 3751f078d..68a043811 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java @@ -45,7 +45,7 @@ public class MylibReader extends DefaultListableBeanFactory { * * @param resourceName the name of the resource */ - public MylibReader(String resourceName) { + private MylibReader(String resourceName) { // Use the class loader of the PrimitiveTypes class to find the resource this(resourceName, PrimitiveTypes.class.getClassLoader()); } @@ -56,7 +56,7 @@ public MylibReader(String resourceName) { * @param resourceName the name of the resource * @param classLoader the ClassLoader for the lookup */ - public MylibReader(String resourceName, ClassLoader classLoader) { + private MylibReader(String resourceName, ClassLoader classLoader) { super(); configureFactory(); this.reader = new XmlBeanDefinitionReader(this); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader2.java b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader2.java new file mode 100644 index 000000000..a9072bab9 --- /dev/null +++ b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader2.java @@ -0,0 +1,148 @@ +/* + * 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 + * + * https://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.mylib; + +import java.util.ArrayList; +import java.util.List; +import org.apache.jdo.tck.pc.order.DefaultListableInstanceFactory; + +/** Utility class to create a mylib instances from an xml representation. */ +public class MylibReader2 extends DefaultListableInstanceFactory { + + private static final long serialVersionUID = 1L; + + /** The name of the root list bean. */ + private static final String ROOT_LIST_NAME = "root"; + + /** Teardown classes */ + @SuppressWarnings("rawtypes") + private static final Class[] tearDownClasses = + new Class[] {PrimitiveTypes.class, PCClass.class}; + + /** + * Create a MylibReader for the specified resourceName. + * + * @param resourceName the name of the resource + */ + public MylibReader2(String resourceName) { + // Use the class loader of the PrimitiveTypes class to find the resource + this(resourceName, PrimitiveTypes.class.getClassLoader()); + } + + /** + * Create a MylibReader for the specified resourceName. + * + * @param resourceName the name of the resource + * @param classLoader the ClassLoader for the lookup + */ + public MylibReader2(String resourceName, ClassLoader classLoader) { + super(); + // configureFactory(); + init(); + } + + private void init() { + System.err.println("MyLibReader2.init()"); + PrimitiveTypes primitiveTypesPositive = + new PrimitiveTypes( + 1L, + false, + null, + (byte) 0, + null, + (short) 0, + null, + 4, + 4, + 4, + Long.valueOf(4), + 4.0f, + 4.0f, + 4.0, + 4.0, + (char) 0, + null, + null, + null, + null, + null, + null); + PrimitiveTypes primitiveTypesNegative = + new PrimitiveTypes( + 2L, false, null, (byte) 0, null, (short) 0, null, -4, -4, -4, -4L, -4.0f, -4.0f, -4.0, + -4.0, (char) 0, null, null, null, null, null, null); + PCClass pcClass1 = new PCClass(1, 10, 10, 0, 0); + PCClass pcClass2 = new PCClass(2, 20, 20, 0, 0); + PrimitiveTypes primitiveTypesCharacterStringLiterals = + new PrimitiveTypes( + 3, false, null, (byte) 0, null, (short) 0, null, 0, null, 0, null, 0, null, 0, null, + (char) 0, (char) 0, null, "Even", null, null, null); + + List roots = new ArrayList<>(); + roots.add(primitiveTypesPositive); + roots.add(primitiveTypesNegative); + roots.add(pcClass1); + roots.add(pcClass2); + roots.add(primitiveTypesCharacterStringLiterals); + register("primitiveTypesPositive", primitiveTypesPositive); + register("primitiveTypesNegative", primitiveTypesNegative); + register("pcClass1", pcClass1); + register("pcClass2", pcClass2); + register("primitiveTypesCharacterStringLiterals", primitiveTypesCharacterStringLiterals); + register(ROOT_LIST_NAME, roots); + } + + /** + * 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 + */ + @SuppressWarnings("unchecked") + public List getRootList() { + return (List) getBean(ROOT_LIST_NAME); + } + + // /** + // * Configure the MylibReader, e.g. register CustomEditor classes to convert the string + // * representation of a property into an instance of the right type. + // */ + // private void configureFactory() { + // registerCustomEditor(Date.class, JDOCustomDateEditor.class); + // } + + // Convenience methods + + /** + * Convenience method returning an Address instance for the specified name. The method returns + * null if there is no Address bean with the specified name. + * + * @param name the name of the bean to return. + * @return the instance of the bean or null if there no Address bean. + */ + public PrimitiveTypes getPrimitiveTypes(String name) { + return getBean(name, PrimitiveTypes.class); + } + + /** + * @return Returns the tearDownClasses. + */ + public static Class[] getTearDownClasses() { + return tearDownClasses; + } +} diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/PCClass.java b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/PCClass.java index 207d9e660..4a33bd006 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/PCClass.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/PCClass.java @@ -31,6 +31,14 @@ public class PCClass implements LoadCallback { public PCClass() {} + public PCClass(long id, int number1, int number2, int transientNumber1, int transientNumber2) { + this.id = id; + this.number1 = number1; + this.number2 = number2; + this.transientNumber1 = transientNumber1; + this.transientNumber2 = transientNumber2; + } + /** * @see LoadCallback#jdoPostLoad() */ diff --git a/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java b/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java index a4ab73f57..ec9b4153f 100644 --- a/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java +++ b/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java @@ -39,6 +39,7 @@ import org.apache.jdo.tck.AbstractReaderTest; import org.apache.jdo.tck.pc.company.CompanyModelReader; import org.apache.jdo.tck.pc.mylib.MylibReader; +import org.apache.jdo.tck.pc.mylib.MylibReader2; import org.apache.jdo.tck.pc.mylib.PCPoint; import org.apache.jdo.tck.pc.mylib.PrimitiveTypes; import org.apache.jdo.tck.util.ConversionHelper; @@ -82,13 +83,13 @@ public abstract class QueryTest extends AbstractReaderTest { * The mylib reader is used to read mylib instances from an XML file. Instances refered by this * reader are made persistent by {@link QueryTest#loadAndPersistMylib(PersistenceManager)}. */ - private MylibReader mylibReaderForPersistentInstances; + private MylibReader2 mylibReaderForPersistentInstances; /** * The mylib reader is used to read mylib instances from an XML file. Instances refered by this * reader are made persistent by */ - private MylibReader mylibReaderForTransientInstances; + private MylibReader2 mylibReaderForTransientInstances; // Helper methods to create persistent PCPoint instances @@ -204,9 +205,9 @@ private CompanyModelReader getCompanyModelReaderForTransientInstances() { * * @return the mylib reader for persistent instances. */ - private MylibReader getMylibReaderForPersistentInstances() { + private MylibReader2 getMylibReaderForPersistentInstances() { if (mylibReaderForPersistentInstances == null) { - mylibReaderForPersistentInstances = new MylibReader(MYLIB_TESTDATA); + mylibReaderForPersistentInstances = new MylibReader2(MYLIB_TESTDATA); } return mylibReaderForPersistentInstances; } @@ -216,9 +217,9 @@ private MylibReader getMylibReaderForPersistentInstances() { * * @return the mylib reader for transient instances. */ - private MylibReader getMylibReaderForTransientInstances() { + private MylibReader2 getMylibReaderForTransientInstances() { if (mylibReaderForTransientInstances == null) { - mylibReaderForTransientInstances = new MylibReader(MYLIB_TESTDATA); + mylibReaderForTransientInstances = new MylibReader2(MYLIB_TESTDATA); } return mylibReaderForTransientInstances; } @@ -244,7 +245,7 @@ public CompanyModelReader loadAndPersistCompanyModel(PersistenceManager pm) { * @param pm the PersistenceManager * @return mylib reader */ - public MylibReader loadAndPersistMylib(PersistenceManager pm) { + public MylibReader2 loadAndPersistMylib(PersistenceManager pm) { makePersistentAll(pm, getRootList(getMylibReaderForPersistentInstances())); return getMylibReaderForPersistentInstances(); } From 917210e6061287376d74cb87f1464574506cb8d8 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 2 Mar 2025 17:28:03 +0100 Subject: [PATCH 03/43] Fixed concurrency issue when running ResultClassRequirementsMap query test --- .../org/apache/jdo/tck/pc/mylib/MylibReader.java | 2 +- .../java/org/apache/jdo/tck/query/QueryTest.java | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java index 68a043811..4a1f2ff13 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java @@ -45,7 +45,7 @@ public class MylibReader extends DefaultListableBeanFactory { * * @param resourceName the name of the resource */ - private MylibReader(String resourceName) { + public MylibReader(String resourceName) { // Use the class loader of the PrimitiveTypes class to find the resource this(resourceName, PrimitiveTypes.class.getClassLoader()); } diff --git a/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java b/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java index ec9b4153f..9c2930705 100644 --- a/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java +++ b/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java @@ -83,13 +83,13 @@ public abstract class QueryTest extends AbstractReaderTest { * The mylib reader is used to read mylib instances from an XML file. Instances refered by this * reader are made persistent by {@link QueryTest#loadAndPersistMylib(PersistenceManager)}. */ - private MylibReader2 mylibReaderForPersistentInstances; + private MylibReader mylibReaderForPersistentInstances; /** * The mylib reader is used to read mylib instances from an XML file. Instances refered by this * reader are made persistent by */ - private MylibReader2 mylibReaderForTransientInstances; + private MylibReader mylibReaderForTransientInstances; // Helper methods to create persistent PCPoint instances @@ -205,9 +205,9 @@ private CompanyModelReader getCompanyModelReaderForTransientInstances() { * * @return the mylib reader for persistent instances. */ - private MylibReader2 getMylibReaderForPersistentInstances() { + private MylibReader getMylibReaderForPersistentInstances() { if (mylibReaderForPersistentInstances == null) { - mylibReaderForPersistentInstances = new MylibReader2(MYLIB_TESTDATA); + mylibReaderForPersistentInstances = new MylibReader(MYLIB_TESTDATA); } return mylibReaderForPersistentInstances; } @@ -217,9 +217,9 @@ private MylibReader2 getMylibReaderForPersistentInstances() { * * @return the mylib reader for transient instances. */ - private MylibReader2 getMylibReaderForTransientInstances() { + private MylibReader getMylibReaderForTransientInstances() { if (mylibReaderForTransientInstances == null) { - mylibReaderForTransientInstances = new MylibReader2(MYLIB_TESTDATA); + mylibReaderForTransientInstances = new MylibReader(MYLIB_TESTDATA); } return mylibReaderForTransientInstances; } @@ -245,7 +245,7 @@ public CompanyModelReader loadAndPersistCompanyModel(PersistenceManager pm) { * @param pm the PersistenceManager * @return mylib reader */ - public MylibReader2 loadAndPersistMylib(PersistenceManager pm) { + public MylibReader loadAndPersistMylib(PersistenceManager pm) { makePersistentAll(pm, getRootList(getMylibReaderForPersistentInstances())); return getMylibReaderForPersistentInstances(); } From 0e5af20167b2561adafb4d58fab431474e906f53 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 2 Mar 2025 17:43:34 +0100 Subject: [PATCH 04/43] Fix query.conf failure --- .../java/org/apache/jdo/tck/query/result/Variable.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tck/src/main/java/org/apache/jdo/tck/query/result/Variable.java b/tck/src/main/java/org/apache/jdo/tck/query/result/Variable.java index fd9fb6acf..3e333878f 100644 --- a/tck/src/main/java/org/apache/jdo/tck/query/result/Variable.java +++ b/tck/src/main/java/org/apache/jdo/tck/query/result/Variable.java @@ -212,7 +212,7 @@ public void testNavigation() { /** */ @SuppressWarnings("unchecked") @Test - @Execution(ExecutionMode.CONCURRENT) + //@Execution(ExecutionMode.CONCURRENT) public void testNoNavigation() { List expected = getTransientCompanyModelInstancesAsList( @@ -296,7 +296,7 @@ public void testMultipleProjectionWithConstraints() { /** */ @SuppressWarnings("unchecked") @Test - @Execution(ExecutionMode.CONCURRENT) + //@Execution(ExecutionMode.CONCURRENT) public void testNavigationWithCompanyAndDepartmentAndEmployeeAndProject() { Object expected = Arrays.asList( @@ -352,7 +352,7 @@ public void testNavigationWithCompanyAndDepartmentAndEmployeeAndProject() { /** */ @SuppressWarnings("unchecked") @Test - @Execution(ExecutionMode.CONCURRENT) + //@Execution(ExecutionMode.CONCURRENT) // TODO this fixed it public void testNavigationWithCompanyAndEmployeeAndProject() { Object expected = Arrays.asList( @@ -652,7 +652,7 @@ public void testNavigationWithThisConstraint() { /** */ @SuppressWarnings("unchecked") @Test - @Execution(ExecutionMode.CONCURRENT) + //@Execution(ExecutionMode.CONCURRENT) public void testNavigationWithCompanyConstraint() { Object expected = Arrays.asList( From 07bce2d4531c73d0353c66f4780191fa838ff9f5 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 2 Mar 2025 17:44:41 +0100 Subject: [PATCH 05/43] Fixed concurrency issue when running query.Variable test --- .../java/org/apache/jdo/tck/query/result/Variable.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tck/src/main/java/org/apache/jdo/tck/query/result/Variable.java b/tck/src/main/java/org/apache/jdo/tck/query/result/Variable.java index 3e333878f..f2d54605e 100644 --- a/tck/src/main/java/org/apache/jdo/tck/query/result/Variable.java +++ b/tck/src/main/java/org/apache/jdo/tck/query/result/Variable.java @@ -18,6 +18,7 @@ package org.apache.jdo.tck.query.result; import java.util.Arrays; +import java.util.Collections; import java.util.List; import javax.jdo.JDOQLTypedQuery; import javax.jdo.PersistenceManager; @@ -130,7 +131,7 @@ public void testDistinctNoNavigation() { @Execution(ExecutionMode.CONCURRENT) public void testDistinctNavigation() { Object elem = new Object[] {Long.valueOf(1), "orange"}; - Object expected = Arrays.asList(elem); + Object expected = Collections.singletonList(elem); PersistenceManager pm = getPMF().getPersistenceManager(); try { JDOQLTypedQuery query = pm.newJDOQLTypedQuery(Employee.class); @@ -263,7 +264,7 @@ public void testMultipleProjectionWithConstraints() { JDOQLTypedQuery query = pm.newJDOQLTypedQuery(Department.class); QDepartment cand = QDepartment.candidate("this"); QEmployee e = QEmployee.variable("e"); - query.filter(cand.deptid.eq(2l).and(cand.employees.contains(e))); + query.filter(cand.deptid.eq(2L).and(cand.employees.contains(e))); query.result(false, e); // SELECT e FROM Department WHERE deptid==2 & employees.contains(e) VARIABLES Employee e @@ -620,7 +621,7 @@ public void testNavigationWithThisConstraint() { QDepartment cand = QDepartment.candidate("this"); QEmployee e = QEmployee.variable("e"); QProject p = QProject.variable("p"); - query.filter(cand.deptid.eq(1l).and(cand.employees.contains(e)).and(e.projects.contains(p))); + query.filter(cand.deptid.eq(1L).and(cand.employees.contains(e)).and(e.projects.contains(p))); query.result(false, e, p); QueryElementHolder holder = From dfb7b5583aeedc44871f2e5922265345ea890e32 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 2 Mar 2025 18:37:22 +0100 Subject: [PATCH 06/43] QUeryTest with new factory --- .../org/apache/jdo/tck/pc/mylib/MylibReader.java | 2 +- .../java/org/apache/jdo/tck/query/QueryTest.java | 15 +++++++-------- .../org/apache/jdo/tck/query/result/Variable.java | 8 ++++---- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java index 4a1f2ff13..68a043811 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java @@ -45,7 +45,7 @@ public class MylibReader extends DefaultListableBeanFactory { * * @param resourceName the name of the resource */ - public MylibReader(String resourceName) { + private MylibReader(String resourceName) { // Use the class loader of the PrimitiveTypes class to find the resource this(resourceName, PrimitiveTypes.class.getClassLoader()); } diff --git a/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java b/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java index 9c2930705..40050dca2 100644 --- a/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java +++ b/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java @@ -38,7 +38,6 @@ import javax.jdo.Transaction; import org.apache.jdo.tck.AbstractReaderTest; import org.apache.jdo.tck.pc.company.CompanyModelReader; -import org.apache.jdo.tck.pc.mylib.MylibReader; import org.apache.jdo.tck.pc.mylib.MylibReader2; import org.apache.jdo.tck.pc.mylib.PCPoint; import org.apache.jdo.tck.pc.mylib.PrimitiveTypes; @@ -83,13 +82,13 @@ public abstract class QueryTest extends AbstractReaderTest { * The mylib reader is used to read mylib instances from an XML file. Instances refered by this * reader are made persistent by {@link QueryTest#loadAndPersistMylib(PersistenceManager)}. */ - private MylibReader mylibReaderForPersistentInstances; + private MylibReader2 mylibReaderForPersistentInstances; /** * The mylib reader is used to read mylib instances from an XML file. Instances refered by this * reader are made persistent by */ - private MylibReader mylibReaderForTransientInstances; + private MylibReader2 mylibReaderForTransientInstances; // Helper methods to create persistent PCPoint instances @@ -205,9 +204,9 @@ private CompanyModelReader getCompanyModelReaderForTransientInstances() { * * @return the mylib reader for persistent instances. */ - private MylibReader getMylibReaderForPersistentInstances() { + private MylibReader2 getMylibReaderForPersistentInstances() { if (mylibReaderForPersistentInstances == null) { - mylibReaderForPersistentInstances = new MylibReader(MYLIB_TESTDATA); + mylibReaderForPersistentInstances = new MylibReader2(MYLIB_TESTDATA); } return mylibReaderForPersistentInstances; } @@ -217,9 +216,9 @@ private MylibReader getMylibReaderForPersistentInstances() { * * @return the mylib reader for transient instances. */ - private MylibReader getMylibReaderForTransientInstances() { + private MylibReader2 getMylibReaderForTransientInstances() { if (mylibReaderForTransientInstances == null) { - mylibReaderForTransientInstances = new MylibReader(MYLIB_TESTDATA); + mylibReaderForTransientInstances = new MylibReader2(MYLIB_TESTDATA); } return mylibReaderForTransientInstances; } @@ -245,7 +244,7 @@ public CompanyModelReader loadAndPersistCompanyModel(PersistenceManager pm) { * @param pm the PersistenceManager * @return mylib reader */ - public MylibReader loadAndPersistMylib(PersistenceManager pm) { + public MylibReader2 loadAndPersistMylib(PersistenceManager pm) { makePersistentAll(pm, getRootList(getMylibReaderForPersistentInstances())); return getMylibReaderForPersistentInstances(); } diff --git a/tck/src/main/java/org/apache/jdo/tck/query/result/Variable.java b/tck/src/main/java/org/apache/jdo/tck/query/result/Variable.java index f2d54605e..0f894e166 100644 --- a/tck/src/main/java/org/apache/jdo/tck/query/result/Variable.java +++ b/tck/src/main/java/org/apache/jdo/tck/query/result/Variable.java @@ -131,7 +131,7 @@ public void testDistinctNoNavigation() { @Execution(ExecutionMode.CONCURRENT) public void testDistinctNavigation() { Object elem = new Object[] {Long.valueOf(1), "orange"}; - Object expected = Collections.singletonList(elem); + Object expected = Arrays.asList(elem); PersistenceManager pm = getPMF().getPersistenceManager(); try { JDOQLTypedQuery query = pm.newJDOQLTypedQuery(Employee.class); @@ -264,7 +264,7 @@ public void testMultipleProjectionWithConstraints() { JDOQLTypedQuery query = pm.newJDOQLTypedQuery(Department.class); QDepartment cand = QDepartment.candidate("this"); QEmployee e = QEmployee.variable("e"); - query.filter(cand.deptid.eq(2L).and(cand.employees.contains(e))); + query.filter(cand.deptid.eq(2l).and(cand.employees.contains(e))); query.result(false, e); // SELECT e FROM Department WHERE deptid==2 & employees.contains(e) VARIABLES Employee e @@ -297,7 +297,7 @@ public void testMultipleProjectionWithConstraints() { /** */ @SuppressWarnings("unchecked") @Test - //@Execution(ExecutionMode.CONCURRENT) + // @Execution(ExecutionMode.CONCURRENT) TODO fails! public void testNavigationWithCompanyAndDepartmentAndEmployeeAndProject() { Object expected = Arrays.asList( @@ -621,7 +621,7 @@ public void testNavigationWithThisConstraint() { QDepartment cand = QDepartment.candidate("this"); QEmployee e = QEmployee.variable("e"); QProject p = QProject.variable("p"); - query.filter(cand.deptid.eq(1L).and(cand.employees.contains(e)).and(e.projects.contains(p))); + query.filter(cand.deptid.eq(1l).and(cand.employees.contains(e)).and(e.projects.contains(p))); query.result(false, e, p); QueryElementHolder holder = From b434ad8d167b52798e6ec82fccc61f389484acfb Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 2 Mar 2025 19:29:46 +0100 Subject: [PATCH 07/43] Fix for result.Variable see JDO-851 --- .../apache/jdo/tck/pc/mylib/MylibReader2.java | 41 -------- .../order/DefaultListableInstanceFactory.java | 39 ++++---- .../jdo/tck/pc/order/OrderModelReader2.java | 97 +------------------ 3 files changed, 25 insertions(+), 152 deletions(-) diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader2.java b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader2.java index a9072bab9..69d47f803 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader2.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader2.java @@ -26,9 +26,6 @@ public class MylibReader2 extends DefaultListableInstanceFactory { private static final long serialVersionUID = 1L; - /** The name of the root list bean. */ - private static final String ROOT_LIST_NAME = "root"; - /** Teardown classes */ @SuppressWarnings("rawtypes") private static final Class[] tearDownClasses = @@ -40,19 +37,7 @@ public class MylibReader2 extends DefaultListableInstanceFactory { * @param resourceName the name of the resource */ public MylibReader2(String resourceName) { - // Use the class loader of the PrimitiveTypes class to find the resource - this(resourceName, PrimitiveTypes.class.getClassLoader()); - } - - /** - * Create a MylibReader for the specified resourceName. - * - * @param resourceName the name of the resource - * @param classLoader the ClassLoader for the lookup - */ - public MylibReader2(String resourceName, ClassLoader classLoader) { super(); - // configureFactory(); init(); } @@ -93,39 +78,13 @@ private void init() { 3, false, null, (byte) 0, null, (short) 0, null, 0, null, 0, null, 0, null, 0, null, (char) 0, (char) 0, null, "Even", null, null, null); - List roots = new ArrayList<>(); - roots.add(primitiveTypesPositive); - roots.add(primitiveTypesNegative); - roots.add(pcClass1); - roots.add(pcClass2); - roots.add(primitiveTypesCharacterStringLiterals); register("primitiveTypesPositive", primitiveTypesPositive); register("primitiveTypesNegative", primitiveTypesNegative); register("pcClass1", pcClass1); register("pcClass2", pcClass2); register("primitiveTypesCharacterStringLiterals", primitiveTypesCharacterStringLiterals); - register(ROOT_LIST_NAME, roots); } - /** - * 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 - */ - @SuppressWarnings("unchecked") - public List getRootList() { - return (List) getBean(ROOT_LIST_NAME); - } - - // /** - // * Configure the MylibReader, e.g. register CustomEditor classes to convert the string - // * representation of a property into an instance of the right type. - // */ - // private void configureFactory() { - // registerCustomEditor(Date.class, JDOCustomDateEditor.class); - // } - // Convenience methods /** diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/order/DefaultListableInstanceFactory.java b/tck/src/main/java/org/apache/jdo/tck/pc/order/DefaultListableInstanceFactory.java index 0db98ac2c..b76f98e5b 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/order/DefaultListableInstanceFactory.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/order/DefaultListableInstanceFactory.java @@ -1,29 +1,32 @@ package org.apache.jdo.tck.pc.order; +import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; +import java.util.List; public class DefaultListableInstanceFactory { - private final HashMap rootMap = new HashMap<>(); // TODO concurrent? + private final HashMap rootMap = new HashMap<>(); + private final List rootList = new ArrayList<>(); - public synchronized Object getBean(String name) { - if (!rootMap.containsKey(name)) { - throw new IllegalArgumentException("Not found: " + name); - } - if (rootMap.get(name) == null) { - throw new IllegalArgumentException("Not found2: " + name); - } - Object o = rootMap.get(name); - System.err.println("Found: " +name + " -->> " + o.getClass()); - // throw new IllegalStateException("Found: " +name + " -->> " + o.getClass()); - return rootMap.get(name); + public synchronized Object getBean(String name) { + if ("root".equals(name)) { + return getRootList(); } + return rootMap.get(name); + } - public T getBean(String name, Class clazz) { - return clazz.cast(getBean(name)); - } + public T getBean(String name, Class clazz) { + return clazz.cast(getBean(name)); + } - protected synchronized void register(String name, Object obj) { - rootMap.put(name, obj); - } + protected synchronized void register(String name, Object obj) { + rootMap.put(name, obj); + rootList.add(obj); + } + + public synchronized List getRootList() { + return Collections.unmodifiableList(rootList); + } } diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader2.java b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader2.java index d1ff7c2d9..8eedfc2f2 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader2.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader2.java @@ -17,124 +17,35 @@ package org.apache.jdo.tck.pc.order; -import java.util.ArrayList; import java.util.Date; -import java.util.List; import java.util.Locale; import org.apache.jdo.tck.util.ConversionHelper; import org.apache.jdo.tck.util.JDOCustomDateEditor; -import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; -import org.springframework.core.io.ClassPathResource; /** Utility class to create a graph of order model instances from an xml representation. */ public class OrderModelReader2 extends DefaultListableInstanceFactory { private static final long serialVersionUID = 1L; - /** 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; - /** Bean definition reader */ - // private final XmlBeanDefinitionReader reader; - /** * Create a OrderModelReader for the specified resourceName. * * @param resourceName the name of the resource */ public OrderModelReader2(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 - * @param classLoader the ClassLOader for the lookup - */ - public OrderModelReader2(String resourceName, ClassLoader classLoader) { super(); configureFactory(); - // this.reader = new XmlBeanDefinitionReader(this); - // this.reader.loadBeanDefinitions(new ClassPathResource(resourceName, classLoader)); init(); } - /** - * 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 - */ - @SuppressWarnings("unchecked") - public List getRootList() { - return (List) getBean(ROOT_LIST_NAME); - } - private void init() { - - - -// -// -// -// -// -// -// - -// -// 1 -// 3 -// -// -// -// -// -// -// - - Order order1 = orderFactory.newOrder(1, 3); - - - - OrderItem item1 = orderFactory.newOrderItem(order1, 1, "SunRay", 15); -// -// -// -// 1 -// -// -// SunRay -// 15 -// -// - - OrderItem item2 = orderFactory.newOrderItem(order1, 1, "SUn Ultra 40", 3); -// -// -// -// 1 -// -// -// Sun Ultra 40 -// 3 -// -// - - List roots = new ArrayList<>(); - roots.add(order1); - - register("order1", order1); - register(ROOT_LIST_NAME, roots); + Order order1 = orderFactory.newOrder(1, 3); + OrderItem item1 = orderFactory.newOrderItem(order1, 1, "SunRay", 15); + OrderItem item2 = orderFactory.newOrderItem(order1, 1, "Sun Ultra 40", 3); + register("order1", order1); } /** From 0b66774b82a32fde0960541a21ece97a4d186d73 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 2 Mar 2025 20:18:16 +0100 Subject: [PATCH 08/43] Remove XML --- .../apache/jdo/tck/AbstractReaderTest.java | 1 + .../jdo/tck/mapping/CompletenessTestMap.java | 6 +- .../CompanyModelReader2.java | 248 ++++++++++++++++++ .../pc/companyMapWithoutJoin/Department.java | 8 + .../pc/companyMapWithoutJoin/IDepartment.java | 2 + 5 files changed, 262 insertions(+), 3 deletions(-) create mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader2.java diff --git a/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java b/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java index 8b61fd4d5..8c05c5367 100644 --- a/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java +++ b/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java @@ -85,6 +85,7 @@ private static T doPrivileged(PrivilegedAction privilegedAction) { if (e.getCause() instanceof RuntimeException) { throw (RuntimeException) e.getCause(); } + e.printStackTrace(); throw new JDOFatalInternalException(e.getMessage()); } } diff --git a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestMap.java b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestMap.java index c32ed40a8..c3c5987a7 100644 --- a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestMap.java +++ b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestMap.java @@ -21,7 +21,7 @@ import java.util.List; import org.apache.jdo.tck.AbstractReaderTest; import org.apache.jdo.tck.pc.companyMapWithoutJoin.CompanyFactoryRegistry; -import org.apache.jdo.tck.pc.companyMapWithoutJoin.CompanyModelReader; +import org.apache.jdo.tck.pc.companyMapWithoutJoin.CompanyModelReader2; import org.apache.jdo.tck.util.DeepEquality; import org.apache.jdo.tck.util.EqualityHelper; import org.junit.jupiter.api.Test; @@ -48,7 +48,7 @@ protected void localSetUp() { if (isTestToBePerformed) { getPM(); CompanyFactoryRegistry.registerFactory(pm); - CompanyModelReader reader = new CompanyModelReader(inputFilename); + CompanyModelReader2 reader = new CompanyModelReader2(inputFilename); addTearDownClass(reader.getTearDownClassesFromFactory()); // persist test data pm.currentTransaction().begin(); @@ -70,7 +70,7 @@ public void test() { // register the default factory CompanyFactoryRegistry.registerFactory(); // get new obj graph to compare persistent graph with - CompanyModelReader reader = new CompanyModelReader(inputFilename); + CompanyModelReader2 reader = new CompanyModelReader2(inputFilename); List rootList = getRootList(reader); getPM(); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader2.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader2.java new file mode 100644 index 000000000..84ae87f00 --- /dev/null +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader2.java @@ -0,0 +1,248 @@ +/* + * 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 + * + * https://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.*; +import java.util.stream.Collectors; +import org.apache.jdo.tck.pc.order.DefaultListableInstanceFactory; +import org.apache.jdo.tck.util.ConversionHelper; +import org.apache.jdo.tck.util.JDOCustomDateEditor; + +/** + * Utility class to create a graph of company model instances from an xml representation. + * + * @author Michael Bouschen + */ +public class CompanyModelReader2 extends DefaultListableInstanceFactory { + + private static final long serialVersionUID = 1L; + + /** The company factory instance. */ + private CompanyFactory companyFactory; + + /** + * Create a CompanyModelReader for the specified resourceName. + * + * @param resourceName the name of the resource + */ + public CompanyModelReader2(String resourceName) { + super(); + configureFactory(); + init(); + } + + private void init() { + ICompany company1 = + companyFactory.newCompany(1L, "Sun Microsystems, Inc.", new Date(1952, 4, 11, 0, 0, 0)); + super.register("company1", company1); + + IDepartment dept1 = companyFactory.newDepartment(1, "Development", company1); + IDepartment dept2 = companyFactory.newDepartment(2, "Human Resources", company1); + company1.setDepartments(toSet(dept1, dept2)); + + IFullTimeEmployee emp1 = + companyFactory.newFullTimeEmployee( + 1, + "emp1First", + "emp1Last", + "emp1Middle", + new Date(1970, 6, 10, 0, 0, 0), + new Date(1999, 1, 1, 0, 0, 0), + "role1", + 60000); + + IFullTimeEmployee emp2 = + companyFactory.newFullTimeEmployee( + 2, + "emp2First", + "emp2Last", + "emp2Middle", + new Date(1975, 12, 22, 0, 0, 0), + new Date(2003, 7, 1, 0, 0, 0), + "role2", + 47000); + + IFullTimeEmployee emp3 = + companyFactory.newFullTimeEmployee( + 3, + "emp3First", + "emp3Last", + "emp3Middle", + new Date(1972, 7, 5, 0, 0, 0), + new Date(2002, 8, 15, 0, 0, 0), + "role3", + 67.00); + + IFullTimeEmployee emp4 = + companyFactory.newFullTimeEmployee( + 4, + "emp4First", + "emp4Last", + "emp4Middle", + new Date(1973, 7, 6, 0, 0, 0), + new Date(2001, 4, 15, 0, 0, 0), + "role4", + 37.00); + + IFullTimeEmployee emp5 = + companyFactory.newFullTimeEmployee( + 5, + "emp5First", + "emp5Last", + "emp5Middle", + new Date(1962, 7, 5, 0, 0, 0), + new Date(1998, 8, 15, 0, 0, 0), + "role5", + 73000); + + emp1.setWeeklyhours(40); + emp1.setDepartment(dept1); + emp1.setFundingDept(dept2); + emp1.setManager(emp2); + emp1.setHradvisor(emp5); + dept1.add(emp1); // TODO do this inside setDepartment + + emp2.setWeeklyhours(40); + emp2.setDepartment(dept1); + emp2.setFundingDept(dept1); + emp2.setHradvisor(emp5); + emp2.setTeam(toSet(emp1, emp3, emp4, emp5)); + dept1.add(emp2); // TODO do this inside setDepartment + + emp3.setWeeklyhours(19); + emp3.setDepartment(dept1); + emp3.setFundingDept(dept1); + emp3.setManager(emp2); + emp3.setHradvisor(emp5); + dept1.add(emp3); // TODO do this inside setDepartment + + // emp4.setWeeklyhours(19); + emp4.setDepartment(dept2); + emp4.setFundingDept(dept2); + emp4.setManager(emp2); + emp4.setHradvisor(emp5); + dept2.add(emp4); // TODO do this inside setDepartment + + // emp5.setWeeklyhours(19); + emp5.setDepartment(dept2); + emp5.setFundingDept(dept2); + emp5.setManager(emp2); + emp5.setHradvisees(toSet(emp1, emp2, emp3, emp4)); + dept2.add(emp5); // TODO do this inside setDepartment + } + + private Set toSet(T... objs) { + return Arrays.stream(objs).collect(Collectors.toSet()); + } + + /** + * 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() { + // registerCustomEditor(Date.class, JDOCustomDateEditor.class); + companyFactory = CompanyFactoryRegistry.getInstance(); + // addSingleton(BEAN_FACTORY_NAME, companyFactory); + } + + // Convenience methods + + /** + * Convenience method returning a Company instance for the specified name. The method returns + * null 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 null if there no Company bean. + */ + public Company getCompany(String name) { + return getBean(name, Company.class); + } + + /** + * Convenience method returning a Department instance for the specified name. The method returns + * null 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 null if there no Department bean. + */ + public Department getDepartment(String name) { + return getBean(name, Department.class); + } + + /** + * Convenience method returning an Employee instance for the specified name. The method returns + * null 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 null if there no Employee bean. + */ + public Employee getEmployee(String name) { + return getBean(name, Employee.class); + } + + /** + * Convenience method returning a FullTimeEmployee instance for the specified name. The method + * returns null 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 null if there no FullTimeEmployee bean. + */ + public FullTimeEmployee getFullTimeEmployee(String name) { + return getBean(name, FullTimeEmployee.class); + } + + /** + * Convenience method returning a PartTimeEmployee instance for the specified name. The method + * returns null 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 null if there no PartTimeEmployee bean. + */ + public PartTimeEmployee getPartTimeEmployee(String name) { + return getBean(name, PartTimeEmployee.class); + } + + /** + * Convenience method returning a Person instance for the specified name. The method returns + * null 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 null if there no Person bean. + */ + public Person getPerson(String name) { + return 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(JDOCustomDateEditor.DATE_PATTERN, Locale.US, value); + } +} diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Department.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Department.java index 0e6cec11c..c3518dd16 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Department.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Department.java @@ -19,6 +19,7 @@ import java.io.Serializable; import java.util.Comparator; +import java.util.HashMap; import java.util.Map; import org.apache.jdo.tck.util.DeepEquality; import org.apache.jdo.tck.util.EqualityHelper; @@ -177,6 +178,13 @@ public void setRoles(Map roles) { this.roles = roles; } + public void add(IEmployee emp) { + if (roles == null) { + roles = new HashMap<>(); + } + roles.put(emp.getRole(), emp); + } + /** * Returns true if all the fields of this instance are deep equal to the coresponding * fields of the other Department. diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IDepartment.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IDepartment.java index 0e71d58a3..934923b42 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IDepartment.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IDepartment.java @@ -40,4 +40,6 @@ public interface IDepartment { void setCompany(ICompany company); void setRoles(Map roles); + + void add(IEmployee emp); } From aff9816a28878abace32215ab21e4ad15f500369 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 9 Mar 2025 18:47:11 +0100 Subject: [PATCH 09/43] Remove XML --- .../tck/mapping/CompletenessTestOrder.java | 6 +-- .../jdo/tck/pc/order/OrderModelReader.java | 47 ++++-------------- ...lReader2.java => OrderModelReaderOld.java} | 49 +++++++++++++++---- 3 files changed, 51 insertions(+), 51 deletions(-) rename tck/src/main/java/org/apache/jdo/tck/pc/order/{OrderModelReader2.java => OrderModelReaderOld.java} (65%) diff --git a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestOrder.java b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestOrder.java index dcc536232..0e4682753 100644 --- a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestOrder.java +++ b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestOrder.java @@ -21,7 +21,7 @@ import java.util.List; import org.apache.jdo.tck.AbstractReaderTest; import org.apache.jdo.tck.pc.order.OrderFactoryRegistry; -import org.apache.jdo.tck.pc.order.OrderModelReader2; +import org.apache.jdo.tck.pc.order.OrderModelReader; import org.apache.jdo.tck.util.DeepEquality; import org.apache.jdo.tck.util.EqualityHelper; import org.junit.jupiter.api.Test; @@ -48,7 +48,7 @@ protected void localSetUp() { if (runsWithApplicationIdentity()) { getPM(); OrderFactoryRegistry.registerFactory(pm); - OrderModelReader2 reader = new OrderModelReader2(inputFilename); + OrderModelReader reader = new OrderModelReader(inputFilename); addTearDownClass(reader.getTearDownClassesFromFactory()); // persist test data pm.currentTransaction().begin(); @@ -70,7 +70,7 @@ public void test() { // register the default factory OrderFactoryRegistry.registerFactory(); // get new obj graph to compare persistent graph with - OrderModelReader2 reader = new OrderModelReader2(inputFilename); + OrderModelReader reader = new OrderModelReader(inputFilename); List rootList = getRootList(reader); getPM(); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java index e0be14b64..4853aa27c 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java @@ -18,63 +18,34 @@ package org.apache.jdo.tck.pc.order; import java.util.Date; -import java.util.List; import java.util.Locale; import org.apache.jdo.tck.util.ConversionHelper; import org.apache.jdo.tck.util.JDOCustomDateEditor; -import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; -import org.springframework.core.io.ClassPathResource; /** Utility class to create a graph of order model instances from an xml representation. */ -public class OrderModelReader extends DefaultListableBeanFactory { +public class OrderModelReader extends DefaultListableInstanceFactory { private static final long serialVersionUID = 1L; - /** 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; - /** Bean definition reader */ - private final XmlBeanDefinitionReader reader; - /** * 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 - * @param classLoader the ClassLOader for the lookup - */ - public OrderModelReader(String resourceName, ClassLoader classLoader) { super(); configureFactory(); - this.reader = new XmlBeanDefinitionReader(this); - this.reader.loadBeanDefinitions(new ClassPathResource(resourceName, classLoader)); + init(); } - /** - * 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 - */ - @SuppressWarnings("unchecked") - public List getRootList() { - return (List) getBean(ROOT_LIST_NAME); + private void init() { + Order order1 = orderFactory.newOrder(1, 3); + OrderItem item1 = orderFactory.newOrderItem(order1, 1, "SunRay", 15); + OrderItem item2 = orderFactory.newOrderItem(order1, 1, "Sun Ultra 40", 3); + register("order1", order1); } /** @@ -82,9 +53,9 @@ public List getRootList() { * representation of a property into an instance of the right type. */ private void configureFactory() { - registerCustomEditor(Date.class, JDOCustomDateEditor.class); + // registerCustomEditor(Date.class, JDOCustomDateEditor.class); orderFactory = OrderFactoryRegistry.getInstance(); - addSingleton(BEAN_FACTORY_NAME, orderFactory); + // addSingleton(BEAN_FACTORY_NAME, orderFactory); } // Convenience methods diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader2.java b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReaderOld.java similarity index 65% rename from tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader2.java rename to tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReaderOld.java index 8eedfc2f2..1670864bf 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader2.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReaderOld.java @@ -18,34 +18,63 @@ package org.apache.jdo.tck.pc.order; import java.util.Date; +import java.util.List; import java.util.Locale; import org.apache.jdo.tck.util.ConversionHelper; import org.apache.jdo.tck.util.JDOCustomDateEditor; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; +import org.springframework.core.io.ClassPathResource; /** Utility class to create a graph of order model instances from an xml representation. */ -public class OrderModelReader2 extends DefaultListableInstanceFactory { +public class OrderModelReaderOld extends DefaultListableBeanFactory { private static final long serialVersionUID = 1L; + /** 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; + /** Bean definition reader */ + private final XmlBeanDefinitionReader reader; + /** * Create a OrderModelReader for the specified resourceName. * * @param resourceName the name of the resource */ - public OrderModelReader2(String resourceName) { + public OrderModelReaderOld(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 + * @param classLoader the ClassLOader for the lookup + */ + public OrderModelReaderOld(String resourceName, ClassLoader classLoader) { super(); configureFactory(); - init(); + this.reader = new XmlBeanDefinitionReader(this); + this.reader.loadBeanDefinitions(new ClassPathResource(resourceName, classLoader)); } - private void init() { - Order order1 = orderFactory.newOrder(1, 3); - OrderItem item1 = orderFactory.newOrderItem(order1, 1, "SunRay", 15); - OrderItem item2 = orderFactory.newOrderItem(order1, 1, "Sun Ultra 40", 3); - register("order1", order1); + /** + * 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 + */ + @SuppressWarnings("unchecked") + public List getRootList() { + return (List) getBean(ROOT_LIST_NAME); } /** @@ -53,9 +82,9 @@ private void init() { * representation of a property into an instance of the right type. */ private void configureFactory() { - // registerCustomEditor(Date.class, JDOCustomDateEditor.class); + registerCustomEditor(Date.class, JDOCustomDateEditor.class); orderFactory = OrderFactoryRegistry.getInstance(); - // addSingleton(BEAN_FACTORY_NAME, orderFactory); + addSingleton(BEAN_FACTORY_NAME, orderFactory); } // Convenience methods From fc4b89914c44399152f7d65f993ef12e2815c258 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Mon, 10 Mar 2025 22:11:38 +0100 Subject: [PATCH 10/43] Remove XML --- tck/src/main/java/org/apache/jdo/tck/pc/order/Order.java | 3 --- .../apache/jdo/tck/pc/order/OrderFactoryAbstractImpl.java | 6 ------ .../java/org/apache/jdo/tck/pc/order/OrderModelReader.java | 2 ++ 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/order/Order.java b/tck/src/main/java/org/apache/jdo/tck/pc/order/Order.java index 9f6b8f8db..ad7113c79 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/order/Order.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/order/Order.java @@ -70,9 +70,6 @@ public void setCustomerId(long customerId) { } public void addItem(OrderItem item) { - if (items == null) { - items = new HashSet<>(); - } items.add(item); } diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderFactoryAbstractImpl.java b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderFactoryAbstractImpl.java index 6629b9c45..3d0515c47 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderFactoryAbstractImpl.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderFactoryAbstractImpl.java @@ -72,12 +72,6 @@ public Order newOrder(long orderId, Set items, long customerId) { public OrderItem newOrderItem(Order order, long item, String description, int quantity) { OrderItem result = newOrderItem(); result.setOrder(order); - // TODO order.addItem(result); // TODO (TZ) This causes an error: - // org.datanucleus.exceptions.NucleusDataStoreException: - // Insert of object "org.apache.jdo.tck.pc.order.OrderItem@6d6fadb8" using statement - // "INSERT INTO APPLICATIONIDENTITY0.ITEM (DESCRIPTION,QUANTITY,ID,ORDERID) VALUES (?,?,?,?)" failed : - // The statement was aborted because it would have caused a duplicate key value in a unique or primary key - // constraint or unique index identified by 'ITEM_CONST' defined on 'ITEM'. result.setItem(item); result.setDescription(description); result.setQuantity(quantity); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java index 4853aa27c..a4aa52f05 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java @@ -45,6 +45,8 @@ private void init() { Order order1 = orderFactory.newOrder(1, 3); OrderItem item1 = orderFactory.newOrderItem(order1, 1, "SunRay", 15); OrderItem item2 = orderFactory.newOrderItem(order1, 1, "Sun Ultra 40", 3); + order1.addItem(item1); + order1.addItem(item2); register("order1", order1); } From a093a96e8f824b72be2fd8cb315cb69820e7f7c1 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 6 Apr 2025 18:55:40 +0200 Subject: [PATCH 11/43] Clean up --- .../jdo/tck/mapping/CompletenessTestMap.java | 6 +- .../CompanyModelReader.java | 149 ++++++++++++----- ...eader2.java => CompanyModelReaderOld.java} | 151 +++++------------- .../apache/jdo/tck/pc/mylib/MylibReader.java | 89 ++++++----- ...{MylibReader2.java => MylibReaderOld.java} | 89 +++++------ .../order/DefaultListableInstanceFactory.java | 1 + .../org/apache/jdo/tck/query/QueryTest.java | 16 +- .../jdoql/CharacterAndStringLiterals.java | 1 + .../jdoql/methods/SupportedMathMethods.java | 1 + 9 files changed, 252 insertions(+), 251 deletions(-) rename tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/{CompanyModelReader2.java => CompanyModelReaderOld.java} (58%) rename tck/src/main/java/org/apache/jdo/tck/pc/mylib/{MylibReader2.java => MylibReaderOld.java} (52%) diff --git a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestMap.java b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestMap.java index c3c5987a7..c32ed40a8 100644 --- a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestMap.java +++ b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestMap.java @@ -21,7 +21,7 @@ import java.util.List; import org.apache.jdo.tck.AbstractReaderTest; import org.apache.jdo.tck.pc.companyMapWithoutJoin.CompanyFactoryRegistry; -import org.apache.jdo.tck.pc.companyMapWithoutJoin.CompanyModelReader2; +import org.apache.jdo.tck.pc.companyMapWithoutJoin.CompanyModelReader; import org.apache.jdo.tck.util.DeepEquality; import org.apache.jdo.tck.util.EqualityHelper; import org.junit.jupiter.api.Test; @@ -48,7 +48,7 @@ protected void localSetUp() { if (isTestToBePerformed) { getPM(); CompanyFactoryRegistry.registerFactory(pm); - CompanyModelReader2 reader = new CompanyModelReader2(inputFilename); + CompanyModelReader reader = new CompanyModelReader(inputFilename); addTearDownClass(reader.getTearDownClassesFromFactory()); // persist test data pm.currentTransaction().begin(); @@ -70,7 +70,7 @@ public void test() { // register the default factory CompanyFactoryRegistry.registerFactory(); // get new obj graph to compare persistent graph with - CompanyModelReader2 reader = new CompanyModelReader2(inputFilename); + CompanyModelReader reader = new CompanyModelReader(inputFilename); List rootList = getRootList(reader); getPM(); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java index 80ac84b40..881405ec6 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java @@ -17,68 +17,137 @@ package org.apache.jdo.tck.pc.companyMapWithoutJoin; -import java.util.Date; -import java.util.List; -import java.util.Locale; +import java.util.*; +import java.util.stream.Collectors; +import org.apache.jdo.tck.pc.order.DefaultListableInstanceFactory; import org.apache.jdo.tck.util.ConversionHelper; import org.apache.jdo.tck.util.JDOCustomDateEditor; -import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; -import org.springframework.core.io.ClassPathResource; /** * Utility class to create a graph of company model instances from an xml representation. * * @author Michael Bouschen */ -public class CompanyModelReader extends DefaultListableBeanFactory { +public class CompanyModelReader extends DefaultListableInstanceFactory { private static final long serialVersionUID = 1L; - /** 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; - /** Bean definition reader */ - private final XmlBeanDefinitionReader reader; - /** * 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 - * @param classLoader the ClassLoader for the lookup - */ - public CompanyModelReader(String resourceName, ClassLoader classLoader) { super(); configureFactory(); - this.reader = new XmlBeanDefinitionReader(this); - this.reader.loadBeanDefinitions(new ClassPathResource(resourceName, classLoader)); + init(); } - /** - * 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 - */ - @SuppressWarnings("unchecked") - public List getRootList() { - return (List) getBean(ROOT_LIST_NAME); + private void init() { + ICompany company1 = + companyFactory.newCompany(1L, "Sun Microsystems, Inc.", new Date(1952, 4, 11, 0, 0, 0)); + super.register("company1", company1); + + IDepartment dept1 = companyFactory.newDepartment(1, "Development", company1); + IDepartment dept2 = companyFactory.newDepartment(2, "Human Resources", company1); + company1.setDepartments(toSet(dept1, dept2)); + + IFullTimeEmployee emp1 = + companyFactory.newFullTimeEmployee( + 1, + "emp1First", + "emp1Last", + "emp1Middle", + new Date(1970, 6, 10, 0, 0, 0), + new Date(1999, 1, 1, 0, 0, 0), + "role1", + 60000); + + IFullTimeEmployee emp2 = + companyFactory.newFullTimeEmployee( + 2, + "emp2First", + "emp2Last", + "emp2Middle", + new Date(1975, 12, 22, 0, 0, 0), + new Date(2003, 7, 1, 0, 0, 0), + "role2", + 47000); + + IFullTimeEmployee emp3 = + companyFactory.newFullTimeEmployee( + 3, + "emp3First", + "emp3Last", + "emp3Middle", + new Date(1972, 7, 5, 0, 0, 0), + new Date(2002, 8, 15, 0, 0, 0), + "role3", + 67.00); + + IFullTimeEmployee emp4 = + companyFactory.newFullTimeEmployee( + 4, + "emp4First", + "emp4Last", + "emp4Middle", + new Date(1973, 7, 6, 0, 0, 0), + new Date(2001, 4, 15, 0, 0, 0), + "role4", + 37.00); + + IFullTimeEmployee emp5 = + companyFactory.newFullTimeEmployee( + 5, + "emp5First", + "emp5Last", + "emp5Middle", + new Date(1962, 7, 5, 0, 0, 0), + new Date(1998, 8, 15, 0, 0, 0), + "role5", + 73000); + + emp1.setWeeklyhours(40); + emp1.setDepartment(dept1); + emp1.setFundingDept(dept2); + emp1.setManager(emp2); + emp1.setHradvisor(emp5); + dept1.add(emp1); // TODO do this inside setDepartment + + emp2.setWeeklyhours(40); + emp2.setDepartment(dept1); + emp2.setFundingDept(dept1); + emp2.setHradvisor(emp5); + emp2.setTeam(toSet(emp1, emp3, emp4, emp5)); + dept1.add(emp2); // TODO do this inside setDepartment + + emp3.setWeeklyhours(19); + emp3.setDepartment(dept1); + emp3.setFundingDept(dept1); + emp3.setManager(emp2); + emp3.setHradvisor(emp5); + dept1.add(emp3); // TODO do this inside setDepartment + + // emp4.setWeeklyhours(19); + emp4.setDepartment(dept2); + emp4.setFundingDept(dept2); + emp4.setManager(emp2); + emp4.setHradvisor(emp5); + dept2.add(emp4); // TODO do this inside setDepartment + + // emp5.setWeeklyhours(19); + emp5.setDepartment(dept2); + emp5.setFundingDept(dept2); + emp5.setManager(emp2); + emp5.setHradvisees(toSet(emp1, emp2, emp3, emp4)); + dept2.add(emp5); // TODO do this inside setDepartment + } + + private Set toSet(T... objs) { + return Arrays.stream(objs).collect(Collectors.toSet()); } /** @@ -86,9 +155,9 @@ public List getRootList() { * representation of a property into an instance of the right type. */ private void configureFactory() { - registerCustomEditor(Date.class, JDOCustomDateEditor.class); + // registerCustomEditor(Date.class, JDOCustomDateEditor.class); companyFactory = CompanyFactoryRegistry.getInstance(); - addSingleton(BEAN_FACTORY_NAME, companyFactory); + // addSingleton(BEAN_FACTORY_NAME, companyFactory); } // Convenience methods diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader2.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReaderOld.java similarity index 58% rename from tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader2.java rename to tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReaderOld.java index 84ae87f00..53001a7b5 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader2.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReaderOld.java @@ -17,137 +17,68 @@ package org.apache.jdo.tck.pc.companyMapWithoutJoin; -import java.util.*; -import java.util.stream.Collectors; -import org.apache.jdo.tck.pc.order.DefaultListableInstanceFactory; +import java.util.Date; +import java.util.List; +import java.util.Locale; import org.apache.jdo.tck.util.ConversionHelper; import org.apache.jdo.tck.util.JDOCustomDateEditor; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; +import org.springframework.core.io.ClassPathResource; /** * Utility class to create a graph of company model instances from an xml representation. * * @author Michael Bouschen */ -public class CompanyModelReader2 extends DefaultListableInstanceFactory { +public class CompanyModelReaderOld extends DefaultListableBeanFactory { private static final long serialVersionUID = 1L; + /** 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; + /** Bean definition reader */ + private final XmlBeanDefinitionReader reader; + /** * Create a CompanyModelReader for the specified resourceName. * * @param resourceName the name of the resource */ - public CompanyModelReader2(String resourceName) { - super(); - configureFactory(); - init(); + public CompanyModelReaderOld(String resourceName) { + // Use the class loader of the Company class to find the resource + this(resourceName, Company.class.getClassLoader()); } - private void init() { - ICompany company1 = - companyFactory.newCompany(1L, "Sun Microsystems, Inc.", new Date(1952, 4, 11, 0, 0, 0)); - super.register("company1", company1); - - IDepartment dept1 = companyFactory.newDepartment(1, "Development", company1); - IDepartment dept2 = companyFactory.newDepartment(2, "Human Resources", company1); - company1.setDepartments(toSet(dept1, dept2)); - - IFullTimeEmployee emp1 = - companyFactory.newFullTimeEmployee( - 1, - "emp1First", - "emp1Last", - "emp1Middle", - new Date(1970, 6, 10, 0, 0, 0), - new Date(1999, 1, 1, 0, 0, 0), - "role1", - 60000); - - IFullTimeEmployee emp2 = - companyFactory.newFullTimeEmployee( - 2, - "emp2First", - "emp2Last", - "emp2Middle", - new Date(1975, 12, 22, 0, 0, 0), - new Date(2003, 7, 1, 0, 0, 0), - "role2", - 47000); - - IFullTimeEmployee emp3 = - companyFactory.newFullTimeEmployee( - 3, - "emp3First", - "emp3Last", - "emp3Middle", - new Date(1972, 7, 5, 0, 0, 0), - new Date(2002, 8, 15, 0, 0, 0), - "role3", - 67.00); - - IFullTimeEmployee emp4 = - companyFactory.newFullTimeEmployee( - 4, - "emp4First", - "emp4Last", - "emp4Middle", - new Date(1973, 7, 6, 0, 0, 0), - new Date(2001, 4, 15, 0, 0, 0), - "role4", - 37.00); - - IFullTimeEmployee emp5 = - companyFactory.newFullTimeEmployee( - 5, - "emp5First", - "emp5Last", - "emp5Middle", - new Date(1962, 7, 5, 0, 0, 0), - new Date(1998, 8, 15, 0, 0, 0), - "role5", - 73000); - - emp1.setWeeklyhours(40); - emp1.setDepartment(dept1); - emp1.setFundingDept(dept2); - emp1.setManager(emp2); - emp1.setHradvisor(emp5); - dept1.add(emp1); // TODO do this inside setDepartment - - emp2.setWeeklyhours(40); - emp2.setDepartment(dept1); - emp2.setFundingDept(dept1); - emp2.setHradvisor(emp5); - emp2.setTeam(toSet(emp1, emp3, emp4, emp5)); - dept1.add(emp2); // TODO do this inside setDepartment - - emp3.setWeeklyhours(19); - emp3.setDepartment(dept1); - emp3.setFundingDept(dept1); - emp3.setManager(emp2); - emp3.setHradvisor(emp5); - dept1.add(emp3); // TODO do this inside setDepartment - - // emp4.setWeeklyhours(19); - emp4.setDepartment(dept2); - emp4.setFundingDept(dept2); - emp4.setManager(emp2); - emp4.setHradvisor(emp5); - dept2.add(emp4); // TODO do this inside setDepartment - - // emp5.setWeeklyhours(19); - emp5.setDepartment(dept2); - emp5.setFundingDept(dept2); - emp5.setManager(emp2); - emp5.setHradvisees(toSet(emp1, emp2, emp3, emp4)); - dept2.add(emp5); // TODO do this inside setDepartment + /** + * Create a CompanyModelReader for the specified resourceName. + * + * @param resourceName the name of the resource + * @param classLoader the ClassLoader for the lookup + */ + public CompanyModelReaderOld(String resourceName, ClassLoader classLoader) { + super(); + configureFactory(); + this.reader = new XmlBeanDefinitionReader(this); + this.reader.loadBeanDefinitions(new ClassPathResource(resourceName, classLoader)); } - private Set toSet(T... objs) { - return Arrays.stream(objs).collect(Collectors.toSet()); + /** + * 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 + */ + @SuppressWarnings("unchecked") + public List getRootList() { + return (List) getBean(ROOT_LIST_NAME); } /** @@ -155,9 +86,9 @@ private Set toSet(T... objs) { * representation of a property into an instance of the right type. */ private void configureFactory() { - // registerCustomEditor(Date.class, JDOCustomDateEditor.class); + registerCustomEditor(Date.class, JDOCustomDateEditor.class); companyFactory = CompanyFactoryRegistry.getInstance(); - // addSingleton(BEAN_FACTORY_NAME, companyFactory); + addSingleton(BEAN_FACTORY_NAME, companyFactory); } // Convenience methods diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java index 68a043811..c23c7aeaa 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java @@ -17,69 +17,70 @@ package org.apache.jdo.tck.pc.mylib; -import java.util.Date; -import java.util.List; -import org.apache.jdo.tck.util.JDOCustomDateEditor; -import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; -import org.springframework.core.io.ClassPathResource; +import org.apache.jdo.tck.pc.order.DefaultListableInstanceFactory; /** Utility class to create a mylib instances from an xml representation. */ -public class MylibReader extends DefaultListableBeanFactory { +public class MylibReader extends DefaultListableInstanceFactory { private static final long serialVersionUID = 1L; - /** The name of the root list bean. */ - public static final String ROOT_LIST_NAME = "root"; - /** Teardown classes */ @SuppressWarnings("rawtypes") private static final Class[] tearDownClasses = new Class[] {PrimitiveTypes.class, PCClass.class}; - /** Bean definition reader */ - private final XmlBeanDefinitionReader reader; - /** * Create a MylibReader for the specified resourceName. * * @param resourceName the name of the resource */ - private MylibReader(String resourceName) { - // Use the class loader of the PrimitiveTypes class to find the resource - this(resourceName, PrimitiveTypes.class.getClassLoader()); - } - - /** - * Create a MylibReader for the specified resourceName. - * - * @param resourceName the name of the resource - * @param classLoader the ClassLoader for the lookup - */ - private MylibReader(String resourceName, ClassLoader classLoader) { + public MylibReader(String resourceName) { super(); - configureFactory(); - this.reader = new XmlBeanDefinitionReader(this); - this.reader.loadBeanDefinitions(new ClassPathResource(resourceName, classLoader)); + init(); } - /** - * 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 - */ - @SuppressWarnings("unchecked") - public List getRootList() { - return (List) getBean(ROOT_LIST_NAME); - } + private void init() { + System.err.println("MyLibReader2.init()"); + PrimitiveTypes primitiveTypesPositive = + new PrimitiveTypes( + 1L, + false, + null, + (byte) 0, + null, + (short) 0, + null, + 4, + 4, + 4, + Long.valueOf(4), + 4.0f, + 4.0f, + 4.0, + 4.0, + (char) 0, + null, + null, + null, + null, + null, + null); + PrimitiveTypes primitiveTypesNegative = + new PrimitiveTypes( + 2L, false, null, (byte) 0, null, (short) 0, null, -4, -4, -4, -4L, -4.0f, -4.0f, -4.0, + -4.0, (char) 0, null, null, null, null, null, null); + PCClass pcClass1 = new PCClass(1, 10, 10, 0, 0); + PCClass pcClass2 = new PCClass(2, 20, 20, 0, 0); + PrimitiveTypes primitiveTypesCharacterStringLiterals = + new PrimitiveTypes( + 3, false, null, (byte) 0, null, (short) 0, null, 0, null, 0, null, 0, null, 0, null, + (char) 0, (char) 0, null, "Even", null, null, null); - /** - * Configure the MylibReader, e.g. register CustomEditor classes to convert the string - * representation of a property into an instance of the right type. - */ - private void configureFactory() { - registerCustomEditor(Date.class, JDOCustomDateEditor.class); + register("primitiveTypesPositive", primitiveTypesPositive); + register("primitiveTypesNegative", primitiveTypesNegative); + register("pcClass1", pcClass1); + register("pcClass2", pcClass2); + register("primitiveTypesCharacterStringLiterals", primitiveTypesCharacterStringLiterals); } // Convenience methods diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader2.java b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReaderOld.java similarity index 52% rename from tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader2.java rename to tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReaderOld.java index 69d47f803..c6de43b05 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader2.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReaderOld.java @@ -17,72 +17,69 @@ package org.apache.jdo.tck.pc.mylib; -import java.util.ArrayList; +import java.util.Date; import java.util.List; -import org.apache.jdo.tck.pc.order.DefaultListableInstanceFactory; +import org.apache.jdo.tck.util.JDOCustomDateEditor; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; +import org.springframework.core.io.ClassPathResource; /** Utility class to create a mylib instances from an xml representation. */ -public class MylibReader2 extends DefaultListableInstanceFactory { +public class MylibReaderOld extends DefaultListableBeanFactory { private static final long serialVersionUID = 1L; + /** The name of the root list bean. */ + public static final String ROOT_LIST_NAME = "root"; + /** Teardown classes */ @SuppressWarnings("rawtypes") private static final Class[] tearDownClasses = new Class[] {PrimitiveTypes.class, PCClass.class}; + /** Bean definition reader */ + private final XmlBeanDefinitionReader reader; + /** * Create a MylibReader for the specified resourceName. * * @param resourceName the name of the resource */ - public MylibReader2(String resourceName) { + private MylibReaderOld(String resourceName) { + // Use the class loader of the PrimitiveTypes class to find the resource + this(resourceName, PrimitiveTypes.class.getClassLoader()); + } + + /** + * Create a MylibReader for the specified resourceName. + * + * @param resourceName the name of the resource + * @param classLoader the ClassLoader for the lookup + */ + private MylibReaderOld(String resourceName, ClassLoader classLoader) { super(); - init(); + configureFactory(); + this.reader = new XmlBeanDefinitionReader(this); + this.reader.loadBeanDefinitions(new ClassPathResource(resourceName, classLoader)); } - private void init() { - System.err.println("MyLibReader2.init()"); - PrimitiveTypes primitiveTypesPositive = - new PrimitiveTypes( - 1L, - false, - null, - (byte) 0, - null, - (short) 0, - null, - 4, - 4, - 4, - Long.valueOf(4), - 4.0f, - 4.0f, - 4.0, - 4.0, - (char) 0, - null, - null, - null, - null, - null, - null); - PrimitiveTypes primitiveTypesNegative = - new PrimitiveTypes( - 2L, false, null, (byte) 0, null, (short) 0, null, -4, -4, -4, -4L, -4.0f, -4.0f, -4.0, - -4.0, (char) 0, null, null, null, null, null, null); - PCClass pcClass1 = new PCClass(1, 10, 10, 0, 0); - PCClass pcClass2 = new PCClass(2, 20, 20, 0, 0); - PrimitiveTypes primitiveTypesCharacterStringLiterals = - new PrimitiveTypes( - 3, false, null, (byte) 0, null, (short) 0, null, 0, null, 0, null, 0, null, 0, null, - (char) 0, (char) 0, null, "Even", null, null, null); + /** + * 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 + */ + @SuppressWarnings("unchecked") + public List getRootList() { + return (List) getBean(ROOT_LIST_NAME); + } - register("primitiveTypesPositive", primitiveTypesPositive); - register("primitiveTypesNegative", primitiveTypesNegative); - register("pcClass1", pcClass1); - register("pcClass2", pcClass2); - register("primitiveTypesCharacterStringLiterals", primitiveTypesCharacterStringLiterals); + /** + * Configure the MylibReader, e.g. register CustomEditor classes to convert the string + * representation of a property into an instance of the right type. + */ + private void configureFactory() { + registerCustomEditor(Date.class, JDOCustomDateEditor.class); } // Convenience methods diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/order/DefaultListableInstanceFactory.java b/tck/src/main/java/org/apache/jdo/tck/pc/order/DefaultListableInstanceFactory.java index b76f98e5b..47d988e49 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/order/DefaultListableInstanceFactory.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/order/DefaultListableInstanceFactory.java @@ -27,6 +27,7 @@ protected synchronized void register(String name, Object obj) { } public synchronized List getRootList() { + new RuntimeException().printStackTrace(); return Collections.unmodifiableList(rootList); } } diff --git a/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java b/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java index 40050dca2..a4ab73f57 100644 --- a/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java +++ b/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java @@ -38,7 +38,7 @@ import javax.jdo.Transaction; import org.apache.jdo.tck.AbstractReaderTest; import org.apache.jdo.tck.pc.company.CompanyModelReader; -import org.apache.jdo.tck.pc.mylib.MylibReader2; +import org.apache.jdo.tck.pc.mylib.MylibReader; import org.apache.jdo.tck.pc.mylib.PCPoint; import org.apache.jdo.tck.pc.mylib.PrimitiveTypes; import org.apache.jdo.tck.util.ConversionHelper; @@ -82,13 +82,13 @@ public abstract class QueryTest extends AbstractReaderTest { * The mylib reader is used to read mylib instances from an XML file. Instances refered by this * reader are made persistent by {@link QueryTest#loadAndPersistMylib(PersistenceManager)}. */ - private MylibReader2 mylibReaderForPersistentInstances; + private MylibReader mylibReaderForPersistentInstances; /** * The mylib reader is used to read mylib instances from an XML file. Instances refered by this * reader are made persistent by */ - private MylibReader2 mylibReaderForTransientInstances; + private MylibReader mylibReaderForTransientInstances; // Helper methods to create persistent PCPoint instances @@ -204,9 +204,9 @@ private CompanyModelReader getCompanyModelReaderForTransientInstances() { * * @return the mylib reader for persistent instances. */ - private MylibReader2 getMylibReaderForPersistentInstances() { + private MylibReader getMylibReaderForPersistentInstances() { if (mylibReaderForPersistentInstances == null) { - mylibReaderForPersistentInstances = new MylibReader2(MYLIB_TESTDATA); + mylibReaderForPersistentInstances = new MylibReader(MYLIB_TESTDATA); } return mylibReaderForPersistentInstances; } @@ -216,9 +216,9 @@ private MylibReader2 getMylibReaderForPersistentInstances() { * * @return the mylib reader for transient instances. */ - private MylibReader2 getMylibReaderForTransientInstances() { + private MylibReader getMylibReaderForTransientInstances() { if (mylibReaderForTransientInstances == null) { - mylibReaderForTransientInstances = new MylibReader2(MYLIB_TESTDATA); + mylibReaderForTransientInstances = new MylibReader(MYLIB_TESTDATA); } return mylibReaderForTransientInstances; } @@ -244,7 +244,7 @@ public CompanyModelReader loadAndPersistCompanyModel(PersistenceManager pm) { * @param pm the PersistenceManager * @return mylib reader */ - public MylibReader2 loadAndPersistMylib(PersistenceManager pm) { + public MylibReader loadAndPersistMylib(PersistenceManager pm) { makePersistentAll(pm, getRootList(getMylibReaderForPersistentInstances())); return getMylibReaderForPersistentInstances(); } diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/CharacterAndStringLiterals.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/CharacterAndStringLiterals.java index 8799e30fc..a89387281 100644 --- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/CharacterAndStringLiterals.java +++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/CharacterAndStringLiterals.java @@ -19,6 +19,7 @@ import javax.jdo.JDOQLTypedQuery; import javax.jdo.PersistenceManager; + import org.apache.jdo.tck.pc.mylib.MylibReader; import org.apache.jdo.tck.pc.mylib.PrimitiveTypes; import org.apache.jdo.tck.pc.mylib.QPrimitiveTypes; diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/methods/SupportedMathMethods.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/methods/SupportedMathMethods.java index 161f5cb24..43c0d44df 100644 --- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/methods/SupportedMathMethods.java +++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/methods/SupportedMathMethods.java @@ -25,6 +25,7 @@ import javax.jdo.PersistenceManager; import javax.jdo.Query; import javax.jdo.Transaction; + import org.apache.jdo.tck.pc.mylib.MylibReader; import org.apache.jdo.tck.pc.mylib.PrimitiveTypes; import org.apache.jdo.tck.pc.mylib.QPrimitiveTypes; From 704a191eb109751427d722a1f77cc720eb971b6a Mon Sep 17 00:00:00 2001 From: Tilmann Date: Thu, 29 May 2025 15:54:12 +0200 Subject: [PATCH 12/43] Remove XML --- tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java | 2 +- .../jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java | 2 +- tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java | 2 +- .../main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java | 1 + .../tck/{pc/order => util}/DefaultListableInstanceFactory.java | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) rename tck/src/main/java/org/apache/jdo/tck/{pc/order => util}/DefaultListableInstanceFactory.java (95%) diff --git a/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java b/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java index 8c05c5367..3476aae0f 100644 --- a/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java +++ b/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java @@ -25,7 +25,7 @@ import javax.jdo.JDOFatalInternalException; import javax.jdo.LegacyJava; -import org.apache.jdo.tck.pc.order.DefaultListableInstanceFactory; +import org.apache.jdo.tck.util.DefaultListableInstanceFactory; import org.springframework.beans.factory.support.DefaultListableBeanFactory; /* diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java index 881405ec6..f7be52700 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java @@ -19,7 +19,7 @@ import java.util.*; import java.util.stream.Collectors; -import org.apache.jdo.tck.pc.order.DefaultListableInstanceFactory; +import org.apache.jdo.tck.util.DefaultListableInstanceFactory; import org.apache.jdo.tck.util.ConversionHelper; import org.apache.jdo.tck.util.JDOCustomDateEditor; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java index c23c7aeaa..ea9ebaa12 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java @@ -17,7 +17,7 @@ package org.apache.jdo.tck.pc.mylib; -import org.apache.jdo.tck.pc.order.DefaultListableInstanceFactory; +import org.apache.jdo.tck.util.DefaultListableInstanceFactory; /** Utility class to create a mylib instances from an xml representation. */ public class MylibReader extends DefaultListableInstanceFactory { diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java index a4aa52f05..504474932 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java @@ -20,6 +20,7 @@ import java.util.Date; import java.util.Locale; import org.apache.jdo.tck.util.ConversionHelper; +import org.apache.jdo.tck.util.DefaultListableInstanceFactory; import org.apache.jdo.tck.util.JDOCustomDateEditor; /** Utility class to create a graph of order model instances from an xml representation. */ diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/order/DefaultListableInstanceFactory.java b/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java similarity index 95% rename from tck/src/main/java/org/apache/jdo/tck/pc/order/DefaultListableInstanceFactory.java rename to tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java index 47d988e49..314eb907d 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/order/DefaultListableInstanceFactory.java +++ b/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java @@ -1,4 +1,4 @@ -package org.apache.jdo.tck.pc.order; +package org.apache.jdo.tck.util; import java.util.ArrayList; import java.util.Collections; From 46466e09f8e9912d9c3ac26a588876a64d0d105d Mon Sep 17 00:00:00 2001 From: Tilmann Date: Thu, 29 May 2025 17:50:56 +0200 Subject: [PATCH 13/43] Remove XML --- .../apache/jdo/tck/AbstractReaderTest.java | 5 +- .../CompanyModelReader.java | 127 ++++++++++--- .../CompanyModelReaderOld.java | 179 ++++++++++++++++++ .../pc/companyListWithoutJoin/Department.java | 6 +- .../companyListWithoutJoin/IDepartment.java | 2 + .../CompanyModelReader.java | 2 +- .../jdoql/CharacterAndStringLiterals.java | 1 - .../jdoql/methods/SupportedMathMethods.java | 1 - .../apache/jdo/tck/query/result/Variable.java | 7 +- 9 files changed, 296 insertions(+), 34 deletions(-) create mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReaderOld.java diff --git a/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java b/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java index 3476aae0f..0bc38244e 100644 --- a/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java +++ b/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java @@ -24,7 +24,6 @@ import java.util.Map; import javax.jdo.JDOFatalInternalException; import javax.jdo.LegacyJava; - import org.apache.jdo.tck.util.DefaultListableInstanceFactory; import org.springframework.beans.factory.support.DefaultListableBeanFactory; @@ -57,7 +56,7 @@ protected Object getBean(final DefaultListableBeanFactory factory, final String } protected T getBean( - final DefaultListableBeanFactory factory, Class clazz, final String name) { + final DefaultListableBeanFactory factory, Class clazz, final String name) { return doPrivileged(() -> factory.getBean(name, clazz)); } @@ -73,7 +72,7 @@ protected Object getBean(final DefaultListableInstanceFactory factory, final Str } protected T getBean( - final DefaultListableInstanceFactory factory, Class clazz, final String name) { + final DefaultListableInstanceFactory factory, Class clazz, final String name) { return doPrivileged(() -> factory.getBean(name, clazz)); } diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java index 67cb2857a..197c7129f 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java @@ -17,21 +17,18 @@ package org.apache.jdo.tck.pc.companyListWithoutJoin; -import java.util.Date; -import java.util.List; -import java.util.Locale; +import java.util.*; +import java.util.stream.Collectors; import org.apache.jdo.tck.util.ConversionHelper; +import org.apache.jdo.tck.util.DefaultListableInstanceFactory; import org.apache.jdo.tck.util.JDOCustomDateEditor; -import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; -import org.springframework.core.io.ClassPathResource; /** * Utility class to create a graph of company model instances from an xml representation. * * @author Michael Bouschen */ -public class CompanyModelReader extends DefaultListableBeanFactory { +public class CompanyModelReader extends DefaultListableInstanceFactory { private static final long serialVersionUID = 1L; @@ -44,9 +41,6 @@ public class CompanyModelReader extends DefaultListableBeanFactory { /** The company factory instance. */ private CompanyFactory companyFactory; - /** Bean definition reader */ - private final XmlBeanDefinitionReader reader; - /** * Create a CompanyModelReader for the specified resourceName. * @@ -66,19 +60,106 @@ public CompanyModelReader(String resourceName) { public CompanyModelReader(String resourceName, ClassLoader classLoader) { super(); configureFactory(); - this.reader = new XmlBeanDefinitionReader(this); - this.reader.loadBeanDefinitions(new ClassPathResource(resourceName, classLoader)); + init(); } - /** - * 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 - */ - @SuppressWarnings("unchecked") - public List getRootList() { - return (List) getBean(ROOT_LIST_NAME); + private void init() { + ICompany company1 = + companyFactory.newCompany(1L, "Sun Microsystems, Inc.", new Date(1952, 4, 11, 0, 0, 0)); + super.register("company1", company1); + + IDepartment dept1 = companyFactory.newDepartment(1, "Development", company1); + IDepartment dept2 = companyFactory.newDepartment(2, "Human Resources", company1); + company1.setDepartments(toSet(dept1, dept2)); + + IFullTimeEmployee emp1 = + companyFactory.newFullTimeEmployee( + 1, + "emp1First", + "emp1Last", + "emp1Middle", + new Date(1970, 6, 10, 0, 0, 0), + new Date(1999, 1, 1, 0, 0, 0), + 60000); + + IFullTimeEmployee emp2 = + companyFactory.newFullTimeEmployee( + 2, + "emp2First", + "emp2Last", + "emp2Middle", + new Date(1975, 12, 22, 0, 0, 0), + new Date(2003, 7, 1, 0, 0, 0), + 47000); + + IFullTimeEmployee emp3 = + companyFactory.newFullTimeEmployee( + 3, + "emp3First", + "emp3Last", + "emp3Middle", + new Date(1972, 7, 5, 0, 0, 0), + new Date(2002, 8, 15, 0, 0, 0), + 67.00); + + IFullTimeEmployee emp4 = + companyFactory.newFullTimeEmployee( + 4, + "emp4First", + "emp4Last", + "emp4Middle", + new Date(1973, 7, 6, 0, 0, 0), + new Date(2001, 4, 15, 0, 0, 0), + 37.00); + + IFullTimeEmployee emp5 = + companyFactory.newFullTimeEmployee( + 5, + "emp5First", + "emp5Last", + "emp5Middle", + new Date(1962, 7, 5, 0, 0, 0), + new Date(1998, 8, 15, 0, 0, 0), + 73000); + + emp1.setWeeklyhours(40); + emp1.setDepartment(dept1); + emp1.setFundingDept(dept2); + emp1.setManager(emp2); + emp1.setHradvisor(emp5); + dept1.addEmployee(emp1); // TODO do this inside setDepartment + + emp2.setWeeklyhours(40); + emp2.setDepartment(dept1); + emp2.setFundingDept(dept1); + emp2.setHradvisor(emp5); + emp2.setTeam(toSet(emp1, emp3, emp4, emp5)); + dept1.addEmployee(emp2); // TODO do this inside setDepartment + + emp3.setWeeklyhours(19); + emp3.setDepartment(dept1); + emp3.setFundingDept(dept1); + emp3.setManager(emp2); + emp3.setHradvisor(emp5); + dept1.addEmployee(emp3); // TODO do this inside setDepartment + + // emp4.setWeeklyhours(19); + emp4.setDepartment(dept2); + emp4.setFundingDept(dept2); + emp4.setManager(emp2); + emp4.setHradvisor(emp5); + dept2.addEmployee(emp4); // TODO do this inside setDepartment + + // emp5.setWeeklyhours(19); + emp5.setDepartment(dept2); + emp5.setFundingDept(dept2); + emp5.setManager(emp2); + emp5.setHradvisees(toSet(emp1, emp2, emp3, emp4)); + dept2.addEmployee(emp5); // TODO do this inside setDepartment + } + + private Set toSet(T... objs) { + return Arrays.stream(objs).collect(Collectors.toSet()); } /** @@ -86,9 +167,9 @@ public List getRootList() { * representation of a property into an instance of the right type. */ private void configureFactory() { - registerCustomEditor(Date.class, JDOCustomDateEditor.class); + // registerCustomEditor(Date.class, JDOCustomDateEditor.class); companyFactory = CompanyFactoryRegistry.getInstance(); - addSingleton(BEAN_FACTORY_NAME, companyFactory); + // addSingleton(BEAN_FACTORY_NAME, companyFactory); } // Convenience methods diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReaderOld.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReaderOld.java new file mode 100644 index 000000000..421112476 --- /dev/null +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReaderOld.java @@ -0,0 +1,179 @@ +/* + * 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 + * + * https://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.companyListWithoutJoin; + +import java.util.Date; +import java.util.List; +import java.util.Locale; +import org.apache.jdo.tck.util.ConversionHelper; +import org.apache.jdo.tck.util.JDOCustomDateEditor; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; +import org.springframework.core.io.ClassPathResource; + +/** + * Utility class to create a graph of company model instances from an xml representation. + * + * @author Michael Bouschen + */ +public class CompanyModelReaderOld extends DefaultListableBeanFactory { + + private static final long serialVersionUID = 1L; + + /** 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; + + /** Bean definition reader */ + private final XmlBeanDefinitionReader reader; + + /** + * Create a CompanyModelReader for the specified resourceName. + * + * @param resourceName the name of the resource + */ + public CompanyModelReaderOld(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 + * @param classLoader the ClassLoader for the lookup + */ + public CompanyModelReaderOld(String resourceName, ClassLoader classLoader) { + super(); + configureFactory(); + this.reader = new XmlBeanDefinitionReader(this); + this.reader.loadBeanDefinitions(new ClassPathResource(resourceName, classLoader)); + } + + /** + * 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 + */ + @SuppressWarnings("unchecked") + 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() { + registerCustomEditor(Date.class, JDOCustomDateEditor.class); + companyFactory = CompanyFactoryRegistry.getInstance(); + addSingleton(BEAN_FACTORY_NAME, companyFactory); + } + + // Convenience methods + + /** + * Convenience method returning a Company instance for the specified name. The method returns + * null 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 null if there no Company bean. + */ + public Company getCompany(String name) { + return getBean(name, Company.class); + } + + /** + * Convenience method returning a Department instance for the specified name. The method returns + * null 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 null if there no Department bean. + */ + public Department getDepartment(String name) { + return getBean(name, Department.class); + } + + /** + * Convenience method returning an Employee instance for the specified name. The method returns + * null 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 null if there no Employee bean. + */ + public Employee getEmployee(String name) { + return getBean(name, Employee.class); + } + + /** + * Convenience method returning a FullTimeEmployee instance for the specified name. The method + * returns null 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 null if there no FullTimeEmployee bean. + */ + public FullTimeEmployee getFullTimeEmployee(String name) { + return getBean(name, FullTimeEmployee.class); + } + + /** + * Convenience method returning a PartTimeEmployee instance for the specified name. The method + * returns null 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 null if there no PartTimeEmployee bean. + */ + public PartTimeEmployee getPartTimeEmployee(String name) { + return getBean(name, PartTimeEmployee.class); + } + + /** + * Convenience method returning a Person instance for the specified name. The method returns + * null 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 null if there no Person bean. + */ + public Person getPerson(String name) { + return 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(JDOCustomDateEditor.DATE_PATTERN, Locale.US, value); + } +} diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/Department.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/Department.java index 13eaa053b..8df9acb3a 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/Department.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/Department.java @@ -18,6 +18,7 @@ package org.apache.jdo.tck.pc.companyListWithoutJoin; import java.io.Serializable; +import java.util.ArrayList; import java.util.Comparator; import java.util.List; import org.apache.jdo.tck.util.DeepEquality; @@ -154,7 +155,10 @@ public List getEmployees() { * * @param emp The employee to add to the department. */ - public void addEmployee(Employee emp) { + public void addEmployee(IEmployee emp) { + if (employees == null) { + employees = new ArrayList<>(); + } employees.add(emp); } diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/IDepartment.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/IDepartment.java index 9b85a2daa..62e799f62 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/IDepartment.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/IDepartment.java @@ -40,4 +40,6 @@ public interface IDepartment { void setCompany(ICompany company); void setEmployees(List employees); + + void addEmployee(IEmployee emp); } diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java index f7be52700..e12fbc239 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java @@ -19,8 +19,8 @@ import java.util.*; import java.util.stream.Collectors; -import org.apache.jdo.tck.util.DefaultListableInstanceFactory; import org.apache.jdo.tck.util.ConversionHelper; +import org.apache.jdo.tck.util.DefaultListableInstanceFactory; import org.apache.jdo.tck.util.JDOCustomDateEditor; /** diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/CharacterAndStringLiterals.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/CharacterAndStringLiterals.java index a89387281..8799e30fc 100644 --- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/CharacterAndStringLiterals.java +++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/CharacterAndStringLiterals.java @@ -19,7 +19,6 @@ import javax.jdo.JDOQLTypedQuery; import javax.jdo.PersistenceManager; - import org.apache.jdo.tck.pc.mylib.MylibReader; import org.apache.jdo.tck.pc.mylib.PrimitiveTypes; import org.apache.jdo.tck.pc.mylib.QPrimitiveTypes; diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/methods/SupportedMathMethods.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/methods/SupportedMathMethods.java index 43c0d44df..161f5cb24 100644 --- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/methods/SupportedMathMethods.java +++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/methods/SupportedMathMethods.java @@ -25,7 +25,6 @@ import javax.jdo.PersistenceManager; import javax.jdo.Query; import javax.jdo.Transaction; - import org.apache.jdo.tck.pc.mylib.MylibReader; import org.apache.jdo.tck.pc.mylib.PrimitiveTypes; import org.apache.jdo.tck.pc.mylib.QPrimitiveTypes; diff --git a/tck/src/main/java/org/apache/jdo/tck/query/result/Variable.java b/tck/src/main/java/org/apache/jdo/tck/query/result/Variable.java index 0f894e166..e7f67099d 100644 --- a/tck/src/main/java/org/apache/jdo/tck/query/result/Variable.java +++ b/tck/src/main/java/org/apache/jdo/tck/query/result/Variable.java @@ -18,7 +18,6 @@ package org.apache.jdo.tck.query.result; import java.util.Arrays; -import java.util.Collections; import java.util.List; import javax.jdo.JDOQLTypedQuery; import javax.jdo.PersistenceManager; @@ -213,7 +212,7 @@ public void testNavigation() { /** */ @SuppressWarnings("unchecked") @Test - //@Execution(ExecutionMode.CONCURRENT) + // @Execution(ExecutionMode.CONCURRENT) public void testNoNavigation() { List expected = getTransientCompanyModelInstancesAsList( @@ -353,7 +352,7 @@ public void testNavigationWithCompanyAndDepartmentAndEmployeeAndProject() { /** */ @SuppressWarnings("unchecked") @Test - //@Execution(ExecutionMode.CONCURRENT) // TODO this fixed it + // @Execution(ExecutionMode.CONCURRENT) // TODO this fixed it public void testNavigationWithCompanyAndEmployeeAndProject() { Object expected = Arrays.asList( @@ -653,7 +652,7 @@ public void testNavigationWithThisConstraint() { /** */ @SuppressWarnings("unchecked") @Test - //@Execution(ExecutionMode.CONCURRENT) + // @Execution(ExecutionMode.CONCURRENT) public void testNavigationWithCompanyConstraint() { Object expected = Arrays.asList( From 673b1346e564f5792375ef1edac6dc4b4459eecf Mon Sep 17 00:00:00 2001 From: Tilmann Date: Thu, 29 May 2025 18:51:17 +0200 Subject: [PATCH 14/43] Remove XML --- .../tck/pc/company/CompanyModelReader.java | 66 ++++- .../tck/pc/company/CompanyModelReaderOld.java | 245 ++++++++++++++++++ .../util/DefaultListableInstanceFactory.java | 1 - 3 files changed, 299 insertions(+), 13 deletions(-) create mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReaderOld.java diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java index 04d7dab6b..1be266f34 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java @@ -17,10 +17,12 @@ package org.apache.jdo.tck.pc.company; +import java.util.Arrays; import java.util.Date; import java.util.List; import java.util.Locale; import org.apache.jdo.tck.util.ConversionHelper; +import org.apache.jdo.tck.util.DefaultListableInstanceFactory; import org.apache.jdo.tck.util.JDOCustomDateEditor; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; @@ -31,21 +33,28 @@ * * @author Michael Bouschen */ -public class CompanyModelReader extends DefaultListableBeanFactory { +public class CompanyModelReader extends DefaultListableInstanceFactory { private static final long serialVersionUID = 1L; - /** 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"; + public static final String QUERY_TEST = + "org/apache/jdo/tck/pc/company/companyForQueryTests.xml"; + public static final String MYLIB_TEST = "org/apache/jdo/tck/pc/mylib/mylibForQueryTests.xml"; + public static final String COMPLETENESS_TEST = + "org/apache/jdo/tck/pc/company/company_1_Tests.xml"; + public static final String COMPLETENESS_TEST_JPA = + "org/apache/jdo/tck/pc/company/company_2_Tests.xml"; + public static final String RELATIONSHIP_TEST = + "org/apache/jdo/tck/pc/company/company_R_Tests.xml"; + public static final String SAMPLE_QUERIES = "org/apache/jdo/tck/pc/company/companyForSampleQueriesTest.xml"; + public static final String JDOQL_NAVIGATION_TESTS = "org/apache/jdo/tck/pc/company/companyForNavigationTests.xml"; + public static final String JDOQL_SUBQUERIES_TESTS = "org/apache/jdo/tck/pc/company/companyForSubqueriesTests.xml"; /** The company factory instance. */ private CompanyFactory companyFactory; /** Bean definition reader */ - private final XmlBeanDefinitionReader reader; + private final CompanyModelReaderOld reader; /** * Create a CompanyModelReader for the specified resourceName. @@ -66,8 +75,34 @@ public CompanyModelReader(String resourceName) { public CompanyModelReader(String resourceName, ClassLoader classLoader) { super(); configureFactory(); - this.reader = new XmlBeanDefinitionReader(this); - this.reader.loadBeanDefinitions(new ClassPathResource(resourceName, classLoader)); + + switch (resourceName) { + case SAMPLE_QUERIES: + case JDOQL_NAVIGATION_TESTS: + case JDOQL_SUBQUERIES_TESTS: + case QUERY_TEST: + case COMPLETENESS_TEST: + case COMPLETENESS_TEST_JPA: + case RELATIONSHIP_TEST: + case MYLIB_TEST: + reader = new CompanyModelReaderOld(resourceName, classLoader); + break; + default: + // this.reader = null; + reader = new CompanyModelReaderOld(resourceName, classLoader); + System.err.println("Not registered: " + resourceName); + throw new IllegalArgumentException("Not registered: " + resourceName); + } + + // init(resourceName); + } + + + public T getBean(String name, Class clazz) { + if (reader != null) { + return reader.getBean(name, clazz); + } + return super.getBean(name, clazz); } /** @@ -78,7 +113,10 @@ public CompanyModelReader(String resourceName, ClassLoader classLoader) { */ @SuppressWarnings("unchecked") public List getRootList() { - return (List) getBean(ROOT_LIST_NAME); + if (reader != null) { + return reader.getRootList(); + } + return super.getRootList(); } /** @@ -86,15 +124,19 @@ public List getRootList() { * representation of a property into an instance of the right type. */ private void configureFactory() { - registerCustomEditor(Date.class, JDOCustomDateEditor.class); + // registerCustomEditor(Date.class, JDOCustomDateEditor.class); companyFactory = CompanyFactoryRegistry.getInstance(); - addSingleton(BEAN_FACTORY_NAME, companyFactory); + // addSingleton(BEAN_FACTORY_NAME, companyFactory); } /** * @return Returns the tearDownClasses. */ public Class[] getTearDownClassesFromFactory() { + for (Class c : companyFactory.getTearDownClasses()) { + System.err.println("TearDownClass: " + c); + } + System.err.println("TearDownClass: " + Arrays.toString(companyFactory.getTearDownClasses())); return companyFactory.getTearDownClasses(); } diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReaderOld.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReaderOld.java new file mode 100644 index 000000000..f419e2c79 --- /dev/null +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReaderOld.java @@ -0,0 +1,245 @@ +/* + * 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 + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.company; + +import java.util.Date; +import java.util.List; +import java.util.Locale; +import org.apache.jdo.tck.util.ConversionHelper; +import org.apache.jdo.tck.util.JDOCustomDateEditor; +import org.springframework.beans.factory.support.DefaultListableBeanFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; +import org.springframework.core.io.ClassPathResource; + +/** + * Utility class to create a graph of company model instances from an xml representation. + * + * @author Michael Bouschen + */ +public class CompanyModelReaderOld extends DefaultListableBeanFactory { + + private static final long serialVersionUID = 1L; + + /** 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; + + /** Bean definition reader */ + private final XmlBeanDefinitionReader reader; + + /** + * Create a CompanyModelReader for the specified resourceName. + * + * @param resourceName the name of the resource + */ + public CompanyModelReaderOld(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 + * @param classLoader the ClassLoader for the lookup + */ + public CompanyModelReaderOld(String resourceName, ClassLoader classLoader) { + super(); + configureFactory(); + this.reader = new XmlBeanDefinitionReader(this); + this.reader.loadBeanDefinitions(new ClassPathResource(resourceName, classLoader)); + } + + /** + * 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 + */ + @SuppressWarnings("unchecked") + 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() { + registerCustomEditor(Date.class, JDOCustomDateEditor.class); + companyFactory = CompanyFactoryRegistry.getInstance(); + addSingleton(BEAN_FACTORY_NAME, companyFactory); + } + + /** + * @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(JDOCustomDateEditor.DATE_PATTERN, Locale.US, value); + } + + // Convenience methods + + /** + * Convenience method returning an Address instance for the specified name. The method returns + * null if there is no Address bean with the specified name. + * + * @param name the name of the bean to return. + * @return the instance of the bean or null if there no Address bean. + */ + public IAddress getAddress(String name) { + return getBean(name, Address.class); + } + + /** + * Convenience method returning a MeetingRoom instance for the specified name. The method returns + * null if there is no MeetingRoom bean with the specified name. + * + * @param name the name of the bean to return. + * @return the instance of the bean or null if there no MeetingRoom bean. + */ + public IMeetingRoom getMeetingRoom(String name) { + return getBean(name, MeetingRoom.class); + } + + /** + * Convenience method returning a Company instance for the specified name. The method returns + * null 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 null if there no Company bean. + */ + public ICompany getCompany(String name) { + return getBean(name, Company.class); + } + + /** + * Convenience method returning a DentalInsurance instance for the specified name. The method + * returns null if there is no DentalInsurance bean with the specified name. + * + * @param name the name of the bean to return. + * @return the instance of the bean or null if there no DentalInsurance bean. + */ + public IDentalInsurance getDentalInsurance(String name) { + return getBean(name, DentalInsurance.class); + } + + /** + * Convenience method returning a Department instance for the specified name. The method returns + * null 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 null if there no Department bean. + */ + public IDepartment getDepartment(String name) { + return getBean(name, Department.class); + } + + /** + * Convenience method returning an Employee instance for the specified name. The method returns + * null 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 null if there no Employee bean. + */ + public IEmployee getEmployee(String name) { + return getBean(name, Employee.class); + } + + /** + * Convenience method returning a FullTimeEmployee instance for the specified name. The method + * returns null 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 null if there no FullTimeEmployee bean. + */ + public IFullTimeEmployee getFullTimeEmployee(String name) { + return getBean(name, FullTimeEmployee.class); + } + + /** + * Convenience method returning an Insurance instance for the specified name. The method returns + * null if there is no Insurance bean with the specified name. + * + * @param name the name of the bean to return. + * @return the instance of the bean or null if there no Insurance bean. + */ + public IInsurance getInsurance(String name) { + return getBean(name, Insurance.class); + } + + /** + * Convenience method returning a MedicalInsurance instance for the specified name. The method + * returns null if there is no MedicalInsurance bean with the specified name. + * + * @param name the name of the bean to return. + * @return the instance of the bean or null if there no MedicalInsurance bean. + */ + public IMedicalInsurance getMedicalInsurance(String name) { + return getBean(name, MedicalInsurance.class); + } + + /** + * Convenience method returning a PartTimeEmployee instance for the specified name. The method + * returns null 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 null if there no PartTimeEmployee bean. + */ + public IPartTimeEmployee getPartTimeEmployee(String name) { + return getBean(name, PartTimeEmployee.class); + } + + /** + * Convenience method returning a Person instance for the specified name. The method returns + * null 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 null if there no Person bean. + */ + public IPerson getPerson(String name) { + return getBean(name, Person.class); + } + + /** + * Convenience method returning a Project instance for the specified name. The method returns + * null if there is no Project bean with the specified name. + * + * @param name the name of the bean to return. + * @return the instance of the bean or null if there no Project bean. + */ + public IProject getProject(String name) { + return getBean(name, Project.class); + } +} diff --git a/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java b/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java index 314eb907d..dd03ee603 100644 --- a/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java +++ b/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java @@ -27,7 +27,6 @@ protected synchronized void register(String name, Object obj) { } public synchronized List getRootList() { - new RuntimeException().printStackTrace(); return Collections.unmodifiableList(rootList); } } From 4050570363e079fd112435bdb71acded7ce54e0a Mon Sep 17 00:00:00 2001 From: Tilmann Date: Thu, 29 May 2025 18:58:38 +0200 Subject: [PATCH 15/43] Remove XML --- .../tck/pc/company/CompanyModelReader.java | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java index 1be266f34..99cb408b2 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java @@ -37,16 +37,9 @@ public class CompanyModelReader extends DefaultListableInstanceFactory { private static final long serialVersionUID = 1L; - public static final String QUERY_TEST = - "org/apache/jdo/tck/pc/company/companyForQueryTests.xml"; + public static final String QUERY_TEST = "org/apache/jdo/tck/pc/company/companyForQueryTests.xml"; public static final String MYLIB_TEST = "org/apache/jdo/tck/pc/mylib/mylibForQueryTests.xml"; - public static final String COMPLETENESS_TEST = - "org/apache/jdo/tck/pc/company/company_1_Tests.xml"; - public static final String COMPLETENESS_TEST_JPA = - "org/apache/jdo/tck/pc/company/company_2_Tests.xml"; - public static final String RELATIONSHIP_TEST = - "org/apache/jdo/tck/pc/company/company_R_Tests.xml"; - public static final String SAMPLE_QUERIES = "org/apache/jdo/tck/pc/company/companyForSampleQueriesTest.xml"; + public static final String SAMPLE_QUERIES_TEST = "org/apache/jdo/tck/pc/company/companyForSampleQueriesTest.xml"; public static final String JDOQL_NAVIGATION_TESTS = "org/apache/jdo/tck/pc/company/companyForNavigationTests.xml"; public static final String JDOQL_SUBQUERIES_TESTS = "org/apache/jdo/tck/pc/company/companyForSubqueriesTests.xml"; @@ -77,19 +70,15 @@ public CompanyModelReader(String resourceName, ClassLoader classLoader) { configureFactory(); switch (resourceName) { - case SAMPLE_QUERIES: + case SAMPLE_QUERIES_TEST: case JDOQL_NAVIGATION_TESTS: case JDOQL_SUBQUERIES_TESTS: case QUERY_TEST: - case COMPLETENESS_TEST: - case COMPLETENESS_TEST_JPA: - case RELATIONSHIP_TEST: case MYLIB_TEST: reader = new CompanyModelReaderOld(resourceName, classLoader); break; default: - // this.reader = null; - reader = new CompanyModelReaderOld(resourceName, classLoader); + this.reader = null; System.err.println("Not registered: " + resourceName); throw new IllegalArgumentException("Not registered: " + resourceName); } From 36cb7e841b4be887c5a50fb3fb6eb34cccc5e2fd Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 1 Jun 2025 19:21:11 +0200 Subject: [PATCH 16/43] QUERY_TEST --- .../jdo/tck/pc/company/CompanyModelData.java | 266 ++++++++++++++++++ .../tck/pc/company/CompanyModelReader.java | 14 +- .../CompanyModelReader.java | 3 + .../CompanyModelReader.java | 3 + .../apache/jdo/tck/pc/mylib/MylibReader.java | 14 +- .../util/DefaultListableInstanceFactory.java | 3 +- 6 files changed, 291 insertions(+), 12 deletions(-) create mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelData.java diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelData.java new file mode 100644 index 000000000..66e7c3551 --- /dev/null +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelData.java @@ -0,0 +1,266 @@ +/* + * 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 + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.company; + +import org.apache.jdo.tck.util.DefaultListableInstanceFactory; + +import java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; + +public class CompanyModelData { + + public static void initQueryTest(CompanyFactory companyFactory, DefaultListableInstanceFactory registry) { + IAddress addr1 = companyFactory.newAddress(1, + "Unter den Linden 1", + "Berlin", + " ", + "12345", + "Germany"); + IAddress addr2 = companyFactory.newAddress(2, + "Broadway 1", + "New York", + "NY", + "10000", + "USA"); + IAddress addr3 = companyFactory.newAddress(3, + "Market St.", + "San Francisco", + "CA", + "94102", + "USA"); + + // Insurance constructors + IMedicalInsurance medicalIns1 = companyFactory.newMedicalInsurance(1, "Carrier1", "PPO"); + IMedicalInsurance medicalIns2 = companyFactory.newMedicalInsurance(2, "Carrier2", "HMO"); + IMedicalInsurance medicalIns3 = companyFactory.newMedicalInsurance(3, "Carrier3", "HMO"); + IMedicalInsurance medicalIns4 = companyFactory.newMedicalInsurance(4, "Carrier4", "HMO"); + IMedicalInsurance medicalIns5 = companyFactory.newMedicalInsurance(5, "Carrier5", "HMO"); + IDentalInsurance dentalIns1 = companyFactory.newDentalInsurance(11, + "Carrier1", BigDecimal.valueOf(99.995)); + IDentalInsurance dentalIns2 = companyFactory.newDentalInsurance(12, + "Carrier2", BigDecimal.valueOf(99.996)); + IDentalInsurance dentalIns3 = companyFactory.newDentalInsurance(13, + "Carrier3", BigDecimal.valueOf(99.997)); + IDentalInsurance dentalIns4 = companyFactory.newDentalInsurance(14, + "Carrier4", BigDecimal.valueOf(99.998)); + IDentalInsurance dentalIns5 = companyFactory.newDentalInsurance(15, + "Carrier5", BigDecimal.valueOf(99.999)); + IDentalInsurance dentalIns99 = companyFactory.newDentalInsurance(99, "Carrier99", null); + + // Project constructors + IProject proj1 = companyFactory.newProject(1, "orange", BigDecimal.valueOf(2500000.99)); + IProject proj2 = companyFactory.newProject(2, "blue", BigDecimal.valueOf(50000.00)); + IProject proj3 = companyFactory.newProject(3, "green", BigDecimal.valueOf(2000.99)); + + // Company constructor + ICompany company1 = + companyFactory.newCompany(1L, "Sun Microsystems, Inc.", new Date(1952, 4, 11, 0, 0, 0), addr1); + + // Meeting room constructors + IMeetingRoom room1 = companyFactory.newMeetingRoom(1, "Comfy Room"); + IMeetingRoom room2 = companyFactory.newMeetingRoom(2, "Large Discussion Room"); + IMeetingRoom room3 = companyFactory.newMeetingRoom(3, "Conference Room"); + + // Department Constructors + IDepartment dept1 = companyFactory.newDepartment(1, "Development", company1); + IDepartment dept2 = companyFactory.newDepartment(2, "Human Resources", company1); + company1.setDepartments(toSet(dept1, dept2)); + + // Employee Constructors + IFullTimeEmployee emp1 = + companyFactory.newFullTimeEmployee( + 1, + "emp1First", + "emp1Last", + "emp1Middle", + new Date(1970, 6, 10, 0, 0, 0), + addr1, + new Date(1999, 1, 1, 0, 0, 0), + 20000); + + IFullTimeEmployee emp2 = + companyFactory.newFullTimeEmployee( + 2, + "emp2First", + "emp2Last", + "emp2Middle", + new Date(1975, 12, 22, 0, 0, 0), + addr2, + new Date(2003, 7, 1, 0, 0, 0), + 10000); + + IPartTimeEmployee emp3 = + companyFactory.newPartTimeEmployee( + 3, + "emp3First", + "emp3Last", + "emp3Middle", + new Date(1972, 7, 5, 0, 0, 0), + addr3, + new Date(2002, 8, 15, 0, 0, 0), + 15); + + IPartTimeEmployee emp4 = + companyFactory.newPartTimeEmployee( + 4, + "emp4First", + "emp4Last", + "emp4Middle", + new Date(1973, 7, 6, 0, 0, 0), + addr3, + new Date(2001, 4, 15, 0, 0, 0), + 13); + + IFullTimeEmployee emp5 = + companyFactory.newFullTimeEmployee( + 5, + "emp5First", + "emp5Last", + "emp5Middle", + new Date(1962, 7, 5, 0, 0, 0), + addr3, + new Date(1998, 8, 15, 0, 0, 0), + 45000); + + // Employee properties + emp1.setWeeklyhours(40); + emp1.setMedicalInsurance(medicalIns1); + emp1.setDentalInsurance(dentalIns1); + emp1.setPhoneNumbers(toMap("home", "1111", "work", "123456-1")); + emp1.setDepartment(dept1); + emp1.setFundingDept(dept2); + emp1.setManager(emp2); + emp1.setMentor(emp2); + emp1.setProtege(emp5); + emp1.setHradvisor(emp5); + emp1.setReviewedProjects(toSet(proj3)); + emp1.setProjects(toSet(proj1)); + + emp2.setWeeklyhours(40); + emp2.setMedicalInsurance(medicalIns2); + emp2.setDentalInsurance(dentalIns2); + emp2.setPhoneNumbers(toMap("home", "2222", "work", "123456-2")); + emp2.setDepartment(dept1); + emp2.setFundingDept(dept1); + emp2.setMentor(emp3); + emp2.setProtege(emp1); + emp2.setHradvisor(emp5); + emp2.setProjects(toSet(proj1, proj2)); + emp2.setTeam(toSet(emp1, emp3, emp4, emp5)); + + emp3.setWeeklyhours(19); + emp3.setMedicalInsurance(medicalIns3); + emp3.setDentalInsurance(dentalIns3); + emp3.setPhoneNumbers(toMap("home", "3333", "work", "123456-3")); + emp3.setDepartment(dept1); + emp3.setFundingDept(dept1); + emp3.setManager(emp2); + emp3.setMentor(emp4); + emp3.setProtege(emp2); + emp3.setHradvisor(emp5); + emp3.setProjects(toSet(proj1, proj2)); + + emp4.setMedicalInsurance(medicalIns4); + emp4.setDentalInsurance(dentalIns4); + emp4.setPhoneNumbers(toMap("home", "3343", "work", "124456-3")); + emp4.setDepartment(dept2); + emp4.setFundingDept(dept2); + emp4.setManager(emp2); + emp4.setMentor(emp5); + emp4.setProtege(emp3); + emp4.setHradvisor(emp5); + emp4.setProjects(toSet(proj3)); + emp4.setReviewedProjects(toSet(proj2)); + + emp5.setMedicalInsurance(medicalIns5); + emp5.setDentalInsurance(dentalIns5); + emp5.setPhoneNumbers(toMap("home", "3363", "work", "126456-3")); + emp5.setDepartment(dept2); + emp5.setFundingDept(dept2); + emp5.setManager(emp2); + emp5.setMentor(emp1); + emp5.setProtege(emp4); + emp5.setProjects(toSet(proj3)); + emp5.setReviewedProjects(toSet(proj2)); + emp5.setHradvisees(toSet(emp1, emp2, emp3, emp4)); + + // Finish departments + dept1.setEmployees(toSet(emp1, emp2, emp3)); + dept1.setFundedEmps(toSet(emp2, emp3)); + dept1.setMeetingRooms(toList(room1, room2, room3)); + + dept2.setEmployees(toSet(emp4, emp5)); + dept2.setFundedEmps(toSet(emp1, emp4, emp5)); + dept2.setMeetingRooms(toList()); + + + + + // Insurance properties + medicalIns1.setEmployee(emp1); + medicalIns2.setEmployee(emp2); + medicalIns3.setEmployee(emp3); + medicalIns4.setEmployee(emp4); + medicalIns5.setEmployee(emp5); + dentalIns1.setEmployee(emp1); + dentalIns2.setEmployee(emp2); + dentalIns3.setEmployee(emp3); + dentalIns4.setEmployee(emp4); + dentalIns5.setEmployee(emp5); + + // Project properties + proj1.setMembers(toSet(emp1, emp2, emp3)); + proj2.setReviewers(toSet(emp4, emp5)); + proj2.setMembers(toSet(emp2, emp3)); + proj3.setReviewers(toSet(emp1)); + proj3.setMembers(toSet(emp4, emp5)); + + // root objects + registry.register("company1", company1); + registry.register("dentalIns99", dentalIns99); + + // TODO why do we need this, i.e. what is the difference to root objects? + registry.register("dept1", dept1); + registry.register("dept2", dept2); + registry.register("emp1", emp1); + registry.register("emp2", emp2); + registry.register("emp3", emp3); + registry.register("emp4", emp4); + registry.register("emp5", emp5); + registry.register("proj1", proj1); + registry.register("proj2", proj2); + registry.register("proj3", proj3); + } + + private static List toList(T... objs) { + return Arrays.stream(objs).collect(Collectors.toList()); + } + + private static Map toMap(String... objs) { + Map map = new HashMap<>(); + for (int i = 0; i < objs.length; i+=2) { + map.put(objs[i], objs[i + 1]); + } + return map; + } + + private static Set toSet(T... objs) { + return Arrays.stream(objs).collect(Collectors.toSet()); + } +} diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java index 99cb408b2..f35717f8b 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java @@ -21,6 +21,8 @@ import java.util.Date; import java.util.List; import java.util.Locale; + +import org.apache.jdo.tck.pc.mylib.MylibReader; import org.apache.jdo.tck.util.ConversionHelper; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; import org.apache.jdo.tck.util.JDOCustomDateEditor; @@ -73,17 +75,22 @@ public CompanyModelReader(String resourceName, ClassLoader classLoader) { case SAMPLE_QUERIES_TEST: case JDOQL_NAVIGATION_TESTS: case JDOQL_SUBQUERIES_TESTS: + reader = new CompanyModelReaderOld(resourceName, classLoader); + break; case QUERY_TEST: + CompanyModelData.initQueryTest(companyFactory, this); + reader = null; + break; case MYLIB_TEST: - reader = new CompanyModelReaderOld(resourceName, classLoader); + // TODO use companyModelFactory! + MylibReader.init(this); + this.reader = null; break; default: this.reader = null; System.err.println("Not registered: " + resourceName); throw new IllegalArgumentException("Not registered: " + resourceName); } - - // init(resourceName); } @@ -100,7 +107,6 @@ public T getBean(String name, Class clazz) { * * @return a list of root instances */ - @SuppressWarnings("unchecked") public List getRootList() { if (reader != null) { return reader.getRootList(); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java index 197c7129f..9daedef2a 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java @@ -63,6 +63,9 @@ public CompanyModelReader(String resourceName, ClassLoader classLoader) { init(); } + /** + * Company instances for CompletenessTest with Map without join table. + */ private void init() { ICompany company1 = companyFactory.newCompany(1L, "Sun Microsystems, Inc.", new Date(1952, 4, 11, 0, 0, 0)); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java index e12fbc239..f7949b4f5 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java @@ -46,6 +46,9 @@ public CompanyModelReader(String resourceName) { init(); } + /** + * Company instances for CompletenessTest with Map without join table. + */ private void init() { ICompany company1 = companyFactory.newCompany(1L, "Sun Microsystems, Inc.", new Date(1952, 4, 11, 0, 0, 0)); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java index ea9ebaa12..81cfbb19d 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java @@ -36,10 +36,10 @@ public class MylibReader extends DefaultListableInstanceFactory { */ public MylibReader(String resourceName) { super(); - init(); + init(this); } - private void init() { + public static void init(DefaultListableInstanceFactory factory) { System.err.println("MyLibReader2.init()"); PrimitiveTypes primitiveTypesPositive = new PrimitiveTypes( @@ -76,11 +76,11 @@ private void init() { 3, false, null, (byte) 0, null, (short) 0, null, 0, null, 0, null, 0, null, 0, null, (char) 0, (char) 0, null, "Even", null, null, null); - register("primitiveTypesPositive", primitiveTypesPositive); - register("primitiveTypesNegative", primitiveTypesNegative); - register("pcClass1", pcClass1); - register("pcClass2", pcClass2); - register("primitiveTypesCharacterStringLiterals", primitiveTypesCharacterStringLiterals); + factory.register("primitiveTypesPositive", primitiveTypesPositive); + factory.register("primitiveTypesNegative", primitiveTypesNegative); + factory.register("pcClass1", pcClass1); + factory.register("pcClass2", pcClass2); + factory.register("primitiveTypesCharacterStringLiterals", primitiveTypesCharacterStringLiterals); } // Convenience methods diff --git a/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java b/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java index dd03ee603..87bce5c90 100644 --- a/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java +++ b/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java @@ -21,12 +21,13 @@ public T getBean(String name, Class clazz) { return clazz.cast(getBean(name)); } - protected synchronized void register(String name, Object obj) { + public synchronized void register(String name, Object obj) { rootMap.put(name, obj); rootList.add(obj); } public synchronized List getRootList() { + System.out.println("Getting root list: " + rootList.size()); // TODO TZ remove return Collections.unmodifiableList(rootList); } } From 95333f4e7c9df922c9639a685f6bba63aacf6d14 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Mon, 22 Sep 2025 20:28:31 +0200 Subject: [PATCH 17/43] Tests pass except concurrent tests --- .../jdo/tck/pc/company/CompanyModelData.java | 39 +++++++++++++------ .../tck/pc/company/CompanyModelReader.java | 19 +++++++-- .../util/DefaultListableInstanceFactory.java | 23 ++++++++--- 3 files changed, 60 insertions(+), 21 deletions(-) diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelData.java index 66e7c3551..7a2f33581 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelData.java @@ -70,7 +70,7 @@ public static void initQueryTest(CompanyFactory companyFactory, DefaultListableI // Company constructor ICompany company1 = - companyFactory.newCompany(1L, "Sun Microsystems, Inc.", new Date(1952, 4, 11, 0, 0, 0), addr1); + companyFactory.newCompany(1L, "Sun Microsystems, Inc.", date(1952, 4, 11, 0, 0, 0), addr1); // Meeting room constructors IMeetingRoom room1 = companyFactory.newMeetingRoom(1, "Comfy Room"); @@ -89,9 +89,9 @@ public static void initQueryTest(CompanyFactory companyFactory, DefaultListableI "emp1First", "emp1Last", "emp1Middle", - new Date(1970, 6, 10, 0, 0, 0), + date(1970, 6, 10, 0, 0, 0), addr1, - new Date(1999, 1, 1, 0, 0, 0), + date(1999, 1, 1, 0, 0, 0), 20000); IFullTimeEmployee emp2 = @@ -100,9 +100,9 @@ public static void initQueryTest(CompanyFactory companyFactory, DefaultListableI "emp2First", "emp2Last", "emp2Middle", - new Date(1975, 12, 22, 0, 0, 0), + date(1975, 12, 22, 0, 0, 0), addr2, - new Date(2003, 7, 1, 0, 0, 0), + date(2003, 7, 1, 0, 0, 0), 10000); IPartTimeEmployee emp3 = @@ -111,9 +111,9 @@ public static void initQueryTest(CompanyFactory companyFactory, DefaultListableI "emp3First", "emp3Last", "emp3Middle", - new Date(1972, 7, 5, 0, 0, 0), + date(1972, 7, 5, 0, 0, 0), addr3, - new Date(2002, 8, 15, 0, 0, 0), + date(2002, 8, 15, 0, 0, 0), 15); IPartTimeEmployee emp4 = @@ -122,9 +122,9 @@ public static void initQueryTest(CompanyFactory companyFactory, DefaultListableI "emp4First", "emp4Last", "emp4Middle", - new Date(1973, 7, 6, 0, 0, 0), + date(1973, 7, 6, 0, 0, 0), addr3, - new Date(2001, 4, 15, 0, 0, 0), + date(2001, 4, 15, 0, 0, 0), 13); IFullTimeEmployee emp5 = @@ -133,9 +133,9 @@ public static void initQueryTest(CompanyFactory companyFactory, DefaultListableI "emp5First", "emp5Last", "emp5Middle", - new Date(1962, 7, 5, 0, 0, 0), + date(1962, 7, 5, 0, 0, 0), addr3, - new Date(1998, 8, 15, 0, 0, 0), + date(1998, 8, 15, 0, 0, 0), 45000); // Employee properties @@ -246,6 +246,23 @@ public static void initQueryTest(CompanyFactory companyFactory, DefaultListableI registry.register("proj1", proj1); registry.register("proj2", proj2); registry.register("proj3", proj3); + registry.register("dentalIns1", dentalIns1); + registry.register("dentalIns2", dentalIns2); + registry.register("dentalIns3", dentalIns3); + registry.register("dentalIns4", dentalIns4); + registry.register("dentalIns5", dentalIns5); + registry.register("medicalIns1", medicalIns1); + registry.register("medicalIns2", medicalIns2); + registry.register("medicalIns3", medicalIns3); + registry.register("medicalIns4", medicalIns4); + registry.register("medicalIns5", medicalIns5); + registry.register("room1", room1); + registry.register("room2", room2); + } + + private static Date date(int y, int m, int d, int h, int min, int sec) { + Date date = new Date(y - 1900, m-1, d, h, min, sec); + return date; } private static List toList(T... objs) { diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java index f35717f8b..ffe564432 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java @@ -69,7 +69,9 @@ public CompanyModelReader(String resourceName) { */ public CompanyModelReader(String resourceName, ClassLoader classLoader) { super(); - configureFactory(); +// configureFactory(); + // reader = new CompanyModelReaderOld(resourceName, classLoader); + switch (resourceName) { case SAMPLE_QUERIES_TEST: @@ -78,18 +80,23 @@ public CompanyModelReader(String resourceName, ClassLoader classLoader) { reader = new CompanyModelReaderOld(resourceName, classLoader); break; case QUERY_TEST: + configureFactory(); + // this.reset(); +// reader = new CompanyModelReaderOld(resourceName, classLoader); CompanyModelData.initQueryTest(companyFactory, this); reader = null; break; case MYLIB_TEST: + configureFactory(); // TODO use companyModelFactory! MylibReader.init(this); this.reader = null; break; default: - this.reader = null; - System.err.println("Not registered: " + resourceName); - throw new IllegalArgumentException("Not registered: " + resourceName); + reader = new CompanyModelReaderOld(resourceName, classLoader); +// this.reader = null; + System.err.println("ERROR: Not registered: " + resourceName); + //throw new IllegalArgumentException("Not registered: " + resourceName); } } @@ -128,6 +135,10 @@ private void configureFactory() { * @return Returns the tearDownClasses. */ public Class[] getTearDownClassesFromFactory() { + if (reader != null) { + return reader.getTearDownClassesFromFactory(); + } + for (Class c : companyFactory.getTearDownClasses()) { System.err.println("TearDownClass: " + c); } diff --git a/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java b/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java index 87bce5c90..ec7276788 100644 --- a/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java +++ b/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java @@ -1,9 +1,6 @@ package org.apache.jdo.tck.util; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; +import java.util.*; public class DefaultListableInstanceFactory { @@ -17,17 +14,31 @@ public synchronized Object getBean(String name) { return rootMap.get(name); } - public T getBean(String name, Class clazz) { + public synchronized T getBean(String name, Class clazz) { + if (!rootMap.containsKey(name)) { + System.err.println("CLIF: Not found: " + name + " ---------------------------- "); + System.err.println("CLIF: Beans: " + rootMap.size() + " " + Arrays.toString(rootMap.keySet().toArray()) + " ---------------------------- "); + } + if (rootMap.get(name) == null) { + System.err.println("CLIF: NULL: " + name + " ---------------------------- "); + System.err.println("CLIF: Beans: " + rootMap.size() + " " + Arrays.toString(rootMap.keySet().toArray()) + " ---------------------------- "); + } return clazz.cast(getBean(name)); } public synchronized void register(String name, Object obj) { + System.out.println("CLIF: Registering: " + name + " " + rootList.size() + " -----------------------"); // TODO TZ remove rootMap.put(name, obj); rootList.add(obj); } public synchronized List getRootList() { - System.out.println("Getting root list: " + rootList.size()); // TODO TZ remove + System.out.println("CLIF: Getting root list: " + rootList.size() + " -----------------------"); // TODO TZ remove return Collections.unmodifiableList(rootList); } + + public synchronized void reset() { + rootMap.clear(); + rootList.clear(); + } } From 9ee1c022db6054eb784ef3932def6a063a7ec451 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Wed, 24 Sep 2025 00:02:33 +0200 Subject: [PATCH 18/43] Tests pass except concurrent tests --- .../jdo/tck/pc/company/CompanyModelData.java | 466 ++++++++---------- 1 file changed, 211 insertions(+), 255 deletions(-) diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelData.java index 7a2f33581..283a8ffc1 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelData.java @@ -17,267 +17,223 @@ package org.apache.jdo.tck.pc.company; -import org.apache.jdo.tck.util.DefaultListableInstanceFactory; - import java.math.BigDecimal; import java.util.*; import java.util.stream.Collectors; +import org.apache.jdo.tck.util.ConversionHelper; +import org.apache.jdo.tck.util.DefaultListableInstanceFactory; +import org.apache.jdo.tck.util.JDOCustomDateEditor; public class CompanyModelData { - public static void initQueryTest(CompanyFactory companyFactory, DefaultListableInstanceFactory registry) { - IAddress addr1 = companyFactory.newAddress(1, - "Unter den Linden 1", - "Berlin", - " ", - "12345", - "Germany"); - IAddress addr2 = companyFactory.newAddress(2, - "Broadway 1", - "New York", - "NY", - "10000", - "USA"); - IAddress addr3 = companyFactory.newAddress(3, - "Market St.", - "San Francisco", - "CA", - "94102", - "USA"); - - // Insurance constructors - IMedicalInsurance medicalIns1 = companyFactory.newMedicalInsurance(1, "Carrier1", "PPO"); - IMedicalInsurance medicalIns2 = companyFactory.newMedicalInsurance(2, "Carrier2", "HMO"); - IMedicalInsurance medicalIns3 = companyFactory.newMedicalInsurance(3, "Carrier3", "HMO"); - IMedicalInsurance medicalIns4 = companyFactory.newMedicalInsurance(4, "Carrier4", "HMO"); - IMedicalInsurance medicalIns5 = companyFactory.newMedicalInsurance(5, "Carrier5", "HMO"); - IDentalInsurance dentalIns1 = companyFactory.newDentalInsurance(11, - "Carrier1", BigDecimal.valueOf(99.995)); - IDentalInsurance dentalIns2 = companyFactory.newDentalInsurance(12, - "Carrier2", BigDecimal.valueOf(99.996)); - IDentalInsurance dentalIns3 = companyFactory.newDentalInsurance(13, - "Carrier3", BigDecimal.valueOf(99.997)); - IDentalInsurance dentalIns4 = companyFactory.newDentalInsurance(14, - "Carrier4", BigDecimal.valueOf(99.998)); - IDentalInsurance dentalIns5 = companyFactory.newDentalInsurance(15, - "Carrier5", BigDecimal.valueOf(99.999)); - IDentalInsurance dentalIns99 = companyFactory.newDentalInsurance(99, "Carrier99", null); - - // Project constructors - IProject proj1 = companyFactory.newProject(1, "orange", BigDecimal.valueOf(2500000.99)); - IProject proj2 = companyFactory.newProject(2, "blue", BigDecimal.valueOf(50000.00)); - IProject proj3 = companyFactory.newProject(3, "green", BigDecimal.valueOf(2000.99)); - - // Company constructor - ICompany company1 = - companyFactory.newCompany(1L, "Sun Microsystems, Inc.", date(1952, 4, 11, 0, 0, 0), addr1); - - // Meeting room constructors - IMeetingRoom room1 = companyFactory.newMeetingRoom(1, "Comfy Room"); - IMeetingRoom room2 = companyFactory.newMeetingRoom(2, "Large Discussion Room"); - IMeetingRoom room3 = companyFactory.newMeetingRoom(3, "Conference Room"); - - // Department Constructors - IDepartment dept1 = companyFactory.newDepartment(1, "Development", company1); - IDepartment dept2 = companyFactory.newDepartment(2, "Human Resources", company1); - company1.setDepartments(toSet(dept1, dept2)); - - // Employee Constructors - IFullTimeEmployee emp1 = - companyFactory.newFullTimeEmployee( - 1, - "emp1First", - "emp1Last", - "emp1Middle", - date(1970, 6, 10, 0, 0, 0), - addr1, - date(1999, 1, 1, 0, 0, 0), - 20000); - - IFullTimeEmployee emp2 = - companyFactory.newFullTimeEmployee( - 2, - "emp2First", - "emp2Last", - "emp2Middle", - date(1975, 12, 22, 0, 0, 0), - addr2, - date(2003, 7, 1, 0, 0, 0), - 10000); - - IPartTimeEmployee emp3 = - companyFactory.newPartTimeEmployee( - 3, - "emp3First", - "emp3Last", - "emp3Middle", - date(1972, 7, 5, 0, 0, 0), - addr3, - date(2002, 8, 15, 0, 0, 0), - 15); - - IPartTimeEmployee emp4 = - companyFactory.newPartTimeEmployee( - 4, - "emp4First", - "emp4Last", - "emp4Middle", - date(1973, 7, 6, 0, 0, 0), - addr3, - date(2001, 4, 15, 0, 0, 0), - 13); - - IFullTimeEmployee emp5 = - companyFactory.newFullTimeEmployee( - 5, - "emp5First", - "emp5Last", - "emp5Middle", - date(1962, 7, 5, 0, 0, 0), - addr3, - date(1998, 8, 15, 0, 0, 0), - 45000); - - // Employee properties - emp1.setWeeklyhours(40); - emp1.setMedicalInsurance(medicalIns1); - emp1.setDentalInsurance(dentalIns1); - emp1.setPhoneNumbers(toMap("home", "1111", "work", "123456-1")); - emp1.setDepartment(dept1); - emp1.setFundingDept(dept2); - emp1.setManager(emp2); - emp1.setMentor(emp2); - emp1.setProtege(emp5); - emp1.setHradvisor(emp5); - emp1.setReviewedProjects(toSet(proj3)); - emp1.setProjects(toSet(proj1)); - - emp2.setWeeklyhours(40); - emp2.setMedicalInsurance(medicalIns2); - emp2.setDentalInsurance(dentalIns2); - emp2.setPhoneNumbers(toMap("home", "2222", "work", "123456-2")); - emp2.setDepartment(dept1); - emp2.setFundingDept(dept1); - emp2.setMentor(emp3); - emp2.setProtege(emp1); - emp2.setHradvisor(emp5); - emp2.setProjects(toSet(proj1, proj2)); - emp2.setTeam(toSet(emp1, emp3, emp4, emp5)); - - emp3.setWeeklyhours(19); - emp3.setMedicalInsurance(medicalIns3); - emp3.setDentalInsurance(dentalIns3); - emp3.setPhoneNumbers(toMap("home", "3333", "work", "123456-3")); - emp3.setDepartment(dept1); - emp3.setFundingDept(dept1); - emp3.setManager(emp2); - emp3.setMentor(emp4); - emp3.setProtege(emp2); - emp3.setHradvisor(emp5); - emp3.setProjects(toSet(proj1, proj2)); - - emp4.setMedicalInsurance(medicalIns4); - emp4.setDentalInsurance(dentalIns4); - emp4.setPhoneNumbers(toMap("home", "3343", "work", "124456-3")); - emp4.setDepartment(dept2); - emp4.setFundingDept(dept2); - emp4.setManager(emp2); - emp4.setMentor(emp5); - emp4.setProtege(emp3); - emp4.setHradvisor(emp5); - emp4.setProjects(toSet(proj3)); - emp4.setReviewedProjects(toSet(proj2)); - - emp5.setMedicalInsurance(medicalIns5); - emp5.setDentalInsurance(dentalIns5); - emp5.setPhoneNumbers(toMap("home", "3363", "work", "126456-3")); - emp5.setDepartment(dept2); - emp5.setFundingDept(dept2); - emp5.setManager(emp2); - emp5.setMentor(emp1); - emp5.setProtege(emp4); - emp5.setProjects(toSet(proj3)); - emp5.setReviewedProjects(toSet(proj2)); - emp5.setHradvisees(toSet(emp1, emp2, emp3, emp4)); - - // Finish departments - dept1.setEmployees(toSet(emp1, emp2, emp3)); - dept1.setFundedEmps(toSet(emp2, emp3)); - dept1.setMeetingRooms(toList(room1, room2, room3)); - - dept2.setEmployees(toSet(emp4, emp5)); - dept2.setFundedEmps(toSet(emp1, emp4, emp5)); - dept2.setMeetingRooms(toList()); - - - - - // Insurance properties - medicalIns1.setEmployee(emp1); - medicalIns2.setEmployee(emp2); - medicalIns3.setEmployee(emp3); - medicalIns4.setEmployee(emp4); - medicalIns5.setEmployee(emp5); - dentalIns1.setEmployee(emp1); - dentalIns2.setEmployee(emp2); - dentalIns3.setEmployee(emp3); - dentalIns4.setEmployee(emp4); - dentalIns5.setEmployee(emp5); - - // Project properties - proj1.setMembers(toSet(emp1, emp2, emp3)); - proj2.setReviewers(toSet(emp4, emp5)); - proj2.setMembers(toSet(emp2, emp3)); - proj3.setReviewers(toSet(emp1)); - proj3.setMembers(toSet(emp4, emp5)); - - // root objects - registry.register("company1", company1); - registry.register("dentalIns99", dentalIns99); - - // TODO why do we need this, i.e. what is the difference to root objects? - registry.register("dept1", dept1); - registry.register("dept2", dept2); - registry.register("emp1", emp1); - registry.register("emp2", emp2); - registry.register("emp3", emp3); - registry.register("emp4", emp4); - registry.register("emp5", emp5); - registry.register("proj1", proj1); - registry.register("proj2", proj2); - registry.register("proj3", proj3); - registry.register("dentalIns1", dentalIns1); - registry.register("dentalIns2", dentalIns2); - registry.register("dentalIns3", dentalIns3); - registry.register("dentalIns4", dentalIns4); - registry.register("dentalIns5", dentalIns5); - registry.register("medicalIns1", medicalIns1); - registry.register("medicalIns2", medicalIns2); - registry.register("medicalIns3", medicalIns3); - registry.register("medicalIns4", medicalIns4); - registry.register("medicalIns5", medicalIns5); - registry.register("room1", room1); - registry.register("room2", room2); - } - - private static Date date(int y, int m, int d, int h, int min, int sec) { - Date date = new Date(y - 1900, m-1, d, h, min, sec); - return date; - } - - private static List toList(T... objs) { - return Arrays.stream(objs).collect(Collectors.toList()); - } - - private static Map toMap(String... objs) { - Map map = new HashMap<>(); - for (int i = 0; i < objs.length; i+=2) { - map.put(objs[i], objs[i + 1]); - } - return map; + public static void initQueryTest( + CompanyFactory factory, DefaultListableInstanceFactory registry) { + IAddress addr1 = + factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); + IAddress addr2 = factory.newAddress(2, "Broadway 1", "New York", "NY", "10000", "USA"); + IAddress addr3 = factory.newAddress(3, "Market St.", "San Francisco", "CA", "94102", "USA"); + + // Insurance constructors + IMedicalInsurance medicalIns1 = factory.newMedicalInsurance(1, "Carrier1", "PPO"); + IMedicalInsurance medicalIns2 = factory.newMedicalInsurance(2, "Carrier2", "HMO"); + IMedicalInsurance medicalIns3 = factory.newMedicalInsurance(3, "Carrier3", "HMO"); + IMedicalInsurance medicalIns4 = factory.newMedicalInsurance(4, "Carrier4", "HMO"); + IMedicalInsurance medicalIns5 = factory.newMedicalInsurance(5, "Carrier5", "HMO"); + IDentalInsurance dentalIns1 = + factory.newDentalInsurance(11, "Carrier1", BigDecimal.valueOf(99.995)); + IDentalInsurance dentalIns2 = + factory.newDentalInsurance(12, "Carrier2", BigDecimal.valueOf(99.996)); + IDentalInsurance dentalIns3 = + factory.newDentalInsurance(13, "Carrier3", BigDecimal.valueOf(99.997)); + IDentalInsurance dentalIns4 = + factory.newDentalInsurance(14, "Carrier4", BigDecimal.valueOf(99.998)); + IDentalInsurance dentalIns5 = + factory.newDentalInsurance(15, "Carrier5", BigDecimal.valueOf(99.999)); + IDentalInsurance dentalIns99 = factory.newDentalInsurance(99, "Carrier99", null); + + // Project constructors + IProject proj1 = factory.newProject(1, "orange", BigDecimal.valueOf(2500000.99)); + IProject proj2 = factory.newProject(2, "blue", BigDecimal.valueOf(50000.00)); + IProject proj3 = factory.newProject(3, "green", BigDecimal.valueOf(2000.99)); + + // Company constructor + ICompany company1 = factory.newCompany(1L, "Sun Microsystems, Inc.", date(1952, 4, 11), addr1); + + // Meeting room constructors + IMeetingRoom room1 = factory.newMeetingRoom(1, "Comfy Room"); + IMeetingRoom room2 = factory.newMeetingRoom(2, "Large Discussion Room"); + IMeetingRoom room3 = factory.newMeetingRoom(3, "Conference Room"); + + // Department Constructors + IDepartment dept1 = factory.newDepartment(1, "Development", company1); + IDepartment dept2 = factory.newDepartment(2, "Human Resources", company1); + company1.setDepartments(toSet(dept1, dept2)); + + // Employee Constructors + IFullTimeEmployee emp1 = + factory.newFullTimeEmployee( + 1, "emp1First", "emp1Last", "emp1Middle", null, addr1, null, 20000); + emp1.setBirthdate(date(1970, 6, 10)); + emp1.setHiredate(date(1999, 1, 1)); + IFullTimeEmployee emp2 = + factory.newFullTimeEmployee( + 2, "emp2First", "emp2Last", "emp2Middle", null, addr2, null, 10000); + emp2.setBirthdate(date(1975, 12, 22)); + emp2.setHiredate(date(2003, 7, 1)); + IPartTimeEmployee emp3 = + factory.newPartTimeEmployee( + 3, "emp3First", "emp3Last", "emp3Middle", null, addr3, null, 15); + emp3.setBirthdate(date(1972, 7, 5)); + emp3.setHiredate(date(2002, 8, 15)); + IPartTimeEmployee emp4 = + factory.newPartTimeEmployee( + 4, "emp4First", "emp4Last", "emp4Middle", null, addr3, null, 13); + emp4.setBirthdate(date(1973, 7, 6)); + emp4.setHiredate(date(2001, 4, 15)); + IFullTimeEmployee emp5 = + factory.newFullTimeEmployee( + 5, "emp5First", "emp5Last", "emp5Middle", null, addr3, null, 45000); + emp5.setBirthdate(date(1962, 7, 5)); + emp5.setHiredate(date(1998, 8, 15)); + + // Employee properties + emp1.setWeeklyhours(40); + emp1.setMedicalInsurance(medicalIns1); + emp1.setDentalInsurance(dentalIns1); + emp1.setPhoneNumbers(toMap("home", "1111", "work", "123456-1")); + emp1.setDepartment(dept1); + emp1.setFundingDept(dept2); + emp1.setManager(emp2); + emp1.setMentor(emp2); + emp1.setProtege(emp5); + emp1.setHradvisor(emp5); + emp1.setReviewedProjects(toSet(proj3)); + emp1.setProjects(toSet(proj1)); + + emp2.setWeeklyhours(40); + emp2.setMedicalInsurance(medicalIns2); + emp2.setDentalInsurance(dentalIns2); + emp2.setPhoneNumbers(toMap("home", "2222", "work", "123456-2")); + emp2.setDepartment(dept1); + emp2.setFundingDept(dept1); + emp2.setMentor(emp3); + emp2.setProtege(emp1); + emp2.setHradvisor(emp5); + emp2.setProjects(toSet(proj1, proj2)); + emp2.setTeam(toSet(emp1, emp3, emp4, emp5)); + + emp3.setWeeklyhours(19); + emp3.setMedicalInsurance(medicalIns3); + emp3.setDentalInsurance(dentalIns3); + emp3.setPhoneNumbers(toMap("home", "3333", "work", "123456-3")); + emp3.setDepartment(dept1); + emp3.setFundingDept(dept1); + emp3.setManager(emp2); + emp3.setMentor(emp4); + emp3.setProtege(emp2); + emp3.setHradvisor(emp5); + emp3.setProjects(toSet(proj1, proj2)); + + emp4.setMedicalInsurance(medicalIns4); + emp4.setDentalInsurance(dentalIns4); + emp4.setPhoneNumbers(toMap("home", "3343", "work", "124456-3")); + emp4.setDepartment(dept2); + emp4.setFundingDept(dept2); + emp4.setManager(emp2); + emp4.setMentor(emp5); + emp4.setProtege(emp3); + emp4.setHradvisor(emp5); + emp4.setProjects(toSet(proj3)); + emp4.setReviewedProjects(toSet(proj2)); + + emp5.setMedicalInsurance(medicalIns5); + emp5.setDentalInsurance(dentalIns5); + emp5.setPhoneNumbers(toMap("home", "3363", "work", "126456-3")); + emp5.setDepartment(dept2); + emp5.setFundingDept(dept2); + emp5.setManager(emp2); + emp5.setMentor(emp1); + emp5.setProtege(emp4); + emp5.setProjects(toSet(proj3)); + emp5.setReviewedProjects(toSet(proj2)); + emp5.setHradvisees(toSet(emp1, emp2, emp3, emp4)); + + // Finish departments + dept1.setEmployees(toSet(emp1, emp2, emp3)); + dept1.setFundedEmps(toSet(emp2, emp3)); + dept1.setMeetingRooms(toList(room1, room2, room3)); + + dept2.setEmployees(toSet(emp4, emp5)); + dept2.setFundedEmps(toSet(emp1, emp4, emp5)); + dept2.setMeetingRooms(toList()); + + // Insurance properties + medicalIns1.setEmployee(emp1); + medicalIns2.setEmployee(emp2); + medicalIns3.setEmployee(emp3); + medicalIns4.setEmployee(emp4); + medicalIns5.setEmployee(emp5); + dentalIns1.setEmployee(emp1); + dentalIns2.setEmployee(emp2); + dentalIns3.setEmployee(emp3); + dentalIns4.setEmployee(emp4); + dentalIns5.setEmployee(emp5); + + // Project properties + proj1.setMembers(toSet(emp1, emp2, emp3)); + proj2.setReviewers(toSet(emp4, emp5)); + proj2.setMembers(toSet(emp2, emp3)); + proj3.setReviewers(toSet(emp1)); + proj3.setMembers(toSet(emp4, emp5)); + + // root objects + registry.register("company1", company1); + registry.register("dentalIns99", dentalIns99); + + // TODO why do we need this, i.e. what is the difference to root objects? + registry.register("dept1", dept1); + registry.register("dept2", dept2); + registry.register("emp1", emp1); + registry.register("emp2", emp2); + registry.register("emp3", emp3); + registry.register("emp4", emp4); + registry.register("emp5", emp5); + registry.register("proj1", proj1); + registry.register("proj2", proj2); + registry.register("proj3", proj3); + registry.register("dentalIns1", dentalIns1); + registry.register("dentalIns2", dentalIns2); + registry.register("dentalIns3", dentalIns3); + registry.register("dentalIns4", dentalIns4); + registry.register("dentalIns5", dentalIns5); + registry.register("medicalIns1", medicalIns1); + registry.register("medicalIns2", medicalIns2); + registry.register("medicalIns3", medicalIns3); + registry.register("medicalIns4", medicalIns4); + registry.register("medicalIns5", medicalIns5); + registry.register("room1", room1); + registry.register("room2", room2); + } + + private static Date date(int y, int m, int d) { + return new GregorianCalendar(y, m - 1, d, 0, 0, 0).getTime(); + } + + @SafeVarargs + private static List toList(T... objs) { + return Arrays.stream(objs).collect(Collectors.toList()); + } + + private static Map toMap(String... objs) { + Map map = new HashMap<>(); + for (int i = 0; i < objs.length; i += 2) { + map.put(objs[i], objs[i + 1]); } + return map; + } - private static Set toSet(T... objs) { - return Arrays.stream(objs).collect(Collectors.toSet()); - } + @SafeVarargs + private static Set toSet(T... objs) { + return Arrays.stream(objs).collect(Collectors.toSet()); + } } From b5a82058e4dbdb1429710993a32817d9aaa2925e Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 12 Oct 2025 17:28:00 +0200 Subject: [PATCH 19/43] SampleQuery works! --- .../jdo/tck/pc/company/CompanyModelData.java | 200 +++++++++++++++++- .../tck/pc/company/CompanyModelReader.java | 10 +- 2 files changed, 206 insertions(+), 4 deletions(-) diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelData.java index 283a8ffc1..fed2fa519 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelData.java @@ -190,7 +190,6 @@ public static void initQueryTest( registry.register("company1", company1); registry.register("dentalIns99", dentalIns99); - // TODO why do we need this, i.e. what is the difference to root objects? registry.register("dept1", dept1); registry.register("dept2", dept2); registry.register("emp1", emp1); @@ -215,6 +214,205 @@ public static void initQueryTest( registry.register("room2", room2); } + public static void initSampleQueryTest( + CompanyFactory factory, DefaultListableInstanceFactory registry) { + IAddress addr1 = + factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); + IAddress addr2 = factory.newAddress(2, "Broadway 1", "New York", "NY", "10000", "USA"); + IAddress addr3 = factory.newAddress(3, "Market St.", "San Francisco", "CA", "94102", "USA"); + + // Insurance constructors + IMedicalInsurance medicalIns1 = factory.newMedicalInsurance(1, "Carrier1", "PPO"); + IMedicalInsurance medicalIns2 = factory.newMedicalInsurance(2, "Carrier2", "HMO"); + IMedicalInsurance medicalIns3 = factory.newMedicalInsurance(3, "Carrier3", "HMO"); + IMedicalInsurance medicalIns4 = factory.newMedicalInsurance(4, "Carrier4", "HMO"); + IMedicalInsurance medicalIns5 = factory.newMedicalInsurance(5, "Carrier5", "HMO"); + IDentalInsurance dentalIns1 = + factory.newDentalInsurance(11, "Carrier1", BigDecimal.valueOf(99.995)); + IDentalInsurance dentalIns2 = + factory.newDentalInsurance(12, "Carrier2", BigDecimal.valueOf(99.996)); + IDentalInsurance dentalIns3 = + factory.newDentalInsurance(13, "Carrier3", BigDecimal.valueOf(99.997)); + IDentalInsurance dentalIns4 = + factory.newDentalInsurance(14, "Carrier4", BigDecimal.valueOf(99.998)); + IDentalInsurance dentalIns5 = + factory.newDentalInsurance(15, "Carrier5", BigDecimal.valueOf(99.999)); + IDentalInsurance dentalIns99 = factory.newDentalInsurance(99, "Carrier99", null); + + // Project constructors + IProject proj1 = factory.newProject(1, "orange", BigDecimal.valueOf(2500000.99)); + IProject proj2 = factory.newProject(2, "blue", BigDecimal.valueOf(50000.00)); + IProject proj3 = factory.newProject(3, "green", BigDecimal.valueOf(2000.99)); + + // Company constructor + ICompany company1 = factory.newCompany(1L, "Sun Microsystems, Inc.", date(1952, 4, 11), addr1); + + // Meeting room constructors + IMeetingRoom room1 = factory.newMeetingRoom(1, "Comfy Room"); + IMeetingRoom room2 = factory.newMeetingRoom(2, "Large Discussion Room"); + IMeetingRoom room3 = factory.newMeetingRoom(3, "Conference Room"); + + // Department Constructors + IDepartment dept1 = factory.newDepartment(1, "R&D", company1); + IDepartment dept2 = factory.newDepartment(2, "Sales", company1); + IDepartment dept3 = factory.newDepartment(3, "Marketing", company1); + company1.setDepartments(toSet(dept1, dept2)); + + // Employee Constructors + IFullTimeEmployee emp1 = + factory.newFullTimeEmployee( + 1, "Michael", "Bouschen", "", null, addr1, null, 40000); + emp1.setBirthdate(date(1970, 6, 10)); + emp1.setHiredate(date(1999, 1, 1)); + IFullTimeEmployee emp2 = + factory.newFullTimeEmployee( + 2, "Craig", "Russell", "L.", null, addr2, null, 50000); + emp2.setBirthdate(date(1975, 12, 22)); + emp2.setHiredate(date(2003, 7, 1)); + IPartTimeEmployee emp3 = + factory.newPartTimeEmployee( + 3, "Joe", "Doe", "", null, addr3, null, 15); + emp3.setBirthdate(date(1972, 7, 5)); + emp3.setHiredate(date(2002, 8, 15)); + IPartTimeEmployee emp4 = + factory.newPartTimeEmployee( + 4, "Jane", "Roe", "", null, addr3, null, 13); + emp4.setBirthdate(date(1973, 7, 6)); + emp4.setHiredate(date(2001, 4, 15)); + IFullTimeEmployee emp5 = + factory.newFullTimeEmployee( + 5, "Tilmann", "Zäschke", "", null, addr3, null, 45000); + emp5.setBirthdate(date(1979, 7, 5)); + emp5.setHiredate(date(1999, 8, 15)); + + // Employee properties + emp1.setWeeklyhours(40); + emp1.setMedicalInsurance(medicalIns1); + emp1.setDentalInsurance(dentalIns1); + emp1.setPhoneNumbers(toMap("home", "1111", "work", "123456-1")); + emp1.setLanguages(toSet("German", "English")); + emp1.setDepartment(dept1); + emp1.setFundingDept(dept2); + emp1.setManager(emp2); + emp1.setMentor(emp2); + emp1.setProtege(emp5); + emp1.setHradvisor(emp5); + emp1.setReviewedProjects(toSet(proj3)); + emp1.setProjects(toSet(proj1)); + + emp2.setWeeklyhours(40); + emp2.setMedicalInsurance(medicalIns2); + emp2.setDentalInsurance(dentalIns2); + emp2.setPhoneNumbers(toMap("home", "2222", "work", "123456-2")); + emp2.setLanguages(toSet("English", "Japanese")); + emp2.setDepartment(dept1); + emp2.setFundingDept(dept1); + emp2.setMentor(emp3); + emp2.setProtege(emp1); + emp2.setHradvisor(emp5); + emp2.setProjects(toSet(proj1, proj2)); + emp2.setTeam(toSet(emp1, emp3, emp4, emp5)); + + emp3.setWeeklyhours(19); + emp3.setMedicalInsurance(medicalIns3); + emp3.setDentalInsurance(dentalIns3); + emp3.setPhoneNumbers(toMap("home", "3333", "work", "123456-3")); + emp3.setLanguages(toSet("English", "French")); + emp3.setDepartment(dept1); + emp3.setFundingDept(dept1); + emp3.setManager(emp2); + emp3.setMentor(emp4); + emp3.setProtege(emp2); + emp3.setHradvisor(emp5); + emp3.setProjects(toSet(proj1, proj2)); + + emp4.setMedicalInsurance(medicalIns4); + emp4.setDentalInsurance(dentalIns4); + emp4.setPhoneNumbers(toMap("home", "3343", "work", "124456-3")); + emp4.setLanguages(toSet("English")); + emp4.setDepartment(dept2); + emp4.setFundingDept(dept2); + emp4.setManager(emp2); + emp4.setMentor(emp5); + emp4.setProtege(emp3); + emp4.setHradvisor(emp5); + emp4.setProjects(toSet(proj3)); + emp4.setReviewedProjects(toSet(proj2)); + + emp5.setMedicalInsurance(medicalIns5); + emp5.setDentalInsurance(dentalIns5); + emp5.setPhoneNumbers(toMap("home", "3363", "work", "126456-3")); + emp5.setLanguages(toSet("German", "English", "French", "Japanese")); + emp5.setDepartment(dept2); + emp5.setFundingDept(dept2); + emp5.setManager(emp2); + emp5.setMentor(emp1); + emp5.setProtege(emp4); + emp5.setProjects(toSet(proj3)); + emp5.setReviewedProjects(toSet(proj2)); + emp5.setHradvisees(toSet(emp1, emp2, emp3, emp4)); + + // Finish departments + dept1.setEmployees(toSet(emp1, emp2, emp3)); + dept1.setFundedEmps(toSet(emp2, emp3)); + dept1.setMeetingRooms(toList(room1, room2, room3)); + + dept2.setEmployees(toSet(emp4, emp5)); + dept2.setFundedEmps(toSet(emp1, emp4, emp5)); + dept2.setMeetingRooms(toList()); + + dept3.setEmployees(toSet()); + dept3.setFundedEmps(toSet()); + dept3.setMeetingRooms(toList()); + + // Insurance properties + medicalIns1.setEmployee(emp1); + medicalIns2.setEmployee(emp2); + medicalIns3.setEmployee(emp3); + medicalIns4.setEmployee(emp4); + medicalIns5.setEmployee(emp5); + dentalIns1.setEmployee(emp1); + dentalIns2.setEmployee(emp2); + dentalIns3.setEmployee(emp3); + dentalIns4.setEmployee(emp4); + dentalIns5.setEmployee(emp5); + + // Project properties + proj1.setMembers(toSet(emp1, emp2, emp3)); + proj2.setReviewers(toSet(emp4, emp5)); + proj2.setMembers(toSet(emp2, emp3)); + proj3.setReviewers(toSet(emp1)); + proj3.setMembers(toSet(emp4, emp5)); + + // root objects + registry.register("company1", company1); + registry.register("dentalIns99", dentalIns99); + + registry.register("dept1", dept1); + registry.register("dept2", dept2); + registry.register("dept3", dept3); + registry.register("emp1", emp1); + registry.register("emp2", emp2); + registry.register("emp3", emp3); + registry.register("emp4", emp4); + registry.register("emp5", emp5); + registry.register("proj1", proj1); + registry.register("proj2", proj2); + registry.register("proj3", proj3); + registry.register("dentalIns1", dentalIns1); + registry.register("dentalIns2", dentalIns2); + registry.register("dentalIns3", dentalIns3); + registry.register("dentalIns4", dentalIns4); + registry.register("dentalIns5", dentalIns5); + registry.register("medicalIns1", medicalIns1); + registry.register("medicalIns2", medicalIns2); + registry.register("medicalIns3", medicalIns3); + registry.register("medicalIns4", medicalIns4); + registry.register("medicalIns5", medicalIns5); + registry.register("room1", room1); + registry.register("room2", room2); + } + private static Date date(int y, int m, int d) { return new GregorianCalendar(y, m - 1, d, 0, 0, 0).getTime(); } diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java index ffe564432..903c30d89 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java @@ -74,18 +74,21 @@ public CompanyModelReader(String resourceName, ClassLoader classLoader) { switch (resourceName) { - case SAMPLE_QUERIES_TEST: + //case SAMPLE_QUERIES_TEST: case JDOQL_NAVIGATION_TESTS: case JDOQL_SUBQUERIES_TESTS: reader = new CompanyModelReaderOld(resourceName, classLoader); break; case QUERY_TEST: configureFactory(); - // this.reset(); -// reader = new CompanyModelReaderOld(resourceName, classLoader); CompanyModelData.initQueryTest(companyFactory, this); reader = null; break; + case SAMPLE_QUERIES_TEST: + configureFactory(); + CompanyModelData.initSampleQueryTest(companyFactory, this); + reader = null; + break; case MYLIB_TEST: configureFactory(); // TODO use companyModelFactory! @@ -143,6 +146,7 @@ public Class[] getTearDownClassesFromFactory() { System.err.println("TearDownClass: " + c); } System.err.println("TearDownClass: " + Arrays.toString(companyFactory.getTearDownClasses())); + this.reset(); return companyFactory.getTearDownClasses(); } From 76a419571dd3d11c2de504dcac1a4ca790abf5cf Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 12 Oct 2025 18:50:18 +0200 Subject: [PATCH 20/43] NavigationTest works --- .../tck/pc/company/CompanyModelReader.java | 14 +- .../tck/pc/company/data/CompanyModelData.java | 46 +++ .../pc/company/data/NavigationTestData.java | 295 ++++++++++++++++++ .../tck/pc/company/data/QueryTestData.java | 216 +++++++++++++ .../SampleQueryTestData.java} | 220 +------------ 5 files changed, 571 insertions(+), 220 deletions(-) create mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/company/data/CompanyModelData.java create mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java create mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java rename tck/src/main/java/org/apache/jdo/tck/pc/company/{CompanyModelData.java => data/SampleQueryTestData.java} (51%) diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java index 903c30d89..75494e551 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java @@ -22,13 +22,13 @@ import java.util.List; import java.util.Locale; +import org.apache.jdo.tck.pc.company.data.NavigationTestData; +import org.apache.jdo.tck.pc.company.data.QueryTestData; +import org.apache.jdo.tck.pc.company.data.SampleQueryTestData; import org.apache.jdo.tck.pc.mylib.MylibReader; import org.apache.jdo.tck.util.ConversionHelper; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; import org.apache.jdo.tck.util.JDOCustomDateEditor; -import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; -import org.springframework.core.io.ClassPathResource; /** * Utility class to create a graph of company model instances from an xml representation. @@ -76,17 +76,21 @@ public CompanyModelReader(String resourceName, ClassLoader classLoader) { switch (resourceName) { //case SAMPLE_QUERIES_TEST: case JDOQL_NAVIGATION_TESTS: + configureFactory(); + NavigationTestData.initNavigationTest(companyFactory, this); + reader = null; + break; case JDOQL_SUBQUERIES_TESTS: reader = new CompanyModelReaderOld(resourceName, classLoader); break; case QUERY_TEST: configureFactory(); - CompanyModelData.initQueryTest(companyFactory, this); + QueryTestData.initQueryTest(companyFactory, this); reader = null; break; case SAMPLE_QUERIES_TEST: configureFactory(); - CompanyModelData.initSampleQueryTest(companyFactory, this); + SampleQueryTestData.initSampleQueryTest(companyFactory, this); reader = null; break; case MYLIB_TEST: diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/CompanyModelData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/CompanyModelData.java new file mode 100644 index 000000000..b16273794 --- /dev/null +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/CompanyModelData.java @@ -0,0 +1,46 @@ +/* + * 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 + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.company.data; + +import java.util.*; +import java.util.stream.Collectors; + +public interface CompanyModelData { + + static Date date(int y, int m, int d) { + return new GregorianCalendar(y, m - 1, d, 0, 0, 0).getTime(); + } + + @SafeVarargs + static List toList(T... objs) { + return Arrays.stream(objs).collect(Collectors.toList()); + } + + static Map toMap(String... objs) { + Map map = new HashMap<>(); + for (int i = 0; i < objs.length; i += 2) { + map.put(objs[i], objs[i + 1]); + } + return map; + } + + @SafeVarargs + static Set toSet(T... objs) { + return Arrays.stream(objs).collect(Collectors.toSet()); + } +} diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java new file mode 100644 index 000000000..0e6dce181 --- /dev/null +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java @@ -0,0 +1,295 @@ +/* + * 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 + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.company.data; + +import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; + +import java.math.BigDecimal; +import org.apache.jdo.tck.pc.company.*; +import org.apache.jdo.tck.util.DefaultListableInstanceFactory; + +public class NavigationTestData { + + public static void initNavigationTest( + CompanyFactory factory, DefaultListableInstanceFactory registry) { + IAddress addr1 = + factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); + IAddress addr2 = factory.newAddress(2, "Broadway 1", "New York", "NY", "10000", "USA"); + IAddress addr3 = factory.newAddress(3, "Market St.", "San Francisco", "CA", "94102", "USA"); + + // Insurance constructors + IMedicalInsurance medicalIns1 = factory.newMedicalInsurance(1, "Carrier1", "PPO"); + IMedicalInsurance medicalIns2 = factory.newMedicalInsurance(2, "Carrier2", "HMO"); + IMedicalInsurance medicalIns3 = factory.newMedicalInsurance(3, "Carrier3", "HMO"); + IMedicalInsurance medicalIns4 = factory.newMedicalInsurance(4, "Carrier4", "HMO"); + IMedicalInsurance medicalIns5 = factory.newMedicalInsurance(5, "Carrier5", "HMO"); + IMedicalInsurance medicalIns98 = factory.newMedicalInsurance(98, "Carrier98", "HMO"); + IDentalInsurance dentalIns1 = + factory.newDentalInsurance(11, "Carrier1", BigDecimal.valueOf(99.995)); + IDentalInsurance dentalIns2 = + factory.newDentalInsurance(12, "Carrier2", BigDecimal.valueOf(99.996)); + IDentalInsurance dentalIns3 = + factory.newDentalInsurance(13, "Carrier3", BigDecimal.valueOf(99.997)); + IDentalInsurance dentalIns4 = + factory.newDentalInsurance(14, "Carrier4", BigDecimal.valueOf(99.998)); + IDentalInsurance dentalIns5 = + factory.newDentalInsurance(15, "Carrier5", BigDecimal.valueOf(99.999)); + IDentalInsurance dentalIns99 = factory.newDentalInsurance(99, "Carrier99", null); + + // Project constructors + IProject proj1 = factory.newProject(1, "orange", BigDecimal.valueOf(2500000.99)); + IProject proj2 = factory.newProject(2, "blue", BigDecimal.valueOf(50000.00)); + IProject proj3 = factory.newProject(3, "green", BigDecimal.valueOf(2000.99)); + + // Company constructor + ICompany company1 = factory.newCompany(1L, "Sun Microsystems, Inc.", date(1952, 4, 11), addr1); + + // Meeting room constructors + IMeetingRoom room1 = factory.newMeetingRoom(1, "Comfy Room"); + IMeetingRoom room2 = factory.newMeetingRoom(2, "Large Discussion Room"); + IMeetingRoom room3 = factory.newMeetingRoom(3, "Conference Room"); + + // Department Constructors + IDepartment dept1 = factory.newDepartment(1, "Development", company1); + IDepartment dept2 = factory.newDepartment(2, "Human Resources", company1); + company1.setDepartments(toSet(dept1, dept2)); + + // Employee Constructors + IFullTimeEmployee emp0 = + factory.newFullTimeEmployee( + 0, "emp0First", "emp0Last", "emp0Middle", null, addr1, null, 50000); + emp0.setBirthdate(date(1962, 7, 10)); + emp0.setHiredate(date(1997, 1, 1)); + IFullTimeEmployee emp1 = + factory.newFullTimeEmployee( + 1, "emp1First", "emp1Last", "emp1Middle", null, addr1, null, 20000); + emp1.setBirthdate(date(1970, 6, 10)); + emp1.setHiredate(date(1999, 1, 1)); + IFullTimeEmployee emp2 = + factory.newFullTimeEmployee( + 2, "emp2First", "emp2Last", "emp2Middle", null, addr2, null, 10000); + emp2.setBirthdate(date(1975, 12, 22)); + emp2.setHiredate(date(2003, 7, 1)); + IPartTimeEmployee emp3 = + factory.newPartTimeEmployee( + 3, "emp3First", "emp3Last", "emp3Middle", null, addr3, null, 15); + emp3.setBirthdate(date(1972, 7, 5)); + emp3.setHiredate(date(2002, 8, 15)); + IPartTimeEmployee emp4 = + factory.newPartTimeEmployee( + 4, "emp4First", "emp4Last", "emp4Middle", null, addr3, null, 25000); + emp4.setBirthdate(date(1973, 7, 6)); + emp4.setHiredate(date(2001, 4, 15)); + IFullTimeEmployee emp5 = + factory.newFullTimeEmployee( + 5, "emp5First", "emp5Last", "emp5Middle", null, addr3, null, 18000); + emp5.setBirthdate(date(1962, 7, 5)); + emp5.setHiredate(date(2002, 11, 1)); + IFullTimeEmployee emp6 = + factory.newFullTimeEmployee( + 6, "emp6First", "emp6Last", "emp6Middle", null, addr3, null, 22000); + emp6.setBirthdate(date(1969, 6, 10)); + emp6.setHiredate(date(2002, 6, 1)); + IFullTimeEmployee emp7 = + factory.newFullTimeEmployee( + 7, "emp7First", "emp7Last", "emp7Middle", null, addr1, null, 40000); + emp7.setBirthdate(date(1970, 6, 10)); + emp7.setHiredate(date(2000, 1, 1)); + IFullTimeEmployee emp8 = + factory.newFullTimeEmployee( + 8, "emp8First", "emp8Last", "emp8Middle", null, addr2, null, 10000); + emp8.setBirthdate(date(1975, 12, 22)); + emp8.setHiredate(date(2003, 8, 1)); + IFullTimeEmployee emp9 = + factory.newFullTimeEmployee( + 9, "emp9First", "emp9Last", "emp9Middle", null, addr3, null, 12000); + emp9.setBirthdate(date(1972, 7, 5)); + emp9.setHiredate(date(2002, 5, 1)); + IFullTimeEmployee emp10 = + factory.newFullTimeEmployee( + 10, "emp10First", "emp10Last", "emp10Middle", null, addr3, null, 24000); + emp10.setBirthdate(date(1972, 7, 5)); + emp10.setHiredate(date(2002, 10, 1)); + + // Employee properties + emp0.setWeeklyhours(40); + emp0.setMedicalInsurance(null); + emp0.setDentalInsurance(null); + emp0.setPhoneNumbers(toMap("home", "3232", "work", "223311-1")); + emp0.setDepartment(dept1); + emp0.setFundingDept(dept2); + emp0.setManager(null); + emp0.setTeam(toSet(emp1)); + emp0.setMentor(null); + emp0.setProtege(null); + emp0.setHradvisor(emp5); + emp0.setReviewedProjects(toSet(proj3)); + emp0.setProjects(toSet(proj1)); + + emp1.setWeeklyhours(40); + emp1.setMedicalInsurance(medicalIns1); + emp1.setDentalInsurance(dentalIns1); + emp1.setPhoneNumbers(toMap("home", "1111", "work", "123456-1")); + emp1.setDepartment(dept1); + emp1.setFundingDept(dept2); + emp1.setManager(emp2); + emp1.setTeam(toSet(emp2, emp3, emp10)); + emp1.setMentor(emp2); + emp1.setProtege(emp5); + emp1.setHradvisor(emp5); + emp1.setReviewedProjects(toSet(proj3)); + emp1.setProjects(toSet(proj1)); + + emp2.setWeeklyhours(40); + emp2.setMedicalInsurance(medicalIns2); + emp2.setDentalInsurance(dentalIns2); + emp2.setPhoneNumbers(toMap("home", "2222", "work", "123456-2")); + emp2.setDepartment(dept1); + emp2.setFundingDept(dept1); + emp2.setMentor(emp3); + emp2.setProtege(emp1); + emp2.setHradvisor(emp5); + emp2.setProjects(toSet(proj1, proj2)); + + emp3.setWeeklyhours(19); + emp3.setMedicalInsurance(medicalIns3); + emp3.setDentalInsurance(dentalIns3); + emp3.setPhoneNumbers(toMap("home", "3333", "work", "123456-3")); + emp3.setDepartment(dept1); + emp3.setFundingDept(dept1); + emp3.setManager(emp1); + emp3.setTeam(toSet()); + emp3.setMentor(emp4); + emp3.setProtege(emp2); + emp3.setHradvisor(emp5); + emp3.setProjects(toSet(proj1, proj2)); + + emp4.setWeeklyhours(40); + emp4.setMedicalInsurance(medicalIns4); + emp4.setDentalInsurance(dentalIns4); + emp4.setPhoneNumbers(toMap("home", "3343", "work", "124456-3")); + emp4.setDepartment(dept1); + emp4.setFundingDept(dept2); + emp4.setManager(null); + emp4.setTeam(toSet(emp5, emp6)); + emp4.setMentor(emp5); + emp4.setProtege(emp3); + emp4.setHradvisor(emp5); + emp4.setProjects(toSet(proj3)); + emp4.setReviewedProjects(toSet(proj2)); + + emp5.setWeeklyhours(35); + emp5.setMedicalInsurance(medicalIns5); + emp5.setDentalInsurance(dentalIns5); + emp5.setPhoneNumbers(toMap("home", "3363", "work", "126456-3")); + emp5.setDepartment(dept1); + emp5.setFundingDept(dept2); + emp5.setManager(emp4); + emp5.setTeam(toSet()); + emp5.setMentor(emp1); + emp5.setProtege(emp4); + emp5.setProjects(toSet(proj3)); + emp5.setReviewedProjects(toSet(proj2)); + emp5.setHradvisees(toSet(emp1, emp2, emp3, emp4)); + + emp6.setWeeklyhours(60); + emp6.setDepartment(dept1); + emp6.setManager(emp4); + emp6.setTeam(toSet()); + + emp7.setWeeklyhours(40); + emp7.setDepartment(dept2); + emp7.setManager(null); + emp7.setTeam(toSet(emp8, emp9)); + + emp8.setWeeklyhours(15); + emp8.setDepartment(dept2); + emp8.setManager(emp7); + emp8.setTeam(toSet()); + + emp9.setWeeklyhours(20); + emp9.setDepartment(dept2); + emp9.setManager(emp7); + emp9.setTeam(toSet()); + + emp10.setWeeklyhours(40); + emp10.setDepartment(dept2); + emp10.setManager(emp1); + emp10.setTeam(toSet()); + + // Finish departments + dept1.setEmployees(toSet(emp1, emp2, emp3, emp4, emp5, emp6)); + + dept2.setEmployees(toSet(emp7, emp8, emp9, emp10)); + + // Insurance properties + medicalIns1.setEmployee(emp1); + medicalIns2.setEmployee(emp2); + medicalIns3.setEmployee(emp3); + medicalIns4.setEmployee(emp4); + medicalIns5.setEmployee(emp5); + medicalIns98.setEmployee(null); + dentalIns1.setEmployee(emp1); + dentalIns2.setEmployee(emp2); + dentalIns3.setEmployee(emp3); + dentalIns4.setEmployee(emp4); + dentalIns5.setEmployee(emp5); + dentalIns99.setEmployee(null); + + // Project properties + proj1.setMembers(toSet(emp1, emp2, emp3)); + proj2.setReviewers(toSet(emp4, emp5)); + proj2.setMembers(toSet(emp2, emp3)); + proj3.setReviewers(toSet(emp1)); + proj3.setMembers(toSet(emp4, emp5)); + + // root objects + registry.register("company1", company1); + registry.register("medicalIns98", medicalIns98); + registry.register("dentalIns99", dentalIns99); + + registry.register("dept1", dept1); + registry.register("dept2", dept2); + registry.register("emp0", emp0); + registry.register("emp1", emp1); + registry.register("emp2", emp2); + registry.register("emp3", emp3); + registry.register("emp4", emp4); + registry.register("emp5", emp5); + registry.register("emp6", emp6); + registry.register("emp7", emp7); + registry.register("emp8", emp8); + registry.register("emp9", emp9); + registry.register("emp10", emp10); + registry.register("proj1", proj1); + registry.register("proj2", proj2); + registry.register("proj3", proj3); + registry.register("dentalIns1", dentalIns1); + registry.register("dentalIns2", dentalIns2); + registry.register("dentalIns3", dentalIns3); + registry.register("dentalIns4", dentalIns4); + registry.register("dentalIns5", dentalIns5); + registry.register("medicalIns1", medicalIns1); + registry.register("medicalIns2", medicalIns2); + registry.register("medicalIns3", medicalIns3); + registry.register("medicalIns4", medicalIns4); + registry.register("medicalIns5", medicalIns5); + registry.register("room1", room1); + registry.register("room2", room2); + } +} diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java new file mode 100644 index 000000000..1f6e531dc --- /dev/null +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java @@ -0,0 +1,216 @@ +/* + * 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 + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.company.data; + +import java.math.BigDecimal; + +import org.apache.jdo.tck.pc.company.*; +import org.apache.jdo.tck.util.DefaultListableInstanceFactory; + +import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; + +public class QueryTestData { + + public static void initQueryTest( + CompanyFactory factory, DefaultListableInstanceFactory registry) { + IAddress addr1 = + factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); + IAddress addr2 = factory.newAddress(2, "Broadway 1", "New York", "NY", "10000", "USA"); + IAddress addr3 = factory.newAddress(3, "Market St.", "San Francisco", "CA", "94102", "USA"); + + // Insurance constructors + IMedicalInsurance medicalIns1 = factory.newMedicalInsurance(1, "Carrier1", "PPO"); + IMedicalInsurance medicalIns2 = factory.newMedicalInsurance(2, "Carrier2", "HMO"); + IMedicalInsurance medicalIns3 = factory.newMedicalInsurance(3, "Carrier3", "HMO"); + IMedicalInsurance medicalIns4 = factory.newMedicalInsurance(4, "Carrier4", "HMO"); + IMedicalInsurance medicalIns5 = factory.newMedicalInsurance(5, "Carrier5", "HMO"); + IDentalInsurance dentalIns1 = + factory.newDentalInsurance(11, "Carrier1", BigDecimal.valueOf(99.995)); + IDentalInsurance dentalIns2 = + factory.newDentalInsurance(12, "Carrier2", BigDecimal.valueOf(99.996)); + IDentalInsurance dentalIns3 = + factory.newDentalInsurance(13, "Carrier3", BigDecimal.valueOf(99.997)); + IDentalInsurance dentalIns4 = + factory.newDentalInsurance(14, "Carrier4", BigDecimal.valueOf(99.998)); + IDentalInsurance dentalIns5 = + factory.newDentalInsurance(15, "Carrier5", BigDecimal.valueOf(99.999)); + IDentalInsurance dentalIns99 = factory.newDentalInsurance(99, "Carrier99", null); + + // Project constructors + IProject proj1 = factory.newProject(1, "orange", BigDecimal.valueOf(2500000.99)); + IProject proj2 = factory.newProject(2, "blue", BigDecimal.valueOf(50000.00)); + IProject proj3 = factory.newProject(3, "green", BigDecimal.valueOf(2000.99)); + + // Company constructor + ICompany company1 = factory.newCompany(1L, "Sun Microsystems, Inc.", date(1952, 4, 11), addr1); + + // Meeting room constructors + IMeetingRoom room1 = factory.newMeetingRoom(1, "Comfy Room"); + IMeetingRoom room2 = factory.newMeetingRoom(2, "Large Discussion Room"); + IMeetingRoom room3 = factory.newMeetingRoom(3, "Conference Room"); + + // Department Constructors + IDepartment dept1 = factory.newDepartment(1, "Development", company1); + IDepartment dept2 = factory.newDepartment(2, "Human Resources", company1); + company1.setDepartments(toSet(dept1, dept2)); + + // Employee Constructors + IFullTimeEmployee emp1 = + factory.newFullTimeEmployee( + 1, "emp1First", "emp1Last", "emp1Middle", null, addr1, null, 20000); + emp1.setBirthdate(date(1970, 6, 10)); + emp1.setHiredate(date(1999, 1, 1)); + IFullTimeEmployee emp2 = + factory.newFullTimeEmployee( + 2, "emp2First", "emp2Last", "emp2Middle", null, addr2, null, 10000); + emp2.setBirthdate(date(1975, 12, 22)); + emp2.setHiredate(date(2003, 7, 1)); + IPartTimeEmployee emp3 = + factory.newPartTimeEmployee( + 3, "emp3First", "emp3Last", "emp3Middle", null, addr3, null, 15); + emp3.setBirthdate(date(1972, 7, 5)); + emp3.setHiredate(date(2002, 8, 15)); + IPartTimeEmployee emp4 = + factory.newPartTimeEmployee( + 4, "emp4First", "emp4Last", "emp4Middle", null, addr3, null, 13); + emp4.setBirthdate(date(1973, 7, 6)); + emp4.setHiredate(date(2001, 4, 15)); + IFullTimeEmployee emp5 = + factory.newFullTimeEmployee( + 5, "emp5First", "emp5Last", "emp5Middle", null, addr3, null, 45000); + emp5.setBirthdate(date(1962, 7, 5)); + emp5.setHiredate(date(1998, 8, 15)); + + // Employee properties + emp1.setWeeklyhours(40); + emp1.setMedicalInsurance(medicalIns1); + emp1.setDentalInsurance(dentalIns1); + emp1.setPhoneNumbers(toMap("home", "1111", "work", "123456-1")); + emp1.setDepartment(dept1); + emp1.setFundingDept(dept2); + emp1.setManager(emp2); + emp1.setMentor(emp2); + emp1.setProtege(emp5); + emp1.setHradvisor(emp5); + emp1.setReviewedProjects(toSet(proj3)); + emp1.setProjects(toSet(proj1)); + + emp2.setWeeklyhours(40); + emp2.setMedicalInsurance(medicalIns2); + emp2.setDentalInsurance(dentalIns2); + emp2.setPhoneNumbers(toMap("home", "2222", "work", "123456-2")); + emp2.setDepartment(dept1); + emp2.setFundingDept(dept1); + emp2.setMentor(emp3); + emp2.setProtege(emp1); + emp2.setHradvisor(emp5); + emp2.setProjects(toSet(proj1, proj2)); + emp2.setTeam(toSet(emp1, emp3, emp4, emp5)); + + emp3.setWeeklyhours(19); + emp3.setMedicalInsurance(medicalIns3); + emp3.setDentalInsurance(dentalIns3); + emp3.setPhoneNumbers(toMap("home", "3333", "work", "123456-3")); + emp3.setDepartment(dept1); + emp3.setFundingDept(dept1); + emp3.setManager(emp2); + emp3.setMentor(emp4); + emp3.setProtege(emp2); + emp3.setHradvisor(emp5); + emp3.setProjects(toSet(proj1, proj2)); + + emp4.setMedicalInsurance(medicalIns4); + emp4.setDentalInsurance(dentalIns4); + emp4.setPhoneNumbers(toMap("home", "3343", "work", "124456-3")); + emp4.setDepartment(dept2); + emp4.setFundingDept(dept2); + emp4.setManager(emp2); + emp4.setMentor(emp5); + emp4.setProtege(emp3); + emp4.setHradvisor(emp5); + emp4.setProjects(toSet(proj3)); + emp4.setReviewedProjects(toSet(proj2)); + + emp5.setMedicalInsurance(medicalIns5); + emp5.setDentalInsurance(dentalIns5); + emp5.setPhoneNumbers(toMap("home", "3363", "work", "126456-3")); + emp5.setDepartment(dept2); + emp5.setFundingDept(dept2); + emp5.setManager(emp2); + emp5.setMentor(emp1); + emp5.setProtege(emp4); + emp5.setProjects(toSet(proj3)); + emp5.setReviewedProjects(toSet(proj2)); + emp5.setHradvisees(toSet(emp1, emp2, emp3, emp4)); + + // Finish departments + dept1.setEmployees(toSet(emp1, emp2, emp3)); + dept1.setFundedEmps(toSet(emp2, emp3)); + dept1.setMeetingRooms(toList(room1, room2, room3)); + + dept2.setEmployees(toSet(emp4, emp5)); + dept2.setFundedEmps(toSet(emp1, emp4, emp5)); + dept2.setMeetingRooms(toList()); + + // Insurance properties + medicalIns1.setEmployee(emp1); + medicalIns2.setEmployee(emp2); + medicalIns3.setEmployee(emp3); + medicalIns4.setEmployee(emp4); + medicalIns5.setEmployee(emp5); + dentalIns1.setEmployee(emp1); + dentalIns2.setEmployee(emp2); + dentalIns3.setEmployee(emp3); + dentalIns4.setEmployee(emp4); + dentalIns5.setEmployee(emp5); + + // Project properties + proj1.setMembers(toSet(emp1, emp2, emp3)); + proj2.setReviewers(toSet(emp4, emp5)); + proj2.setMembers(toSet(emp2, emp3)); + proj3.setReviewers(toSet(emp1)); + proj3.setMembers(toSet(emp4, emp5)); + + // root objects + registry.register("company1", company1); + registry.register("dentalIns99", dentalIns99); + + registry.register("dept1", dept1); + registry.register("dept2", dept2); + registry.register("emp1", emp1); + registry.register("emp2", emp2); + registry.register("emp3", emp3); + registry.register("emp4", emp4); + registry.register("emp5", emp5); + registry.register("proj1", proj1); + registry.register("proj2", proj2); + registry.register("proj3", proj3); + registry.register("dentalIns1", dentalIns1); + registry.register("dentalIns2", dentalIns2); + registry.register("dentalIns3", dentalIns3); + registry.register("dentalIns4", dentalIns4); + registry.register("dentalIns5", dentalIns5); + registry.register("medicalIns1", medicalIns1); + registry.register("medicalIns2", medicalIns2); + registry.register("medicalIns3", medicalIns3); + registry.register("medicalIns4", medicalIns4); + registry.register("medicalIns5", medicalIns5); + registry.register("room1", room1); + registry.register("room2", room2); + } +} diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java similarity index 51% rename from tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelData.java rename to tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java index fed2fa519..ccafa4e13 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java @@ -15,204 +15,16 @@ * limitations under the License. */ -package org.apache.jdo.tck.pc.company; +package org.apache.jdo.tck.pc.company.data; import java.math.BigDecimal; -import java.util.*; -import java.util.stream.Collectors; -import org.apache.jdo.tck.util.ConversionHelper; -import org.apache.jdo.tck.util.DefaultListableInstanceFactory; -import org.apache.jdo.tck.util.JDOCustomDateEditor; - -public class CompanyModelData { - - public static void initQueryTest( - CompanyFactory factory, DefaultListableInstanceFactory registry) { - IAddress addr1 = - factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); - IAddress addr2 = factory.newAddress(2, "Broadway 1", "New York", "NY", "10000", "USA"); - IAddress addr3 = factory.newAddress(3, "Market St.", "San Francisco", "CA", "94102", "USA"); - - // Insurance constructors - IMedicalInsurance medicalIns1 = factory.newMedicalInsurance(1, "Carrier1", "PPO"); - IMedicalInsurance medicalIns2 = factory.newMedicalInsurance(2, "Carrier2", "HMO"); - IMedicalInsurance medicalIns3 = factory.newMedicalInsurance(3, "Carrier3", "HMO"); - IMedicalInsurance medicalIns4 = factory.newMedicalInsurance(4, "Carrier4", "HMO"); - IMedicalInsurance medicalIns5 = factory.newMedicalInsurance(5, "Carrier5", "HMO"); - IDentalInsurance dentalIns1 = - factory.newDentalInsurance(11, "Carrier1", BigDecimal.valueOf(99.995)); - IDentalInsurance dentalIns2 = - factory.newDentalInsurance(12, "Carrier2", BigDecimal.valueOf(99.996)); - IDentalInsurance dentalIns3 = - factory.newDentalInsurance(13, "Carrier3", BigDecimal.valueOf(99.997)); - IDentalInsurance dentalIns4 = - factory.newDentalInsurance(14, "Carrier4", BigDecimal.valueOf(99.998)); - IDentalInsurance dentalIns5 = - factory.newDentalInsurance(15, "Carrier5", BigDecimal.valueOf(99.999)); - IDentalInsurance dentalIns99 = factory.newDentalInsurance(99, "Carrier99", null); - - // Project constructors - IProject proj1 = factory.newProject(1, "orange", BigDecimal.valueOf(2500000.99)); - IProject proj2 = factory.newProject(2, "blue", BigDecimal.valueOf(50000.00)); - IProject proj3 = factory.newProject(3, "green", BigDecimal.valueOf(2000.99)); - - // Company constructor - ICompany company1 = factory.newCompany(1L, "Sun Microsystems, Inc.", date(1952, 4, 11), addr1); - - // Meeting room constructors - IMeetingRoom room1 = factory.newMeetingRoom(1, "Comfy Room"); - IMeetingRoom room2 = factory.newMeetingRoom(2, "Large Discussion Room"); - IMeetingRoom room3 = factory.newMeetingRoom(3, "Conference Room"); - - // Department Constructors - IDepartment dept1 = factory.newDepartment(1, "Development", company1); - IDepartment dept2 = factory.newDepartment(2, "Human Resources", company1); - company1.setDepartments(toSet(dept1, dept2)); - - // Employee Constructors - IFullTimeEmployee emp1 = - factory.newFullTimeEmployee( - 1, "emp1First", "emp1Last", "emp1Middle", null, addr1, null, 20000); - emp1.setBirthdate(date(1970, 6, 10)); - emp1.setHiredate(date(1999, 1, 1)); - IFullTimeEmployee emp2 = - factory.newFullTimeEmployee( - 2, "emp2First", "emp2Last", "emp2Middle", null, addr2, null, 10000); - emp2.setBirthdate(date(1975, 12, 22)); - emp2.setHiredate(date(2003, 7, 1)); - IPartTimeEmployee emp3 = - factory.newPartTimeEmployee( - 3, "emp3First", "emp3Last", "emp3Middle", null, addr3, null, 15); - emp3.setBirthdate(date(1972, 7, 5)); - emp3.setHiredate(date(2002, 8, 15)); - IPartTimeEmployee emp4 = - factory.newPartTimeEmployee( - 4, "emp4First", "emp4Last", "emp4Middle", null, addr3, null, 13); - emp4.setBirthdate(date(1973, 7, 6)); - emp4.setHiredate(date(2001, 4, 15)); - IFullTimeEmployee emp5 = - factory.newFullTimeEmployee( - 5, "emp5First", "emp5Last", "emp5Middle", null, addr3, null, 45000); - emp5.setBirthdate(date(1962, 7, 5)); - emp5.setHiredate(date(1998, 8, 15)); - - // Employee properties - emp1.setWeeklyhours(40); - emp1.setMedicalInsurance(medicalIns1); - emp1.setDentalInsurance(dentalIns1); - emp1.setPhoneNumbers(toMap("home", "1111", "work", "123456-1")); - emp1.setDepartment(dept1); - emp1.setFundingDept(dept2); - emp1.setManager(emp2); - emp1.setMentor(emp2); - emp1.setProtege(emp5); - emp1.setHradvisor(emp5); - emp1.setReviewedProjects(toSet(proj3)); - emp1.setProjects(toSet(proj1)); - - emp2.setWeeklyhours(40); - emp2.setMedicalInsurance(medicalIns2); - emp2.setDentalInsurance(dentalIns2); - emp2.setPhoneNumbers(toMap("home", "2222", "work", "123456-2")); - emp2.setDepartment(dept1); - emp2.setFundingDept(dept1); - emp2.setMentor(emp3); - emp2.setProtege(emp1); - emp2.setHradvisor(emp5); - emp2.setProjects(toSet(proj1, proj2)); - emp2.setTeam(toSet(emp1, emp3, emp4, emp5)); - - emp3.setWeeklyhours(19); - emp3.setMedicalInsurance(medicalIns3); - emp3.setDentalInsurance(dentalIns3); - emp3.setPhoneNumbers(toMap("home", "3333", "work", "123456-3")); - emp3.setDepartment(dept1); - emp3.setFundingDept(dept1); - emp3.setManager(emp2); - emp3.setMentor(emp4); - emp3.setProtege(emp2); - emp3.setHradvisor(emp5); - emp3.setProjects(toSet(proj1, proj2)); - - emp4.setMedicalInsurance(medicalIns4); - emp4.setDentalInsurance(dentalIns4); - emp4.setPhoneNumbers(toMap("home", "3343", "work", "124456-3")); - emp4.setDepartment(dept2); - emp4.setFundingDept(dept2); - emp4.setManager(emp2); - emp4.setMentor(emp5); - emp4.setProtege(emp3); - emp4.setHradvisor(emp5); - emp4.setProjects(toSet(proj3)); - emp4.setReviewedProjects(toSet(proj2)); - - emp5.setMedicalInsurance(medicalIns5); - emp5.setDentalInsurance(dentalIns5); - emp5.setPhoneNumbers(toMap("home", "3363", "work", "126456-3")); - emp5.setDepartment(dept2); - emp5.setFundingDept(dept2); - emp5.setManager(emp2); - emp5.setMentor(emp1); - emp5.setProtege(emp4); - emp5.setProjects(toSet(proj3)); - emp5.setReviewedProjects(toSet(proj2)); - emp5.setHradvisees(toSet(emp1, emp2, emp3, emp4)); - - // Finish departments - dept1.setEmployees(toSet(emp1, emp2, emp3)); - dept1.setFundedEmps(toSet(emp2, emp3)); - dept1.setMeetingRooms(toList(room1, room2, room3)); - - dept2.setEmployees(toSet(emp4, emp5)); - dept2.setFundedEmps(toSet(emp1, emp4, emp5)); - dept2.setMeetingRooms(toList()); - // Insurance properties - medicalIns1.setEmployee(emp1); - medicalIns2.setEmployee(emp2); - medicalIns3.setEmployee(emp3); - medicalIns4.setEmployee(emp4); - medicalIns5.setEmployee(emp5); - dentalIns1.setEmployee(emp1); - dentalIns2.setEmployee(emp2); - dentalIns3.setEmployee(emp3); - dentalIns4.setEmployee(emp4); - dentalIns5.setEmployee(emp5); +import org.apache.jdo.tck.pc.company.*; +import org.apache.jdo.tck.util.DefaultListableInstanceFactory; - // Project properties - proj1.setMembers(toSet(emp1, emp2, emp3)); - proj2.setReviewers(toSet(emp4, emp5)); - proj2.setMembers(toSet(emp2, emp3)); - proj3.setReviewers(toSet(emp1)); - proj3.setMembers(toSet(emp4, emp5)); +import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; - // root objects - registry.register("company1", company1); - registry.register("dentalIns99", dentalIns99); - - registry.register("dept1", dept1); - registry.register("dept2", dept2); - registry.register("emp1", emp1); - registry.register("emp2", emp2); - registry.register("emp3", emp3); - registry.register("emp4", emp4); - registry.register("emp5", emp5); - registry.register("proj1", proj1); - registry.register("proj2", proj2); - registry.register("proj3", proj3); - registry.register("dentalIns1", dentalIns1); - registry.register("dentalIns2", dentalIns2); - registry.register("dentalIns3", dentalIns3); - registry.register("dentalIns4", dentalIns4); - registry.register("dentalIns5", dentalIns5); - registry.register("medicalIns1", medicalIns1); - registry.register("medicalIns2", medicalIns2); - registry.register("medicalIns3", medicalIns3); - registry.register("medicalIns4", medicalIns4); - registry.register("medicalIns5", medicalIns5); - registry.register("room1", room1); - registry.register("room2", room2); - } +public class SampleQueryTestData { public static void initSampleQueryTest( CompanyFactory factory, DefaultListableInstanceFactory registry) { @@ -412,26 +224,4 @@ public static void initSampleQueryTest( registry.register("room1", room1); registry.register("room2", room2); } - - private static Date date(int y, int m, int d) { - return new GregorianCalendar(y, m - 1, d, 0, 0, 0).getTime(); - } - - @SafeVarargs - private static List toList(T... objs) { - return Arrays.stream(objs).collect(Collectors.toList()); - } - - private static Map toMap(String... objs) { - Map map = new HashMap<>(); - for (int i = 0; i < objs.length; i += 2) { - map.put(objs[i], objs[i + 1]); - } - return map; - } - - @SafeVarargs - private static Set toSet(T... objs) { - return Arrays.stream(objs).collect(Collectors.toSet()); - } } From b3602fadd348630e4421eb4837577a9fc6fa0e3b Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 12 Oct 2025 19:17:38 +0200 Subject: [PATCH 21/43] SubqueryTest works --- .../tck/pc/company/CompanyModelReader.java | 7 +- .../pc/company/data/NavigationTestData.java | 1 + .../pc/company/data/SampleQueryTestData.java | 1 + .../tck/pc/company/data/SubqueryTestData.java | 175 ++++++++++++++++++ 4 files changed, 183 insertions(+), 1 deletion(-) create mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java index 75494e551..e29821f1f 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java @@ -25,6 +25,7 @@ import org.apache.jdo.tck.pc.company.data.NavigationTestData; import org.apache.jdo.tck.pc.company.data.QueryTestData; import org.apache.jdo.tck.pc.company.data.SampleQueryTestData; +import org.apache.jdo.tck.pc.company.data.SubqueryTestData; import org.apache.jdo.tck.pc.mylib.MylibReader; import org.apache.jdo.tck.util.ConversionHelper; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; @@ -69,6 +70,7 @@ public CompanyModelReader(String resourceName) { */ public CompanyModelReader(String resourceName, ClassLoader classLoader) { super(); + this.reset(); // configureFactory(); // reader = new CompanyModelReaderOld(resourceName, classLoader); @@ -81,7 +83,10 @@ public CompanyModelReader(String resourceName, ClassLoader classLoader) { reader = null; break; case JDOQL_SUBQUERIES_TESTS: - reader = new CompanyModelReaderOld(resourceName, classLoader); +// reader = new CompanyModelReaderOld(resourceName, classLoader); + configureFactory(); + SubqueryTestData.initSubqueryTest(companyFactory, this); + reader = null; break; case QUERY_TEST: configureFactory(); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java index 0e6dce181..0ed528313 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java @@ -291,5 +291,6 @@ public static void initNavigationTest( registry.register("medicalIns5", medicalIns5); registry.register("room1", room1); registry.register("room2", room2); + registry.register("room3", room3); } } diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java index ccafa4e13..e3ef143c4 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java @@ -223,5 +223,6 @@ public static void initSampleQueryTest( registry.register("medicalIns5", medicalIns5); registry.register("room1", room1); registry.register("room2", room2); + registry.register("room3", room3); } } diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java new file mode 100644 index 000000000..5bf43c2fa --- /dev/null +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java @@ -0,0 +1,175 @@ +/* + * 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 + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.company.data; + +import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; + +import org.apache.jdo.tck.pc.company.*; +import org.apache.jdo.tck.util.DefaultListableInstanceFactory; + +public class SubqueryTestData { + + public static void initSubqueryTest( + CompanyFactory factory, DefaultListableInstanceFactory registry) { + IAddress addr1 = + factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); + IAddress addr2 = factory.newAddress(2, "Broadway 1", "New York", "NY", "10000", "USA"); + IAddress addr3 = factory.newAddress(3, "Market St.", "San Francisco", "CA", "94102", "USA"); + + // Company constructor + ICompany company1 = factory.newCompany(1L, "Sun Microsystems, Inc.", date(1952, 4, 11), addr1); + + // Meeting room constructors + IMeetingRoom room1 = factory.newMeetingRoom(1, "Comfy Room"); + IMeetingRoom room2 = factory.newMeetingRoom(2, "Large Discussion Room"); + IMeetingRoom room3 = factory.newMeetingRoom(3, "Conference Room"); + + // Department Constructors + IDepartment dept1 = factory.newDepartment(1, "Development", company1); + IDepartment dept2 = factory.newDepartment(2, "Human Resources", company1); + company1.setDepartments(toSet(dept1, dept2)); + + // Employee Constructors + IFullTimeEmployee emp1 = + factory.newFullTimeEmployee( + 1, "emp1First", "emp1Last", "emp1Middle", null, addr1, null, 30000); + emp1.setBirthdate(date(1970, 6, 10)); + emp1.setHiredate(date(1999, 1, 1)); + IFullTimeEmployee emp2 = + factory.newFullTimeEmployee( + 2, "emp2First", "emp2Last", "emp2Middle", null, addr2, null, 20000); + emp2.setBirthdate(date(1975, 12, 22)); + emp2.setHiredate(date(2003, 7, 1)); + IPartTimeEmployee emp3 = + factory.newPartTimeEmployee( + 3, "emp3First", "emp3Last", "emp3Middle", null, addr3, null, 10000); + emp3.setBirthdate(date(1972, 7, 5)); + emp3.setHiredate(date(2002, 8, 15)); + IPartTimeEmployee emp4 = + factory.newPartTimeEmployee( + 4, "emp4First", "emp4Last", "emp4Middle", null, addr2, null, 25000); + emp4.setBirthdate(date(1973, 7, 6)); + emp4.setHiredate(date(2001, 4, 15)); + IFullTimeEmployee emp5 = + factory.newFullTimeEmployee( + 5, "emp5First", "emp5Last", "emp5Middle", null, addr2, null, 18000); + emp5.setBirthdate(date(1962, 7, 5)); + emp5.setHiredate(date(2002, 11, 1)); + IFullTimeEmployee emp6 = + factory.newFullTimeEmployee( + 6, "emp6First", "emp6Last", "emp6Middle", null, addr3, null, 22000); + emp6.setBirthdate(date(1969, 6, 10)); + emp6.setHiredate(date(2002, 6, 1)); + IFullTimeEmployee emp7 = + factory.newFullTimeEmployee( + 7, "emp7First", "emp7Last", "emp7Middle", null, addr1, null, 40000); + emp7.setBirthdate(date(1970, 6, 10)); + emp7.setHiredate(date(2000, 1, 1)); + IFullTimeEmployee emp8 = + factory.newFullTimeEmployee( + 8, "emp8First", "emp8Last", "emp8Middle", null, addr2, null, 10000); + emp8.setBirthdate(date(1975, 12, 22)); + emp8.setHiredate(date(2003, 8, 1)); + IFullTimeEmployee emp9 = + factory.newFullTimeEmployee( + 9, "emp9First", "emp9Last", "emp9Middle", null, addr3, null, 12000); + emp9.setBirthdate(date(1972, 7, 5)); + emp9.setHiredate(date(2002, 5, 1)); + IFullTimeEmployee emp10 = + factory.newFullTimeEmployee( + 10, "emp10First", "emp10Last", "emp10Middle", null, addr3, null, 24000); + emp10.setBirthdate(date(1972, 7, 5)); + emp10.setHiredate(date(2002, 10, 1)); + + // Employee properties + emp1.setWeeklyhours(40); + emp1.setDepartment(dept1); + emp1.setManager(null); + emp1.setTeam(toSet(emp2, emp3, emp10)); + + emp2.setWeeklyhours(40); + emp2.setDepartment(dept1); + emp2.setManager(emp1); + emp2.setTeam(toSet()); + + emp3.setWeeklyhours(25); + emp3.setDepartment(dept1); + emp3.setManager(emp1); + emp3.setTeam(toSet()); + + emp4.setWeeklyhours(40); + emp4.setDepartment(dept1); + emp4.setManager(null); + emp4.setTeam(toSet(emp5, emp6)); + + emp5.setWeeklyhours(35); + emp5.setDepartment(dept1); + emp5.setManager(emp4); + emp5.setTeam(toSet()); + + emp6.setWeeklyhours(40); + emp6.setDepartment(dept1); + emp6.setManager(emp4); + emp6.setTeam(toSet()); + + emp7.setWeeklyhours(40); + emp7.setDepartment(dept2); + emp7.setManager(null); + emp7.setTeam(toSet(emp8, emp9)); + + emp8.setWeeklyhours(15); + emp8.setDepartment(dept2); + emp8.setManager(emp7); + emp8.setTeam(toSet()); + + emp9.setWeeklyhours(20); + emp9.setDepartment(dept2); + emp9.setManager(emp7); + emp9.setTeam(toSet()); + + emp10.setWeeklyhours(40); + emp10.setDepartment(dept2); + emp10.setManager(emp1); + emp10.setTeam(toSet()); + + // Finish departments + dept1.setEmployees(toSet(emp1, emp2, emp3, emp4, emp5, emp6)); + dept1.setMeetingRooms(toList(room1, room2)); + + dept2.setEmployees(toSet(emp7, emp8, emp9, emp10)); + dept2.setMeetingRooms(toList(room3)); + + // root objects + registry.register("company1", company1); + + registry.register("dept1", dept1); + registry.register("dept2", dept2); + registry.register("emp1", emp1); + registry.register("emp2", emp2); + registry.register("emp3", emp3); + registry.register("emp4", emp4); + registry.register("emp5", emp5); + registry.register("emp6", emp6); + registry.register("emp7", emp7); + registry.register("emp8", emp8); + registry.register("emp9", emp9); + registry.register("emp10", emp10); + registry.register("room1", room1); + registry.register("room2", room2); + } +} From 5687c1eb8a91ee60ba17c09060b816daf90c7f05 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 12 Oct 2025 20:00:41 +0200 Subject: [PATCH 22/43] EmbeddedTest works --- .../tck/pc/company/CompanyModelReader.java | 18 ++- .../tck/pc/company/data/EmbeddedTestData.java | 121 ++++++++++++++++++ .../pc/company/data/NavigationTestData.java | 2 +- .../tck/pc/company/data/QueryTestData.java | 2 +- .../pc/company/data/SampleQueryTestData.java | 2 +- .../tck/pc/company/data/SubqueryTestData.java | 2 +- .../util/DefaultListableInstanceFactory.java | 20 +-- 7 files changed, 150 insertions(+), 17 deletions(-) create mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java index e29821f1f..2a304e0c7 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java @@ -46,6 +46,13 @@ public class CompanyModelReader extends DefaultListableInstanceFactory { public static final String JDOQL_NAVIGATION_TESTS = "org/apache/jdo/tck/pc/company/companyForNavigationTests.xml"; public static final String JDOQL_SUBQUERIES_TESTS = "org/apache/jdo/tck/pc/company/companyForSubqueriesTests.xml"; + public static final String RELATIONSHIPS_ALL = "org/apache/jdo/tck/pc/company/companyAllRelationships.xml"; + public static final String RELATIONSHIPS_1_1 = "org/apache/jdo/tck/pc/company/company1-1Relationships.xml"; + public static final String RELATIONSHIPS_1_M = "org/apache/jdo/tck/pc/company/company1-MRelationships.xml"; + public static final String EMBEDDED = "org/apache/jdo/tck/pc/company/companyEmbedded.xml"; + public static final String RELATIONSHIPS_M_M = "org/apache/jdo/tck/pc/company/companyM-MRelationships.xml"; + public static final String RELATIONSHIPS_NO = "org/apache/jdo/tck/pc/company/companyNoRelationships.xml"; + /** The company factory instance. */ private CompanyFactory companyFactory; @@ -74,16 +81,21 @@ public CompanyModelReader(String resourceName, ClassLoader classLoader) { // configureFactory(); // reader = new CompanyModelReaderOld(resourceName, classLoader); - switch (resourceName) { - //case SAMPLE_QUERIES_TEST: + case RELATIONSHIPS_ALL: + case RELATIONSHIPS_1_1: + case RELATIONSHIPS_1_M: + case RELATIONSHIPS_M_M: + case RELATIONSHIPS_NO: + case EMBEDDED: + reader = new CompanyModelReaderOld(resourceName, classLoader); + break; case JDOQL_NAVIGATION_TESTS: configureFactory(); NavigationTestData.initNavigationTest(companyFactory, this); reader = null; break; case JDOQL_SUBQUERIES_TESTS: -// reader = new CompanyModelReaderOld(resourceName, classLoader); configureFactory(); SubqueryTestData.initSubqueryTest(companyFactory, this); reader = null; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java new file mode 100644 index 000000000..06c439494 --- /dev/null +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java @@ -0,0 +1,121 @@ +/* + * 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 + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.company.data; + +import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; + +import java.math.BigDecimal; +import org.apache.jdo.tck.pc.company.*; +import org.apache.jdo.tck.util.DefaultListableInstanceFactory; + +public class EmbeddedTestData { + + public static void initEmbeddedTest( + CompanyFactory factory, DefaultListableInstanceFactory registry) { + IAddress addr1 = + factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); + IAddress addr2 = factory.newAddress(2, "Broadway 1", "New York", "NY", "10000", "USA"); + IAddress addr3 = factory.newAddress(3, "Market St.", "San Francisco", "CA", "94102", "USA"); + + // Insurance constructors + IMedicalInsurance medicalIns1 = factory.newMedicalInsurance(1, "Carrier1", "PPO"); + IMedicalInsurance medicalIns2 = factory.newMedicalInsurance(2, "Carrier2", "HMO"); + IMedicalInsurance medicalIns3 = factory.newMedicalInsurance(3, "Carrier2", "HMO"); + IDentalInsurance dentalIns1 = + factory.newDentalInsurance(4, "Carrier2", BigDecimal.valueOf(99.999)); + + // Project constructors + IProject proj1 = factory.newProject(1, "orange", BigDecimal.valueOf(2500000.99)); + IProject proj2 = factory.newProject(2, "blue", BigDecimal.valueOf(50000.00)); + IProject proj3 = factory.newProject(3, "green", BigDecimal.valueOf(2000.99)); + + // Company constructor + ICompany company1 = factory.newCompany(1L, "Sun Microsystems, Inc.", date(1952, 4, 11), addr1); + + // Meeting room constructors + + // Department Constructors + IDepartment dept1 = factory.newDepartment(1, "Development", company1); + IDepartment dept2 = factory.newDepartment(2, "Human Resources", company1); + company1.setDepartments(toSet(dept1, dept2)); + + // Employee Constructors + IFullTimeEmployee emp1 = + factory.newFullTimeEmployee( + 1, "emp1First", "emp1Last", "emp1Middle", null, addr1, null, 20000); + emp1.setBirthdate(date(1970, 6, 10)); + emp1.setHiredate(date(1999, 1, 1)); + IFullTimeEmployee emp2 = + factory.newFullTimeEmployee( + 2, "emp2First", "emp2Last", "emp2Middle", null, addr2, null, 10000); + emp2.setBirthdate(date(1975, 12, 22)); + emp2.setHiredate(date(2003, 7, 1)); + IPartTimeEmployee emp3 = + factory.newPartTimeEmployee( + 3, "emp3First", "emp3Last", "emp3Middle", null, addr3, null, 15); + emp3.setBirthdate(date(1972, 7, 5)); + emp3.setHiredate(date(2002, 8, 15)); + IPartTimeEmployee emp4 = + factory.newPartTimeEmployee( + 4, "emp4First", "emp4Last", "emp4Middle", null, addr3, null, 13); + emp4.setBirthdate(date(1973, 7, 6)); + emp4.setHiredate(date(2001, 4, 15)); + IFullTimeEmployee emp5 = + factory.newFullTimeEmployee( + 5, "emp5First", "emp5Last", "emp5Middle", null, addr3, null, 45000); + emp5.setBirthdate(date(1962, 7, 5)); + emp5.setHiredate(date(1998, 8, 15)); + + // Employee properties + emp1.setWeeklyhours(40); + emp1.setPhoneNumbers(toMap("home", "1111", "work", "123456-1")); + + emp2.setWeeklyhours(40); + emp2.setPhoneNumbers(toMap("home", "2222", "work", "123456-2")); + + emp3.setWeeklyhours(19); + emp3.setPhoneNumbers(toMap("home", "3333", "work", "123456-3")); + + emp4.setPhoneNumbers(toMap("home", "3343", "work", "124456-3")); + + emp5.setPhoneNumbers(toMap("home", "3363", "work", "126456-3")); + + // Department properties + + // Insurance properties + + // Project properties + + // root objects + registry.register("company1", company1); + registry.register("dept1", dept1); + registry.register("dept2", dept2); + registry.register("emp1", emp1); + registry.register("emp2", emp2); + registry.register("emp3", emp3); + registry.register("emp4", emp4); + registry.register("emp5", emp5); + registry.register("medicalIns1", medicalIns1); + registry.register("medicalIns2", medicalIns2); + registry.register("medicalIns3", medicalIns3); + registry.register("dentalIns1", dentalIns1); + registry.register("proj1", proj1); + registry.register("proj2", proj2); + registry.register("proj3", proj3); + } +} diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java index 0ed528313..3731efcf7 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java @@ -232,7 +232,7 @@ public static void initNavigationTest( emp10.setManager(emp1); emp10.setTeam(toSet()); - // Finish departments + // Department properties dept1.setEmployees(toSet(emp1, emp2, emp3, emp4, emp5, emp6)); dept2.setEmployees(toSet(emp7, emp8, emp9, emp10)); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java index 1f6e531dc..b94e09740 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java @@ -158,7 +158,7 @@ public static void initQueryTest( emp5.setReviewedProjects(toSet(proj2)); emp5.setHradvisees(toSet(emp1, emp2, emp3, emp4)); - // Finish departments + // Department properties dept1.setEmployees(toSet(emp1, emp2, emp3)); dept1.setFundedEmps(toSet(emp2, emp3)); dept1.setMeetingRooms(toList(room1, room2, room3)); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java index e3ef143c4..b3d9a828c 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java @@ -164,7 +164,7 @@ public static void initSampleQueryTest( emp5.setReviewedProjects(toSet(proj2)); emp5.setHradvisees(toSet(emp1, emp2, emp3, emp4)); - // Finish departments + // Department properties dept1.setEmployees(toSet(emp1, emp2, emp3)); dept1.setFundedEmps(toSet(emp2, emp3)); dept1.setMeetingRooms(toList(room1, room2, room3)); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java index 5bf43c2fa..6110ca9df 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java @@ -147,7 +147,7 @@ public static void initSubqueryTest( emp10.setManager(emp1); emp10.setTeam(toSet()); - // Finish departments + // Department properties dept1.setEmployees(toSet(emp1, emp2, emp3, emp4, emp5, emp6)); dept1.setMeetingRooms(toList(room1, room2)); diff --git a/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java b/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java index ec7276788..7b584e4c8 100644 --- a/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java +++ b/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java @@ -15,25 +15,25 @@ public synchronized Object getBean(String name) { } public synchronized T getBean(String name, Class clazz) { - if (!rootMap.containsKey(name)) { - System.err.println("CLIF: Not found: " + name + " ---------------------------- "); - System.err.println("CLIF: Beans: " + rootMap.size() + " " + Arrays.toString(rootMap.keySet().toArray()) + " ---------------------------- "); - } - if (rootMap.get(name) == null) { - System.err.println("CLIF: NULL: " + name + " ---------------------------- "); - System.err.println("CLIF: Beans: " + rootMap.size() + " " + Arrays.toString(rootMap.keySet().toArray()) + " ---------------------------- "); - } +// if (!rootMap.containsKey(name)) { +// System.err.println("CLIF: Not found: " + name + " ---------------------------- "); +// System.err.println("CLIF: Beans: " + rootMap.size() + " " + Arrays.toString(rootMap.keySet().toArray()) + " ---------------------------- "); +// } +// if (rootMap.get(name) == null) { +// System.err.println("CLIF: NULL: " + name + " ---------------------------- "); +// System.err.println("CLIF: Beans: " + rootMap.size() + " " + Arrays.toString(rootMap.keySet().toArray()) + " ---------------------------- "); +// } return clazz.cast(getBean(name)); } public synchronized void register(String name, Object obj) { - System.out.println("CLIF: Registering: " + name + " " + rootList.size() + " -----------------------"); // TODO TZ remove +// System.out.println("CLIF: Registering: " + name + " " + rootList.size() + " -----------------------"); // TODO TZ remove rootMap.put(name, obj); rootList.add(obj); } public synchronized List getRootList() { - System.out.println("CLIF: Getting root list: " + rootList.size() + " -----------------------"); // TODO TZ remove +// System.out.println("CLIF: Getting root list: " + rootList.size() + " -----------------------"); // TODO TZ remove return Collections.unmodifiableList(rootList); } From 22b31c1d00dba222f8df1f6d3dbd04f46f5acdff Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sat, 18 Oct 2025 22:26:59 +0200 Subject: [PATCH 23/43] Update EmbeddedTestData.java --- .../org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java index 06c439494..62a4fffa1 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java @@ -35,7 +35,7 @@ public static void initEmbeddedTest( // Insurance constructors IMedicalInsurance medicalIns1 = factory.newMedicalInsurance(1, "Carrier1", "PPO"); IMedicalInsurance medicalIns2 = factory.newMedicalInsurance(2, "Carrier2", "HMO"); - IMedicalInsurance medicalIns3 = factory.newMedicalInsurance(3, "Carrier2", "HMO"); + IMedicalInsurance medicalIns3 = factory.newMedicalInsurance(3, "Carrier3", "HMO"); IDentalInsurance dentalIns1 = factory.newDentalInsurance(4, "Carrier2", BigDecimal.valueOf(99.999)); From 1dbbee760463d943a9c4a7f66290fa4ec749644c Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 19 Oct 2025 15:55:14 +0200 Subject: [PATCH 24/43] AllRelationshipsTest --- .../tck/pc/company/CompanyModelReader.java | 10 +- .../pc/company/data/AllRelationshipsData.java | 203 ++++++++++++++++++ 2 files changed, 208 insertions(+), 5 deletions(-) create mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/company/data/AllRelationshipsData.java diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java index 2a304e0c7..d6ed2c461 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java @@ -22,10 +22,7 @@ import java.util.List; import java.util.Locale; -import org.apache.jdo.tck.pc.company.data.NavigationTestData; -import org.apache.jdo.tck.pc.company.data.QueryTestData; -import org.apache.jdo.tck.pc.company.data.SampleQueryTestData; -import org.apache.jdo.tck.pc.company.data.SubqueryTestData; +import org.apache.jdo.tck.pc.company.data.*; import org.apache.jdo.tck.pc.mylib.MylibReader; import org.apache.jdo.tck.util.ConversionHelper; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; @@ -83,6 +80,10 @@ public CompanyModelReader(String resourceName, ClassLoader classLoader) { switch (resourceName) { case RELATIONSHIPS_ALL: + configureFactory(); + AllRelationshipsData.init(companyFactory, this); + reader = null; + break; case RELATIONSHIPS_1_1: case RELATIONSHIPS_1_M: case RELATIONSHIPS_M_M: @@ -167,7 +168,6 @@ public Class[] getTearDownClassesFromFactory() { System.err.println("TearDownClass: " + c); } System.err.println("TearDownClass: " + Arrays.toString(companyFactory.getTearDownClasses())); - this.reset(); return companyFactory.getTearDownClasses(); } diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/AllRelationshipsData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/AllRelationshipsData.java new file mode 100644 index 000000000..86016bf6d --- /dev/null +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/AllRelationshipsData.java @@ -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 + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.company.data; + +import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; + +import java.math.BigDecimal; +import org.apache.jdo.tck.pc.company.*; +import org.apache.jdo.tck.util.DefaultListableInstanceFactory; + +public class AllRelationshipsData { + + public static void init( + CompanyFactory factory, DefaultListableInstanceFactory registry) { + IAddress addr1 = + factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); + IAddress addr2 = factory.newAddress(2, "Broadway 1", "New York", "NY", "10000", "USA"); + IAddress addr3 = factory.newAddress(3, "Market St.", "San Francisco", "CA", "94102", "USA"); + + // Insurance constructors + IMedicalInsurance medicalIns1 = factory.newMedicalInsurance(1, "Carrier1", "PPO"); + IMedicalInsurance medicalIns2 = factory.newMedicalInsurance(2, "Carrier2", "HMO"); + IMedicalInsurance medicalIns3 = factory.newMedicalInsurance(3, "Carrier3", "HMO"); + IMedicalInsurance medicalIns4 = factory.newMedicalInsurance(4, "Carrier4", "HMO"); + IMedicalInsurance medicalIns5 = factory.newMedicalInsurance(5, "Carrier5", "HMO"); + IDentalInsurance dentalIns1 = + factory.newDentalInsurance(11, "Carrier1", BigDecimal.valueOf(99.999)); + IDentalInsurance dentalIns2 = + factory.newDentalInsurance(12, "Carrier2", BigDecimal.valueOf(99.999)); + IDentalInsurance dentalIns3 = + factory.newDentalInsurance(13, "Carrier3", BigDecimal.valueOf(99.999)); + IDentalInsurance dentalIns4 = + factory.newDentalInsurance(14, "Carrier4", BigDecimal.valueOf(99.999)); + IDentalInsurance dentalIns5 = + factory.newDentalInsurance(15, "Carrier5", BigDecimal.valueOf(99.999)); + + // Project constructors + IProject proj1 = factory.newProject(1, "orange", BigDecimal.valueOf(2500000.99)); + IProject proj2 = factory.newProject(2, "blue", BigDecimal.valueOf(50000.00)); + IProject proj3 = factory.newProject(3, "green", BigDecimal.valueOf(2000.99)); + + // Company constructor + ICompany company1 = factory.newCompany(1L, "Sun Microsystems, Inc.", date(1952, 4, 11), addr1); + + // Meeting room constructors + + // Department Constructors + IDepartment dept1 = factory.newDepartment(1, "Development", company1); + IDepartment dept2 = factory.newDepartment(2, "Human Resources", company1); + company1.setDepartments(toSet(dept1, dept2)); + + // Employee Constructors + IFullTimeEmployee emp1 = + factory.newFullTimeEmployee( + 1, "emp1First", "emp1Last", "emp1Middle", null, addr1, null, 20000); + emp1.setBirthdate(date(1970, 6, 10)); + emp1.setHiredate(date(1999, 1, 1)); + IFullTimeEmployee emp2 = + factory.newFullTimeEmployee( + 2, "emp2First", "emp2Last", "emp2Middle", null, addr2, null, 10000); + emp2.setBirthdate(date(1975, 12, 22)); + emp2.setHiredate(date(2003, 7, 1)); + IPartTimeEmployee emp3 = + factory.newPartTimeEmployee( + 3, "emp3First", "emp3Last", "emp3Middle", null, addr3, null, 15); + emp3.setBirthdate(date(1972, 7, 5)); + emp3.setHiredate(date(2002, 8, 15)); + IPartTimeEmployee emp4 = + factory.newPartTimeEmployee( + 4, "emp4First", "emp4Last", "emp4Middle", null, addr3, null, 13); + emp4.setBirthdate(date(1973, 7, 6)); + emp4.setHiredate(date(2001, 4, 15)); + IFullTimeEmployee emp5 = + factory.newFullTimeEmployee( + 5, "emp5First", "emp5Last", "emp5Middle", null, addr3, null, 45000); + emp5.setBirthdate(date(1962, 7, 5)); + emp5.setHiredate(date(1998, 8, 15)); + + // Employee properties + emp1.setWeeklyhours(40); + emp1.setMedicalInsurance(medicalIns1); + emp1.setDentalInsurance(dentalIns1); + emp1.setPhoneNumbers(toMap("home", "1111", "work", "123456-1")); + emp1.setDepartment(dept1); + emp1.setFundingDept(dept2); + emp1.setManager(emp2); + emp1.setMentor(emp2); + emp1.setProtege(emp5); + emp1.setHradvisor(emp5); + emp1.setReviewedProjects(toSet(proj3)); + emp1.setProjects(toSet(proj1)); + + emp2.setWeeklyhours(40); + emp2.setMedicalInsurance(medicalIns2); + emp2.setDentalInsurance(dentalIns2); + emp2.setPhoneNumbers(toMap("home", "2222", "work", "123456-2")); + emp2.setDepartment(dept1); + emp2.setFundingDept(dept1); + emp2.setMentor(emp3); + emp2.setProtege(emp1); + emp2.setHradvisor(emp5); + emp2.setProjects(toSet(proj1, proj2)); + emp2.setTeam(toSet(emp1, emp3, emp4, emp5)); + + emp3.setWeeklyhours(19); + emp3.setMedicalInsurance(medicalIns3); + emp3.setDentalInsurance(dentalIns3); + emp3.setPhoneNumbers(toMap("home", "3333", "work", "123456-3")); + emp3.setDepartment(dept1); + emp3.setFundingDept(dept1); + emp3.setManager(emp2); + emp3.setMentor(emp4); + emp3.setProtege(emp2); + emp3.setHradvisor(emp5); + emp3.setProjects(toSet(proj1, proj2)); + + emp4.setMedicalInsurance(medicalIns4); + emp4.setDentalInsurance(dentalIns4); + emp4.setPhoneNumbers(toMap("home", "3343", "work", "124456-3")); + emp4.setDepartment(dept2); + emp4.setFundingDept(dept2); + emp4.setManager(emp2); + emp4.setMentor(emp5); + emp4.setProtege(emp3); + emp4.setHradvisor(emp5); + emp4.setReviewedProjects(toSet(proj2)); + emp4.setProjects(toSet(proj3)); + + emp5.setMedicalInsurance(medicalIns5); + emp5.setDentalInsurance(dentalIns5); + emp5.setPhoneNumbers(toMap("home", "3363", "work", "126456-3")); + emp5.setDepartment(dept2); + emp5.setFundingDept(dept2); + emp5.setManager(emp2); + emp5.setMentor(emp1); + emp5.setProtege(emp4); + emp5.setReviewedProjects(toSet(proj2)); + emp5.setProjects(toSet(proj3)); + emp5.setHradvisees(toSet(emp1, emp2, emp3, emp4)); + + // Department properties + dept1.setEmployeeOfTheMonth(emp1); + dept1.setEmployees(toSet(emp1, emp2, emp3)); + dept1.setFundedEmps(toSet(emp2, emp3)); + + dept2.setEmployees(toSet(emp4, emp5)); + dept2.setFundedEmps(toSet(emp1, emp4, emp5)); + + // Insurance properties + medicalIns1.setEmployee(emp1); + medicalIns2.setEmployee(emp2); + medicalIns3.setEmployee(emp3); + medicalIns4.setEmployee(emp4); + medicalIns5.setEmployee(emp5); + + dentalIns1.setEmployee(emp1); + dentalIns2.setEmployee(emp2); + dentalIns3.setEmployee(emp3); + dentalIns4.setEmployee(emp4); + dentalIns5.setEmployee(emp5); + + // Project properties + proj1.setMembers(toSet(emp1, emp2, emp3)); + + proj2.setReviewers(toSet(emp4, emp5)); + proj2.setMembers(toSet(emp2, emp3)); + + proj3.setReviewers(toSet(emp1)); + proj3.setMembers(toSet(emp4, emp5)); + + // root objects + registry.register("company1", company1); + registry.register("dept1", dept1); + registry.register("dept2", dept2); + registry.register("emp1", emp1); + registry.register("emp2", emp2); + registry.register("emp3", emp3); + registry.register("emp4", emp4); + registry.register("emp5", emp5); + registry.register("medicalIns1", medicalIns1); + registry.register("medicalIns2", medicalIns2); + registry.register("medicalIns3", medicalIns3); + registry.register("dentalIns1", dentalIns1); + registry.register("proj1", proj1); + registry.register("proj2", proj2); + registry.register("proj3", proj3); + } +} From 7889a2b6d4de9056f4757f9bd329c11ab620cdda Mon Sep 17 00:00:00 2001 From: Tilmann Date: Thu, 23 Oct 2025 14:19:43 +0200 Subject: [PATCH 25/43] All tests migrated --- .../tck/pc/company/CompanyModelReader.java | 22 ++- .../tck/pc/company/data/EmbeddedTestData.java | 2 +- .../pc/company/data/Relationships1_1Data.java | 153 ++++++++++++++++++ .../pc/company/data/Relationships1_MData.java | 143 ++++++++++++++++ ...ipsData.java => RelationshipsAllData.java} | 2 +- .../pc/company/data/RelationshipsM_MData.java | 138 ++++++++++++++++ .../pc/company/data/RelationshipsNoData.java | 124 ++++++++++++++ .../util/DefaultListableInstanceFactory.java | 10 -- 8 files changed, 580 insertions(+), 14 deletions(-) create mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java create mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java rename tck/src/main/java/org/apache/jdo/tck/pc/company/data/{AllRelationshipsData.java => RelationshipsAllData.java} (99%) create mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java create mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java index d6ed2c461..14ad37bf2 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java @@ -81,15 +81,33 @@ public CompanyModelReader(String resourceName, ClassLoader classLoader) { switch (resourceName) { case RELATIONSHIPS_ALL: configureFactory(); - AllRelationshipsData.init(companyFactory, this); + RelationshipsAllData.init(companyFactory, this); reader = null; break; case RELATIONSHIPS_1_1: + configureFactory(); + Relationships1_1Data.init(companyFactory, this); + reader = null; + break; case RELATIONSHIPS_1_M: + configureFactory(); + Relationships1_MData.init(companyFactory, this); + reader = null; + break; case RELATIONSHIPS_M_M: + configureFactory(); + RelationshipsM_MData.init(companyFactory, this); + reader = null; + break; case RELATIONSHIPS_NO: + configureFactory(); + RelationshipsNoData.init(companyFactory, this); + reader = null; + break; case EMBEDDED: - reader = new CompanyModelReaderOld(resourceName, classLoader); + configureFactory(); + EmbeddedTestData.init(companyFactory, this); + reader = null; break; case JDOQL_NAVIGATION_TESTS: configureFactory(); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java index 62a4fffa1..bc35b7989 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java @@ -25,7 +25,7 @@ public class EmbeddedTestData { - public static void initEmbeddedTest( + public static void init( CompanyFactory factory, DefaultListableInstanceFactory registry) { IAddress addr1 = factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java new file mode 100644 index 000000000..9ae20241f --- /dev/null +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java @@ -0,0 +1,153 @@ +/* + * 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 + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.company.data; + +import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; + +import java.math.BigDecimal; +import org.apache.jdo.tck.pc.company.*; +import org.apache.jdo.tck.util.DefaultListableInstanceFactory; + +public class Relationships1_1Data { + + public static void init( + CompanyFactory factory, DefaultListableInstanceFactory registry) { + IAddress addr1 = + factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); + IAddress addr2 = factory.newAddress(2, "Broadway 1", "New York", "NY", "10000", "USA"); + IAddress addr3 = factory.newAddress(3, "Market St.", "San Francisco", "CA", "94102", "USA"); + + // Insurance constructors + IMedicalInsurance medicalIns1 = factory.newMedicalInsurance(1, "Carrier1", "PPO"); + IMedicalInsurance medicalIns2 = factory.newMedicalInsurance(2, "Carrier2", "HMO"); + IMedicalInsurance medicalIns3 = factory.newMedicalInsurance(3, "Carrier3", "HMO"); + IMedicalInsurance medicalIns4 = factory.newMedicalInsurance(4, "Carrier4", "HMO"); + IMedicalInsurance medicalIns5 = factory.newMedicalInsurance(5, "Carrier5", "HMO"); + IDentalInsurance dentalIns1 = + factory.newDentalInsurance(11, "Carrier1", BigDecimal.valueOf(99.999)); + IDentalInsurance dentalIns2 = + factory.newDentalInsurance(12, "Carrier2", BigDecimal.valueOf(99.999)); + IDentalInsurance dentalIns3 = + factory.newDentalInsurance(13, "Carrier3", BigDecimal.valueOf(99.999)); + IDentalInsurance dentalIns4 = + factory.newDentalInsurance(14, "Carrier4", BigDecimal.valueOf(99.999)); + IDentalInsurance dentalIns5 = + factory.newDentalInsurance(15, "Carrier5", BigDecimal.valueOf(99.999)); + + // Project constructors + IProject proj1 = factory.newProject(1, "orange", BigDecimal.valueOf(2500000.99)); + IProject proj2 = factory.newProject(2, "blue", BigDecimal.valueOf(50000.00)); + IProject proj3 = factory.newProject(3, "green", BigDecimal.valueOf(2000.99)); + + // Company constructor + ICompany company1 = factory.newCompany(1L, "Sun Microsystems, Inc.", date(1952, 4, 11), addr1); + + // Meeting room constructors + + // Department Constructors + IDepartment dept1 = factory.newDepartment(1, "Development", company1); + IDepartment dept2 = factory.newDepartment(2, "Human Resources", company1); + company1.setDepartments(toSet(dept1, dept2)); + + // Employee Constructors + IFullTimeEmployee emp1 = + factory.newFullTimeEmployee( + 1, "emp1First", "emp1Last", "emp1Middle", null, addr1, null, 20000); + emp1.setBirthdate(date(1970, 6, 10)); + emp1.setHiredate(date(1999, 1, 1)); + IFullTimeEmployee emp2 = + factory.newFullTimeEmployee( + 2, "emp2First", "emp2Last", "emp2Middle", null, addr2, null, 10000); + emp2.setBirthdate(date(1975, 12, 22)); + emp2.setHiredate(date(2003, 7, 1)); + IPartTimeEmployee emp3 = + factory.newPartTimeEmployee( + 3, "emp3First", "emp3Last", "emp3Middle", null, addr3, null, 15); + emp3.setBirthdate(date(1972, 7, 5)); + emp3.setHiredate(date(2002, 8, 15)); + IPartTimeEmployee emp4 = + factory.newPartTimeEmployee( + 4, "emp4First", "emp4Last", "emp4Middle", null, addr3, null, 13); + emp4.setBirthdate(date(1973, 7, 6)); + emp4.setHiredate(date(2001, 4, 15)); + IFullTimeEmployee emp5 = + factory.newFullTimeEmployee( + 5, "emp5First", "emp5Last", "emp5Middle", null, addr3, null, 45000); + emp5.setBirthdate(date(1962, 7, 5)); + emp5.setHiredate(date(1998, 8, 15)); + + // Employee properties + emp1.setWeeklyhours(40); + emp1.setMedicalInsurance(medicalIns1); + emp1.setDentalInsurance(dentalIns1); + emp1.setMentor(emp2); + emp1.setProtege(emp5); + + emp2.setWeeklyhours(40); + emp2.setMedicalInsurance(medicalIns2); + emp2.setDentalInsurance(dentalIns2); + emp2.setMentor(emp3); + emp2.setProtege(emp1); + + emp3.setWeeklyhours(19); + emp3.setMedicalInsurance(medicalIns3); + emp3.setDentalInsurance(dentalIns3); + emp3.setMentor(emp4); + emp3.setProtege(emp2); + + emp4.setMedicalInsurance(medicalIns4); + emp4.setDentalInsurance(dentalIns4); + emp4.setMentor(emp5); + emp4.setProtege(emp3); + + emp5.setMedicalInsurance(medicalIns5); + emp5.setDentalInsurance(dentalIns5); + emp5.setMentor(emp1); + emp5.setProtege(emp4); + + // Department properties + + // Insurance properties + medicalIns1.setEmployee(emp1); + medicalIns2.setEmployee(emp2); + medicalIns3.setEmployee(emp3); + medicalIns4.setEmployee(emp4); + medicalIns5.setEmployee(emp5); + + dentalIns1.setEmployee(emp1); + dentalIns2.setEmployee(emp2); + dentalIns3.setEmployee(emp3); + dentalIns4.setEmployee(emp4); + dentalIns5.setEmployee(emp5); + + // Project properties + + // root objects + registry.register("company1", company1); + registry.register("dept1", dept1); + registry.register("dept2", dept2); + registry.register("emp1", emp1); + registry.register("emp2", emp2); + registry.register("emp3", emp3); + registry.register("emp4", emp4); + registry.register("emp5", emp5); + registry.register("proj1", proj1); + registry.register("proj2", proj2); + registry.register("proj3", proj3); + } +} diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java new file mode 100644 index 000000000..1b9e6a3da --- /dev/null +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java @@ -0,0 +1,143 @@ +/* + * 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 + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.company.data; + +import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; + +import java.math.BigDecimal; +import org.apache.jdo.tck.pc.company.*; +import org.apache.jdo.tck.util.DefaultListableInstanceFactory; + +public class Relationships1_MData { + + public static void init( + CompanyFactory factory, DefaultListableInstanceFactory registry) { + IAddress addr1 = + factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); + IAddress addr2 = factory.newAddress(2, "Broadway 1", "New York", "NY", "10000", "USA"); + IAddress addr3 = factory.newAddress(3, "Market St.", "San Francisco", "CA", "94102", "USA"); + + // Insurance constructors + IMedicalInsurance medicalIns1 = factory.newMedicalInsurance(1, "Carrier1", "PPO"); + IMedicalInsurance medicalIns2 = factory.newMedicalInsurance(2, "Carrier2", "HMO"); + IMedicalInsurance medicalIns3 = factory.newMedicalInsurance(3, "Carrier3", "HMO"); + IMedicalInsurance medicalIns4 = factory.newMedicalInsurance(4, "Carrier4", "HMO"); + IMedicalInsurance medicalIns5 = factory.newMedicalInsurance(5, "Carrier5", "HMO"); + IDentalInsurance dentalIns1 = + factory.newDentalInsurance(11, "Carrier1", BigDecimal.valueOf(99.999)); + IDentalInsurance dentalIns2 = + factory.newDentalInsurance(12, "Carrier2", BigDecimal.valueOf(99.999)); + IDentalInsurance dentalIns3 = + factory.newDentalInsurance(13, "Carrier3", BigDecimal.valueOf(99.999)); + IDentalInsurance dentalIns4 = + factory.newDentalInsurance(14, "Carrier4", BigDecimal.valueOf(99.999)); + IDentalInsurance dentalIns5 = + factory.newDentalInsurance(15, "Carrier5", BigDecimal.valueOf(99.999)); + + // Project constructors + IProject proj1 = factory.newProject(1, "orange", BigDecimal.valueOf(2500000.99)); + IProject proj2 = factory.newProject(2, "blue", BigDecimal.valueOf(50000.00)); + IProject proj3 = factory.newProject(3, "green", BigDecimal.valueOf(2000.99)); + + // Company constructor + ICompany company1 = factory.newCompany(1L, "Sun Microsystems, Inc.", date(1952, 4, 11), addr1); + + // Meeting room constructors + + // Department Constructors + IDepartment dept1 = factory.newDepartment(1, "Development", company1); + IDepartment dept2 = factory.newDepartment(2, "Human Resources", company1); + company1.setDepartments(toSet(dept1, dept2)); + + // Employee Constructors + IFullTimeEmployee emp1 = + factory.newFullTimeEmployee( + 1, "emp1First", "emp1Last", "emp1Middle", null, addr1, null, 20000); + emp1.setBirthdate(date(1970, 6, 10)); + emp1.setHiredate(date(1999, 1, 1)); + IFullTimeEmployee emp2 = + factory.newFullTimeEmployee( + 2, "emp2First", "emp2Last", "emp2Middle", null, addr2, null, 10000); + emp2.setBirthdate(date(1975, 12, 22)); + emp2.setHiredate(date(2003, 7, 1)); + IPartTimeEmployee emp3 = + factory.newPartTimeEmployee( + 3, "emp3First", "emp3Last", "emp3Middle", null, addr3, null, 15); + emp3.setBirthdate(date(1972, 7, 5)); + emp3.setHiredate(date(2002, 8, 15)); + IPartTimeEmployee emp4 = + factory.newPartTimeEmployee( + 4, "emp4First", "emp4Last", "emp4Middle", null, addr3, null, 13); + emp4.setBirthdate(date(1973, 7, 6)); + emp4.setHiredate(date(2001, 4, 15)); + IFullTimeEmployee emp5 = + factory.newFullTimeEmployee( + 5, "emp5First", "emp5Last", "emp5Middle", null, addr3, null, 45000); + emp5.setBirthdate(date(1962, 7, 5)); + emp5.setHiredate(date(1998, 8, 15)); + + // Employee properties + emp1.setWeeklyhours(40); + emp1.setDepartment(dept1); + emp1.setFundingDept(dept2); + emp1.setManager(emp2); + emp1.setHradvisor(emp5); + + emp2.setWeeklyhours(40); + emp2.setDepartment(dept1); + emp2.setFundingDept(dept1); + emp2.setHradvisor(emp5); + emp2.setTeam(toSet(emp1, emp3, emp4, emp5)); + + emp3.setDepartment(dept1); + emp3.setFundingDept(dept1); + emp3.setManager(emp2); + emp3.setHradvisor(emp5); + + emp4.setDepartment(dept2); + emp4.setFundingDept(dept2); + emp4.setManager(emp2); + emp4.setHradvisor(emp5); + + emp5.setDepartment(dept2); + emp5.setFundingDept(dept2); + emp5.setManager(emp2); + emp5.setHradvisees(toSet(emp1, emp2, emp3, emp4)); + + // Department properties + dept1.setEmployees(toSet(emp1, emp2, emp3)); + dept1.setFundedEmps(toSet(emp2, emp3)); + + dept2.setEmployees(toSet(emp4, emp5)); + dept2.setFundedEmps(toSet(emp1, emp4, emp5)); + + // Insurance properties + + // Project properties + + // root objects + registry.register("company1", company1); + registry.register("medicalIns1", medicalIns1); + registry.register("medicalIns2", medicalIns2); + registry.register("medicalIns3", medicalIns3); + registry.register("dentalIns1", dentalIns1); + registry.register("proj1", proj1); + registry.register("proj2", proj2); + registry.register("proj3", proj3); + } +} diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/AllRelationshipsData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java similarity index 99% rename from tck/src/main/java/org/apache/jdo/tck/pc/company/data/AllRelationshipsData.java rename to tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java index 86016bf6d..8177df679 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/AllRelationshipsData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java @@ -23,7 +23,7 @@ import org.apache.jdo.tck.pc.company.*; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; -public class AllRelationshipsData { +public class RelationshipsAllData { public static void init( CompanyFactory factory, DefaultListableInstanceFactory registry) { diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java new file mode 100644 index 000000000..feb1d09f2 --- /dev/null +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java @@ -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 + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.company.data; + +import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; + +import java.math.BigDecimal; +import org.apache.jdo.tck.pc.company.*; +import org.apache.jdo.tck.util.DefaultListableInstanceFactory; + +public class RelationshipsM_MData { + + public static void init( + CompanyFactory factory, DefaultListableInstanceFactory registry) { + IAddress addr1 = + factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); + IAddress addr2 = factory.newAddress(2, "Broadway 1", "New York", "NY", "10000", "USA"); + IAddress addr3 = factory.newAddress(3, "Market St.", "San Francisco", "CA", "94102", "USA"); + + // Insurance constructors + IMedicalInsurance medicalIns1 = factory.newMedicalInsurance(1, "Carrier1", "PPO"); + IMedicalInsurance medicalIns2 = factory.newMedicalInsurance(2, "Carrier2", "HMO"); + IMedicalInsurance medicalIns3 = factory.newMedicalInsurance(3, "Carrier3", "HMO"); + IMedicalInsurance medicalIns4 = factory.newMedicalInsurance(4, "Carrier4", "HMO"); + IMedicalInsurance medicalIns5 = factory.newMedicalInsurance(5, "Carrier5", "HMO"); + IDentalInsurance dentalIns1 = + factory.newDentalInsurance(11, "Carrier1", BigDecimal.valueOf(99.999)); + IDentalInsurance dentalIns2 = + factory.newDentalInsurance(12, "Carrier2", BigDecimal.valueOf(99.999)); + IDentalInsurance dentalIns3 = + factory.newDentalInsurance(13, "Carrier3", BigDecimal.valueOf(99.999)); + IDentalInsurance dentalIns4 = + factory.newDentalInsurance(14, "Carrier4", BigDecimal.valueOf(99.999)); + IDentalInsurance dentalIns5 = + factory.newDentalInsurance(15, "Carrier5", BigDecimal.valueOf(99.999)); + + // Project constructors + IProject proj1 = factory.newProject(1, "orange", BigDecimal.valueOf(2500000.99)); + IProject proj2 = factory.newProject(2, "blue", BigDecimal.valueOf(50000.00)); + IProject proj3 = factory.newProject(3, "green", BigDecimal.valueOf(2000.99)); + + // Company constructor + ICompany company1 = factory.newCompany(1L, "Sun Microsystems, Inc.", date(1952, 4, 11), addr1); + + // Meeting room constructors + + // Department Constructors + IDepartment dept1 = factory.newDepartment(1, "Development", company1); + IDepartment dept2 = factory.newDepartment(2, "Human Resources", company1); + company1.setDepartments(toSet(dept1, dept2)); + + // Employee Constructors + IFullTimeEmployee emp1 = + factory.newFullTimeEmployee( + 1, "emp1First", "emp1Last", "emp1Middle", null, addr1, null, 20000); + emp1.setBirthdate(date(1970, 6, 10)); + emp1.setHiredate(date(1999, 1, 1)); + IFullTimeEmployee emp2 = + factory.newFullTimeEmployee( + 2, "emp2First", "emp2Last", "emp2Middle", null, addr2, null, 10000); + emp2.setBirthdate(date(1975, 12, 22)); + emp2.setHiredate(date(2003, 7, 1)); + IPartTimeEmployee emp3 = + factory.newPartTimeEmployee( + 3, "emp3First", "emp3Last", "emp3Middle", null, addr3, null, 15); + emp3.setBirthdate(date(1972, 7, 5)); + emp3.setHiredate(date(2002, 8, 15)); + IPartTimeEmployee emp4 = + factory.newPartTimeEmployee( + 4, "emp4First", "emp4Last", "emp4Middle", null, addr3, null, 13); + emp4.setBirthdate(date(1973, 7, 6)); + emp4.setHiredate(date(2001, 4, 15)); + IFullTimeEmployee emp5 = + factory.newFullTimeEmployee( + 5, "emp5First", "emp5Last", "emp5Middle", null, addr3, null, 45000); + emp5.setBirthdate(date(1962, 7, 5)); + emp5.setHiredate(date(1998, 8, 15)); + + // Employee properties + emp1.setWeeklyhours(40); + emp1.setReviewedProjects(toSet(proj3)); + emp1.setProjects(toSet(proj1)); + + emp2.setWeeklyhours(40); + emp2.setProjects(toSet(proj1, proj2)); + + emp3.setWeeklyhours(19); + emp3.setProjects(toSet(proj1, proj2)); + + emp4.setReviewedProjects(toSet(proj2)); + emp4.setProjects(toSet(proj3)); + + emp5.setReviewedProjects(toSet(proj2)); + emp5.setProjects(toSet(proj3)); + + // Department properties + + // Insurance properties + + // Project properties + proj1.setMembers(toSet(emp1, emp2, emp3)); + + proj2.setReviewers(toSet(emp4, emp5)); + proj2.setMembers(toSet(emp2, emp3)); + + proj3.setReviewers(toSet(emp1)); + proj3.setMembers(toSet(emp4, emp5)); + + // root objects + registry.register("company1", company1); + registry.register("dept1", dept1); + registry.register("dept2", dept2); + registry.register("emp1", emp1); + registry.register("emp2", emp2); + registry.register("emp3", emp3); + registry.register("emp4", emp4); + registry.register("emp5", emp5); + registry.register("medicalIns1", medicalIns1); + registry.register("medicalIns2", medicalIns2); + registry.register("medicalIns3", medicalIns3); + registry.register("dentalIns1", dentalIns1); + } +} diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java new file mode 100644 index 000000000..872ff5e5b --- /dev/null +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java @@ -0,0 +1,124 @@ +/* + * 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 + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.company.data; + +import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; + +import java.math.BigDecimal; +import org.apache.jdo.tck.pc.company.*; +import org.apache.jdo.tck.util.DefaultListableInstanceFactory; + +public class RelationshipsNoData { + + public static void init( + CompanyFactory factory, DefaultListableInstanceFactory registry) { + IAddress addr1 = + factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); + IAddress addr2 = factory.newAddress(2, "Broadway 1", "New York", "NY", "10000", "USA"); + IAddress addr3 = factory.newAddress(3, "Market St.", "San Francisco", "CA", "94102", "USA"); + + // Insurance constructors + IMedicalInsurance medicalIns1 = factory.newMedicalInsurance(1, "Carrier1", "PPO"); + IMedicalInsurance medicalIns2 = factory.newMedicalInsurance(2, "Carrier2", "HMO"); + IMedicalInsurance medicalIns3 = factory.newMedicalInsurance(3, "Carrier3", "HMO"); + IMedicalInsurance medicalIns4 = factory.newMedicalInsurance(4, "Carrier4", "HMO"); + IMedicalInsurance medicalIns5 = factory.newMedicalInsurance(5, "Carrier5", "HMO"); + IDentalInsurance dentalIns1 = + factory.newDentalInsurance(11, "Carrier1", BigDecimal.valueOf(99.999)); + IDentalInsurance dentalIns2 = + factory.newDentalInsurance(12, "Carrier2", BigDecimal.valueOf(99.999)); + IDentalInsurance dentalIns3 = + factory.newDentalInsurance(13, "Carrier3", BigDecimal.valueOf(99.999)); + IDentalInsurance dentalIns4 = + factory.newDentalInsurance(14, "Carrier4", BigDecimal.valueOf(99.999)); + IDentalInsurance dentalIns5 = + factory.newDentalInsurance(15, "Carrier5", BigDecimal.valueOf(99.999)); + + // Project constructors + IProject proj1 = factory.newProject(1, "orange", BigDecimal.valueOf(2500000.99)); + IProject proj2 = factory.newProject(2, "blue", BigDecimal.valueOf(50000.00)); + IProject proj3 = factory.newProject(3, "green", BigDecimal.valueOf(2000.99)); + + // Company constructor + ICompany company1 = factory.newCompany(1L, "Sun Microsystems, Inc.", date(1952, 4, 11), addr1); + + // Meeting room constructors + + // Department Constructors + IDepartment dept1 = factory.newDepartment(1, "Development", company1); + IDepartment dept2 = factory.newDepartment(2, "Human Resources", company1); + company1.setDepartments(toSet(dept1, dept2)); + + // Employee Constructors + IFullTimeEmployee emp1 = + factory.newFullTimeEmployee( + 1, "emp1First", "emp1Last", "emp1Middle", null, addr1, null, 20000); + emp1.setBirthdate(date(1970, 6, 10)); + emp1.setHiredate(date(1999, 1, 1)); + IFullTimeEmployee emp2 = + factory.newFullTimeEmployee( + 2, "emp2First", "emp2Last", "emp2Middle", null, addr2, null, 10000); + emp2.setBirthdate(date(1975, 12, 22)); + emp2.setHiredate(date(2003, 7, 1)); + IPartTimeEmployee emp3 = + factory.newPartTimeEmployee( + 3, "emp3First", "emp3Last", "emp3Middle", null, addr3, null, 15); + emp3.setBirthdate(date(1972, 7, 5)); + emp3.setHiredate(date(2002, 8, 15)); + IPartTimeEmployee emp4 = + factory.newPartTimeEmployee( + 4, "emp4First", "emp4Last", "emp4Middle", null, addr3, null, 13); + emp4.setBirthdate(date(1973, 7, 6)); + emp4.setHiredate(date(2001, 4, 15)); + IFullTimeEmployee emp5 = + factory.newFullTimeEmployee( + 5, "emp5First", "emp5Last", "emp5Middle", null, addr3, null, 45000); + emp5.setBirthdate(date(1962, 7, 5)); + emp5.setHiredate(date(1998, 8, 15)); + + // Employee properties + emp1.setWeeklyhours(40); + + emp2.setWeeklyhours(40); + + emp3.setWeeklyhours(19); + + // Department properties + + // Insurance properties + + // Project properties + + // root objects + registry.register("company1", company1); + registry.register("dept1", dept1); + registry.register("dept2", dept2); + registry.register("emp1", emp1); + registry.register("emp2", emp2); + registry.register("emp3", emp3); + registry.register("emp4", emp4); + registry.register("emp5", emp5); + registry.register("medicalIns1", medicalIns1); + registry.register("medicalIns2", medicalIns2); + registry.register("medicalIns3", medicalIns3); + registry.register("dentalIns1", dentalIns1); + registry.register("proj1", proj1); + registry.register("proj2", proj2); + registry.register("proj3", proj3); + } +} diff --git a/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java b/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java index 7b584e4c8..244fc0724 100644 --- a/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java +++ b/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java @@ -15,25 +15,15 @@ public synchronized Object getBean(String name) { } public synchronized T getBean(String name, Class clazz) { -// if (!rootMap.containsKey(name)) { -// System.err.println("CLIF: Not found: " + name + " ---------------------------- "); -// System.err.println("CLIF: Beans: " + rootMap.size() + " " + Arrays.toString(rootMap.keySet().toArray()) + " ---------------------------- "); -// } -// if (rootMap.get(name) == null) { -// System.err.println("CLIF: NULL: " + name + " ---------------------------- "); -// System.err.println("CLIF: Beans: " + rootMap.size() + " " + Arrays.toString(rootMap.keySet().toArray()) + " ---------------------------- "); -// } return clazz.cast(getBean(name)); } public synchronized void register(String name, Object obj) { -// System.out.println("CLIF: Registering: " + name + " " + rootList.size() + " -----------------------"); // TODO TZ remove rootMap.put(name, obj); rootList.add(obj); } public synchronized List getRootList() { -// System.out.println("CLIF: Getting root list: " + rootList.size() + " -----------------------"); // TODO TZ remove return Collections.unmodifiableList(rootList); } From ff850fc625efade8dc94ec9373cecd113fb0c674 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Thu, 23 Oct 2025 17:55:38 +0200 Subject: [PATCH 26/43] Structure cleanup --- .../apache/jdo/tck/AbstractReaderTest.java | 1 + .../tck/mapping/AbstractRelationshipTest.java | 10 +- .../tck/pc/company/CompanyModelReader.java | 87 +++++---- .../tck/pc/company/data/EmbeddedTestData.java | 9 +- .../CompanyModelReaderOld.java | 179 ------------------ .../CompanyModelReaderOld.java | 179 ------------------ .../jdo/tck/pc/mylib/MylibReaderOld.java | 104 ---------- .../jdo/tck/pc/order/OrderModelReaderOld.java | 131 ------------- .../org/apache/jdo/tck/util/DataSource.java | 27 +++ .../conf/company1-1Relationships.conf | 1 + .../conf/company1-MRelationships.conf | 1 + .../conf/companyAllRelationships.conf | 1 + .../companyAnnotated1-1RelationshipsFCPM.conf | 1 + .../companyAnnotated1-MRelationshipsFCPM.conf | 3 +- .../conf/companyM-MRelationships.conf | 3 +- .../conf/relationshipAllRelationships.conf | 1 + .../conf/relationshipNoRelationships.conf | 1 + 17 files changed, 95 insertions(+), 644 deletions(-) delete mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReaderOld.java delete mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReaderOld.java delete mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReaderOld.java delete mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReaderOld.java create mode 100644 tck/src/main/java/org/apache/jdo/tck/util/DataSource.java diff --git a/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java b/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java index 0bc38244e..8cb7b2bcd 100644 --- a/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java +++ b/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java @@ -40,6 +40,7 @@ public abstract class AbstractReaderTest extends JDO_Test { /** The name of the file containing the bean collection (test data). */ protected final String inputFilename = System.getProperty("jdo.tck.testdata"); + protected final String inputClassname = System.getProperty("jdo.tck.testdatasource"); /** The map of String (bean name) to Object (bean). */ protected final Map oidMap = new HashMap<>(); diff --git a/tck/src/main/java/org/apache/jdo/tck/mapping/AbstractRelationshipTest.java b/tck/src/main/java/org/apache/jdo/tck/mapping/AbstractRelationshipTest.java index e54a964d0..d5376ac47 100644 --- a/tck/src/main/java/org/apache/jdo/tck/mapping/AbstractRelationshipTest.java +++ b/tck/src/main/java/org/apache/jdo/tck/mapping/AbstractRelationshipTest.java @@ -21,15 +21,13 @@ import java.util.Collection; import java.util.List; import org.apache.jdo.tck.AbstractReaderTest; -import org.apache.jdo.tck.pc.company.CompanyFactoryRegistry; -import org.apache.jdo.tck.pc.company.CompanyModelReader; -import org.apache.jdo.tck.pc.company.IEmployee; -import org.apache.jdo.tck.pc.company.IProject; +import org.apache.jdo.tck.pc.company.*; +import org.apache.jdo.tck.util.DataSource; /* * Abstract class for managed relationship tests */ -public class AbstractRelationshipTest extends AbstractReaderTest { +public abstract class AbstractRelationshipTest extends AbstractReaderTest { protected CompanyModelReader reader = null; @@ -44,7 +42,7 @@ protected void localSetUp() { if (isTestToBePerformed()) { getPM(); CompanyFactoryRegistry.registerFactory(pm); - reader = new CompanyModelReader(inputFilename); + reader = new CompanyModelReader(inputClassname, 0); addTearDownClass(reader.getTearDownClassesFromFactory()); // persist test data pm.currentTransaction().begin(); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java index 14ad37bf2..edd200cc5 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java @@ -17,14 +17,13 @@ package org.apache.jdo.tck.pc.company; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Locale; - +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.util.*; import org.apache.jdo.tck.pc.company.data.*; import org.apache.jdo.tck.pc.mylib.MylibReader; import org.apache.jdo.tck.util.ConversionHelper; +import org.apache.jdo.tck.util.DataSource; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; import org.apache.jdo.tck.util.JDOCustomDateEditor; @@ -39,16 +38,24 @@ public class CompanyModelReader extends DefaultListableInstanceFactory { public static final String QUERY_TEST = "org/apache/jdo/tck/pc/company/companyForQueryTests.xml"; public static final String MYLIB_TEST = "org/apache/jdo/tck/pc/mylib/mylibForQueryTests.xml"; - public static final String SAMPLE_QUERIES_TEST = "org/apache/jdo/tck/pc/company/companyForSampleQueriesTest.xml"; - public static final String JDOQL_NAVIGATION_TESTS = "org/apache/jdo/tck/pc/company/companyForNavigationTests.xml"; - public static final String JDOQL_SUBQUERIES_TESTS = "org/apache/jdo/tck/pc/company/companyForSubqueriesTests.xml"; - - public static final String RELATIONSHIPS_ALL = "org/apache/jdo/tck/pc/company/companyAllRelationships.xml"; - public static final String RELATIONSHIPS_1_1 = "org/apache/jdo/tck/pc/company/company1-1Relationships.xml"; - public static final String RELATIONSHIPS_1_M = "org/apache/jdo/tck/pc/company/company1-MRelationships.xml"; + public static final String SAMPLE_QUERIES_TEST = + "org/apache/jdo/tck/pc/company/companyForSampleQueriesTest.xml"; + public static final String JDOQL_NAVIGATION_TESTS = + "org/apache/jdo/tck/pc/company/companyForNavigationTests.xml"; + public static final String JDOQL_SUBQUERIES_TESTS = + "org/apache/jdo/tck/pc/company/companyForSubqueriesTests.xml"; + + public static final String RELATIONSHIPS_ALL = + "org/apache/jdo/tck/pc/company/companyAllRelationships.xml"; + public static final String RELATIONSHIPS_1_1 = + "org/apache/jdo/tck/pc/company/company1-1Relationships.xml"; + public static final String RELATIONSHIPS_1_M = + "org/apache/jdo/tck/pc/company/company1-MRelationships.xml"; public static final String EMBEDDED = "org/apache/jdo/tck/pc/company/companyEmbedded.xml"; - public static final String RELATIONSHIPS_M_M = "org/apache/jdo/tck/pc/company/companyM-MRelationships.xml"; - public static final String RELATIONSHIPS_NO = "org/apache/jdo/tck/pc/company/companyNoRelationships.xml"; + public static final String RELATIONSHIPS_M_M = + "org/apache/jdo/tck/pc/company/companyM-MRelationships.xml"; + public static final String RELATIONSHIPS_NO = + "org/apache/jdo/tck/pc/company/companyNoRelationships.xml"; /** The company factory instance. */ private CompanyFactory companyFactory; @@ -66,6 +73,26 @@ public CompanyModelReader(String resourceName) { this(resourceName, Company.class.getClassLoader()); } + public CompanyModelReader(String resourceName, int dummy) { + super(); + this.reset(); + configureFactory(); + reader = null; + try { + Class> cls = + (Class>) Class.forName(resourceName); + Constructor> cstr = cls.getConstructor(); + DataSource ds = cstr.newInstance(); + ds.initMe(companyFactory, this); + } catch (ClassNotFoundException + | InvocationTargetException + | NoSuchMethodException + | InstantiationException + | IllegalAccessException e) { + throw new IllegalArgumentException(e); + } + } + /** * Create a CompanyModelReader for the specified resourceName. * @@ -75,75 +102,51 @@ public CompanyModelReader(String resourceName) { public CompanyModelReader(String resourceName, ClassLoader classLoader) { super(); this.reset(); -// configureFactory(); - // reader = new CompanyModelReaderOld(resourceName, classLoader); + configureFactory(); + reader = null; switch (resourceName) { case RELATIONSHIPS_ALL: - configureFactory(); RelationshipsAllData.init(companyFactory, this); - reader = null; break; case RELATIONSHIPS_1_1: - configureFactory(); Relationships1_1Data.init(companyFactory, this); - reader = null; break; case RELATIONSHIPS_1_M: - configureFactory(); Relationships1_MData.init(companyFactory, this); - reader = null; break; case RELATIONSHIPS_M_M: - configureFactory(); RelationshipsM_MData.init(companyFactory, this); - reader = null; break; case RELATIONSHIPS_NO: - configureFactory(); RelationshipsNoData.init(companyFactory, this); - reader = null; break; case EMBEDDED: - configureFactory(); EmbeddedTestData.init(companyFactory, this); - reader = null; break; case JDOQL_NAVIGATION_TESTS: - configureFactory(); NavigationTestData.initNavigationTest(companyFactory, this); - reader = null; break; case JDOQL_SUBQUERIES_TESTS: - configureFactory(); SubqueryTestData.initSubqueryTest(companyFactory, this); - reader = null; break; case QUERY_TEST: - configureFactory(); QueryTestData.initQueryTest(companyFactory, this); - reader = null; break; case SAMPLE_QUERIES_TEST: - configureFactory(); SampleQueryTestData.initSampleQueryTest(companyFactory, this); - reader = null; break; case MYLIB_TEST: - configureFactory(); // TODO use companyModelFactory! MylibReader.init(this); - this.reader = null; break; default: - reader = new CompanyModelReaderOld(resourceName, classLoader); -// this.reader = null; + // this.reader = null; System.err.println("ERROR: Not registered: " + resourceName); - //throw new IllegalArgumentException("Not registered: " + resourceName); + // throw new IllegalArgumentException("Not registered: " + resourceName); } } - public T getBean(String name, Class clazz) { if (reader != null) { return reader.getBean(name, clazz); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java index bc35b7989..10a843052 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java @@ -21,9 +21,15 @@ import java.math.BigDecimal; import org.apache.jdo.tck.pc.company.*; +import org.apache.jdo.tck.util.DataSource; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; -public class EmbeddedTestData { +public class EmbeddedTestData implements DataSource { + + @Override + public void initMe(CompanyFactory factory, DefaultListableInstanceFactory registry) { + init(factory, registry); + } public static void init( CompanyFactory factory, DefaultListableInstanceFactory registry) { @@ -118,4 +124,5 @@ public static void init( registry.register("proj2", proj2); registry.register("proj3", proj3); } + } diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReaderOld.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReaderOld.java deleted file mode 100644 index 421112476..000000000 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReaderOld.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * 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 - * - * https://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.companyListWithoutJoin; - -import java.util.Date; -import java.util.List; -import java.util.Locale; -import org.apache.jdo.tck.util.ConversionHelper; -import org.apache.jdo.tck.util.JDOCustomDateEditor; -import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; -import org.springframework.core.io.ClassPathResource; - -/** - * Utility class to create a graph of company model instances from an xml representation. - * - * @author Michael Bouschen - */ -public class CompanyModelReaderOld extends DefaultListableBeanFactory { - - private static final long serialVersionUID = 1L; - - /** 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; - - /** Bean definition reader */ - private final XmlBeanDefinitionReader reader; - - /** - * Create a CompanyModelReader for the specified resourceName. - * - * @param resourceName the name of the resource - */ - public CompanyModelReaderOld(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 - * @param classLoader the ClassLoader for the lookup - */ - public CompanyModelReaderOld(String resourceName, ClassLoader classLoader) { - super(); - configureFactory(); - this.reader = new XmlBeanDefinitionReader(this); - this.reader.loadBeanDefinitions(new ClassPathResource(resourceName, classLoader)); - } - - /** - * 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 - */ - @SuppressWarnings("unchecked") - 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() { - registerCustomEditor(Date.class, JDOCustomDateEditor.class); - companyFactory = CompanyFactoryRegistry.getInstance(); - addSingleton(BEAN_FACTORY_NAME, companyFactory); - } - - // Convenience methods - - /** - * Convenience method returning a Company instance for the specified name. The method returns - * null 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 null if there no Company bean. - */ - public Company getCompany(String name) { - return getBean(name, Company.class); - } - - /** - * Convenience method returning a Department instance for the specified name. The method returns - * null 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 null if there no Department bean. - */ - public Department getDepartment(String name) { - return getBean(name, Department.class); - } - - /** - * Convenience method returning an Employee instance for the specified name. The method returns - * null 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 null if there no Employee bean. - */ - public Employee getEmployee(String name) { - return getBean(name, Employee.class); - } - - /** - * Convenience method returning a FullTimeEmployee instance for the specified name. The method - * returns null 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 null if there no FullTimeEmployee bean. - */ - public FullTimeEmployee getFullTimeEmployee(String name) { - return getBean(name, FullTimeEmployee.class); - } - - /** - * Convenience method returning a PartTimeEmployee instance for the specified name. The method - * returns null 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 null if there no PartTimeEmployee bean. - */ - public PartTimeEmployee getPartTimeEmployee(String name) { - return getBean(name, PartTimeEmployee.class); - } - - /** - * Convenience method returning a Person instance for the specified name. The method returns - * null 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 null if there no Person bean. - */ - public Person getPerson(String name) { - return 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(JDOCustomDateEditor.DATE_PATTERN, Locale.US, value); - } -} diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReaderOld.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReaderOld.java deleted file mode 100644 index 53001a7b5..000000000 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReaderOld.java +++ /dev/null @@ -1,179 +0,0 @@ -/* - * 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 - * - * https://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.List; -import java.util.Locale; -import org.apache.jdo.tck.util.ConversionHelper; -import org.apache.jdo.tck.util.JDOCustomDateEditor; -import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; -import org.springframework.core.io.ClassPathResource; - -/** - * Utility class to create a graph of company model instances from an xml representation. - * - * @author Michael Bouschen - */ -public class CompanyModelReaderOld extends DefaultListableBeanFactory { - - private static final long serialVersionUID = 1L; - - /** 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; - - /** Bean definition reader */ - private final XmlBeanDefinitionReader reader; - - /** - * Create a CompanyModelReader for the specified resourceName. - * - * @param resourceName the name of the resource - */ - public CompanyModelReaderOld(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 - * @param classLoader the ClassLoader for the lookup - */ - public CompanyModelReaderOld(String resourceName, ClassLoader classLoader) { - super(); - configureFactory(); - this.reader = new XmlBeanDefinitionReader(this); - this.reader.loadBeanDefinitions(new ClassPathResource(resourceName, classLoader)); - } - - /** - * 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 - */ - @SuppressWarnings("unchecked") - 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() { - registerCustomEditor(Date.class, JDOCustomDateEditor.class); - companyFactory = CompanyFactoryRegistry.getInstance(); - addSingleton(BEAN_FACTORY_NAME, companyFactory); - } - - // Convenience methods - - /** - * Convenience method returning a Company instance for the specified name. The method returns - * null 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 null if there no Company bean. - */ - public Company getCompany(String name) { - return getBean(name, Company.class); - } - - /** - * Convenience method returning a Department instance for the specified name. The method returns - * null 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 null if there no Department bean. - */ - public Department getDepartment(String name) { - return getBean(name, Department.class); - } - - /** - * Convenience method returning an Employee instance for the specified name. The method returns - * null 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 null if there no Employee bean. - */ - public Employee getEmployee(String name) { - return getBean(name, Employee.class); - } - - /** - * Convenience method returning a FullTimeEmployee instance for the specified name. The method - * returns null 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 null if there no FullTimeEmployee bean. - */ - public FullTimeEmployee getFullTimeEmployee(String name) { - return getBean(name, FullTimeEmployee.class); - } - - /** - * Convenience method returning a PartTimeEmployee instance for the specified name. The method - * returns null 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 null if there no PartTimeEmployee bean. - */ - public PartTimeEmployee getPartTimeEmployee(String name) { - return getBean(name, PartTimeEmployee.class); - } - - /** - * Convenience method returning a Person instance for the specified name. The method returns - * null 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 null if there no Person bean. - */ - public Person getPerson(String name) { - return 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(JDOCustomDateEditor.DATE_PATTERN, Locale.US, value); - } -} diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReaderOld.java b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReaderOld.java deleted file mode 100644 index c6de43b05..000000000 --- a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReaderOld.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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 - * - * https://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.mylib; - -import java.util.Date; -import java.util.List; -import org.apache.jdo.tck.util.JDOCustomDateEditor; -import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; -import org.springframework.core.io.ClassPathResource; - -/** Utility class to create a mylib instances from an xml representation. */ -public class MylibReaderOld extends DefaultListableBeanFactory { - - private static final long serialVersionUID = 1L; - - /** The name of the root list bean. */ - public static final String ROOT_LIST_NAME = "root"; - - /** Teardown classes */ - @SuppressWarnings("rawtypes") - private static final Class[] tearDownClasses = - new Class[] {PrimitiveTypes.class, PCClass.class}; - - /** Bean definition reader */ - private final XmlBeanDefinitionReader reader; - - /** - * Create a MylibReader for the specified resourceName. - * - * @param resourceName the name of the resource - */ - private MylibReaderOld(String resourceName) { - // Use the class loader of the PrimitiveTypes class to find the resource - this(resourceName, PrimitiveTypes.class.getClassLoader()); - } - - /** - * Create a MylibReader for the specified resourceName. - * - * @param resourceName the name of the resource - * @param classLoader the ClassLoader for the lookup - */ - private MylibReaderOld(String resourceName, ClassLoader classLoader) { - super(); - configureFactory(); - this.reader = new XmlBeanDefinitionReader(this); - this.reader.loadBeanDefinitions(new ClassPathResource(resourceName, classLoader)); - } - - /** - * 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 - */ - @SuppressWarnings("unchecked") - public List getRootList() { - return (List) getBean(ROOT_LIST_NAME); - } - - /** - * Configure the MylibReader, e.g. register CustomEditor classes to convert the string - * representation of a property into an instance of the right type. - */ - private void configureFactory() { - registerCustomEditor(Date.class, JDOCustomDateEditor.class); - } - - // Convenience methods - - /** - * Convenience method returning an Address instance for the specified name. The method returns - * null if there is no Address bean with the specified name. - * - * @param name the name of the bean to return. - * @return the instance of the bean or null if there no Address bean. - */ - public PrimitiveTypes getPrimitiveTypes(String name) { - return getBean(name, PrimitiveTypes.class); - } - - /** - * @return Returns the tearDownClasses. - */ - public static Class[] getTearDownClasses() { - return tearDownClasses; - } -} diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReaderOld.java b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReaderOld.java deleted file mode 100644 index 1670864bf..000000000 --- a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReaderOld.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * 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 - * - * https://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.Date; -import java.util.List; -import java.util.Locale; -import org.apache.jdo.tck.util.ConversionHelper; -import org.apache.jdo.tck.util.JDOCustomDateEditor; -import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; -import org.springframework.core.io.ClassPathResource; - -/** Utility class to create a graph of order model instances from an xml representation. */ -public class OrderModelReaderOld extends DefaultListableBeanFactory { - - private static final long serialVersionUID = 1L; - - /** 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; - - /** Bean definition reader */ - private final XmlBeanDefinitionReader reader; - - /** - * Create a OrderModelReader for the specified resourceName. - * - * @param resourceName the name of the resource - */ - public OrderModelReaderOld(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 - * @param classLoader the ClassLOader for the lookup - */ - public OrderModelReaderOld(String resourceName, ClassLoader classLoader) { - super(); - configureFactory(); - this.reader = new XmlBeanDefinitionReader(this); - this.reader.loadBeanDefinitions(new ClassPathResource(resourceName, classLoader)); - } - - /** - * 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 - */ - @SuppressWarnings("unchecked") - 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() { - registerCustomEditor(Date.class, JDOCustomDateEditor.class); - orderFactory = OrderFactoryRegistry.getInstance(); - addSingleton(BEAN_FACTORY_NAME, orderFactory); - } - - // Convenience methods - - /** - * Convenience method returning a Order instance for the specified name. The method returns - * null 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 null if there no Order bean. - */ - public Order getOrder(String name) { - return getBean(name, Order.class); - } - - /** - * Convenience method returning a OrderItem instance for the specified name. The method returns - * null 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 null if there no Department bean. - */ - public OrderItem getOrderItem(String name) { - return 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(JDOCustomDateEditor.DATE_PATTERN, Locale.US, value); - } -} diff --git a/tck/src/main/java/org/apache/jdo/tck/util/DataSource.java b/tck/src/main/java/org/apache/jdo/tck/util/DataSource.java new file mode 100644 index 000000000..3ba1e6ee9 --- /dev/null +++ b/tck/src/main/java/org/apache/jdo/tck/util/DataSource.java @@ -0,0 +1,27 @@ +/* + * 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 + * + * https://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.util; + +import org.apache.jdo.tck.pc.company.CompanyFactory; + +public interface DataSource { + void initMe(F factory, DefaultListableInstanceFactory registry); + + + +} diff --git a/tck/src/main/resources/conf/company1-1Relationships.conf b/tck/src/main/resources/conf/company1-1Relationships.conf index 2bd5652f5..cfaa7ed81 100644 --- a/tck/src/main/resources/conf/company1-1Relationships.conf +++ b/tck/src/main/resources/conf/company1-1Relationships.conf @@ -17,5 +17,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata wi jdo.tck.mapping.companyfactory = jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest jdo.tck.testdata = org/apache/jdo/tck/pc/company/company1-1Relationships.xml +jdo.tck.testdatasource = org.apache.jdo.tck.pc.company.data.Relationships1_1Data jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/company1-MRelationships.conf b/tck/src/main/resources/conf/company1-MRelationships.conf index 825f3aa6f..1f9b01b22 100644 --- a/tck/src/main/resources/conf/company1-MRelationships.conf +++ b/tck/src/main/resources/conf/company1-MRelationships.conf @@ -17,5 +17,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata wi jdo.tck.mapping.companyfactory = jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest jdo.tck.testdata = org/apache/jdo/tck/pc/company/company1-MRelationships.xml +jdo.tck.testdatasource = org.apache.jdo.tck.pc.company.data.Relationships1_MData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyAllRelationships.conf b/tck/src/main/resources/conf/companyAllRelationships.conf index 606ccce93..56ac0ccd6 100644 --- a/tck/src/main/resources/conf/companyAllRelationships.conf +++ b/tck/src/main/resources/conf/companyAllRelationships.conf @@ -18,5 +18,6 @@ and embedded objects. jdo.tck.mapping.companyfactory = jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyAllRelationships.xml +jdo.tck.testdatasource = org.apache.jdo.tck.pc.company.data.RelationshipsAllData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyAnnotated1-1RelationshipsFCPM.conf b/tck/src/main/resources/conf/companyAnnotated1-1RelationshipsFCPM.conf index f4d91eef3..abaea9dbf 100644 --- a/tck/src/main/resources/conf/companyAnnotated1-1RelationshipsFCPM.conf +++ b/tck/src/main/resources/conf/companyAnnotated1-1RelationshipsFCPM.conf @@ -17,5 +17,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata wi jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.companyAnnotatedFC.CompanyFactoryAnnotatedFCPMDelegator jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest jdo.tck.testdata = org/apache/jdo/tck/pc/company/company1-1Relationships.xml +jdo.tck.testdatasource = org.apache.jdo.tck.pc.company.data.Relationships1_1Data jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyAnnotated1-MRelationshipsFCPM.conf b/tck/src/main/resources/conf/companyAnnotated1-MRelationshipsFCPM.conf index 19bdea0a8..8dc8e7c4d 100644 --- a/tck/src/main/resources/conf/companyAnnotated1-MRelationshipsFCPM.conf +++ b/tck/src/main/resources/conf/companyAnnotated1-MRelationshipsFCPM.conf @@ -16,6 +16,7 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata with 1-M relationships, annotations. jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.companyAnnotatedFC.CompanyFactoryAnnotatedFCPMDelegator jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/company1-MRelationships.xml +#jdo.tck.testdata = org/apache/jdo/tck/pc/company/company1-MRelationships.xml +jdo.tck.testdatasource = org.apache.jdo.tck.pc.company.data.Relationships1_MData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyM-MRelationships.conf b/tck/src/main/resources/conf/companyM-MRelationships.conf index 8f3faf168..5ce4cbcbd 100644 --- a/tck/src/main/resources/conf/companyM-MRelationships.conf +++ b/tck/src/main/resources/conf/companyM-MRelationships.conf @@ -16,6 +16,7 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata with M-M relationships. jdo.tck.mapping.companyfactory = jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyM-MRelationships.xml +#jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyM-MRelationships.xml +jdo.tck.testdatasource = org.apache.jdo.tck.pc.company.data.RelationshipsM_MData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/relationshipAllRelationships.conf b/tck/src/main/resources/conf/relationshipAllRelationships.conf index 9704cdb6c..4560f3643 100644 --- a/tck/src/main/resources/conf/relationshipAllRelationships.conf +++ b/tck/src/main/resources/conf/relationshipAllRelationships.conf @@ -17,6 +17,7 @@ jdo.tck.description = Managed relationship tests with standard mapping, \ basic testdata with all relationships. jdo.tck.mapping.companyfactory = jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyAllRelationships.xml +jdo.tck.testdatasource = org.apache.jdo.tck.pc.company.data.RelationshipsAllData jdo.tck.mapping = 0 jdo.tck.requiredOptions = jdo.tck.classes = org.apache.jdo.tck.mapping.Relationship1To1AllRelationships \ diff --git a/tck/src/main/resources/conf/relationshipNoRelationships.conf b/tck/src/main/resources/conf/relationshipNoRelationships.conf index 09e744365..d719bfdde 100644 --- a/tck/src/main/resources/conf/relationshipNoRelationships.conf +++ b/tck/src/main/resources/conf/relationshipNoRelationships.conf @@ -17,6 +17,7 @@ jdo.tck.description = Managed relationship tests with standard mapping, \ basic testdata with no relationships. jdo.tck.mapping.companyfactory = jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyNoRelationships.xml +jdo.tck.testdatasource = org.apache.jdo.tck.pc.company.data.RelationshipsNoData jdo.tck.mapping = 0 jdo.tck.requiredOptions = jdo.tck.classes = org.apache.jdo.tck.mapping.Relationship1To1NoRelationships \ From 2c40e37b6c0d48624244aea435827ee9a9fb8da2 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 26 Oct 2025 12:17:04 +0100 Subject: [PATCH 27/43] Test class in conf files --- .../apache/jdo/tck/AbstractReaderTest.java | 1 - .../tck/mapping/AbstractRelationshipTest.java | 10 ++- .../tck/pc/company/CompanyModelReader.java | 40 +++++----- .../pc/company/data/CompanyDataSource.java | 23 ++++++ .../tck/pc/company/data/EmbeddedTestData.java | 3 +- .../pc/company/data/NavigationTestData.java | 9 ++- .../tck/pc/company/data/QueryTestData.java | 9 ++- .../pc/company/data/Relationships1_1Data.java | 7 +- .../pc/company/data/Relationships1_MData.java | 7 +- .../pc/company/data/RelationshipsAllData.java | 7 +- .../pc/company/data/RelationshipsM_MData.java | 7 +- .../pc/company/data/RelationshipsNoData.java | 7 +- .../pc/company/data/SampleQueryTestData.java | 9 ++- .../tck/pc/company/data/SubqueryTestData.java | 9 ++- .../apache/jdo/tck/pc/mylib/MylibReader.java | 53 +------------- .../jdo/tck/pc/mylib/MylibReaderTestData.java | 73 +++++++++++++++++++ .../org/apache/jdo/tck/util/DataSource.java | 7 +- .../util/DefaultListableInstanceFactory.java | 18 +++++ .../conf/company1-1Relationships.conf | 3 +- .../conf/company1-MRelationships.conf | 3 +- .../conf/companyAllRelationships.conf | 3 +- .../companyAnnotated1-1RelationshipsFCPM.conf | 3 +- .../companyAnnotated1-MRelationshipsFCPM.conf | 3 +- .../main/resources/conf/companyEmbedded.conf | 2 +- .../conf/companyM-MRelationships.conf | 3 +- .../conf/companyNoRelationships.conf | 2 +- .../conf/relationshipAllRelationships.conf | 3 +- .../conf/relationshipNoRelationships.conf | 3 +- 28 files changed, 214 insertions(+), 113 deletions(-) create mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/company/data/CompanyDataSource.java create mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReaderTestData.java diff --git a/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java b/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java index 8cb7b2bcd..0bc38244e 100644 --- a/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java +++ b/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java @@ -40,7 +40,6 @@ public abstract class AbstractReaderTest extends JDO_Test { /** The name of the file containing the bean collection (test data). */ protected final String inputFilename = System.getProperty("jdo.tck.testdata"); - protected final String inputClassname = System.getProperty("jdo.tck.testdatasource"); /** The map of String (bean name) to Object (bean). */ protected final Map oidMap = new HashMap<>(); diff --git a/tck/src/main/java/org/apache/jdo/tck/mapping/AbstractRelationshipTest.java b/tck/src/main/java/org/apache/jdo/tck/mapping/AbstractRelationshipTest.java index d5376ac47..e54a964d0 100644 --- a/tck/src/main/java/org/apache/jdo/tck/mapping/AbstractRelationshipTest.java +++ b/tck/src/main/java/org/apache/jdo/tck/mapping/AbstractRelationshipTest.java @@ -21,13 +21,15 @@ import java.util.Collection; import java.util.List; import org.apache.jdo.tck.AbstractReaderTest; -import org.apache.jdo.tck.pc.company.*; -import org.apache.jdo.tck.util.DataSource; +import org.apache.jdo.tck.pc.company.CompanyFactoryRegistry; +import org.apache.jdo.tck.pc.company.CompanyModelReader; +import org.apache.jdo.tck.pc.company.IEmployee; +import org.apache.jdo.tck.pc.company.IProject; /* * Abstract class for managed relationship tests */ -public abstract class AbstractRelationshipTest extends AbstractReaderTest { +public class AbstractRelationshipTest extends AbstractReaderTest { protected CompanyModelReader reader = null; @@ -42,7 +44,7 @@ protected void localSetUp() { if (isTestToBePerformed()) { getPM(); CompanyFactoryRegistry.registerFactory(pm); - reader = new CompanyModelReader(inputClassname, 0); + reader = new CompanyModelReader(inputFilename); addTearDownClass(reader.getTearDownClassesFromFactory()); // persist test data pm.currentTransaction().begin(); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java index edd200cc5..6790151b9 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java @@ -21,7 +21,7 @@ import java.lang.reflect.InvocationTargetException; import java.util.*; import org.apache.jdo.tck.pc.company.data.*; -import org.apache.jdo.tck.pc.mylib.MylibReader; +import org.apache.jdo.tck.pc.mylib.MylibReaderTestData; import org.apache.jdo.tck.util.ConversionHelper; import org.apache.jdo.tck.util.DataSource; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; @@ -73,24 +73,21 @@ public CompanyModelReader(String resourceName) { this(resourceName, Company.class.getClassLoader()); } + public CompanyModelReader(DataSource resource) { + super(); + reader = null; + this.reset(); + configureFactory(); + resource.initMe(companyFactory, this); + } + + @SuppressWarnings("unchecked") public CompanyModelReader(String resourceName, int dummy) { super(); this.reset(); configureFactory(); reader = null; - try { - Class> cls = - (Class>) Class.forName(resourceName); - Constructor> cstr = cls.getConstructor(); - DataSource ds = cstr.newInstance(); - ds.initMe(companyFactory, this); - } catch (ClassNotFoundException - | InvocationTargetException - | NoSuchMethodException - | InstantiationException - | IllegalAccessException e) { - throw new IllegalArgumentException(e); - } + getDataSource(resourceName).initMe(companyFactory, this); } /** @@ -105,6 +102,11 @@ public CompanyModelReader(String resourceName, ClassLoader classLoader) { configureFactory(); reader = null; + if (!resourceName.endsWith(".xml")) { + getDataSource(resourceName).initMe(companyFactory, this); + return; + } + switch (resourceName) { case RELATIONSHIPS_ALL: RelationshipsAllData.init(companyFactory, this); @@ -125,20 +127,20 @@ public CompanyModelReader(String resourceName, ClassLoader classLoader) { EmbeddedTestData.init(companyFactory, this); break; case JDOQL_NAVIGATION_TESTS: - NavigationTestData.initNavigationTest(companyFactory, this); + NavigationTestData.init(companyFactory, this); break; case JDOQL_SUBQUERIES_TESTS: - SubqueryTestData.initSubqueryTest(companyFactory, this); + SubqueryTestData.init(companyFactory, this); break; case QUERY_TEST: - QueryTestData.initQueryTest(companyFactory, this); + QueryTestData.init(companyFactory, this); break; case SAMPLE_QUERIES_TEST: - SampleQueryTestData.initSampleQueryTest(companyFactory, this); + SampleQueryTestData.init(companyFactory, this); break; case MYLIB_TEST: // TODO use companyModelFactory! - MylibReader.init(this); + new MylibReaderTestData().initMe(this, this); break; default: // this.reader = null; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/CompanyDataSource.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/CompanyDataSource.java new file mode 100644 index 000000000..9c4239cec --- /dev/null +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/CompanyDataSource.java @@ -0,0 +1,23 @@ +/* + * 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 + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jdo.tck.pc.company.data; + +import org.apache.jdo.tck.pc.company.CompanyFactory; +import org.apache.jdo.tck.util.DataSource; + +public interface CompanyDataSource extends DataSource {} diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java index 10a843052..6872d9cf7 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java @@ -21,10 +21,9 @@ import java.math.BigDecimal; import org.apache.jdo.tck.pc.company.*; -import org.apache.jdo.tck.util.DataSource; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; -public class EmbeddedTestData implements DataSource { +public class EmbeddedTestData implements CompanyDataSource { @Override public void initMe(CompanyFactory factory, DefaultListableInstanceFactory registry) { diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java index 3731efcf7..2788bbf5e 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java @@ -23,9 +23,14 @@ import org.apache.jdo.tck.pc.company.*; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; -public class NavigationTestData { +public class NavigationTestData implements CompanyDataSource { - public static void initNavigationTest( + @Override + public void initMe(CompanyFactory factory, DefaultListableInstanceFactory registry) { + init(factory, registry); + } + + public static void init( CompanyFactory factory, DefaultListableInstanceFactory registry) { IAddress addr1 = factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java index b94e09740..00ef4fcd5 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java @@ -24,9 +24,14 @@ import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; -public class QueryTestData { +public class QueryTestData implements CompanyDataSource { - public static void initQueryTest( + @Override + public void initMe(CompanyFactory factory, DefaultListableInstanceFactory registry) { + init(factory, registry); + } + + public static void init( CompanyFactory factory, DefaultListableInstanceFactory registry) { IAddress addr1 = factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java index 9ae20241f..016df0d71 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java @@ -23,7 +23,12 @@ import org.apache.jdo.tck.pc.company.*; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; -public class Relationships1_1Data { +public class Relationships1_1Data implements CompanyDataSource { + + @Override + public void initMe(CompanyFactory factory, DefaultListableInstanceFactory registry) { + init(factory, registry); + } public static void init( CompanyFactory factory, DefaultListableInstanceFactory registry) { diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java index 1b9e6a3da..72479b1dd 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java @@ -23,7 +23,12 @@ import org.apache.jdo.tck.pc.company.*; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; -public class Relationships1_MData { +public class Relationships1_MData implements CompanyDataSource { + + @Override + public void initMe(CompanyFactory factory, DefaultListableInstanceFactory registry) { + init(factory, registry); + } public static void init( CompanyFactory factory, DefaultListableInstanceFactory registry) { diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java index 8177df679..26f88c01b 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java @@ -23,7 +23,12 @@ import org.apache.jdo.tck.pc.company.*; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; -public class RelationshipsAllData { +public class RelationshipsAllData implements CompanyDataSource { + + @Override + public void initMe(CompanyFactory factory, DefaultListableInstanceFactory registry) { + init(factory, registry); + } public static void init( CompanyFactory factory, DefaultListableInstanceFactory registry) { diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java index feb1d09f2..fbb912a2c 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java @@ -23,7 +23,12 @@ import org.apache.jdo.tck.pc.company.*; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; -public class RelationshipsM_MData { +public class RelationshipsM_MData implements CompanyDataSource { + + @Override + public void initMe(CompanyFactory factory, DefaultListableInstanceFactory registry) { + init(factory, registry); + } public static void init( CompanyFactory factory, DefaultListableInstanceFactory registry) { diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java index 872ff5e5b..b77aa446d 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java @@ -23,7 +23,12 @@ import org.apache.jdo.tck.pc.company.*; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; -public class RelationshipsNoData { +public class RelationshipsNoData implements CompanyDataSource { + + @Override + public void initMe(CompanyFactory factory, DefaultListableInstanceFactory registry) { + init(factory, registry); + } public static void init( CompanyFactory factory, DefaultListableInstanceFactory registry) { diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java index b3d9a828c..bd1814cf1 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java @@ -24,9 +24,14 @@ import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; -public class SampleQueryTestData { +public class SampleQueryTestData implements CompanyDataSource { - public static void initSampleQueryTest( + @Override + public void initMe(CompanyFactory factory, DefaultListableInstanceFactory registry) { + init(factory, registry); + } + + public static void init( CompanyFactory factory, DefaultListableInstanceFactory registry) { IAddress addr1 = factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java index 6110ca9df..aed6dd7a5 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java @@ -22,9 +22,14 @@ import org.apache.jdo.tck.pc.company.*; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; -public class SubqueryTestData { +public class SubqueryTestData implements CompanyDataSource { - public static void initSubqueryTest( + @Override + public void initMe(CompanyFactory factory, DefaultListableInstanceFactory registry) { + init(factory, registry); + } + + public static void init( CompanyFactory factory, DefaultListableInstanceFactory registry) { IAddress addr1 = factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java index 81cfbb19d..487a9bedb 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java @@ -19,13 +19,10 @@ import org.apache.jdo.tck.util.DefaultListableInstanceFactory; -/** Utility class to create a mylib instances from an xml representation. */ +/** Utility class to create mylib test data instances. */ public class MylibReader extends DefaultListableInstanceFactory { - private static final long serialVersionUID = 1L; - /** Teardown classes */ - @SuppressWarnings("rawtypes") private static final Class[] tearDownClasses = new Class[] {PrimitiveTypes.class, PCClass.class}; @@ -36,51 +33,7 @@ public class MylibReader extends DefaultListableInstanceFactory { */ public MylibReader(String resourceName) { super(); - init(this); - } - - public static void init(DefaultListableInstanceFactory factory) { - System.err.println("MyLibReader2.init()"); - PrimitiveTypes primitiveTypesPositive = - new PrimitiveTypes( - 1L, - false, - null, - (byte) 0, - null, - (short) 0, - null, - 4, - 4, - 4, - Long.valueOf(4), - 4.0f, - 4.0f, - 4.0, - 4.0, - (char) 0, - null, - null, - null, - null, - null, - null); - PrimitiveTypes primitiveTypesNegative = - new PrimitiveTypes( - 2L, false, null, (byte) 0, null, (short) 0, null, -4, -4, -4, -4L, -4.0f, -4.0f, -4.0, - -4.0, (char) 0, null, null, null, null, null, null); - PCClass pcClass1 = new PCClass(1, 10, 10, 0, 0); - PCClass pcClass2 = new PCClass(2, 20, 20, 0, 0); - PrimitiveTypes primitiveTypesCharacterStringLiterals = - new PrimitiveTypes( - 3, false, null, (byte) 0, null, (short) 0, null, 0, null, 0, null, 0, null, 0, null, - (char) 0, (char) 0, null, "Even", null, null, null); - - factory.register("primitiveTypesPositive", primitiveTypesPositive); - factory.register("primitiveTypesNegative", primitiveTypesNegative); - factory.register("pcClass1", pcClass1); - factory.register("pcClass2", pcClass2); - factory.register("primitiveTypesCharacterStringLiterals", primitiveTypesCharacterStringLiterals); + new MylibReaderTestData().initMe(this, this); } // Convenience methods @@ -90,7 +43,7 @@ public static void init(DefaultListableInstanceFactory factory) { * null if there is no Address bean with the specified name. * * @param name the name of the bean to return. - * @return the instance of the bean or null if there no Address bean. + * @return the instance of the bean or null if there is no Address bean. */ public PrimitiveTypes getPrimitiveTypes(String name) { return getBean(name, PrimitiveTypes.class); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReaderTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReaderTestData.java new file mode 100644 index 000000000..987c5176b --- /dev/null +++ b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReaderTestData.java @@ -0,0 +1,73 @@ +/* + * 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 + * + * https://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.mylib; + +import org.apache.jdo.tck.util.DataSource; +import org.apache.jdo.tck.util.DefaultListableInstanceFactory; + +/** Utility class to create a mylib instances for unit tests. */ +public class MylibReaderTestData implements DataSource { + + @Override + public void initMe(DefaultListableInstanceFactory factory, DefaultListableInstanceFactory registry) { + init(registry); + } + + public static void init(DefaultListableInstanceFactory registry) { + PrimitiveTypes primitiveTypesPositive = + new PrimitiveTypes( + 1L, + false, + null, + (byte) 0, + null, + (short) 0, + null, + 4, + 4, + 4, + Long.valueOf(4), + 4.0f, + 4.0f, + 4.0, + 4.0, + (char) 0, + null, + null, + null, + null, + null, + null); + PrimitiveTypes primitiveTypesNegative = + new PrimitiveTypes( + 2L, false, null, (byte) 0, null, (short) 0, null, -4, -4, -4, -4L, -4.0f, -4.0f, -4.0, + -4.0, (char) 0, null, null, null, null, null, null); + PCClass pcClass1 = new PCClass(1, 10, 10, 0, 0); + PCClass pcClass2 = new PCClass(2, 20, 20, 0, 0); + PrimitiveTypes primitiveTypesCharacterStringLiterals = + new PrimitiveTypes( + 3, false, null, (byte) 0, null, (short) 0, null, 0, null, 0, null, 0, null, 0, null, + (char) 0, (char) 0, null, "Even", null, null, null); + + registry.register("primitiveTypesPositive", primitiveTypesPositive); + registry.register("primitiveTypesNegative", primitiveTypesNegative); + registry.register("pcClass1", pcClass1); + registry.register("pcClass2", pcClass2); + registry.register("primitiveTypesCharacterStringLiterals", primitiveTypesCharacterStringLiterals); + } +} diff --git a/tck/src/main/java/org/apache/jdo/tck/util/DataSource.java b/tck/src/main/java/org/apache/jdo/tck/util/DataSource.java index 3ba1e6ee9..00ca04041 100644 --- a/tck/src/main/java/org/apache/jdo/tck/util/DataSource.java +++ b/tck/src/main/java/org/apache/jdo/tck/util/DataSource.java @@ -17,11 +17,6 @@ package org.apache.jdo.tck.util; -import org.apache.jdo.tck.pc.company.CompanyFactory; - public interface DataSource { - void initMe(F factory, DefaultListableInstanceFactory registry); - - - + void initMe(F factory, DefaultListableInstanceFactory registry); } diff --git a/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java b/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java index 244fc0724..8971201ce 100644 --- a/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java +++ b/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java @@ -1,5 +1,7 @@ package org.apache.jdo.tck.util; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; import java.util.*; public class DefaultListableInstanceFactory { @@ -31,4 +33,20 @@ public synchronized void reset() { rootMap.clear(); rootList.clear(); } + + @SuppressWarnings("unchecked") + public static DataSource getDataSource(String resourceName) { + System.err.println("Instantiating data class: " + resourceName); + try { + Class> cls = (Class>) Class.forName(resourceName); + Constructor> cstr = cls.getConstructor(); + return cstr.newInstance(); + } catch (ClassNotFoundException + | InvocationTargetException + | NoSuchMethodException + | InstantiationException + | IllegalAccessException e) { + throw new IllegalArgumentException("Error executing test data class: " + resourceName, e); + } + } } diff --git a/tck/src/main/resources/conf/company1-1Relationships.conf b/tck/src/main/resources/conf/company1-1Relationships.conf index cfaa7ed81..ce797d143 100644 --- a/tck/src/main/resources/conf/company1-1Relationships.conf +++ b/tck/src/main/resources/conf/company1-1Relationships.conf @@ -16,7 +16,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata with 1-1 relationships. jdo.tck.mapping.companyfactory = jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/company1-1Relationships.xml -jdo.tck.testdatasource = org.apache.jdo.tck.pc.company.data.Relationships1_1Data +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.Relationships1_1Data jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/company1-MRelationships.conf b/tck/src/main/resources/conf/company1-MRelationships.conf index 1f9b01b22..189fb9feb 100644 --- a/tck/src/main/resources/conf/company1-MRelationships.conf +++ b/tck/src/main/resources/conf/company1-MRelationships.conf @@ -16,7 +16,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata with 1-M relationships. jdo.tck.mapping.companyfactory = jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/company1-MRelationships.xml -jdo.tck.testdatasource = org.apache.jdo.tck.pc.company.data.Relationships1_MData +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.Relationships1_MData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyAllRelationships.conf b/tck/src/main/resources/conf/companyAllRelationships.conf index 56ac0ccd6..b9d944075 100644 --- a/tck/src/main/resources/conf/companyAllRelationships.conf +++ b/tck/src/main/resources/conf/companyAllRelationships.conf @@ -17,7 +17,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata wi and embedded objects. jdo.tck.mapping.companyfactory = jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyAllRelationships.xml -jdo.tck.testdatasource = org.apache.jdo.tck.pc.company.data.RelationshipsAllData +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsAllData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyAnnotated1-1RelationshipsFCPM.conf b/tck/src/main/resources/conf/companyAnnotated1-1RelationshipsFCPM.conf index abaea9dbf..f71ff09a5 100644 --- a/tck/src/main/resources/conf/companyAnnotated1-1RelationshipsFCPM.conf +++ b/tck/src/main/resources/conf/companyAnnotated1-1RelationshipsFCPM.conf @@ -16,7 +16,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata with 1-1 relationships, annotations. jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.companyAnnotatedFC.CompanyFactoryAnnotatedFCPMDelegator jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/company1-1Relationships.xml -jdo.tck.testdatasource = org.apache.jdo.tck.pc.company.data.Relationships1_1Data +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.Relationships1_1Data jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyAnnotated1-MRelationshipsFCPM.conf b/tck/src/main/resources/conf/companyAnnotated1-MRelationshipsFCPM.conf index 8dc8e7c4d..550d7aa56 100644 --- a/tck/src/main/resources/conf/companyAnnotated1-MRelationshipsFCPM.conf +++ b/tck/src/main/resources/conf/companyAnnotated1-MRelationshipsFCPM.conf @@ -16,7 +16,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata with 1-M relationships, annotations. jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.companyAnnotatedFC.CompanyFactoryAnnotatedFCPMDelegator jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -#jdo.tck.testdata = org/apache/jdo/tck/pc/company/company1-MRelationships.xml -jdo.tck.testdatasource = org.apache.jdo.tck.pc.company.data.Relationships1_MData +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.Relationships1_MData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyEmbedded.conf b/tck/src/main/resources/conf/companyEmbedded.conf index e3ae8ac68..387061d1d 100644 --- a/tck/src/main/resources/conf/companyEmbedded.conf +++ b/tck/src/main/resources/conf/companyEmbedded.conf @@ -17,6 +17,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata wi and embedded objects. jdo.tck.mapping.companyfactory = jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyEmbedded.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.EmbeddedTestData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyM-MRelationships.conf b/tck/src/main/resources/conf/companyM-MRelationships.conf index 5ce4cbcbd..07dd6f728 100644 --- a/tck/src/main/resources/conf/companyM-MRelationships.conf +++ b/tck/src/main/resources/conf/companyM-MRelationships.conf @@ -16,7 +16,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata with M-M relationships. jdo.tck.mapping.companyfactory = jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -#jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyM-MRelationships.xml -jdo.tck.testdatasource = org.apache.jdo.tck.pc.company.data.RelationshipsM_MData +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsM_MData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyNoRelationships.conf b/tck/src/main/resources/conf/companyNoRelationships.conf index d15599fed..dad6d6369 100644 --- a/tck/src/main/resources/conf/companyNoRelationships.conf +++ b/tck/src/main/resources/conf/companyNoRelationships.conf @@ -16,6 +16,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata with no relationships. jdo.tck.mapping.companyfactory = jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyNoRelationships.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsNoData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/relationshipAllRelationships.conf b/tck/src/main/resources/conf/relationshipAllRelationships.conf index 4560f3643..1761e23b8 100644 --- a/tck/src/main/resources/conf/relationshipAllRelationships.conf +++ b/tck/src/main/resources/conf/relationshipAllRelationships.conf @@ -16,8 +16,7 @@ jdo.tck.description = Managed relationship tests with standard mapping, \ basic testdata with all relationships. jdo.tck.mapping.companyfactory = -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyAllRelationships.xml -jdo.tck.testdatasource = org.apache.jdo.tck.pc.company.data.RelationshipsAllData +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsAllData jdo.tck.mapping = 0 jdo.tck.requiredOptions = jdo.tck.classes = org.apache.jdo.tck.mapping.Relationship1To1AllRelationships \ diff --git a/tck/src/main/resources/conf/relationshipNoRelationships.conf b/tck/src/main/resources/conf/relationshipNoRelationships.conf index d719bfdde..0c12b05a0 100644 --- a/tck/src/main/resources/conf/relationshipNoRelationships.conf +++ b/tck/src/main/resources/conf/relationshipNoRelationships.conf @@ -16,8 +16,7 @@ jdo.tck.description = Managed relationship tests with standard mapping, \ basic testdata with no relationships. jdo.tck.mapping.companyfactory = -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyNoRelationships.xml -jdo.tck.testdatasource = org.apache.jdo.tck.pc.company.data.RelationshipsNoData +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsNoData jdo.tck.mapping = 0 jdo.tck.requiredOptions = jdo.tck.classes = org.apache.jdo.tck.mapping.Relationship1To1NoRelationships \ From d03a4887c8c54ede2c2d51d40d63f7f0279af263 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 26 Oct 2025 13:48:36 +0100 Subject: [PATCH 28/43] Use jdo.tck.testdata --- .../jdo/tck/pc/order/OrderModelReader.java | 11 +---- .../pc/order/OrderModelReaderTestData.java | 43 +++++++++++++++++++ ...nyAnnotatedAllRelationshipsFCConcrete.conf | 2 +- .../companyAnnotatedAllRelationshipsFCPM.conf | 2 +- ...yAnnotatedAllRelationshipsJPAConcrete.conf | 2 +- ...companyAnnotatedAllRelationshipsJPAPM.conf | 2 +- ...nyAnnotatedAllRelationshipsPCConcrete.conf | 2 +- .../companyAnnotatedAllRelationshipsPCPM.conf | 2 +- .../companyAnnotatedAllRelationshipsPIPM.conf | 2 +- .../conf/companyAnnotatedEmbeddedFCPM.conf | 2 +- .../companyAnnotatedEmbeddedJPAConcrete.conf | 2 +- .../conf/companyAnnotatedEmbeddedJPAPM.conf | 2 +- ...nyAnnotatedM-MRelationshipsFCConcrete.conf | 2 +- .../companyAnnotatedM-MRelationshipsFCPM.conf | 2 +- ...anyAnnotatedNoRelationshipsFCConcrete.conf | 2 +- .../companyAnnotatedNoRelationshipsFCPM.conf | 2 +- ...anyAnnotatedNoRelationshipsPCConcrete.conf | 2 +- .../companyAnnotatedNoRelationshipsPCPM.conf | 2 +- .../companyAnnotatedNoRelationshipsPIPM.conf | 2 +- ...OverrideAnnotatedAllRelationshipsFCPM.conf | 2 +- .../main/resources/conf/companyPMClass.conf | 2 +- .../resources/conf/companyPMInterface.conf | 2 +- .../main/resources/conf/compoundIdentity.conf | 2 +- tck/src/main/resources/conf/inheritance1.conf | 2 +- tck/src/main/resources/conf/inheritance2.conf | 2 +- tck/src/main/resources/conf/inheritance3.conf | 2 +- tck/src/main/resources/conf/inheritance4.conf | 2 +- 27 files changed, 69 insertions(+), 35 deletions(-) create mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReaderTestData.java diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java index 504474932..0f0f60eac 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java @@ -39,16 +39,7 @@ public class OrderModelReader extends DefaultListableInstanceFactory { public OrderModelReader(String resourceName) { super(); configureFactory(); - init(); - } - - private void init() { - Order order1 = orderFactory.newOrder(1, 3); - OrderItem item1 = orderFactory.newOrderItem(order1, 1, "SunRay", 15); - OrderItem item2 = orderFactory.newOrderItem(order1, 1, "Sun Ultra 40", 3); - order1.addItem(item1); - order1.addItem(item2); - register("order1", order1); + getDataSource(resourceName).initMe(orderFactory, this); } /** diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReaderTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReaderTestData.java new file mode 100644 index 000000000..2047c60f0 --- /dev/null +++ b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReaderTestData.java @@ -0,0 +1,43 @@ +/* + * 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 + * + * https://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.Date; +import java.util.Locale; +import org.apache.jdo.tck.util.ConversionHelper; +import org.apache.jdo.tck.util.DataSource; +import org.apache.jdo.tck.util.DefaultListableInstanceFactory; +import org.apache.jdo.tck.util.JDOCustomDateEditor; + +/** Utility class to create a graph of order model instances from an xml representation. */ +public class OrderModelReaderTestData implements DataSource { + + @Override + public void initMe(OrderFactory factory, DefaultListableInstanceFactory registry) { + init(factory, registry); + } + + private void init(OrderFactory orderFactory, DefaultListableInstanceFactory registry) { + Order order1 = orderFactory.newOrder(1, 3); + OrderItem item1 = orderFactory.newOrderItem(order1, 1, "SunRay", 15); + OrderItem item2 = orderFactory.newOrderItem(order1, 1, "Sun Ultra 40", 3); + order1.addItem(item1); + order1.addItem(item2); + registry.register("order1", order1); + } +} diff --git a/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsFCConcrete.conf b/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsFCConcrete.conf index 436322a8a..5c32eea5e 100644 --- a/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsFCConcrete.conf +++ b/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsFCConcrete.conf @@ -17,6 +17,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata wi and embedded objects, annotations. jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.companyAnnotatedFC.CompanyFactoryAnnotatedFCConcreteDelegator jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyAllRelationships.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsAllData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsFCPM.conf b/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsFCPM.conf index 181a879c3..46f51d7d1 100644 --- a/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsFCPM.conf +++ b/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsFCPM.conf @@ -17,6 +17,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata wi and embedded objects, annotations. jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.companyAnnotatedFC.CompanyFactoryAnnotatedFCPMDelegator jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyAllRelationships.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsAllData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsJPAConcrete.conf b/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsJPAConcrete.conf index 4013a7760..d7232287c 100644 --- a/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsJPAConcrete.conf +++ b/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsJPAConcrete.conf @@ -16,6 +16,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata with M-M relationships, annotations. jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.companyAnnotatedJPA.CompanyFactoryAnnotatedJPAAppConcrete jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTestJPA -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyAllRelationships.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsAllData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsJPAPM.conf b/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsJPAPM.conf index 9ea828b01..97b6a0b24 100644 --- a/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsJPAPM.conf +++ b/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsJPAPM.conf @@ -17,6 +17,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata wi and embedded objects, annotations. jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.companyAnnotatedJPA.CompanyFactoryAnnotatedJPAAppPM jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTestJPA -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyAllRelationships.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsAllData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsPCConcrete.conf b/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsPCConcrete.conf index 80d6057f8..395668767 100644 --- a/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsPCConcrete.conf +++ b/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsPCConcrete.conf @@ -17,6 +17,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata wi and embedded objects, annotations. jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.companyAnnotatedPC.CompanyFactoryAnnotatedPCConcreteDelegator jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyAllRelationships.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsAllData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsPCPM.conf b/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsPCPM.conf index 7fd69991c..8f891e6a1 100644 --- a/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsPCPM.conf +++ b/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsPCPM.conf @@ -17,6 +17,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata wi and embedded objects, annotations. jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.companyAnnotatedPC.CompanyFactoryAnnotatedPCPMDelegator jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyAllRelationships.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsAllData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsPIPM.conf b/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsPIPM.conf index 8f36c466c..01070bb01 100644 --- a/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsPIPM.conf +++ b/tck/src/main/resources/conf/companyAnnotatedAllRelationshipsPIPM.conf @@ -16,6 +16,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata with no relationships. jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.companyAnnotatedPI.CompanyFactoryAnnotatedPIPMDelegator jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyAllRelationships.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsAllData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyAnnotatedEmbeddedFCPM.conf b/tck/src/main/resources/conf/companyAnnotatedEmbeddedFCPM.conf index ac4402d7c..b1a60a192 100644 --- a/tck/src/main/resources/conf/companyAnnotatedEmbeddedFCPM.conf +++ b/tck/src/main/resources/conf/companyAnnotatedEmbeddedFCPM.conf @@ -17,6 +17,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata wi and embedded objects, annotations. jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.companyAnnotatedFC.CompanyFactoryAnnotatedFCPMDelegator jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyEmbedded.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.EmbeddedTestData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyAnnotatedEmbeddedJPAConcrete.conf b/tck/src/main/resources/conf/companyAnnotatedEmbeddedJPAConcrete.conf index 8bb34979e..99d56c55b 100644 --- a/tck/src/main/resources/conf/companyAnnotatedEmbeddedJPAConcrete.conf +++ b/tck/src/main/resources/conf/companyAnnotatedEmbeddedJPAConcrete.conf @@ -16,6 +16,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata with no relationships. jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.companyAnnotatedJPA.CompanyFactoryAnnotatedJPAAppConcrete jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTestJPA -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyEmbedded.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.EmbeddedTestData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyAnnotatedEmbeddedJPAPM.conf b/tck/src/main/resources/conf/companyAnnotatedEmbeddedJPAPM.conf index bd77aacae..661472359 100644 --- a/tck/src/main/resources/conf/companyAnnotatedEmbeddedJPAPM.conf +++ b/tck/src/main/resources/conf/companyAnnotatedEmbeddedJPAPM.conf @@ -17,6 +17,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata wi and embedded objects, annotations. jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.companyAnnotatedJPA.CompanyFactoryAnnotatedJPAAppPM jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTestJPA -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyEmbedded.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.EmbeddedTestData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyAnnotatedM-MRelationshipsFCConcrete.conf b/tck/src/main/resources/conf/companyAnnotatedM-MRelationshipsFCConcrete.conf index 86bed6e45..9b8dbd8be 100644 --- a/tck/src/main/resources/conf/companyAnnotatedM-MRelationshipsFCConcrete.conf +++ b/tck/src/main/resources/conf/companyAnnotatedM-MRelationshipsFCConcrete.conf @@ -16,6 +16,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata with M-M relationships, annotations. jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.companyAnnotatedFC.CompanyFactoryAnnotatedFCConcreteDelegator jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyM-MRelationships.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsM_MData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyAnnotatedM-MRelationshipsFCPM.conf b/tck/src/main/resources/conf/companyAnnotatedM-MRelationshipsFCPM.conf index 366248808..3b1f7501d 100644 --- a/tck/src/main/resources/conf/companyAnnotatedM-MRelationshipsFCPM.conf +++ b/tck/src/main/resources/conf/companyAnnotatedM-MRelationshipsFCPM.conf @@ -16,6 +16,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata with M-M relationships, annotations. jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.companyAnnotatedFC.CompanyFactoryAnnotatedFCPMDelegator jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyM-MRelationships.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsM_MData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyAnnotatedNoRelationshipsFCConcrete.conf b/tck/src/main/resources/conf/companyAnnotatedNoRelationshipsFCConcrete.conf index d4522468b..02d7b2fee 100644 --- a/tck/src/main/resources/conf/companyAnnotatedNoRelationshipsFCConcrete.conf +++ b/tck/src/main/resources/conf/companyAnnotatedNoRelationshipsFCConcrete.conf @@ -16,6 +16,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata with no relationships. jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.companyAnnotatedFC.CompanyFactoryAnnotatedFCConcreteDelegator jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyNoRelationships.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsNoData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyAnnotatedNoRelationshipsFCPM.conf b/tck/src/main/resources/conf/companyAnnotatedNoRelationshipsFCPM.conf index 51420f1cd..9661fd420 100644 --- a/tck/src/main/resources/conf/companyAnnotatedNoRelationshipsFCPM.conf +++ b/tck/src/main/resources/conf/companyAnnotatedNoRelationshipsFCPM.conf @@ -16,6 +16,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata with no relationships. jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.companyAnnotatedFC.CompanyFactoryAnnotatedFCPMDelegator jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyNoRelationships.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsNoData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyAnnotatedNoRelationshipsPCConcrete.conf b/tck/src/main/resources/conf/companyAnnotatedNoRelationshipsPCConcrete.conf index 3660eae0a..128375aed 100644 --- a/tck/src/main/resources/conf/companyAnnotatedNoRelationshipsPCConcrete.conf +++ b/tck/src/main/resources/conf/companyAnnotatedNoRelationshipsPCConcrete.conf @@ -16,6 +16,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata with no relationships. jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.companyAnnotatedPC.CompanyFactoryAnnotatedPCConcreteDelegator jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyNoRelationships.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsNoData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyAnnotatedNoRelationshipsPCPM.conf b/tck/src/main/resources/conf/companyAnnotatedNoRelationshipsPCPM.conf index 07486898f..79beac8bf 100644 --- a/tck/src/main/resources/conf/companyAnnotatedNoRelationshipsPCPM.conf +++ b/tck/src/main/resources/conf/companyAnnotatedNoRelationshipsPCPM.conf @@ -16,6 +16,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata with no relationships. jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.companyAnnotatedPC.CompanyFactoryAnnotatedPCPMDelegator jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyNoRelationships.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsNoData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyAnnotatedNoRelationshipsPIPM.conf b/tck/src/main/resources/conf/companyAnnotatedNoRelationshipsPIPM.conf index 80e2edbc4..6fcfac286 100644 --- a/tck/src/main/resources/conf/companyAnnotatedNoRelationshipsPIPM.conf +++ b/tck/src/main/resources/conf/companyAnnotatedNoRelationshipsPIPM.conf @@ -16,6 +16,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata with no relationships. jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.companyAnnotatedPI.CompanyFactoryAnnotatedPIPMDelegator jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyNoRelationships.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsNoData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyOverrideAnnotatedAllRelationshipsFCPM.conf b/tck/src/main/resources/conf/companyOverrideAnnotatedAllRelationshipsFCPM.conf index 22c990310..c60cc6919 100644 --- a/tck/src/main/resources/conf/companyOverrideAnnotatedAllRelationshipsFCPM.conf +++ b/tck/src/main/resources/conf/companyOverrideAnnotatedAllRelationshipsFCPM.conf @@ -17,6 +17,6 @@ jdo.tck.description = Completeness test with mapping 11 overriding annotations, and embedded objects, annotations. jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.companyAnnotatedFC.CompanyFactoryAnnotatedFCPMDelegator jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyAllRelationships.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsAllData jdo.tck.mapping = 11 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyPMClass.conf b/tck/src/main/resources/conf/companyPMClass.conf index 79480643a..f68662234 100644 --- a/tck/src/main/resources/conf/companyPMClass.conf +++ b/tck/src/main/resources/conf/companyPMClass.conf @@ -17,6 +17,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata wi and embedded objects. jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.company.CompanyFactoryPMClass jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyAllRelationships.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsAllData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyPMInterface.conf b/tck/src/main/resources/conf/companyPMInterface.conf index 54dead410..949c2285a 100644 --- a/tck/src/main/resources/conf/companyPMInterface.conf +++ b/tck/src/main/resources/conf/companyPMInterface.conf @@ -17,6 +17,6 @@ jdo.tck.description = Completeness test with standard mapping, basic testdata wi and embedded objects. jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.company.CompanyFactoryPMInterface jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyAllRelationships.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsAllData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/compoundIdentity.conf b/tck/src/main/resources/conf/compoundIdentity.conf index 8ac42ca8a..6aabd0e45 100644 --- a/tck/src/main/resources/conf/compoundIdentity.conf +++ b/tck/src/main/resources/conf/compoundIdentity.conf @@ -16,6 +16,6 @@ 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.testdata = org.apache.jdo.tck.pc.order.OrderModelReaderTestData jdo.tck.mapping = 0 jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/inheritance1.conf b/tck/src/main/resources/conf/inheritance1.conf index 8e89157b2..b228554a8 100644 --- a/tck/src/main/resources/conf/inheritance1.conf +++ b/tck/src/main/resources/conf/inheritance1.conf @@ -19,6 +19,6 @@ Each table contains columns for the declared fields. \ Inheritance strategy: new-table for all classes. jdo.tck.mapping.companyfactory = jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyAllRelationships.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsAllData jdo.tck.mapping = 1 jdo.tck.requiredOptions = javax.jdo.option.mapping.JoinedTablePerClass diff --git a/tck/src/main/resources/conf/inheritance2.conf b/tck/src/main/resources/conf/inheritance2.conf index 9adef2a5b..f83a94f95 100644 --- a/tck/src/main/resources/conf/inheritance2.conf +++ b/tck/src/main/resources/conf/inheritance2.conf @@ -26,7 +26,7 @@ and parttime employees. \ Inheritance strategy: new-table for all classes. jdo.tck.mapping.companyfactory = jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyAllRelationships.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsAllData jdo.tck.mapping = 2 jdo.tck.requiredOptions = javax.jdo.option.mapping.NonJoinedTablePerConcreteClass \ javax.jdo.option.mapping.RelationSubclassTable diff --git a/tck/src/main/resources/conf/inheritance3.conf b/tck/src/main/resources/conf/inheritance3.conf index 3a0e8a088..514daa890 100644 --- a/tck/src/main/resources/conf/inheritance3.conf +++ b/tck/src/main/resources/conf/inheritance3.conf @@ -21,7 +21,7 @@ Insurance has inheritance strategy "subclass-table". \ MedicalInsurance and DentalInsurance have inheritance strategy "new-table". jdo.tck.mapping.companyfactory = jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyAllRelationships.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsAllData jdo.tck.mapping = 3 jdo.tck.requiredOptions = javax.jdo.option.mapping.JoinedTablePerConcreteClass \ javax.jdo.option.mapping.RelationSubclassTable diff --git a/tck/src/main/resources/conf/inheritance4.conf b/tck/src/main/resources/conf/inheritance4.conf index 5a69ffd87..72cf837d9 100644 --- a/tck/src/main/resources/conf/inheritance4.conf +++ b/tck/src/main/resources/conf/inheritance4.conf @@ -19,6 +19,6 @@ PartTimeEmployee, FullTimeEmployee, MedicalInsurance, and DentalInsurance \ have inheritance strategy "superclass-table". jdo.tck.mapping.companyfactory = jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTest -jdo.tck.testdata = org/apache/jdo/tck/pc/company/companyAllRelationships.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.company.data.RelationshipsAllData jdo.tck.mapping = 4 jdo.tck.requiredOptions = From ed6e2a19fc090bb60768d50ec3cd243ec89edcec Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 26 Oct 2025 14:49:23 +0100 Subject: [PATCH 29/43] Prepare removal of XML files --- README.md | 2 +- .../src/main/java/org/apache/jdo/exectck/Enhance.java | 9 +-------- tck/RunRules.md | 4 ---- tck/pom.xml | 3 --- 4 files changed, 2 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index bbe2e57ad..d7b4fa281 100644 --- a/README.md +++ b/README.md @@ -158,7 +158,7 @@ While running the TCK, maven uses the following configuration files in src/conf: * test configuration files (*.conf). Each of these files sets values for * jdo.tck.testdescription : An optional string describing the purpose of these tests * jdo.tck.classes : A list of one or more test classes (required) - * jdo.tck.testdata : The fully qualified file name of the xml test data file(optional) + * jdo.tck.testdata : The fully qualified file name of the class that creates test data file(optional) * jdo.tck.mapping : The file designator that maven.xml uses to build a javax.jdo.option.Mapping value and corresponding schema name (required) * exclude.list : A list of test classes NOT to execute during a TCK test run diff --git a/exectck/src/main/java/org/apache/jdo/exectck/Enhance.java b/exectck/src/main/java/org/apache/jdo/exectck/Enhance.java index c7a6bbd73..e5611a6eb 100644 --- a/exectck/src/main/java/org/apache/jdo/exectck/Enhance.java +++ b/exectck/src/main/java/org/apache/jdo/exectck/Enhance.java @@ -137,7 +137,7 @@ public void execute() throws MojoExecutionException, MojoFailureException { } String[] metadataExtensions = {"jdo", "jdoquery", "orm", "xml", "properties"}; - String[] srcDirs = {"jdo", "orm", "testdata"}; + String[] srcDirs = {"jdo", "orm"}; String classesDirName = buildDirectory + File.separator + "classes" + File.separator; // Copy metadata from src to enhanced @@ -209,13 +209,6 @@ private void copyMetadata( File toFile = new File(enhancedDirName + File.separator + pkgName); toFileName = toFile.toString(); FileUtils.copyFile(fromFile, toFile); - } else if (srcDir.equals("testdata")) { - startIdx = fromFileName.indexOf("org" + File.separator); - String pkgName = fromFileName.substring(startIdx); - File toFile = - new File(enhancedDirName + File.separator + idType + File.separator + pkgName); - toFileName = toFile.toString(); - FileUtils.copyFile(fromFile, toFile); } else { // idType not in pathname, do not copy } diff --git a/tck/RunRules.md b/tck/RunRules.md index 46ae879a7..72fd85f41 100644 --- a/tck/RunRules.md +++ b/tck/RunRules.md @@ -91,10 +91,6 @@ files: - `src` - this directory contains the test configuration files and directories: - - `testdata` - this directory contains data (represented as .xml - files) loaded into the datastore for tests. These files must - not be modified. - - `sql` - this directory contains DDL to define the tables used in the tests. The files distributed must not be modified. Files may be created for databases for which the DDL for the diff --git a/tck/pom.xml b/tck/pom.xml index eb8d53f95..0575bdd50 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -92,9 +92,6 @@ ${basedir}/src/main/resources/sql - - ${basedir}/src/main/resources/testdata - ${basedir}/src/main/resources/meta From 84b603062367fe34f592afecb62f6d86aef61399 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 26 Oct 2025 15:51:47 +0100 Subject: [PATCH 30/43] Prepare removal of XML files --- .../apache/jdo/tck/AbstractReaderTest.java | 1 - .../tck/pc/company/CompanyModelReader.java | 149 +----------------- .../tck/pc/company/data/EmbeddedTestData.java | 7 +- .../pc/company/data/NavigationTestData.java | 7 +- .../tck/pc/company/data/QueryTestData.java | 7 +- .../pc/company/data/Relationships1_1Data.java | 7 +- .../pc/company/data/Relationships1_MData.java | 7 +- .../pc/company/data/RelationshipsAllData.java | 7 +- .../pc/company/data/RelationshipsM_MData.java | 7 +- .../pc/company/data/RelationshipsNoData.java | 7 +- .../pc/company/data/SampleQueryTestData.java | 7 +- .../tck/pc/company/data/SubqueryTestData.java | 7 +- .../apache/jdo/tck/pc/mylib/MylibReader.java | 2 +- .../jdo/tck/pc/mylib/MylibReaderTestData.java | 6 +- .../jdo/tck/pc/order/OrderModelReader.java | 14 +- .../pc/order/OrderModelReaderTestData.java | 16 +- .../org/apache/jdo/tck/query/QueryTest.java | 4 +- .../tck/query/api/SampleModifyQueries.java | 2 +- .../jdo/tck/query/api/SampleReadQueries.java | 2 +- .../jdoql/NavigationComparisonWithNull.java | 2 +- .../NavigationThroughACollectionField.java | 2 +- .../NavigationThroughANullValuedField.java | 2 +- ...ationThroughReferencesUsesDotOperator.java | 2 +- .../jdoql/subqueries/SubqueriesTest.java | 2 +- .../jdoql/variables/StringVariables.java | 2 +- .../org/apache/jdo/tck/util/DataSource.java | 2 +- .../util/DefaultListableInstanceFactory.java | 20 +-- 27 files changed, 41 insertions(+), 259 deletions(-) diff --git a/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java b/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java index 0bc38244e..0dee9bf8c 100644 --- a/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java +++ b/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java @@ -84,7 +84,6 @@ private static T doPrivileged(PrivilegedAction privilegedAction) { if (e.getCause() instanceof RuntimeException) { throw (RuntimeException) e.getCause(); } - e.printStackTrace(); throw new JDOFatalInternalException(e.getMessage()); } } diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java index 6790151b9..2f002d9d3 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java @@ -17,13 +17,8 @@ package org.apache.jdo.tck.pc.company; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; import java.util.*; -import org.apache.jdo.tck.pc.company.data.*; -import org.apache.jdo.tck.pc.mylib.MylibReaderTestData; import org.apache.jdo.tck.util.ConversionHelper; -import org.apache.jdo.tck.util.DataSource; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; import org.apache.jdo.tck.util.JDOCustomDateEditor; @@ -34,34 +29,8 @@ */ public class CompanyModelReader extends DefaultListableInstanceFactory { - private static final long serialVersionUID = 1L; - - public static final String QUERY_TEST = "org/apache/jdo/tck/pc/company/companyForQueryTests.xml"; - public static final String MYLIB_TEST = "org/apache/jdo/tck/pc/mylib/mylibForQueryTests.xml"; - public static final String SAMPLE_QUERIES_TEST = - "org/apache/jdo/tck/pc/company/companyForSampleQueriesTest.xml"; - public static final String JDOQL_NAVIGATION_TESTS = - "org/apache/jdo/tck/pc/company/companyForNavigationTests.xml"; - public static final String JDOQL_SUBQUERIES_TESTS = - "org/apache/jdo/tck/pc/company/companyForSubqueriesTests.xml"; - - public static final String RELATIONSHIPS_ALL = - "org/apache/jdo/tck/pc/company/companyAllRelationships.xml"; - public static final String RELATIONSHIPS_1_1 = - "org/apache/jdo/tck/pc/company/company1-1Relationships.xml"; - public static final String RELATIONSHIPS_1_M = - "org/apache/jdo/tck/pc/company/company1-MRelationships.xml"; - public static final String EMBEDDED = "org/apache/jdo/tck/pc/company/companyEmbedded.xml"; - public static final String RELATIONSHIPS_M_M = - "org/apache/jdo/tck/pc/company/companyM-MRelationships.xml"; - public static final String RELATIONSHIPS_NO = - "org/apache/jdo/tck/pc/company/companyNoRelationships.xml"; - /** The company factory instance. */ - private CompanyFactory companyFactory; - - /** Bean definition reader */ - private final CompanyModelReaderOld reader; + private final CompanyFactory companyFactory; /** * Create a CompanyModelReader for the specified resourceName. @@ -69,128 +38,14 @@ public class CompanyModelReader extends DefaultListableInstanceFactory { * @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()); - } - - public CompanyModelReader(DataSource resource) { - super(); - reader = null; - this.reset(); - configureFactory(); - resource.initMe(companyFactory, this); - } - - @SuppressWarnings("unchecked") - public CompanyModelReader(String resourceName, int dummy) { - super(); - this.reset(); - configureFactory(); - reader = null; - getDataSource(resourceName).initMe(companyFactory, this); - } - - /** - * Create a CompanyModelReader for the specified resourceName. - * - * @param resourceName the name of the resource - * @param classLoader the ClassLoader for the lookup - */ - public CompanyModelReader(String resourceName, ClassLoader classLoader) { - super(); - this.reset(); - configureFactory(); - reader = null; - - if (!resourceName.endsWith(".xml")) { - getDataSource(resourceName).initMe(companyFactory, this); - return; - } - - switch (resourceName) { - case RELATIONSHIPS_ALL: - RelationshipsAllData.init(companyFactory, this); - break; - case RELATIONSHIPS_1_1: - Relationships1_1Data.init(companyFactory, this); - break; - case RELATIONSHIPS_1_M: - Relationships1_MData.init(companyFactory, this); - break; - case RELATIONSHIPS_M_M: - RelationshipsM_MData.init(companyFactory, this); - break; - case RELATIONSHIPS_NO: - RelationshipsNoData.init(companyFactory, this); - break; - case EMBEDDED: - EmbeddedTestData.init(companyFactory, this); - break; - case JDOQL_NAVIGATION_TESTS: - NavigationTestData.init(companyFactory, this); - break; - case JDOQL_SUBQUERIES_TESTS: - SubqueryTestData.init(companyFactory, this); - break; - case QUERY_TEST: - QueryTestData.init(companyFactory, this); - break; - case SAMPLE_QUERIES_TEST: - SampleQueryTestData.init(companyFactory, this); - break; - case MYLIB_TEST: - // TODO use companyModelFactory! - new MylibReaderTestData().initMe(this, this); - break; - default: - // this.reader = null; - System.err.println("ERROR: Not registered: " + resourceName); - // throw new IllegalArgumentException("Not registered: " + resourceName); - } - } - - public T getBean(String name, Class clazz) { - if (reader != null) { - return reader.getBean(name, clazz); - } - return super.getBean(name, clazz); - } - - /** - * 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() { - if (reader != null) { - return reader.getRootList(); - } - return super.getRootList(); - } - - /** - * 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() { - // registerCustomEditor(Date.class, JDOCustomDateEditor.class); companyFactory = CompanyFactoryRegistry.getInstance(); - // addSingleton(BEAN_FACTORY_NAME, companyFactory); + getDataSource(resourceName).init(companyFactory, this); } /** * @return Returns the tearDownClasses. */ public Class[] getTearDownClassesFromFactory() { - if (reader != null) { - return reader.getTearDownClassesFromFactory(); - } - - for (Class c : companyFactory.getTearDownClasses()) { - System.err.println("TearDownClass: " + c); - } - System.err.println("TearDownClass: " + Arrays.toString(companyFactory.getTearDownClasses())); return companyFactory.getTearDownClasses(); } diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java index 6872d9cf7..0992242e3 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java @@ -26,12 +26,7 @@ public class EmbeddedTestData implements CompanyDataSource { @Override - public void initMe(CompanyFactory factory, DefaultListableInstanceFactory registry) { - init(factory, registry); - } - - public static void init( - CompanyFactory factory, DefaultListableInstanceFactory registry) { + public void init(CompanyFactory factory, DefaultListableInstanceFactory registry) { IAddress addr1 = factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); IAddress addr2 = factory.newAddress(2, "Broadway 1", "New York", "NY", "10000", "USA"); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java index 2788bbf5e..64c4c6d77 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java @@ -26,12 +26,7 @@ public class NavigationTestData implements CompanyDataSource { @Override - public void initMe(CompanyFactory factory, DefaultListableInstanceFactory registry) { - init(factory, registry); - } - - public static void init( - CompanyFactory factory, DefaultListableInstanceFactory registry) { + public void init(CompanyFactory factory, DefaultListableInstanceFactory registry) { IAddress addr1 = factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); IAddress addr2 = factory.newAddress(2, "Broadway 1", "New York", "NY", "10000", "USA"); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java index 00ef4fcd5..29e126df5 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java @@ -27,12 +27,7 @@ public class QueryTestData implements CompanyDataSource { @Override - public void initMe(CompanyFactory factory, DefaultListableInstanceFactory registry) { - init(factory, registry); - } - - public static void init( - CompanyFactory factory, DefaultListableInstanceFactory registry) { + public void init(CompanyFactory factory, DefaultListableInstanceFactory registry) { IAddress addr1 = factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); IAddress addr2 = factory.newAddress(2, "Broadway 1", "New York", "NY", "10000", "USA"); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java index 016df0d71..970dc4b0e 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java @@ -26,12 +26,7 @@ public class Relationships1_1Data implements CompanyDataSource { @Override - public void initMe(CompanyFactory factory, DefaultListableInstanceFactory registry) { - init(factory, registry); - } - - public static void init( - CompanyFactory factory, DefaultListableInstanceFactory registry) { + public void init(CompanyFactory factory, DefaultListableInstanceFactory registry) { IAddress addr1 = factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); IAddress addr2 = factory.newAddress(2, "Broadway 1", "New York", "NY", "10000", "USA"); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java index 72479b1dd..c0004463d 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java @@ -26,12 +26,7 @@ public class Relationships1_MData implements CompanyDataSource { @Override - public void initMe(CompanyFactory factory, DefaultListableInstanceFactory registry) { - init(factory, registry); - } - - public static void init( - CompanyFactory factory, DefaultListableInstanceFactory registry) { + public void init(CompanyFactory factory, DefaultListableInstanceFactory registry) { IAddress addr1 = factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); IAddress addr2 = factory.newAddress(2, "Broadway 1", "New York", "NY", "10000", "USA"); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java index 26f88c01b..7fa3fe614 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java @@ -26,12 +26,7 @@ public class RelationshipsAllData implements CompanyDataSource { @Override - public void initMe(CompanyFactory factory, DefaultListableInstanceFactory registry) { - init(factory, registry); - } - - public static void init( - CompanyFactory factory, DefaultListableInstanceFactory registry) { + public void init(CompanyFactory factory, DefaultListableInstanceFactory registry) { IAddress addr1 = factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); IAddress addr2 = factory.newAddress(2, "Broadway 1", "New York", "NY", "10000", "USA"); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java index fbb912a2c..26f999bd3 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java @@ -26,12 +26,7 @@ public class RelationshipsM_MData implements CompanyDataSource { @Override - public void initMe(CompanyFactory factory, DefaultListableInstanceFactory registry) { - init(factory, registry); - } - - public static void init( - CompanyFactory factory, DefaultListableInstanceFactory registry) { + public void init(CompanyFactory factory, DefaultListableInstanceFactory registry) { IAddress addr1 = factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); IAddress addr2 = factory.newAddress(2, "Broadway 1", "New York", "NY", "10000", "USA"); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java index b77aa446d..395cb3850 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java @@ -26,12 +26,7 @@ public class RelationshipsNoData implements CompanyDataSource { @Override - public void initMe(CompanyFactory factory, DefaultListableInstanceFactory registry) { - init(factory, registry); - } - - public static void init( - CompanyFactory factory, DefaultListableInstanceFactory registry) { + public void init(CompanyFactory factory, DefaultListableInstanceFactory registry) { IAddress addr1 = factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); IAddress addr2 = factory.newAddress(2, "Broadway 1", "New York", "NY", "10000", "USA"); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java index bd1814cf1..514b385cf 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java @@ -27,12 +27,7 @@ public class SampleQueryTestData implements CompanyDataSource { @Override - public void initMe(CompanyFactory factory, DefaultListableInstanceFactory registry) { - init(factory, registry); - } - - public static void init( - CompanyFactory factory, DefaultListableInstanceFactory registry) { + public void init(CompanyFactory factory, DefaultListableInstanceFactory registry) { IAddress addr1 = factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); IAddress addr2 = factory.newAddress(2, "Broadway 1", "New York", "NY", "10000", "USA"); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java index aed6dd7a5..35b6d352d 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java @@ -25,12 +25,7 @@ public class SubqueryTestData implements CompanyDataSource { @Override - public void initMe(CompanyFactory factory, DefaultListableInstanceFactory registry) { - init(factory, registry); - } - - public static void init( - CompanyFactory factory, DefaultListableInstanceFactory registry) { + public void init(CompanyFactory factory, DefaultListableInstanceFactory registry) { IAddress addr1 = factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); IAddress addr2 = factory.newAddress(2, "Broadway 1", "New York", "NY", "10000", "USA"); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java index 487a9bedb..4afbe2edb 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java @@ -33,7 +33,7 @@ public class MylibReader extends DefaultListableInstanceFactory { */ public MylibReader(String resourceName) { super(); - new MylibReaderTestData().initMe(this, this); + new MylibReaderTestData().init(this, this); } // Convenience methods diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReaderTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReaderTestData.java index 987c5176b..ffb39a0b3 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReaderTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReaderTestData.java @@ -24,11 +24,7 @@ public class MylibReaderTestData implements DataSource { @Override - public void initMe(DefaultListableInstanceFactory factory, DefaultListableInstanceFactory registry) { - init(registry); - } - - public static void init(DefaultListableInstanceFactory registry) { + public void init(DefaultListableInstanceFactory factory, DefaultListableInstanceFactory registry) { PrimitiveTypes primitiveTypesPositive = new PrimitiveTypes( 1L, diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java index 0f0f60eac..fb4a834bf 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java @@ -26,8 +26,6 @@ /** Utility class to create a graph of order model instances from an xml representation. */ public class OrderModelReader extends DefaultListableInstanceFactory { - private static final long serialVersionUID = 1L; - /** The order factory instance. */ private OrderFactory orderFactory; @@ -38,18 +36,8 @@ public class OrderModelReader extends DefaultListableInstanceFactory { */ public OrderModelReader(String resourceName) { super(); - configureFactory(); - getDataSource(resourceName).initMe(orderFactory, this); - } - - /** - * 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() { - // registerCustomEditor(Date.class, JDOCustomDateEditor.class); orderFactory = OrderFactoryRegistry.getInstance(); - // addSingleton(BEAN_FACTORY_NAME, orderFactory); + getDataSource(resourceName).init(orderFactory, this); } // Convenience methods diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReaderTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReaderTestData.java index 2047c60f0..34789b06b 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReaderTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReaderTestData.java @@ -17,25 +17,17 @@ package org.apache.jdo.tck.pc.order; -import java.util.Date; -import java.util.Locale; -import org.apache.jdo.tck.util.ConversionHelper; import org.apache.jdo.tck.util.DataSource; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; -import org.apache.jdo.tck.util.JDOCustomDateEditor; /** Utility class to create a graph of order model instances from an xml representation. */ public class OrderModelReaderTestData implements DataSource { @Override - public void initMe(OrderFactory factory, DefaultListableInstanceFactory registry) { - init(factory, registry); - } - - private void init(OrderFactory orderFactory, DefaultListableInstanceFactory registry) { - Order order1 = orderFactory.newOrder(1, 3); - OrderItem item1 = orderFactory.newOrderItem(order1, 1, "SunRay", 15); - OrderItem item2 = orderFactory.newOrderItem(order1, 1, "Sun Ultra 40", 3); + public void init(OrderFactory factory, DefaultListableInstanceFactory registry) { + Order order1 = factory.newOrder(1, 3); + OrderItem item1 = factory.newOrderItem(order1, 1, "SunRay", 15); + OrderItem item2 = factory.newOrderItem(order1, 1, "Sun Ultra 40", 3); order1.addItem(item1); order1.addItem(item2); registry.register("order1", order1); diff --git a/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java b/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java index a4ab73f57..22c7f0d74 100644 --- a/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java +++ b/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java @@ -51,10 +51,10 @@ public abstract class QueryTest extends AbstractReaderTest { /** */ public static final String COMPANY_TESTDATA = - "org/apache/jdo/tck/pc/company/companyForQueryTests.xml"; + "org.apache.jdo.tck.pc.company.data.QueryTestData"; /** */ - public static final String MYLIB_TESTDATA = "org/apache/jdo/tck/pc/mylib/mylibForQueryTests.xml"; + public static final String MYLIB_TESTDATA = "org.apache.jdo.tck.pc.mylib.MylibReaderTestData"; /** List of inserted instances (see methods insertPCPoints and getFromInserted). */ protected final List persistentPCPoints = new ArrayList<>(); diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/SampleModifyQueries.java b/tck/src/main/java/org/apache/jdo/tck/query/api/SampleModifyQueries.java index 851018c5b..c6b2da3ad 100644 --- a/tck/src/main/java/org/apache/jdo/tck/query/api/SampleModifyQueries.java +++ b/tck/src/main/java/org/apache/jdo/tck/query/api/SampleModifyQueries.java @@ -54,7 +54,7 @@ public class SampleModifyQueries extends QueryTest { /** */ private static final String SAMPLE_QUERIES_TEST_COMPANY_TESTDATA = - "org/apache/jdo/tck/pc/company/companyForSampleQueriesTest.xml"; + "org.apache.jdo.tck.pc.company.data.SampleQueryTestData"; /** * Deleting Multiple Instances. diff --git a/tck/src/main/java/org/apache/jdo/tck/query/api/SampleReadQueries.java b/tck/src/main/java/org/apache/jdo/tck/query/api/SampleReadQueries.java index a533a415c..5199961b0 100644 --- a/tck/src/main/java/org/apache/jdo/tck/query/api/SampleReadQueries.java +++ b/tck/src/main/java/org/apache/jdo/tck/query/api/SampleReadQueries.java @@ -74,7 +74,7 @@ public class SampleReadQueries extends QueryTest { /** */ private static final String SAMPLE_QUERIES_TEST_COMPANY_TESTDATA = - "org/apache/jdo/tck/pc/company/companyForSampleQueriesTest.xml"; + "org.apache.jdo.tck.pc.company.data.SampleQueryTestData"; private static final String SINGLE_STRING_QUERY_01 = "select from org.apache.jdo.tck.pc.company.FullTimeEmployee where salary > 30000"; diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationComparisonWithNull.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationComparisonWithNull.java index 403ca5f62..b992447c1 100644 --- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationComparisonWithNull.java +++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationComparisonWithNull.java @@ -50,7 +50,7 @@ public class NavigationComparisonWithNull extends QueryTest { /** */ public static final String NAVIGATION_TEST_COMPANY_TESTDATA = - "org/apache/jdo/tck/pc/company/companyForNavigationTests.xml"; + "org.apache.jdo.tck.pc.company.data.NavigationTestData"; /** * Returns the name of the company test data resource. diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughACollectionField.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughACollectionField.java index aadee8126..0e67fc8dd 100644 --- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughACollectionField.java +++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughACollectionField.java @@ -43,7 +43,7 @@ public class NavigationThroughACollectionField extends QueryTest { /** */ public static final String NAVIGATION_TEST_COMPANY_TESTDATA = - "org/apache/jdo/tck/pc/company/companyForNavigationTests.xml"; + "org.apache.jdo.tck.pc.company.data.NavigationTestData"; /** * Returns the name of the company test data resource. diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughANullValuedField.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughANullValuedField.java index e595a0462..8f0bd8910 100644 --- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughANullValuedField.java +++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughANullValuedField.java @@ -52,7 +52,7 @@ public class NavigationThroughANullValuedField extends QueryTest { /** */ public static final String NAVIGATION_TEST_COMPANY_TESTDATA = - "org/apache/jdo/tck/pc/company/companyForNavigationTests.xml"; + "org.apache.jdo.tck.pc.company.data.NavigationTestData"; /** * Returns the name of the company test data resource. diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughReferencesUsesDotOperator.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughReferencesUsesDotOperator.java index 98755d04e..85b8d8374 100644 --- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughReferencesUsesDotOperator.java +++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/NavigationThroughReferencesUsesDotOperator.java @@ -50,7 +50,7 @@ public class NavigationThroughReferencesUsesDotOperator extends QueryTest { /** */ public static final String NAVIGATION_TEST_COMPANY_TESTDATA = - "org/apache/jdo/tck/pc/company/companyForNavigationTests.xml"; + "org.apache.jdo.tck.pc.company.data.NavigationTestData"; /** * Returns the name of the company test data resource. diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/subqueries/SubqueriesTest.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/subqueries/SubqueriesTest.java index fd4cf55a7..0a219a345 100644 --- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/subqueries/SubqueriesTest.java +++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/subqueries/SubqueriesTest.java @@ -28,7 +28,7 @@ public abstract class SubqueriesTest extends QueryTest { /** */ public static final String SUBQUERIES_TEST_COMPANY_TESTDATA = - "org/apache/jdo/tck/pc/company/companyForSubqueriesTests.xml"; + "org.apache.jdo.tck.pc.company.data.SubqueryTestData"; /** * Returns the name of the company test data resource. diff --git a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/variables/StringVariables.java b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/variables/StringVariables.java index be48e185e..0f67a28e6 100644 --- a/tck/src/main/java/org/apache/jdo/tck/query/jdoql/variables/StringVariables.java +++ b/tck/src/main/java/org/apache/jdo/tck/query/jdoql/variables/StringVariables.java @@ -49,7 +49,7 @@ public class StringVariables extends QueryTest { /** */ private static final String SAMPLE_QUERIES_TEST_COMPANY_TESTDATA = - "org/apache/jdo/tck/pc/company/companyForSampleQueriesTest.xml"; + "org.apache.jdo.tck.pc.company.data.SampleQueryTestData"; private static final String COLLECTION_STRING_VARIABLE_SSQ = "select from org.apache.jdo.tck.pc.company.FullTimeEmployee " diff --git a/tck/src/main/java/org/apache/jdo/tck/util/DataSource.java b/tck/src/main/java/org/apache/jdo/tck/util/DataSource.java index 00ca04041..2ef866d79 100644 --- a/tck/src/main/java/org/apache/jdo/tck/util/DataSource.java +++ b/tck/src/main/java/org/apache/jdo/tck/util/DataSource.java @@ -18,5 +18,5 @@ package org.apache.jdo.tck.util; public interface DataSource { - void initMe(F factory, DefaultListableInstanceFactory registry); + void init(F factory, DefaultListableInstanceFactory registry); } diff --git a/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java b/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java index 8971201ce..9f370fa33 100644 --- a/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java +++ b/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java @@ -9,14 +9,14 @@ public class DefaultListableInstanceFactory { private final HashMap rootMap = new HashMap<>(); private final List rootList = new ArrayList<>(); - public synchronized Object getBean(String name) { + public final synchronized Object getBean(String name) { if ("root".equals(name)) { return getRootList(); } return rootMap.get(name); } - public synchronized T getBean(String name, Class clazz) { + public final synchronized T getBean(String name, Class clazz) { return clazz.cast(getBean(name)); } @@ -25,15 +25,16 @@ public synchronized void register(String name, Object obj) { rootList.add(obj); } - public synchronized List getRootList() { + /** + * 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 final synchronized List getRootList() { return Collections.unmodifiableList(rootList); } - public synchronized void reset() { - rootMap.clear(); - rootList.clear(); - } - @SuppressWarnings("unchecked") public static DataSource getDataSource(String resourceName) { System.err.println("Instantiating data class: " + resourceName); @@ -45,7 +46,8 @@ public static DataSource getDataSource(String resourceName) { | InvocationTargetException | NoSuchMethodException | InstantiationException - | IllegalAccessException e) { + | IllegalAccessException + | NullPointerException e) { throw new IllegalArgumentException("Error executing test data class: " + resourceName, e); } } From 52d39bd17b880ed9cbf68ff5c694573c33595c36 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 26 Oct 2025 15:53:44 +0100 Subject: [PATCH 31/43] Prepare removal of XML files --- .../tck/pc/company/data/EmbeddedTestData.java | 1 - .../pc/company/data/NavigationTestData.java | 32 +++++++++---------- .../tck/pc/company/data/QueryTestData.java | 5 ++- .../pc/company/data/Relationships1_1Data.java | 8 ++--- .../pc/company/data/Relationships1_MData.java | 8 ++--- .../pc/company/data/RelationshipsAllData.java | 8 ++--- .../pc/company/data/RelationshipsM_MData.java | 8 ++--- .../pc/company/data/RelationshipsNoData.java | 8 ++--- .../pc/company/data/SampleQueryTestData.java | 32 ++++++++----------- .../tck/pc/company/data/SubqueryTestData.java | 28 ++++++++-------- .../jdo/tck/pc/mylib/MylibReaderTestData.java | 6 ++-- .../org/apache/jdo/tck/query/QueryTest.java | 3 +- 12 files changed, 70 insertions(+), 77 deletions(-) diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java index 0992242e3..6ef420b3b 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java @@ -118,5 +118,4 @@ public void init(CompanyFactory factory, DefaultListableInstanceFactory registry registry.register("proj2", proj2); registry.register("proj3", proj3); } - } diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java index 64c4c6d77..d44349f9e 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java @@ -71,13 +71,13 @@ public void init(CompanyFactory factory, DefaultListableInstanceFactory registry // Employee Constructors IFullTimeEmployee emp0 = - factory.newFullTimeEmployee( - 0, "emp0First", "emp0Last", "emp0Middle", null, addr1, null, 50000); + factory.newFullTimeEmployee( + 0, "emp0First", "emp0Last", "emp0Middle", null, addr1, null, 50000); emp0.setBirthdate(date(1962, 7, 10)); emp0.setHiredate(date(1997, 1, 1)); IFullTimeEmployee emp1 = - factory.newFullTimeEmployee( - 1, "emp1First", "emp1Last", "emp1Middle", null, addr1, null, 20000); + factory.newFullTimeEmployee( + 1, "emp1First", "emp1Last", "emp1Middle", null, addr1, null, 20000); emp1.setBirthdate(date(1970, 6, 10)); emp1.setHiredate(date(1999, 1, 1)); IFullTimeEmployee emp2 = @@ -96,33 +96,33 @@ public void init(CompanyFactory factory, DefaultListableInstanceFactory registry emp4.setBirthdate(date(1973, 7, 6)); emp4.setHiredate(date(2001, 4, 15)); IFullTimeEmployee emp5 = - factory.newFullTimeEmployee( - 5, "emp5First", "emp5Last", "emp5Middle", null, addr3, null, 18000); + factory.newFullTimeEmployee( + 5, "emp5First", "emp5Last", "emp5Middle", null, addr3, null, 18000); emp5.setBirthdate(date(1962, 7, 5)); emp5.setHiredate(date(2002, 11, 1)); IFullTimeEmployee emp6 = - factory.newFullTimeEmployee( - 6, "emp6First", "emp6Last", "emp6Middle", null, addr3, null, 22000); + factory.newFullTimeEmployee( + 6, "emp6First", "emp6Last", "emp6Middle", null, addr3, null, 22000); emp6.setBirthdate(date(1969, 6, 10)); emp6.setHiredate(date(2002, 6, 1)); IFullTimeEmployee emp7 = - factory.newFullTimeEmployee( - 7, "emp7First", "emp7Last", "emp7Middle", null, addr1, null, 40000); + factory.newFullTimeEmployee( + 7, "emp7First", "emp7Last", "emp7Middle", null, addr1, null, 40000); emp7.setBirthdate(date(1970, 6, 10)); emp7.setHiredate(date(2000, 1, 1)); IFullTimeEmployee emp8 = - factory.newFullTimeEmployee( - 8, "emp8First", "emp8Last", "emp8Middle", null, addr2, null, 10000); + factory.newFullTimeEmployee( + 8, "emp8First", "emp8Last", "emp8Middle", null, addr2, null, 10000); emp8.setBirthdate(date(1975, 12, 22)); emp8.setHiredate(date(2003, 8, 1)); IFullTimeEmployee emp9 = - factory.newFullTimeEmployee( - 9, "emp9First", "emp9Last", "emp9Middle", null, addr3, null, 12000); + factory.newFullTimeEmployee( + 9, "emp9First", "emp9Last", "emp9Middle", null, addr3, null, 12000); emp9.setBirthdate(date(1972, 7, 5)); emp9.setHiredate(date(2002, 5, 1)); IFullTimeEmployee emp10 = - factory.newFullTimeEmployee( - 10, "emp10First", "emp10Last", "emp10Middle", null, addr3, null, 24000); + factory.newFullTimeEmployee( + 10, "emp10First", "emp10Last", "emp10Middle", null, addr3, null, 24000); emp10.setBirthdate(date(1972, 7, 5)); emp10.setHiredate(date(2002, 10, 1)); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java index 29e126df5..0bcb988c5 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java @@ -17,13 +17,12 @@ package org.apache.jdo.tck.pc.company.data; -import java.math.BigDecimal; +import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; +import java.math.BigDecimal; import org.apache.jdo.tck.pc.company.*; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; -import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; - public class QueryTestData implements CompanyDataSource { @Override diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java index 970dc4b0e..33209a16b 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java @@ -41,13 +41,13 @@ public void init(CompanyFactory factory, DefaultListableInstanceFactory registry IDentalInsurance dentalIns1 = factory.newDentalInsurance(11, "Carrier1", BigDecimal.valueOf(99.999)); IDentalInsurance dentalIns2 = - factory.newDentalInsurance(12, "Carrier2", BigDecimal.valueOf(99.999)); + factory.newDentalInsurance(12, "Carrier2", BigDecimal.valueOf(99.999)); IDentalInsurance dentalIns3 = - factory.newDentalInsurance(13, "Carrier3", BigDecimal.valueOf(99.999)); + factory.newDentalInsurance(13, "Carrier3", BigDecimal.valueOf(99.999)); IDentalInsurance dentalIns4 = - factory.newDentalInsurance(14, "Carrier4", BigDecimal.valueOf(99.999)); + factory.newDentalInsurance(14, "Carrier4", BigDecimal.valueOf(99.999)); IDentalInsurance dentalIns5 = - factory.newDentalInsurance(15, "Carrier5", BigDecimal.valueOf(99.999)); + factory.newDentalInsurance(15, "Carrier5", BigDecimal.valueOf(99.999)); // Project constructors IProject proj1 = factory.newProject(1, "orange", BigDecimal.valueOf(2500000.99)); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java index c0004463d..bb55a30e7 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java @@ -41,13 +41,13 @@ public void init(CompanyFactory factory, DefaultListableInstanceFactory registry IDentalInsurance dentalIns1 = factory.newDentalInsurance(11, "Carrier1", BigDecimal.valueOf(99.999)); IDentalInsurance dentalIns2 = - factory.newDentalInsurance(12, "Carrier2", BigDecimal.valueOf(99.999)); + factory.newDentalInsurance(12, "Carrier2", BigDecimal.valueOf(99.999)); IDentalInsurance dentalIns3 = - factory.newDentalInsurance(13, "Carrier3", BigDecimal.valueOf(99.999)); + factory.newDentalInsurance(13, "Carrier3", BigDecimal.valueOf(99.999)); IDentalInsurance dentalIns4 = - factory.newDentalInsurance(14, "Carrier4", BigDecimal.valueOf(99.999)); + factory.newDentalInsurance(14, "Carrier4", BigDecimal.valueOf(99.999)); IDentalInsurance dentalIns5 = - factory.newDentalInsurance(15, "Carrier5", BigDecimal.valueOf(99.999)); + factory.newDentalInsurance(15, "Carrier5", BigDecimal.valueOf(99.999)); // Project constructors IProject proj1 = factory.newProject(1, "orange", BigDecimal.valueOf(2500000.99)); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java index 7fa3fe614..7f4fd42fd 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java @@ -41,13 +41,13 @@ public void init(CompanyFactory factory, DefaultListableInstanceFactory registry IDentalInsurance dentalIns1 = factory.newDentalInsurance(11, "Carrier1", BigDecimal.valueOf(99.999)); IDentalInsurance dentalIns2 = - factory.newDentalInsurance(12, "Carrier2", BigDecimal.valueOf(99.999)); + factory.newDentalInsurance(12, "Carrier2", BigDecimal.valueOf(99.999)); IDentalInsurance dentalIns3 = - factory.newDentalInsurance(13, "Carrier3", BigDecimal.valueOf(99.999)); + factory.newDentalInsurance(13, "Carrier3", BigDecimal.valueOf(99.999)); IDentalInsurance dentalIns4 = - factory.newDentalInsurance(14, "Carrier4", BigDecimal.valueOf(99.999)); + factory.newDentalInsurance(14, "Carrier4", BigDecimal.valueOf(99.999)); IDentalInsurance dentalIns5 = - factory.newDentalInsurance(15, "Carrier5", BigDecimal.valueOf(99.999)); + factory.newDentalInsurance(15, "Carrier5", BigDecimal.valueOf(99.999)); // Project constructors IProject proj1 = factory.newProject(1, "orange", BigDecimal.valueOf(2500000.99)); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java index 26f999bd3..5b75b693e 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java @@ -41,13 +41,13 @@ public void init(CompanyFactory factory, DefaultListableInstanceFactory registry IDentalInsurance dentalIns1 = factory.newDentalInsurance(11, "Carrier1", BigDecimal.valueOf(99.999)); IDentalInsurance dentalIns2 = - factory.newDentalInsurance(12, "Carrier2", BigDecimal.valueOf(99.999)); + factory.newDentalInsurance(12, "Carrier2", BigDecimal.valueOf(99.999)); IDentalInsurance dentalIns3 = - factory.newDentalInsurance(13, "Carrier3", BigDecimal.valueOf(99.999)); + factory.newDentalInsurance(13, "Carrier3", BigDecimal.valueOf(99.999)); IDentalInsurance dentalIns4 = - factory.newDentalInsurance(14, "Carrier4", BigDecimal.valueOf(99.999)); + factory.newDentalInsurance(14, "Carrier4", BigDecimal.valueOf(99.999)); IDentalInsurance dentalIns5 = - factory.newDentalInsurance(15, "Carrier5", BigDecimal.valueOf(99.999)); + factory.newDentalInsurance(15, "Carrier5", BigDecimal.valueOf(99.999)); // Project constructors IProject proj1 = factory.newProject(1, "orange", BigDecimal.valueOf(2500000.99)); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java index 395cb3850..85a65e4d6 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java @@ -41,13 +41,13 @@ public void init(CompanyFactory factory, DefaultListableInstanceFactory registry IDentalInsurance dentalIns1 = factory.newDentalInsurance(11, "Carrier1", BigDecimal.valueOf(99.999)); IDentalInsurance dentalIns2 = - factory.newDentalInsurance(12, "Carrier2", BigDecimal.valueOf(99.999)); + factory.newDentalInsurance(12, "Carrier2", BigDecimal.valueOf(99.999)); IDentalInsurance dentalIns3 = - factory.newDentalInsurance(13, "Carrier3", BigDecimal.valueOf(99.999)); + factory.newDentalInsurance(13, "Carrier3", BigDecimal.valueOf(99.999)); IDentalInsurance dentalIns4 = - factory.newDentalInsurance(14, "Carrier4", BigDecimal.valueOf(99.999)); + factory.newDentalInsurance(14, "Carrier4", BigDecimal.valueOf(99.999)); IDentalInsurance dentalIns5 = - factory.newDentalInsurance(15, "Carrier5", BigDecimal.valueOf(99.999)); + factory.newDentalInsurance(15, "Carrier5", BigDecimal.valueOf(99.999)); // Project constructors IProject proj1 = factory.newProject(1, "orange", BigDecimal.valueOf(2500000.99)); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java index 514b385cf..b0e335a0f 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java @@ -17,19 +17,18 @@ package org.apache.jdo.tck.pc.company.data; -import java.math.BigDecimal; +import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; +import java.math.BigDecimal; import org.apache.jdo.tck.pc.company.*; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; -import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; - public class SampleQueryTestData implements CompanyDataSource { @Override public void init(CompanyFactory factory, DefaultListableInstanceFactory registry) { IAddress addr1 = - factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); + factory.newAddress(1, "Unter den Linden 1", "Berlin", " ", "12345", "Germany"); IAddress addr2 = factory.newAddress(2, "Broadway 1", "New York", "NY", "10000", "USA"); IAddress addr3 = factory.newAddress(3, "Market St.", "San Francisco", "CA", "94102", "USA"); @@ -40,15 +39,15 @@ public void init(CompanyFactory factory, DefaultListableInstanceFactory registry IMedicalInsurance medicalIns4 = factory.newMedicalInsurance(4, "Carrier4", "HMO"); IMedicalInsurance medicalIns5 = factory.newMedicalInsurance(5, "Carrier5", "HMO"); IDentalInsurance dentalIns1 = - factory.newDentalInsurance(11, "Carrier1", BigDecimal.valueOf(99.995)); + factory.newDentalInsurance(11, "Carrier1", BigDecimal.valueOf(99.995)); IDentalInsurance dentalIns2 = - factory.newDentalInsurance(12, "Carrier2", BigDecimal.valueOf(99.996)); + factory.newDentalInsurance(12, "Carrier2", BigDecimal.valueOf(99.996)); IDentalInsurance dentalIns3 = - factory.newDentalInsurance(13, "Carrier3", BigDecimal.valueOf(99.997)); + factory.newDentalInsurance(13, "Carrier3", BigDecimal.valueOf(99.997)); IDentalInsurance dentalIns4 = - factory.newDentalInsurance(14, "Carrier4", BigDecimal.valueOf(99.998)); + factory.newDentalInsurance(14, "Carrier4", BigDecimal.valueOf(99.998)); IDentalInsurance dentalIns5 = - factory.newDentalInsurance(15, "Carrier5", BigDecimal.valueOf(99.999)); + factory.newDentalInsurance(15, "Carrier5", BigDecimal.valueOf(99.999)); IDentalInsurance dentalIns99 = factory.newDentalInsurance(99, "Carrier99", null); // Project constructors @@ -72,28 +71,23 @@ public void init(CompanyFactory factory, DefaultListableInstanceFactory registry // Employee Constructors IFullTimeEmployee emp1 = - factory.newFullTimeEmployee( - 1, "Michael", "Bouschen", "", null, addr1, null, 40000); + factory.newFullTimeEmployee(1, "Michael", "Bouschen", "", null, addr1, null, 40000); emp1.setBirthdate(date(1970, 6, 10)); emp1.setHiredate(date(1999, 1, 1)); IFullTimeEmployee emp2 = - factory.newFullTimeEmployee( - 2, "Craig", "Russell", "L.", null, addr2, null, 50000); + factory.newFullTimeEmployee(2, "Craig", "Russell", "L.", null, addr2, null, 50000); emp2.setBirthdate(date(1975, 12, 22)); emp2.setHiredate(date(2003, 7, 1)); IPartTimeEmployee emp3 = - factory.newPartTimeEmployee( - 3, "Joe", "Doe", "", null, addr3, null, 15); + factory.newPartTimeEmployee(3, "Joe", "Doe", "", null, addr3, null, 15); emp3.setBirthdate(date(1972, 7, 5)); emp3.setHiredate(date(2002, 8, 15)); IPartTimeEmployee emp4 = - factory.newPartTimeEmployee( - 4, "Jane", "Roe", "", null, addr3, null, 13); + factory.newPartTimeEmployee(4, "Jane", "Roe", "", null, addr3, null, 13); emp4.setBirthdate(date(1973, 7, 6)); emp4.setHiredate(date(2001, 4, 15)); IFullTimeEmployee emp5 = - factory.newFullTimeEmployee( - 5, "Tilmann", "Zäschke", "", null, addr3, null, 45000); + factory.newFullTimeEmployee(5, "Tilmann", "Zäschke", "", null, addr3, null, 45000); emp5.setBirthdate(date(1979, 7, 5)); emp5.setHiredate(date(1999, 8, 15)); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java index 35b6d352d..43dcf3284 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java @@ -46,8 +46,8 @@ public void init(CompanyFactory factory, DefaultListableInstanceFactory registry // Employee Constructors IFullTimeEmployee emp1 = - factory.newFullTimeEmployee( - 1, "emp1First", "emp1Last", "emp1Middle", null, addr1, null, 30000); + factory.newFullTimeEmployee( + 1, "emp1First", "emp1Last", "emp1Middle", null, addr1, null, 30000); emp1.setBirthdate(date(1970, 6, 10)); emp1.setHiredate(date(1999, 1, 1)); IFullTimeEmployee emp2 = @@ -66,33 +66,33 @@ public void init(CompanyFactory factory, DefaultListableInstanceFactory registry emp4.setBirthdate(date(1973, 7, 6)); emp4.setHiredate(date(2001, 4, 15)); IFullTimeEmployee emp5 = - factory.newFullTimeEmployee( - 5, "emp5First", "emp5Last", "emp5Middle", null, addr2, null, 18000); + factory.newFullTimeEmployee( + 5, "emp5First", "emp5Last", "emp5Middle", null, addr2, null, 18000); emp5.setBirthdate(date(1962, 7, 5)); emp5.setHiredate(date(2002, 11, 1)); IFullTimeEmployee emp6 = - factory.newFullTimeEmployee( - 6, "emp6First", "emp6Last", "emp6Middle", null, addr3, null, 22000); + factory.newFullTimeEmployee( + 6, "emp6First", "emp6Last", "emp6Middle", null, addr3, null, 22000); emp6.setBirthdate(date(1969, 6, 10)); emp6.setHiredate(date(2002, 6, 1)); IFullTimeEmployee emp7 = - factory.newFullTimeEmployee( - 7, "emp7First", "emp7Last", "emp7Middle", null, addr1, null, 40000); + factory.newFullTimeEmployee( + 7, "emp7First", "emp7Last", "emp7Middle", null, addr1, null, 40000); emp7.setBirthdate(date(1970, 6, 10)); emp7.setHiredate(date(2000, 1, 1)); IFullTimeEmployee emp8 = - factory.newFullTimeEmployee( - 8, "emp8First", "emp8Last", "emp8Middle", null, addr2, null, 10000); + factory.newFullTimeEmployee( + 8, "emp8First", "emp8Last", "emp8Middle", null, addr2, null, 10000); emp8.setBirthdate(date(1975, 12, 22)); emp8.setHiredate(date(2003, 8, 1)); IFullTimeEmployee emp9 = - factory.newFullTimeEmployee( - 9, "emp9First", "emp9Last", "emp9Middle", null, addr3, null, 12000); + factory.newFullTimeEmployee( + 9, "emp9First", "emp9Last", "emp9Middle", null, addr3, null, 12000); emp9.setBirthdate(date(1972, 7, 5)); emp9.setHiredate(date(2002, 5, 1)); IFullTimeEmployee emp10 = - factory.newFullTimeEmployee( - 10, "emp10First", "emp10Last", "emp10Middle", null, addr3, null, 24000); + factory.newFullTimeEmployee( + 10, "emp10First", "emp10Last", "emp10Middle", null, addr3, null, 24000); emp10.setBirthdate(date(1972, 7, 5)); emp10.setHiredate(date(2002, 10, 1)); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReaderTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReaderTestData.java index ffb39a0b3..48d0e8bef 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReaderTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReaderTestData.java @@ -24,7 +24,8 @@ public class MylibReaderTestData implements DataSource { @Override - public void init(DefaultListableInstanceFactory factory, DefaultListableInstanceFactory registry) { + public void init( + DefaultListableInstanceFactory factory, DefaultListableInstanceFactory registry) { PrimitiveTypes primitiveTypesPositive = new PrimitiveTypes( 1L, @@ -64,6 +65,7 @@ public void init(DefaultListableInstanceFactory factory, DefaultListableInstance registry.register("primitiveTypesNegative", primitiveTypesNegative); registry.register("pcClass1", pcClass1); registry.register("pcClass2", pcClass2); - registry.register("primitiveTypesCharacterStringLiterals", primitiveTypesCharacterStringLiterals); + registry.register( + "primitiveTypesCharacterStringLiterals", primitiveTypesCharacterStringLiterals); } } diff --git a/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java b/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java index 22c7f0d74..88125cd20 100644 --- a/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java +++ b/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java @@ -50,8 +50,7 @@ public abstract class QueryTest extends AbstractReaderTest { public static final String SERIALZED_QUERY = "query.ser"; /** */ - public static final String COMPANY_TESTDATA = - "org.apache.jdo.tck.pc.company.data.QueryTestData"; + public static final String COMPANY_TESTDATA = "org.apache.jdo.tck.pc.company.data.QueryTestData"; /** */ public static final String MYLIB_TESTDATA = "org.apache.jdo.tck.pc.mylib.MylibReaderTestData"; From 3dd8a9cf1a6041acd000f27ab852d2cd88af5c07 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 26 Oct 2025 15:53:56 +0100 Subject: [PATCH 32/43] Prepare removal of XML files --- .../jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java | 4 +--- .../jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java index 9daedef2a..c305feb17 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java @@ -63,9 +63,7 @@ public CompanyModelReader(String resourceName, ClassLoader classLoader) { init(); } - /** - * Company instances for CompletenessTest with Map without join table. - */ + /** Company instances for CompletenessTest with Map without join table. */ private void init() { ICompany company1 = companyFactory.newCompany(1L, "Sun Microsystems, Inc.", new Date(1952, 4, 11, 0, 0, 0)); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java index f7949b4f5..018a4d948 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java @@ -46,9 +46,7 @@ public CompanyModelReader(String resourceName) { init(); } - /** - * Company instances for CompletenessTest with Map without join table. - */ + /** Company instances for CompletenessTest with Map without join table. */ private void init() { ICompany company1 = companyFactory.newCompany(1L, "Sun Microsystems, Inc.", new Date(1952, 4, 11, 0, 0, 0)); From de07a967a6f198c5a4d2c97bd4a1531dcf693163 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 26 Oct 2025 16:30:35 +0100 Subject: [PATCH 33/43] Prepare removal of XML files --- exectck/pom.xml | 4 --- parent-pom/pom.xml | 6 ---- tck/pom.xml | 4 --- .../apache/jdo/tck/AbstractReaderTest.java | 28 ------------------- ...nceManagedByAnotherPersistenceManager.java | 4 +-- .../util/DefaultListableInstanceFactory.java | 1 - .../jdo/tck/util/JDOCustomDateEditor.java | 10 ++----- .../main/resources/conf/iut-log4j.properties | 6 ---- tck/src/main/resources/conf/iut-log4j2.xml | 11 +------- tck/src/main/resources/conf/jdori-log4j2.xml | 11 +------- .../main/resources/conf/logging.properties | 5 ---- tck/src/main/resources/conf/security.policy | 16 ----------- .../main/resources/conf/simplelog.properties | 5 ---- 13 files changed, 7 insertions(+), 104 deletions(-) diff --git a/exectck/pom.xml b/exectck/pom.xml index c59d00b7f..f307799c4 100644 --- a/exectck/pom.xml +++ b/exectck/pom.xml @@ -62,10 +62,6 @@ javax.jdo jdo-api - - org.springframework - spring-beans - org.eclipse.persistence javax.persistence diff --git a/parent-pom/pom.xml b/parent-pom/pom.xml index 3bf3632db..2b1abc492 100644 --- a/parent-pom/pom.xml +++ b/parent-pom/pom.xml @@ -175,7 +175,6 @@ 2.2.1 10.14.2.0 2.20.0 - 5.3.39 1.3.5 5.0.0 2.12.1 @@ -258,11 +257,6 @@ commons-io ${version.commons-io} - - org.springframework - spring-beans - ${version.spring-beans} - commons-logging commons-logging diff --git a/tck/pom.xml b/tck/pom.xml index 0575bdd50..e4627adcc 100644 --- a/tck/pom.xml +++ b/tck/pom.xml @@ -68,10 +68,6 @@ javax.transaction javax.transaction-api - - org.springframework - spring-beans - org.eclipse.persistence javax.persistence diff --git a/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java b/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java index 0dee9bf8c..3f76dea32 100644 --- a/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java +++ b/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java @@ -25,7 +25,6 @@ import javax.jdo.JDOFatalInternalException; import javax.jdo.LegacyJava; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; -import org.springframework.beans.factory.support.DefaultListableBeanFactory; /* * Abstract class for managed relationship tests @@ -44,22 +43,6 @@ public abstract class AbstractReaderTest extends JDO_Test { /** The map of String (bean name) to Object (bean). */ protected final Map oidMap = new HashMap<>(); - /** - * Get the named bean from the bean factory. - * - * @param factory the bean factory - * @param name the name of the bean - * @return the named object - */ - protected Object getBean(final DefaultListableBeanFactory factory, final String name) { - return doPrivileged(() -> factory.getBean(name)); - } - - protected T getBean( - final DefaultListableBeanFactory factory, Class clazz, final String name) { - return doPrivileged(() -> factory.getBean(name, clazz)); - } - /** * Get the named bean from the bean factory. * @@ -88,17 +71,6 @@ private static T doPrivileged(PrivilegedAction privilegedAction) { } } - /** - * Get the root object from the bean factory. - * - * @param factory the bean factory - * @return the List of objects - */ - @SuppressWarnings("unchecked") - protected List getRootList(DefaultListableBeanFactory factory) { - return (List) getBean(factory, ROOT_NAME); - } - /** * Get the root object from the bean factory. * diff --git a/tck/src/main/java/org/apache/jdo/tck/api/persistencemanager/DeletePersistentFailsIfInstanceManagedByAnotherPersistenceManager.java b/tck/src/main/java/org/apache/jdo/tck/api/persistencemanager/DeletePersistentFailsIfInstanceManagedByAnotherPersistenceManager.java index 21ee3ded3..6e59880d4 100644 --- a/tck/src/main/java/org/apache/jdo/tck/api/persistencemanager/DeletePersistentFailsIfInstanceManagedByAnotherPersistenceManager.java +++ b/tck/src/main/java/org/apache/jdo/tck/api/persistencemanager/DeletePersistentFailsIfInstanceManagedByAnotherPersistenceManager.java @@ -92,7 +92,7 @@ private void createObjects(PersistenceManager pm) { pcPointArray = new PCPoint[2]; pcPointArray[0] = p4; - pcPointArray[0] = p5; + pcPointArray[1] = p5; tx.commit(); } finally { if ((tx != null) && tx.isActive()) tx.rollback(); @@ -145,7 +145,7 @@ private void runTestDeletePersistentAll2(PersistenceManager pm) { tx.begin(); try { - pm.deletePersistentAll(pcPointArray); + pm.deletePersistentAll((Object[]) pcPointArray); fail( ASSERTION_FAILED, "pm.deletePersistent(Object[]) with pc instance(s) managed by another pm should throw exception"); diff --git a/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java b/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java index 9f370fa33..4a6bdfe4c 100644 --- a/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java +++ b/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java @@ -37,7 +37,6 @@ public final synchronized List getRootList() { @SuppressWarnings("unchecked") public static DataSource getDataSource(String resourceName) { - System.err.println("Instantiating data class: " + resourceName); try { Class> cls = (Class>) Class.forName(resourceName); Constructor> cstr = cls.getConstructor(); diff --git a/tck/src/main/java/org/apache/jdo/tck/util/JDOCustomDateEditor.java b/tck/src/main/java/org/apache/jdo/tck/util/JDOCustomDateEditor.java index 124d14698..c58ef43b0 100644 --- a/tck/src/main/java/org/apache/jdo/tck/util/JDOCustomDateEditor.java +++ b/tck/src/main/java/org/apache/jdo/tck/util/JDOCustomDateEditor.java @@ -19,20 +19,16 @@ import java.text.SimpleDateFormat; import java.util.Date; -import java.util.Locale; -import org.springframework.beans.propertyeditors.CustomDateEditor; -public class JDOCustomDateEditor extends CustomDateEditor { +public class JDOCustomDateEditor { /** The format of date values in the xml representation */ public static final String DATE_PATTERN = "d/MMM/yyyy"; - public JDOCustomDateEditor() { - super(new SimpleDateFormat(DATE_PATTERN, Locale.US), true); - } + private JDOCustomDateEditor() {} /** - * Redturs a string representation of the specified date using DATE_PATTERN as date formatter + * Returns a string representation of the specified date using DATE_PATTERN as date formatter * pattern. * * @param date the date diff --git a/tck/src/main/resources/conf/iut-log4j.properties b/tck/src/main/resources/conf/iut-log4j.properties index c0a4505f1..83dc64aa9 100644 --- a/tck/src/main/resources/conf/iut-log4j.properties +++ b/tck/src/main/resources/conf/iut-log4j.properties @@ -25,12 +25,6 @@ log4j.rootLogger = ERROR, TCK log4j.logger.org.apache.jdo.tck = INFO, TCK log4j.additivity.org.apache.jdo.tck = false -# SpringFramework loggers -log4j.logger.org.springframework = ERROR, TCK -log4j.additivity.org.springframework = false -log4j.logger.org.apache.jdo.tck.pc.company.CompanyModelReader = ERROR, TCK -log4j.logger.org.apache.jdo.tck.pc.mylib.MylibReader = ERROR, TCK - # TCK appenders log4j.appender.TCK = org.apache.jdo.tck.util.TCKFileAppender log4j.appender.TCK.File = tck.txt diff --git a/tck/src/main/resources/conf/iut-log4j2.xml b/tck/src/main/resources/conf/iut-log4j2.xml index ddb94cef0..faf7e9b0e 100644 --- a/tck/src/main/resources/conf/iut-log4j2.xml +++ b/tck/src/main/resources/conf/iut-log4j2.xml @@ -41,16 +41,7 @@ - - - - - - - - - - + diff --git a/tck/src/main/resources/conf/jdori-log4j2.xml b/tck/src/main/resources/conf/jdori-log4j2.xml index 853dcfd0c..2aa6cd8a6 100644 --- a/tck/src/main/resources/conf/jdori-log4j2.xml +++ b/tck/src/main/resources/conf/jdori-log4j2.xml @@ -41,16 +41,7 @@ - - - - - - - - - - + diff --git a/tck/src/main/resources/conf/logging.properties b/tck/src/main/resources/conf/logging.properties index 8dc631fa4..06ea4f6dd 100644 --- a/tck/src/main/resources/conf/logging.properties +++ b/tck/src/main/resources/conf/logging.properties @@ -40,11 +40,6 @@ # TCK logger org.apache.jdo.tck.level = INFO -# SpringFramework loggers -org.springframework.level = SEVERE -org.apache.jdo.tck.pc.company.CompanyModelReader.level = SEVERE -org.apache.jdo.tck.pc.mylib.MylibReader = SEVERE - org.apache.jdo.tck.util.TCKFileHandler.fileName = tck.txt org.apache.jdo.tck.util.TCKFileHandler.level = FINEST diff --git a/tck/src/main/resources/conf/security.policy b/tck/src/main/resources/conf/security.policy index 7ba11d365..a151e5ee3 100644 --- a/tck/src/main/resources/conf/security.policy +++ b/tck/src/main/resources/conf/security.policy @@ -18,26 +18,10 @@ grant codeBase "file:/D:/users\\michael\\.maven/repository/junit/jars/junit-3.8. permission java.io.FilePermission "${user.home}${/}junit.properties", "read"; }; -// Springbeans code base -grant codeBase "file:/D:/users\\michael\\.maven/repository/org.springframework/jars/spring-beans-2.0.jar" { - permission java.lang.RuntimePermission "accessDeclaredMembers"; - permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; - permission java.lang.RuntimePermission "getClassLoader"; -}; - -// Springcore code base -grant codeBase "file:/D:/users\\michael\\.maven/repository/org.springframework/jars/spring-core-2.0.jar" { - permission java.lang.RuntimePermission "accessDeclaredMembers"; -}; - // TCK test classes grant codeBase "file:/D:/projects/jdo/workspace/jdo/trunk/tck2/target/classes/-" { permission javax.jdo.spi.JDOPermission "closePersistenceManagerFactory"; permission javax.jdo.spi.JDOPermission "setStateManager"; -// needed for Springbeans - permission java.lang.RuntimePermission "accessDeclaredMembers"; - permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; - permission java.lang.RuntimePermission "getClassLoader"; }; // TCK PC enhanced classes diff --git a/tck/src/main/resources/conf/simplelog.properties b/tck/src/main/resources/conf/simplelog.properties index fa0bd8c8f..af1f1d5d0 100644 --- a/tck/src/main/resources/conf/simplelog.properties +++ b/tck/src/main/resources/conf/simplelog.properties @@ -31,10 +31,5 @@ org.apache.commons.logging.simplelog.defaultlog = error # TCK logger org.apache.commons.logging.simplelog.log.org.apache.jdo.tck = info -# SpringFramework loggers -org.apache.commons.logging.simplelog.log.org.springframework = error -org.apache.commons.logging.simplelog.log.org.apache.jdo.tck.pc.company.CompanyModelReader = error -org.apache.commons.logging.simplelog.log.org.apache.jdo.tck.pc.mylib.MylibReader = error - # JDO vendor specific loggers #org.apache.commons.logging.simplelog.log. = info From 93ff38479eb21b1372a6793a4eba2f2f33430543 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 26 Oct 2025 16:37:28 +0100 Subject: [PATCH 34/43] Prepare removal of XML files --- .../org/apache/jdo/tck/util/DataSource.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tck/src/main/java/org/apache/jdo/tck/util/DataSource.java b/tck/src/main/java/org/apache/jdo/tck/util/DataSource.java index 2ef866d79..97016dc00 100644 --- a/tck/src/main/java/org/apache/jdo/tck/util/DataSource.java +++ b/tck/src/main/java/org/apache/jdo/tck/util/DataSource.java @@ -17,6 +17,26 @@ package org.apache.jdo.tck.util; +/** + * Common interface for classes that generate data for tests. + * + * @param Factory class. + */ public interface DataSource { + /** + * Implementations should generate test data objects and register them with the registry. + * + *

The "init()" Methods are usually structured as follows:
+ * - Creation of all instances, using the factory if one is available.
+ * - Setting of all properties of all instances.
+ * - Registration of instance with names (root names and bean names) insofar as it is required by + * the tests.
+ * + *

The test class name is usually given as argument to the constructor of the factory class. + * Often the name is read from the "org.tck.testdata" property in the config files. + * + * @param factory Factory instance. May be "null" if no factory is used. + * @param registry Registry for named objects (formerly "roots" and "beans"). + */ void init(F factory, DefaultListableInstanceFactory registry); } From 8bfe82e439743c0a72f695af7bc968856af87935 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 26 Oct 2025 18:56:41 +0100 Subject: [PATCH 35/43] Prepare removal of XML files --- .../tck/pc/company/data/EmbeddedTestData.java | 2 +- .../pc/company/data/NavigationTestData.java | 2 +- .../tck/pc/company/data/QueryTestData.java | 2 +- .../pc/company/data/Relationships1_1Data.java | 2 +- .../pc/company/data/Relationships1_MData.java | 2 +- .../pc/company/data/RelationshipsAllData.java | 2 +- .../pc/company/data/RelationshipsM_MData.java | 2 +- .../pc/company/data/RelationshipsNoData.java | 2 +- .../pc/company/data/SampleQueryTestData.java | 2 +- .../tck/pc/company/data/SubqueryTestData.java | 2 +- .../pc/companyListWithoutJoin/Department.java | 6 +- .../companyListWithoutJoin/IDepartment.java | 2 - .../CompanyModelTestData.java | 136 ++++++++++++++++++ .../pc/companyMapWithoutJoin/Department.java | 8 -- .../pc/companyMapWithoutJoin/IDepartment.java | 2 - .../apache/jdo/tck/pc/mylib/MylibReader.java | 2 +- ...ReaderTestData.java => MylibTestData.java} | 2 +- .../org/apache/jdo/tck/pc/order/Order.java | 7 +- .../pc/order/OrderFactoryAbstractImpl.java | 1 - .../jdo/tck/pc/order/OrderModelReader.java | 1 - ...rTestData.java => OrderModelTestData.java} | 9 +- .../org/apache/jdo/tck/query/QueryTest.java | 2 +- .../DataSourceUtil.java} | 13 +- .../main/resources/conf/compoundIdentity.conf | 2 +- 24 files changed, 168 insertions(+), 45 deletions(-) create mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelTestData.java rename tck/src/main/java/org/apache/jdo/tck/pc/mylib/{MylibReaderTestData.java => MylibTestData.java} (96%) rename tck/src/main/java/org/apache/jdo/tck/pc/order/{OrderModelReaderTestData.java => OrderModelTestData.java} (84%) rename tck/src/main/java/org/apache/jdo/tck/{pc/company/data/CompanyModelData.java => util/DataSourceUtil.java} (81%) diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java index 6ef420b3b..65dfb6078 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java @@ -17,7 +17,7 @@ package org.apache.jdo.tck.pc.company.data; -import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; +import static org.apache.jdo.tck.util.DataSourceUtil.*; import java.math.BigDecimal; import org.apache.jdo.tck.pc.company.*; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java index d44349f9e..08dc79252 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java @@ -17,7 +17,7 @@ package org.apache.jdo.tck.pc.company.data; -import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; +import static org.apache.jdo.tck.util.DataSourceUtil.*; import java.math.BigDecimal; import org.apache.jdo.tck.pc.company.*; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java index 0bcb988c5..9cfcf902e 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java @@ -17,7 +17,7 @@ package org.apache.jdo.tck.pc.company.data; -import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; +import static org.apache.jdo.tck.util.DataSourceUtil.*; import java.math.BigDecimal; import org.apache.jdo.tck.pc.company.*; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java index 33209a16b..bcbeded7d 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java @@ -17,7 +17,7 @@ package org.apache.jdo.tck.pc.company.data; -import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; +import static org.apache.jdo.tck.util.DataSourceUtil.*; import java.math.BigDecimal; import org.apache.jdo.tck.pc.company.*; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java index bb55a30e7..5171199b4 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java @@ -17,7 +17,7 @@ package org.apache.jdo.tck.pc.company.data; -import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; +import static org.apache.jdo.tck.util.DataSourceUtil.*; import java.math.BigDecimal; import org.apache.jdo.tck.pc.company.*; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java index 7f4fd42fd..eb13a672e 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java @@ -17,7 +17,7 @@ package org.apache.jdo.tck.pc.company.data; -import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; +import static org.apache.jdo.tck.util.DataSourceUtil.*; import java.math.BigDecimal; import org.apache.jdo.tck.pc.company.*; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java index 5b75b693e..f85acaacf 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java @@ -17,7 +17,7 @@ package org.apache.jdo.tck.pc.company.data; -import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; +import static org.apache.jdo.tck.util.DataSourceUtil.*; import java.math.BigDecimal; import org.apache.jdo.tck.pc.company.*; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java index 85a65e4d6..0e6334dfe 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java @@ -17,7 +17,7 @@ package org.apache.jdo.tck.pc.company.data; -import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; +import static org.apache.jdo.tck.util.DataSourceUtil.*; import java.math.BigDecimal; import org.apache.jdo.tck.pc.company.*; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java index b0e335a0f..0edbbfac1 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java @@ -17,7 +17,7 @@ package org.apache.jdo.tck.pc.company.data; -import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; +import static org.apache.jdo.tck.util.DataSourceUtil.*; import java.math.BigDecimal; import org.apache.jdo.tck.pc.company.*; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java index 43dcf3284..01296c655 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java @@ -17,7 +17,7 @@ package org.apache.jdo.tck.pc.company.data; -import static org.apache.jdo.tck.pc.company.data.CompanyModelData.*; +import static org.apache.jdo.tck.util.DataSourceUtil.*; import org.apache.jdo.tck.pc.company.*; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/Department.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/Department.java index 8df9acb3a..13eaa053b 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/Department.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/Department.java @@ -18,7 +18,6 @@ package org.apache.jdo.tck.pc.companyListWithoutJoin; import java.io.Serializable; -import java.util.ArrayList; import java.util.Comparator; import java.util.List; import org.apache.jdo.tck.util.DeepEquality; @@ -155,10 +154,7 @@ public List getEmployees() { * * @param emp The employee to add to the department. */ - public void addEmployee(IEmployee emp) { - if (employees == null) { - employees = new ArrayList<>(); - } + public void addEmployee(Employee emp) { employees.add(emp); } diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/IDepartment.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/IDepartment.java index 62e799f62..9b85a2daa 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/IDepartment.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/IDepartment.java @@ -40,6 +40,4 @@ public interface IDepartment { void setCompany(ICompany company); void setEmployees(List employees); - - void addEmployee(IEmployee emp); } diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelTestData.java new file mode 100644 index 000000000..460489069 --- /dev/null +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelTestData.java @@ -0,0 +1,136 @@ +/* + * 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 + * + * https://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 static org.apache.jdo.tck.util.DataSourceUtil.*; + +import org.apache.jdo.tck.util.DataSource; +import org.apache.jdo.tck.util.DefaultListableInstanceFactory; + +/** + * Utility class to create a graph of company model instances. + * + * @author Tilmann Zäschke + */ +public class CompanyModelTestData implements DataSource { + + /** Company instances for CompletenessTest with Map without join table. */ + @Override + public void init(CompanyFactory factory, DefaultListableInstanceFactory registry) { + + // Instances / Constructors + + ICompany company1 = factory.newCompany(1L, "Sun Microsystems, Inc.", date(1952, 4, 11)); + + IDepartment dept1 = factory.newDepartment(1, "Development", company1); + IDepartment dept2 = factory.newDepartment(2, "Human Resources", company1); + company1.setDepartments(toSet(dept1, dept2)); + + IFullTimeEmployee emp1 = + factory.newFullTimeEmployee( + 1, + "emp1First", + "emp1Last", + "emp1Middle", + date(1970, 6, 10), + date(1999, 1, 1), + "role1", + 60000); + + IFullTimeEmployee emp2 = + factory.newFullTimeEmployee( + 2, + "emp2First", + "emp2Last", + "emp2Middle", + date(1975, 12, 22), + date(2003, 7, 1), + "role2", + 47000); + + IFullTimeEmployee emp3 = + factory.newFullTimeEmployee( + 3, + "emp3First", + "emp3Last", + "emp3Middle", + date(1972, 7, 5), + date(2002, 8, 15), + "role3", + 67.00); + + IFullTimeEmployee emp4 = + factory.newFullTimeEmployee( + 4, + "emp4First", + "emp4Last", + "emp4Middle", + date(1973, 7, 6), + date(2001, 4, 15), + "role4", + 37.00); + + IFullTimeEmployee emp5 = + factory.newFullTimeEmployee( + 5, + "emp5First", + "emp5Last", + "emp5Middle", + date(1962, 7, 5), + date(1998, 8, 15), + "role5", + 73000); + + // Properties + + emp1.setWeeklyhours(40); + emp1.setDepartment(dept1); + emp1.setFundingDept(dept2); + emp1.setManager(emp2); + emp1.setHradvisor(emp5); + + emp2.setWeeklyhours(40); + emp2.setDepartment(dept1); + emp2.setFundingDept(dept1); + emp2.setHradvisor(emp5); + emp2.setTeam(toSet(emp1, emp3, emp4, emp5)); + + emp3.setWeeklyhours(19); + emp3.setDepartment(dept1); + emp3.setFundingDept(dept1); + emp3.setManager(emp2); + emp3.setHradvisor(emp5); + + emp4.setDepartment(dept2); + emp4.setFundingDept(dept2); + emp4.setManager(emp2); + emp4.setHradvisor(emp5); + + emp5.setDepartment(dept2); + emp5.setFundingDept(dept2); + emp5.setManager(emp2); + emp5.setHradvisees(toSet(emp1, emp2, emp3, emp4)); + + dept1.setRoles(toMap(IEmployee::getRole, emp1, emp2, emp3)); + dept2.setRoles(toMap(IEmployee::getRole, emp4, emp5)); + + // Register named objects + + registry.register("company1", company1); + } +} diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Department.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Department.java index c3518dd16..0e6cec11c 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Department.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/Department.java @@ -19,7 +19,6 @@ import java.io.Serializable; import java.util.Comparator; -import java.util.HashMap; import java.util.Map; import org.apache.jdo.tck.util.DeepEquality; import org.apache.jdo.tck.util.EqualityHelper; @@ -178,13 +177,6 @@ public void setRoles(Map roles) { this.roles = roles; } - public void add(IEmployee emp) { - if (roles == null) { - roles = new HashMap<>(); - } - roles.put(emp.getRole(), emp); - } - /** * Returns true if all the fields of this instance are deep equal to the coresponding * fields of the other Department. diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IDepartment.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IDepartment.java index 934923b42..0e71d58a3 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IDepartment.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/IDepartment.java @@ -40,6 +40,4 @@ public interface IDepartment { void setCompany(ICompany company); void setRoles(Map roles); - - void add(IEmployee emp); } diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java index 4afbe2edb..587095c69 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReader.java @@ -33,7 +33,7 @@ public class MylibReader extends DefaultListableInstanceFactory { */ public MylibReader(String resourceName) { super(); - new MylibReaderTestData().init(this, this); + new MylibTestData().init(this, this); } // Convenience methods diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReaderTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibTestData.java similarity index 96% rename from tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReaderTestData.java rename to tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibTestData.java index 48d0e8bef..599b981fa 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibReaderTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/mylib/MylibTestData.java @@ -21,7 +21,7 @@ import org.apache.jdo.tck.util.DefaultListableInstanceFactory; /** Utility class to create a mylib instances for unit tests. */ -public class MylibReaderTestData implements DataSource { +public class MylibTestData implements DataSource { @Override public void init( diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/order/Order.java b/tck/src/main/java/org/apache/jdo/tck/pc/order/Order.java index ad7113c79..b857b7624 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/order/Order.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/order/Order.java @@ -19,7 +19,6 @@ import java.io.Serializable; import java.util.Comparator; -import java.util.HashSet; import java.util.Set; import org.apache.jdo.tck.util.DeepEquality; import org.apache.jdo.tck.util.EqualityHelper; @@ -29,7 +28,7 @@ public class Order implements Serializable, Comparable, Comparator private static final long serialVersionUID = 1L; long orderId; - Set items = new HashSet<>(); + Set items; long customerId; public Order() {} @@ -69,10 +68,6 @@ public void setCustomerId(long customerId) { this.customerId = customerId; } - public void addItem(OrderItem item) { - items.add(item); - } - /** * Returns true if all the fields of this instance are deep equal to the coresponding * fields of the specified Person. diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderFactoryAbstractImpl.java b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderFactoryAbstractImpl.java index 3d0515c47..436e8eab7 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderFactoryAbstractImpl.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderFactoryAbstractImpl.java @@ -59,7 +59,6 @@ public Order newOrder(long orderId, long customerId) { return result; } - @Deprecated // TODO (TZ) remove public Order newOrder(long orderId, Set items, long customerId) { Order result = newOrder(); result.setOrderId(orderId); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java index fb4a834bf..b3a064bfe 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReader.java @@ -35,7 +35,6 @@ public class OrderModelReader extends DefaultListableInstanceFactory { * @param resourceName the name of the resource */ public OrderModelReader(String resourceName) { - super(); orderFactory = OrderFactoryRegistry.getInstance(); getDataSource(resourceName).init(orderFactory, this); } diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReaderTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelTestData.java similarity index 84% rename from tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReaderTestData.java rename to tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelTestData.java index 34789b06b..523a0f4fa 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelReaderTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelTestData.java @@ -17,19 +17,20 @@ package org.apache.jdo.tck.pc.order; +import static org.apache.jdo.tck.util.DataSourceUtil.*; + import org.apache.jdo.tck.util.DataSource; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; -/** Utility class to create a graph of order model instances from an xml representation. */ -public class OrderModelReaderTestData implements DataSource { +/** Utility class to create a graph of order model instances. */ +public class OrderModelTestData implements DataSource { @Override public void init(OrderFactory factory, DefaultListableInstanceFactory registry) { Order order1 = factory.newOrder(1, 3); OrderItem item1 = factory.newOrderItem(order1, 1, "SunRay", 15); OrderItem item2 = factory.newOrderItem(order1, 1, "Sun Ultra 40", 3); - order1.addItem(item1); - order1.addItem(item2); + order1.setItems(toSet(item1, item2)); registry.register("order1", order1); } } diff --git a/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java b/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java index 88125cd20..c99838436 100644 --- a/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java +++ b/tck/src/main/java/org/apache/jdo/tck/query/QueryTest.java @@ -53,7 +53,7 @@ public abstract class QueryTest extends AbstractReaderTest { public static final String COMPANY_TESTDATA = "org.apache.jdo.tck.pc.company.data.QueryTestData"; /** */ - public static final String MYLIB_TESTDATA = "org.apache.jdo.tck.pc.mylib.MylibReaderTestData"; + public static final String MYLIB_TESTDATA = "org.apache.jdo.tck.pc.mylib.MylibTestData"; /** List of inserted instances (see methods insertPCPoints and getFromInserted). */ protected final List persistentPCPoints = new ArrayList<>(); diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/CompanyModelData.java b/tck/src/main/java/org/apache/jdo/tck/util/DataSourceUtil.java similarity index 81% rename from tck/src/main/java/org/apache/jdo/tck/pc/company/data/CompanyModelData.java rename to tck/src/main/java/org/apache/jdo/tck/util/DataSourceUtil.java index b16273794..4062a315f 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/CompanyModelData.java +++ b/tck/src/main/java/org/apache/jdo/tck/util/DataSourceUtil.java @@ -15,12 +15,13 @@ * limitations under the License. */ -package org.apache.jdo.tck.pc.company.data; +package org.apache.jdo.tck.util; import java.util.*; +import java.util.function.Function; import java.util.stream.Collectors; -public interface CompanyModelData { +public interface DataSourceUtil { static Date date(int y, int m, int d) { return new GregorianCalendar(y, m - 1, d, 0, 0, 0).getTime(); @@ -39,6 +40,14 @@ static Map toMap(String... objs) { return map; } + static Map toMap(Function keyFn, V... objs) { + Map map = new HashMap<>(); + for (int i = 0; i < objs.length; i++) { + map.put(keyFn.apply(objs[i]), objs[i]); + } + return map; + } + @SafeVarargs static Set toSet(T... objs) { return Arrays.stream(objs).collect(Collectors.toSet()); diff --git a/tck/src/main/resources/conf/compoundIdentity.conf b/tck/src/main/resources/conf/compoundIdentity.conf index 6aabd0e45..c3e9550a3 100644 --- a/tck/src/main/resources/conf/compoundIdentity.conf +++ b/tck/src/main/resources/conf/compoundIdentity.conf @@ -16,6 +16,6 @@ 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.OrderModelReaderTestData +jdo.tck.testdata = org.apache.jdo.tck.pc.order.OrderModelTestData jdo.tck.mapping = 0 jdo.tck.requiredOptions = From 1cc43894f201c5e934e1c958c9de879e59690c11 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 26 Oct 2025 18:56:53 +0100 Subject: [PATCH 36/43] Prepare removal of XML files --- .../CompanyModelReader.java | 122 +---------------- .../CompanyModelTestData.java | 99 ++++++++++++++ .../CompanyModelReader.java | 123 +----------------- .../conf/companyListWithoutJoin.conf | 2 +- .../resources/conf/companyMapWithoutJoin.conf | 2 +- 5 files changed, 104 insertions(+), 244 deletions(-) create mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelTestData.java diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java index c305feb17..8827c28e9 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java @@ -18,7 +18,6 @@ package org.apache.jdo.tck.pc.companyListWithoutJoin; import java.util.*; -import java.util.stream.Collectors; import org.apache.jdo.tck.util.ConversionHelper; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; import org.apache.jdo.tck.util.JDOCustomDateEditor; @@ -30,14 +29,6 @@ */ public class CompanyModelReader extends DefaultListableInstanceFactory { - private static final long serialVersionUID = 1L; - - /** 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; @@ -58,119 +49,8 @@ public CompanyModelReader(String resourceName) { * @param classLoader the ClassLoader for the lookup */ public CompanyModelReader(String resourceName, ClassLoader classLoader) { - super(); - configureFactory(); - init(); - } - - /** Company instances for CompletenessTest with Map without join table. */ - private void init() { - ICompany company1 = - companyFactory.newCompany(1L, "Sun Microsystems, Inc.", new Date(1952, 4, 11, 0, 0, 0)); - super.register("company1", company1); - - IDepartment dept1 = companyFactory.newDepartment(1, "Development", company1); - IDepartment dept2 = companyFactory.newDepartment(2, "Human Resources", company1); - company1.setDepartments(toSet(dept1, dept2)); - - IFullTimeEmployee emp1 = - companyFactory.newFullTimeEmployee( - 1, - "emp1First", - "emp1Last", - "emp1Middle", - new Date(1970, 6, 10, 0, 0, 0), - new Date(1999, 1, 1, 0, 0, 0), - 60000); - - IFullTimeEmployee emp2 = - companyFactory.newFullTimeEmployee( - 2, - "emp2First", - "emp2Last", - "emp2Middle", - new Date(1975, 12, 22, 0, 0, 0), - new Date(2003, 7, 1, 0, 0, 0), - 47000); - - IFullTimeEmployee emp3 = - companyFactory.newFullTimeEmployee( - 3, - "emp3First", - "emp3Last", - "emp3Middle", - new Date(1972, 7, 5, 0, 0, 0), - new Date(2002, 8, 15, 0, 0, 0), - 67.00); - - IFullTimeEmployee emp4 = - companyFactory.newFullTimeEmployee( - 4, - "emp4First", - "emp4Last", - "emp4Middle", - new Date(1973, 7, 6, 0, 0, 0), - new Date(2001, 4, 15, 0, 0, 0), - 37.00); - - IFullTimeEmployee emp5 = - companyFactory.newFullTimeEmployee( - 5, - "emp5First", - "emp5Last", - "emp5Middle", - new Date(1962, 7, 5, 0, 0, 0), - new Date(1998, 8, 15, 0, 0, 0), - 73000); - - emp1.setWeeklyhours(40); - emp1.setDepartment(dept1); - emp1.setFundingDept(dept2); - emp1.setManager(emp2); - emp1.setHradvisor(emp5); - dept1.addEmployee(emp1); // TODO do this inside setDepartment - - emp2.setWeeklyhours(40); - emp2.setDepartment(dept1); - emp2.setFundingDept(dept1); - emp2.setHradvisor(emp5); - emp2.setTeam(toSet(emp1, emp3, emp4, emp5)); - dept1.addEmployee(emp2); // TODO do this inside setDepartment - - emp3.setWeeklyhours(19); - emp3.setDepartment(dept1); - emp3.setFundingDept(dept1); - emp3.setManager(emp2); - emp3.setHradvisor(emp5); - dept1.addEmployee(emp3); // TODO do this inside setDepartment - - // emp4.setWeeklyhours(19); - emp4.setDepartment(dept2); - emp4.setFundingDept(dept2); - emp4.setManager(emp2); - emp4.setHradvisor(emp5); - dept2.addEmployee(emp4); // TODO do this inside setDepartment - - // emp5.setWeeklyhours(19); - emp5.setDepartment(dept2); - emp5.setFundingDept(dept2); - emp5.setManager(emp2); - emp5.setHradvisees(toSet(emp1, emp2, emp3, emp4)); - dept2.addEmployee(emp5); // TODO do this inside setDepartment - } - - private Set toSet(T... objs) { - return Arrays.stream(objs).collect(Collectors.toSet()); - } - - /** - * 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() { - // registerCustomEditor(Date.class, JDOCustomDateEditor.class); companyFactory = CompanyFactoryRegistry.getInstance(); - // addSingleton(BEAN_FACTORY_NAME, companyFactory); + getDataSource(resourceName).init(companyFactory, this); } // Convenience methods diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelTestData.java new file mode 100644 index 000000000..49db73355 --- /dev/null +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelTestData.java @@ -0,0 +1,99 @@ +/* + * 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 + * + * https://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.companyListWithoutJoin; + +import static org.apache.jdo.tck.util.DataSourceUtil.*; + +import org.apache.jdo.tck.util.DataSource; +import org.apache.jdo.tck.util.DefaultListableInstanceFactory; + +/** + * Utility class to create a graph of company model instances. + * + * @author Michael Bouschen + */ +public class CompanyModelTestData implements DataSource { + + /** Company instances for CompletenessTest with Map without join table. */ + @Override + public void init(CompanyFactory factory, DefaultListableInstanceFactory registry) { + + // Instances / Constructors + + ICompany company1 = factory.newCompany(1L, "Sun Microsystems, Inc.", date(1952, 4, 11)); + + IDepartment dept1 = factory.newDepartment(1, "Development", company1); + IDepartment dept2 = factory.newDepartment(2, "Human Resources", company1); + company1.setDepartments(toSet(dept1, dept2)); + + IFullTimeEmployee emp1 = + factory.newFullTimeEmployee( + 1, "emp1First", "emp1Last", "emp1Middle", date(1970, 6, 10), date(1999, 1, 1), 60000); + + IFullTimeEmployee emp2 = + factory.newFullTimeEmployee( + 2, "emp2First", "emp2Last", "emp2Middle", date(1975, 12, 22), date(2003, 7, 1), 47000); + + IFullTimeEmployee emp3 = + factory.newFullTimeEmployee( + 3, "emp3First", "emp3Last", "emp3Middle", date(1972, 7, 5), date(2002, 8, 15), 67.00); + + IFullTimeEmployee emp4 = + factory.newFullTimeEmployee( + 4, "emp4First", "emp4Last", "emp4Middle", date(1973, 7, 6), date(2001, 4, 15), 37.00); + + IFullTimeEmployee emp5 = + factory.newFullTimeEmployee( + 5, "emp5First", "emp5Last", "emp5Middle", date(1962, 7, 5), date(1998, 8, 15), 73000); + + emp1.setWeeklyhours(40); + emp1.setDepartment(dept1); + emp1.setFundingDept(dept2); + emp1.setManager(emp2); + emp1.setHradvisor(emp5); + + emp2.setWeeklyhours(40); + emp2.setDepartment(dept1); + emp2.setFundingDept(dept1); + emp2.setHradvisor(emp5); + emp2.setTeam(toSet(emp1, emp3, emp4, emp5)); + + emp3.setWeeklyhours(19); + emp3.setDepartment(dept1); + emp3.setFundingDept(dept1); + emp3.setManager(emp2); + emp3.setHradvisor(emp5); + + emp4.setDepartment(dept2); + emp4.setFundingDept(dept2); + emp4.setManager(emp2); + emp4.setHradvisor(emp5); + + emp5.setDepartment(dept2); + emp5.setFundingDept(dept2); + emp5.setManager(emp2); + emp5.setHradvisees(toSet(emp1, emp2, emp3, emp4)); + + dept1.setEmployees(toList(emp1, emp2, emp3)); + dept2.setEmployees(toList(emp4, emp5)); + + // Register named objects + + registry.register("company1", company1); + } +} diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java index 018a4d948..45bd93ac0 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java @@ -18,20 +18,17 @@ package org.apache.jdo.tck.pc.companyMapWithoutJoin; import java.util.*; -import java.util.stream.Collectors; import org.apache.jdo.tck.util.ConversionHelper; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; import org.apache.jdo.tck.util.JDOCustomDateEditor; /** - * Utility class to create a graph of company model instances from an xml representation. + * Utility class to create a graph of company model instances. * * @author Michael Bouschen */ public class CompanyModelReader extends DefaultListableInstanceFactory { - private static final long serialVersionUID = 1L; - /** The company factory instance. */ private CompanyFactory companyFactory; @@ -41,124 +38,8 @@ public class CompanyModelReader extends DefaultListableInstanceFactory { * @param resourceName the name of the resource */ public CompanyModelReader(String resourceName) { - super(); - configureFactory(); - init(); - } - - /** Company instances for CompletenessTest with Map without join table. */ - private void init() { - ICompany company1 = - companyFactory.newCompany(1L, "Sun Microsystems, Inc.", new Date(1952, 4, 11, 0, 0, 0)); - super.register("company1", company1); - - IDepartment dept1 = companyFactory.newDepartment(1, "Development", company1); - IDepartment dept2 = companyFactory.newDepartment(2, "Human Resources", company1); - company1.setDepartments(toSet(dept1, dept2)); - - IFullTimeEmployee emp1 = - companyFactory.newFullTimeEmployee( - 1, - "emp1First", - "emp1Last", - "emp1Middle", - new Date(1970, 6, 10, 0, 0, 0), - new Date(1999, 1, 1, 0, 0, 0), - "role1", - 60000); - - IFullTimeEmployee emp2 = - companyFactory.newFullTimeEmployee( - 2, - "emp2First", - "emp2Last", - "emp2Middle", - new Date(1975, 12, 22, 0, 0, 0), - new Date(2003, 7, 1, 0, 0, 0), - "role2", - 47000); - - IFullTimeEmployee emp3 = - companyFactory.newFullTimeEmployee( - 3, - "emp3First", - "emp3Last", - "emp3Middle", - new Date(1972, 7, 5, 0, 0, 0), - new Date(2002, 8, 15, 0, 0, 0), - "role3", - 67.00); - - IFullTimeEmployee emp4 = - companyFactory.newFullTimeEmployee( - 4, - "emp4First", - "emp4Last", - "emp4Middle", - new Date(1973, 7, 6, 0, 0, 0), - new Date(2001, 4, 15, 0, 0, 0), - "role4", - 37.00); - - IFullTimeEmployee emp5 = - companyFactory.newFullTimeEmployee( - 5, - "emp5First", - "emp5Last", - "emp5Middle", - new Date(1962, 7, 5, 0, 0, 0), - new Date(1998, 8, 15, 0, 0, 0), - "role5", - 73000); - - emp1.setWeeklyhours(40); - emp1.setDepartment(dept1); - emp1.setFundingDept(dept2); - emp1.setManager(emp2); - emp1.setHradvisor(emp5); - dept1.add(emp1); // TODO do this inside setDepartment - - emp2.setWeeklyhours(40); - emp2.setDepartment(dept1); - emp2.setFundingDept(dept1); - emp2.setHradvisor(emp5); - emp2.setTeam(toSet(emp1, emp3, emp4, emp5)); - dept1.add(emp2); // TODO do this inside setDepartment - - emp3.setWeeklyhours(19); - emp3.setDepartment(dept1); - emp3.setFundingDept(dept1); - emp3.setManager(emp2); - emp3.setHradvisor(emp5); - dept1.add(emp3); // TODO do this inside setDepartment - - // emp4.setWeeklyhours(19); - emp4.setDepartment(dept2); - emp4.setFundingDept(dept2); - emp4.setManager(emp2); - emp4.setHradvisor(emp5); - dept2.add(emp4); // TODO do this inside setDepartment - - // emp5.setWeeklyhours(19); - emp5.setDepartment(dept2); - emp5.setFundingDept(dept2); - emp5.setManager(emp2); - emp5.setHradvisees(toSet(emp1, emp2, emp3, emp4)); - dept2.add(emp5); // TODO do this inside setDepartment - } - - private Set toSet(T... objs) { - return Arrays.stream(objs).collect(Collectors.toSet()); - } - - /** - * 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() { - // registerCustomEditor(Date.class, JDOCustomDateEditor.class); companyFactory = CompanyFactoryRegistry.getInstance(); - // addSingleton(BEAN_FACTORY_NAME, companyFactory); + getDataSource(resourceName).init(companyFactory, this); } // Convenience methods diff --git a/tck/src/main/resources/conf/companyListWithoutJoin.conf b/tck/src/main/resources/conf/companyListWithoutJoin.conf index 270ebc359..f3d8139b6 100644 --- a/tck/src/main/resources/conf/companyListWithoutJoin.conf +++ b/tck/src/main/resources/conf/companyListWithoutJoin.conf @@ -15,7 +15,7 @@ jdo.tck.description = Completeness test with companyListWithoutJoin model. jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.companyListWithoutJoin.CompanyFactoryPMClass -jdo.tck.testdata = org/apache/jdo/tck/pc/companyListWithoutJoin/companyListWithoutJoin.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.companyListWithoutJoin.CompanyModelTestData jdo.tck.mapping = 10 jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTestList jdo.tck.requiredOptions = diff --git a/tck/src/main/resources/conf/companyMapWithoutJoin.conf b/tck/src/main/resources/conf/companyMapWithoutJoin.conf index 0bb2275f4..497888222 100644 --- a/tck/src/main/resources/conf/companyMapWithoutJoin.conf +++ b/tck/src/main/resources/conf/companyMapWithoutJoin.conf @@ -15,7 +15,7 @@ jdo.tck.description = Completeness test with companyMapWithoutJoin model. jdo.tck.mapping.companyfactory = org.apache.jdo.tck.pc.companyMapWithoutJoin.CompanyFactoryPMClass -jdo.tck.testdata = org/apache/jdo/tck/pc/companyMapWithoutJoin/companyMapWithoutJoin.xml +jdo.tck.testdata = org.apache.jdo.tck.pc.companyMapWithoutJoin.CompanyModelTestData jdo.tck.mapping = 9 jdo.tck.classes = org.apache.jdo.tck.mapping.CompletenessTestMap jdo.tck.requiredOptions = From 529c3ae58bcb6a7bb90f9a2444e0d1284eeb58e8 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 26 Oct 2025 18:57:10 +0100 Subject: [PATCH 37/43] Remove XML files --- .../tck/pc/company/CompanyModelReaderOld.java | 245 -------- .../pc/company/company1-1Relationships.xml | 239 -------- .../pc/company/company1-MRelationships.xml | 238 -------- .../pc/company/companyAllRelationships.xml | 406 ------------- .../jdo/tck/pc/company/companyEmbedded.xml | 212 ------- .../pc/company/companyForNavigationTests.xml | 562 ------------------ .../tck/pc/company/companyForQueryTests.xml | 437 -------------- .../company/companyForSampleQueriesTest.xml | 486 --------------- .../pc/company/companyForSubqueriesTests.xml | 282 --------- .../pc/company/companyM-MRelationships.xml | 246 -------- .../tck/pc/company/companyNoRelationships.xml | 152 ----- .../companyListWithoutJoin.xml | 154 ----- .../companyMapWithoutJoin.xml | 169 ------ .../jdo/tck/pc/mylib/mylibForQueryTests.xml | 80 --- .../org/apache/jdo/tck/pc/order/order.xml | 67 --- 15 files changed, 3975 deletions(-) delete mode 100644 tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReaderOld.java delete mode 100644 tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/company1-1Relationships.xml delete mode 100644 tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/company1-MRelationships.xml delete mode 100644 tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyAllRelationships.xml delete mode 100644 tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyEmbedded.xml delete mode 100644 tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyForNavigationTests.xml delete mode 100644 tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyForQueryTests.xml delete mode 100644 tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyForSampleQueriesTest.xml delete mode 100644 tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyForSubqueriesTests.xml delete mode 100644 tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyM-MRelationships.xml delete mode 100644 tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyNoRelationships.xml delete mode 100644 tck/src/main/resources/testdata/org/apache/jdo/tck/pc/companyListWithoutJoin/companyListWithoutJoin.xml delete mode 100644 tck/src/main/resources/testdata/org/apache/jdo/tck/pc/companyMapWithoutJoin/companyMapWithoutJoin.xml delete mode 100644 tck/src/main/resources/testdata/org/apache/jdo/tck/pc/mylib/mylibForQueryTests.xml delete mode 100644 tck/src/main/resources/testdata/org/apache/jdo/tck/pc/order/order.xml diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReaderOld.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReaderOld.java deleted file mode 100644 index f419e2c79..000000000 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReaderOld.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * 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 - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.jdo.tck.pc.company; - -import java.util.Date; -import java.util.List; -import java.util.Locale; -import org.apache.jdo.tck.util.ConversionHelper; -import org.apache.jdo.tck.util.JDOCustomDateEditor; -import org.springframework.beans.factory.support.DefaultListableBeanFactory; -import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; -import org.springframework.core.io.ClassPathResource; - -/** - * Utility class to create a graph of company model instances from an xml representation. - * - * @author Michael Bouschen - */ -public class CompanyModelReaderOld extends DefaultListableBeanFactory { - - private static final long serialVersionUID = 1L; - - /** 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; - - /** Bean definition reader */ - private final XmlBeanDefinitionReader reader; - - /** - * Create a CompanyModelReader for the specified resourceName. - * - * @param resourceName the name of the resource - */ - public CompanyModelReaderOld(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 - * @param classLoader the ClassLoader for the lookup - */ - public CompanyModelReaderOld(String resourceName, ClassLoader classLoader) { - super(); - configureFactory(); - this.reader = new XmlBeanDefinitionReader(this); - this.reader.loadBeanDefinitions(new ClassPathResource(resourceName, classLoader)); - } - - /** - * 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 - */ - @SuppressWarnings("unchecked") - 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() { - registerCustomEditor(Date.class, JDOCustomDateEditor.class); - companyFactory = CompanyFactoryRegistry.getInstance(); - addSingleton(BEAN_FACTORY_NAME, companyFactory); - } - - /** - * @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(JDOCustomDateEditor.DATE_PATTERN, Locale.US, value); - } - - // Convenience methods - - /** - * Convenience method returning an Address instance for the specified name. The method returns - * null if there is no Address bean with the specified name. - * - * @param name the name of the bean to return. - * @return the instance of the bean or null if there no Address bean. - */ - public IAddress getAddress(String name) { - return getBean(name, Address.class); - } - - /** - * Convenience method returning a MeetingRoom instance for the specified name. The method returns - * null if there is no MeetingRoom bean with the specified name. - * - * @param name the name of the bean to return. - * @return the instance of the bean or null if there no MeetingRoom bean. - */ - public IMeetingRoom getMeetingRoom(String name) { - return getBean(name, MeetingRoom.class); - } - - /** - * Convenience method returning a Company instance for the specified name. The method returns - * null 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 null if there no Company bean. - */ - public ICompany getCompany(String name) { - return getBean(name, Company.class); - } - - /** - * Convenience method returning a DentalInsurance instance for the specified name. The method - * returns null if there is no DentalInsurance bean with the specified name. - * - * @param name the name of the bean to return. - * @return the instance of the bean or null if there no DentalInsurance bean. - */ - public IDentalInsurance getDentalInsurance(String name) { - return getBean(name, DentalInsurance.class); - } - - /** - * Convenience method returning a Department instance for the specified name. The method returns - * null 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 null if there no Department bean. - */ - public IDepartment getDepartment(String name) { - return getBean(name, Department.class); - } - - /** - * Convenience method returning an Employee instance for the specified name. The method returns - * null 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 null if there no Employee bean. - */ - public IEmployee getEmployee(String name) { - return getBean(name, Employee.class); - } - - /** - * Convenience method returning a FullTimeEmployee instance for the specified name. The method - * returns null 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 null if there no FullTimeEmployee bean. - */ - public IFullTimeEmployee getFullTimeEmployee(String name) { - return getBean(name, FullTimeEmployee.class); - } - - /** - * Convenience method returning an Insurance instance for the specified name. The method returns - * null if there is no Insurance bean with the specified name. - * - * @param name the name of the bean to return. - * @return the instance of the bean or null if there no Insurance bean. - */ - public IInsurance getInsurance(String name) { - return getBean(name, Insurance.class); - } - - /** - * Convenience method returning a MedicalInsurance instance for the specified name. The method - * returns null if there is no MedicalInsurance bean with the specified name. - * - * @param name the name of the bean to return. - * @return the instance of the bean or null if there no MedicalInsurance bean. - */ - public IMedicalInsurance getMedicalInsurance(String name) { - return getBean(name, MedicalInsurance.class); - } - - /** - * Convenience method returning a PartTimeEmployee instance for the specified name. The method - * returns null 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 null if there no PartTimeEmployee bean. - */ - public IPartTimeEmployee getPartTimeEmployee(String name) { - return getBean(name, PartTimeEmployee.class); - } - - /** - * Convenience method returning a Person instance for the specified name. The method returns - * null 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 null if there no Person bean. - */ - public IPerson getPerson(String name) { - return getBean(name, Person.class); - } - - /** - * Convenience method returning a Project instance for the specified name. The method returns - * null if there is no Project bean with the specified name. - * - * @param name the name of the bean to return. - * @return the instance of the bean or null if there no Project bean. - */ - public IProject getProject(String name) { - return getBean(name, Project.class); - } -} diff --git a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/company1-1Relationships.xml b/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/company1-1Relationships.xml deleted file mode 100644 index 9cb7ac029..000000000 --- a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/company1-1Relationships.xml +++ /dev/null @@ -1,239 +0,0 @@ - - - - - Company instances for CompletenessTest with 1-1 relationships - - - - - - - - - - - - - - - - - - - - - 1 - Sun Microsystems, Inc. - 11/Apr/1952 - - - - 1 - Development - - - - 2 - Human Resources - - - - 1 - emp1First - emp1Last - emp1Middle - 10/Jun/1970 - 1/Jan/1999 - 20000 - 40 - - - - - - - 2 - emp2First - emp2Last - emp2Middle - 22/Dec/1975 - 1/Jul/2003 - 10000 - 40 - - - - - - - 3 - emp3First - emp3Last - emp3Middle - 5/Sep/1972 - 15/Aug/2002 - 15 - 19 - - - - - - - 4 - emp4First - emp4Last - emp4Middle - 6/Sep/1973 - 15/Apr/2001 - 13 - - - - - - - 5 - emp5First - emp5Last - emp5Middle - 5/Jul/1962 - 15/Aug/1998 - 45000 - - - - - - - - 1 - Unter den Linden 1 - Berlin - - 12345 - Germany - - - 2 - Broadway 1 - New York - NY - 10000 - USA - - - 3 - Market St. - San Francisco - CA - 94102 - USA - - - - 1 - Carrier1 - PPO - - - - - 2 - Carrier2 - HMO - - - - - 3 - Carrier3 - HMO - - - - - 4 - Carrier4 - HMO - - - - - 5 - Carrier5 - HMO - - - - - 11 - Carrier1 - 99.999 - - - - - 12 - Carrier2 - 99.999 - - - - - 13 - Carrier3 - 99.999 - - - - - 14 - Carrier4 - 99.999 - - - - - 15 - Carrier5 - 99.999 - - - - - 1 - orange - 2500000.99 - - - 2 - blue - 50000.00 - - - 3 - green - 2000.99 - - - diff --git a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/company1-MRelationships.xml b/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/company1-MRelationships.xml deleted file mode 100644 index c4fb6aeee..000000000 --- a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/company1-MRelationships.xml +++ /dev/null @@ -1,238 +0,0 @@ - - - - - Company instances for CompletenessTest with 1-m relationships - - - - - - - - - - - - - - - - - - 1 - Sun Microsystems, Inc. - 11/Apr/1952 - - - - - - - - - - 1 - Development - - - - - - - - - - - - - - - - - - 2 - Human Resources - - - - - - - - - - - - - - - - - - 1 - emp1First - emp1Last - emp1Middle - 10/Jun/1970 - 1/Jan/1999 - 20000 - 40 - - - - - - - 2 - emp2First - emp2Last - emp2Middle - 22/Dec/1975 - 1/Jul/2003 - 10000 - 40 - - - - - - - - - - - - - - 3 - emp3First - emp3Last - emp3Middle - 5/Sep/1972 - 15/Aug/2002 - 15 - 19 - - - - - - - 4 - emp4First - emp4Last - emp4Middle - 6/Sep/1973 - 15/Apr/2001 - 13 - - - - - - - 5 - emp5First - emp5Last - emp5Middle - 5/Jul/1962 - 15/Aug/1998 - 45000 - - - - - - - - - - - - - - - 1 - Unter den Linden 1 - Berlin - - 12345 - Germany - - - 2 - Broadway 1 - New York - NY - 10000 - USA - - - 3 - Market St. - San Francisco - CA - 94102 - USA - - - - 1 - Carrier1 - PPO - - - - 2 - Carrier2 - HMO - - - - 3 - Carrier2 - HMO - - - - 4 - Carrier2 - 99.999 - - - - 1 - orange - 2500000.99 - - - 2 - blue - 50000.00 - - - 3 - green - 2000.99 - - - diff --git a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyAllRelationships.xml b/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyAllRelationships.xml deleted file mode 100644 index afc493719..000000000 --- a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyAllRelationships.xml +++ /dev/null @@ -1,406 +0,0 @@ - - - - - Company instances for CompletenessTest with all relationships - - - - - - - - - - - 1 - Sun Microsystems, Inc. - 11/Apr/1952 - - - - - - - - - - - 1 - Development - - - - - - - - - - - - - - - - - - - 2 - Human Resources - - - - - - - - - - - - - - - - - - 1 - emp1First - emp1Last - emp1Middle - 10/Jun/1970 - - 1/Jan/1999 - 20000 - 40 - - - - - 1111 - 123456-1 - - - - - - - - - - - - - - - - - - - - - 2 - emp2First - emp2Last - emp2Middle - 22/Dec/1975 - - 1/Jul/2003 - 10000 - 40 - - - - - 2222 - 123456-2 - - - - - - - - - - - - - - - - - - - - - - - - 3 - emp3First - emp3Last - emp3Middle - 5/Sep/1972 - - 15/Aug/2002 - 15 - 19 - - - - - 3333 - 123456-3 - - - - - - - - - - - - - - - - - 4 - emp4First - emp4Last - emp4Middle - 6/Sep/1973 - - 15/Apr/2001 - 13 - - - - - 3343 - 124456-3 - - - - - - - - - - - - - - - - - - - - - 5 - emp5First - emp5Last - emp5Middle - 5/Jul/1962 - - 15/Aug/1998 - 45000 - - - - - 3363 - 126456-3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - Unter den Linden 1 - Berlin - - 12345 - Germany - - - 2 - Broadway 1 - New York - NY - 10000 - USA - - - 3 - Market St. - San Francisco - CA - 94102 - USA - - - - 1 - Carrier1 - PPO - - - - - 2 - Carrier2 - HMO - - - - - 3 - Carrier3 - HMO - - - - - 4 - Carrier4 - HMO - - - - - 5 - Carrier5 - HMO - - - - - 11 - Carrier1 - 99.999 - - - - - 12 - Carrier2 - 99.999 - - - - - 13 - Carrier3 - 99.999 - - - - - 14 - Carrier4 - 99.999 - - - - - 15 - Carrier5 - 99.999 - - - - - 1 - orange - 2500000.99 - - - - - - - - - - 2 - blue - 50000.00 - - - - - - - - - - - - - - - 3 - green - 2000.99 - - - - - - - - - - - - - - diff --git a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyEmbedded.xml b/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyEmbedded.xml deleted file mode 100644 index 41c3eab6c..000000000 --- a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyEmbedded.xml +++ /dev/null @@ -1,212 +0,0 @@ - - - - - Company instances for CompletenessTest with embedded relationships - - - - - - - - - - - - - - - - - - - - - - - - - 1 - Sun Microsystems, Inc. - 11/Apr/1952 - - - - - 1 - Development - - - - 2 - Human Resources - - - - 1 - emp1First - emp1Last - emp1Middle - 10/Jun/1970 - - 1/Jan/1999 - 20000 - 40 - - - 1111 - 123456-1 - - - - - 2 - emp2First - emp2Last - emp2Middle - 22/Dec/1975 - - 1/Jul/2003 - 10000 - 40 - - - 2222 - 123456-2 - - - - - 3 - emp3First - emp3Last - emp3Middle - 5/Sep/1972 - - 15/Aug/2002 - 15 - 19 - - - 3333 - 123456-3 - - - - - 4 - emp4First - emp4Last - emp4Middle - 6/Sep/1973 - - 15/Apr/2001 - 13 - - - 3343 - 124456-3 - - - - - 5 - emp5First - emp5Last - emp5Middle - 5/Jul/1962 - - 15/Aug/1998 - 45000 - - - 3363 - 126456-3 - - - - - - 1 - Unter den Linden 1 - Berlin - - 12345 - Germany - - - 2 - Broadway 1 - New York - NY - 10000 - USA - - - 3 - Market St. - San Francisco - CA - 94102 - USA - - - - 1 - Carrier1 - PPO - - - - 2 - Carrier2 - HMO - - - - 3 - Carrier2 - HMO - - - - 4 - Carrier2 - 99.999 - - - - 1 - orange - 2500000.99 - - - 2 - blue - 50000.00 - - - 3 - green - 2000.99 - - diff --git a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyForNavigationTests.xml b/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyForNavigationTests.xml deleted file mode 100644 index 13a5b7b87..000000000 --- a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyForNavigationTests.xml +++ /dev/null @@ -1,562 +0,0 @@ - - - - - Company instances for navigation query testing - - - - - - - - - - - - - 1 - Sun Microsystems, Inc. - 11/Apr/1952 - - - - - - - - - - - 1 - Comfy Room - - - 2 - Large Discussion Room - - - 3 - Conference Room - - - - 1 - Development - - - - - - - - - - - - - - - 2 - Human Resources - - - - - - - - - - - - - 0 - emp0First - emp0Last - emp0Middle - 10/Jul/1962 - - 1/Jan/1997 - 50000 - 40 - - - - - 3232 - 223311-1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - emp1First - emp1Last - emp1Middle - 10/Jun/1970 - - 1/Jan/1999 - 20000 - 40 - - - - - 1111 - 123456-1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 2 - emp2First - emp2Last - emp2Middle - 22/Dec/1975 - - 1/Jul/2003 - 10000 - 40 - - - - - 2222 - 123456-2 - - - - - - - - - - - - - - - - - - - 3 - emp3First - emp3Last - emp3Middle - 5/Sep/1972 - - 15/Aug/2002 - 15 - 19 - - - - - 3333 - 123456-3 - - - - - - - - - - - - - - - - - - - 4 - emp4First - emp4Last - emp4Middle - 6/Sep/1973 - - 15/Apr/2001 - 25000 - 40 - - - - - 3343 - 124456-3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - emp5First - emp5Last - emp5Middle - 5/Jul/1962 - - 1/Nov/2002 - 18000 - 35 - - - - - 3363 - 126456-3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6 - emp6First - emp6Last - emp6Middle - 10/Jun/1969 - - 1/Jun/2002 - 22000 - 40 - - - - - - - 7 - emp7First - emp7Last - emp7Middle - 10/Jun/1970 - - 1/Jan/2000 - 40000 - 40 - - - - - - - - - - - - 8 - emp8First - emp8Last - emp8Middle - 22/Dec/1975 - - 1/Aug/2003 - 10000 - 15 - - - - - - - 9 - emp9First - emp9Last - emp9Middle - 5/Sep/1972 - - 1/May/2002 - 12000 - 20 - - - - - - - 10 - emp10First - emp10Last - emp10Middle - 5/Sep/1972 - - 1/Oct/2002 - 24000 - 40 - - - - - - - 1 - Unter den Linden 1 - Berlin - - 12345 - Germany - - - 2 - Broadway 1 - New York - NY - 10000 - USA - - - 3 - Market St. - San Francisco - CA - 94102 - USA - - - - 1 - Carrier1 - PPO - - - - - 2 - Carrier2 - HMO - - - - - 3 - Carrier3 - HMO - - - - - 4 - Carrier4 - HMO - - - - - 5 - Carrier5 - HMO - - - - - 98 - Carrier98 - HMO - - - - - 11 - Carrier1 - 99.995 - - - - - 12 - Carrier2 - 99.996 - - - - - 13 - Carrier3 - 99.997 - - - - - 14 - Carrier4 - 99.998 - - - - - 15 - Carrier5 - 99.999 - - - - - 99 - Carrier99 - - - - - - 1 - orange - 2500000.99 - - - - - - - - - - 2 - blue - 50000.00 - - - - - - - - - - - - - - - 3 - green - 2000.99 - - - - - - - - - - - - - - diff --git a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyForQueryTests.xml b/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyForQueryTests.xml deleted file mode 100644 index 755351aca..000000000 --- a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyForQueryTests.xml +++ /dev/null @@ -1,437 +0,0 @@ - - - - - Company instances for query testing - - - - - - - - - - - - 1 - Sun Microsystems, Inc. - 11/Apr/1952 - - - - - - - - - - - 1 - Comfy Room - - - 2 - Large Discussion Room - - - 3 - Conference Room - - - - 1 - Development - - - - - - - - - - - - - - - - - - - - - - - - - 2 - Human Resources - - - - - - - - - - - - - - - - - - - - - - 1 - emp1First - emp1Last - emp1Middle - 10/Jun/1970 - - 1/Jan/1999 - 20000 - 40 - - - - - 1111 - 123456-1 - - - - - - - - - - - - - - - - - - - - - 2 - emp2First - emp2Last - emp2Middle - 22/Dec/1975 - - 1/Jul/2003 - 10000 - 40 - - - - - 2222 - 123456-2 - - - - - - - - - - - - - - - - - - - - - - - - 3 - emp3First - emp3Last - emp3Middle - 5/Sep/1972 - - 15/Aug/2002 - 15 - 19 - - - - - 3333 - 123456-3 - - - - - - - - - - - - - - - - - 4 - emp4First - emp4Last - emp4Middle - 6/Sep/1973 - - 15/Apr/2001 - 13 - - - - - 3343 - 124456-3 - - - - - - - - - - - - - - - - - - - - - 5 - emp5First - emp5Last - emp5Middle - 5/Jul/1962 - - 15/Aug/1998 - 45000 - - - - - 3363 - 126456-3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - Unter den Linden 1 - Berlin - - 12345 - Germany - - - 2 - Broadway 1 - New York - NY - 10000 - USA - - - 3 - Market St. - San Francisco - CA - 94102 - USA - - - - 1 - Carrier1 - PPO - - - - - 2 - Carrier2 - HMO - - - - - 3 - Carrier3 - HMO - - - - - 4 - Carrier4 - HMO - - - - - 5 - Carrier5 - HMO - - - - - 11 - Carrier1 - 99.995 - - - - - 12 - Carrier2 - 99.996 - - - - - 13 - Carrier3 - 99.997 - - - - - 14 - Carrier4 - 99.998 - - - - - 15 - Carrier5 - 99.999 - - - - - 99 - Carrier99 - - - - - 1 - orange - 2500000.99 - - - - - - - - - - 2 - blue - 50000.00 - - - - - - - - - - - - - - - 3 - green - 2000.99 - - - - - - - - - - - - - - - diff --git a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyForSampleQueriesTest.xml b/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyForSampleQueriesTest.xml deleted file mode 100644 index 82fe49736..000000000 --- a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyForSampleQueriesTest.xml +++ /dev/null @@ -1,486 +0,0 @@ - - - - - Company instances for query testing - - - - - - - - - - - - 1 - Sun Microsystems, Inc. - 11/Apr/1952 - - - - - - - - - - - - 1 - Comfy Room - - - 2 - Large Discussion Room - - - 3 - Conference Room - - - - 1 - R&D - - - - - - - - - - - - - - - - - - - - - - - - - 2 - Sales - - - - - - - - - - - - - - - - - - - - - - 3 - Marketing - - - - - - - - - - - - - - - - - 1 - Michael - Bouschen - - 10/Jun/1970 - - 1/Jan/1999 - 40000 - 40 - - - - - 1111 - 123456-1 - - - - - German - English - - - - - - - - - - - - - - - - - - - - - 2 - Craig - L. - Russell - 22/Dec/1975 - - 1/Jul/2003 - 50000 - 40 - - - - - 2222 - 123456-2 - - - - - English - Japanese - - - - - - - - - - - - - - - - - - - - - - - - 3 - Joe - Doe - - 5/Sep/1972 - - 15/Aug/2002 - 15 - 19 - - - - - 3333 - 123456-3 - - - - - English - French - - - - - - - - - - - - - - - - - 4 - Jane - Roe - - 6/Sep/1973 - - 15/Apr/2001 - 13 - - - - - 3343 - 124456-3 - - - - - English - - - - - - - - - - - - - - - - - - - - - 5 - Tillmann - Zäschke - - 5/Jul/1979 - - 15/Aug/1999 - 45000 - - - - - 3363 - 126456-3 - - - - - German - English - French - Japanese - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - Unter den Linden 1 - Berlin - - 12345 - Germany - - - 2 - Broadway 1 - New York - NY - 10000 - USA - - - 3 - Market St. - San Francisco - CA - 94102 - USA - - - - 1 - Carrier1 - PPO - - - - - 2 - Carrier2 - HMO - - - - - 3 - Carrier3 - HMO - - - - - 4 - Carrier4 - HMO - - - - - 5 - Carrier5 - HMO - - - - - 11 - Carrier1 - 99.995 - - - - - 12 - Carrier2 - 99.996 - - - - - 13 - Carrier3 - 99.997 - - - - - 14 - Carrier4 - 99.998 - - - - - 15 - Carrier5 - 99.999 - - - - - 99 - Carrier99 - - - - - 1 - orange - 2500000.99 - - - - - - - - - - 2 - blue - 50000.00 - - - - - - - - - - - - - - - 3 - green - 2000.99 - - - - - - - - - - - - - - diff --git a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyForSubqueriesTests.xml b/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyForSubqueriesTests.xml deleted file mode 100644 index 389bb7f53..000000000 --- a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyForSubqueriesTests.xml +++ /dev/null @@ -1,282 +0,0 @@ - - - - - Company instances for query testing - - - - - - - - - - - 1 - Sun Microsystems, Inc. - 11/Apr/1952 - - - - - - - - - - - 1 - Comfy Room - - - 2 - Large Discussion Room - - - 3 - Conference Room - - - - 1 - Development - - - - - - - - - - - - - - - - - - - - - 2 - Human Resources - - - - - - - - - - - - - - - - - - 1 - emp1First - emp1Last - emp1Middle - 10/Jun/1970 - - 1/Jan/1999 - 30000 - 40 - - - - - - - - - - - - 2 - emp2First - emp2Last - emp2Middle - 22/Dec/1975 - - 1/Jul/2003 - 20000 - 40 - - - - - - 3 - emp3First - emp3Last - emp3Middle - 5/Sep/1972 - - 15/Aug/2002 - 10000 - 25 - - - - - - 4 - emp4First - emp4Last - emp4Middle - 6/Sep/1973 - - 15/Apr/2001 - 25000 - 40 - - - - - - - - - - - 5 - emp5First - emp5Last - emp5Middle - 5/Jul/1962 - - 1/Nov/2002 - 18000 - 35 - - - - - - 6 - emp6First - emp6Last - emp6Middle - 10/Jun/1969 - - 1/Jun/2002 - 22000 - 40 - - - - - - 7 - emp7First - emp7Last - emp7Middle - 10/Jun/1970 - - 1/Jan/2000 - 40000 - 40 - - - - - - - - - - - 8 - emp8First - emp8Last - emp8Middle - 22/Dec/1975 - - 1/Aug/2003 - 10000 - 15 - - - - - - 9 - emp9First - emp9Last - emp9Middle - 5/Sep/1972 - - 1/May/2002 - 12000 - 20 - - - - - - 10 - emp10First - emp10Last - emp10Middle - 5/Sep/1972 - - 1/Oct/2002 - 24000 - 40 - - - - - - - 1 - Unter den Linden 1 - Berlin - - 12345 - Germany - - - 2 - Broadway 1 - New York - NY - 10000 - USA - - - 3 - Market St. - San Francisco - CA - 94102 - USA - - - diff --git a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyM-MRelationships.xml b/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyM-MRelationships.xml deleted file mode 100644 index 310d02848..000000000 --- a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyM-MRelationships.xml +++ /dev/null @@ -1,246 +0,0 @@ - - - - - Company instances for CompletenessTest with m-m relationships - - - - - - - - - - - - - - - - - - - - - - 1 - Sun Microsystems, Inc. - 11/Apr/1952 - - - - 1 - Development - - - - 2 - Human Resources - - - - 1 - emp1First - emp1Last - emp1Middle - 10/Jun/1970 - 1/Jan/1999 - 20000 - 40 - - - - - - - - - - - - - 2 - emp2First - emp2Last - emp2Middle - 22/Dec/1975 - 1/Jul/2003 - 10000 - 40 - - - - - - - - - 3 - emp3First - emp3Last - emp3Middle - 5/Sep/1972 - 15/Aug/2002 - 15 - 19 - - - - - - - - - 4 - emp4First - emp4Last - emp4Middle - 6/Sep/1973 - 15/Apr/2001 - 13 - - - - - - - - - - - - - 5 - emp5First - emp5Last - emp5Middle - 5/Jul/1962 - 15/Aug/1998 - 45000 - - - - - - - - - - - - - - 1 - Unter den Linden 1 - Berlin - - 12345 - Germany - - - 2 - Broadway 1 - New York - NY - 10000 - USA - - - 3 - Market St. - San Francisco - CA - 94102 - USA - - - - 1 - Carrier1 - PPO - - - - 2 - Carrier2 - HMO - - - - 3 - Carrier2 - HMO - - - - 4 - Carrier2 - 99.999 - - - - 1 - orange - 2500000.99 - - - - - - - - - - 2 - blue - 50000.00 - - - - - - - - - - - - - - - 3 - green - 2000.99 - - - - - - - - - - - - - - diff --git a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyNoRelationships.xml b/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyNoRelationships.xml deleted file mode 100644 index 683c97718..000000000 --- a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/company/companyNoRelationships.xml +++ /dev/null @@ -1,152 +0,0 @@ - - - - - Company instances for CompletenessTest with no relationships - - - - - - - - - - - - - - - - - - - - - - - - - 1 - Sun Microsystems, Inc. - 11/Apr/1952 - - - - 1 - Development - - - - 2 - Human Resources - - - - 1 - emp1First - emp1Last - emp1Middle - 10/Jun/1970 - 1/Jan/1999 - 20000 - 40 - - - 2 - emp2First - emp2Last - emp2Middle - 22/Dec/1975 - 1/Jul/2003 - 10000 - 40 - - - 3 - emp3First - emp3Last - emp3Middle - 5/Sep/1972 - 15/Aug/2002 - 15 - 19 - - - 4 - emp4First - emp4Last - emp4Middle - 6/Sep/1973 - 15/Apr/2001 - 13 - - - 5 - emp5First - emp5Last - emp5Middle - 5/Jul/1962 - 15/Aug/1998 - 45000 - - - - 1 - Carrier1 - PPO - - - - 2 - Carrier2 - HMO - - - - 3 - Carrier2 - HMO - - - - 4 - Carrier2 - 99.999 - - - - 1 - orange - 2500000.99 - - - 2 - blue - 50000.00 - - - 3 - green - 2000.99 - - - diff --git a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/companyListWithoutJoin/companyListWithoutJoin.xml b/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/companyListWithoutJoin/companyListWithoutJoin.xml deleted file mode 100644 index f7a4c9f1f..000000000 --- a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/companyListWithoutJoin/companyListWithoutJoin.xml +++ /dev/null @@ -1,154 +0,0 @@ - - - - - Company instances for CompletenessTest with Map without join table - - - - - - - - - - - 1 - Sun Microsystems, Inc. - 11/Apr/1952 - - - - - - - - - - 1 - Development - - - - - - - - - - - - 2 - Human Resources - - - - - - - - - - - 1 - emp1First - emp1Last - emp1Middle - 10/Jun/1970 - 1/Jan/1999 - 60000 - 40 - - - - - - - 2 - emp2First - emp2Last - emp2Middle - 22/Dec/1975 - 1/Jul/2003 - 47000 - 40 - - - - - - - - - - - - - - 3 - emp3First - emp3Last - emp3Middle - 5/Sep/1972 - 15/Aug/2002 - 67.00 - 19 - - - - - - - 4 - emp4First - emp4Last - emp4Middle - 6/Sep/1973 - 15/Apr/2001 - 37.00 - - - - - - - 5 - emp5First - emp5Last - emp5Middle - 5/Jul/1962 - 15/Aug/1998 - 73000 - - - - - - - - - - - - - - - diff --git a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/companyMapWithoutJoin/companyMapWithoutJoin.xml b/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/companyMapWithoutJoin/companyMapWithoutJoin.xml deleted file mode 100644 index 2909f7f5e..000000000 --- a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/companyMapWithoutJoin/companyMapWithoutJoin.xml +++ /dev/null @@ -1,169 +0,0 @@ - - - - - Company instances for CompletenessTest with Map without join table - - - - - - - - - - - 1 - Sun Microsystems, Inc. - 11/Apr/1952 - - - - - - - - - - 1 - Development - - - - - - - - - - - - - - - - - - 2 - Human Resources - - - - - - - - - - - - - - - 1 - emp1First - emp1Last - emp1Middle - 10/Jun/1970 - 1/Jan/1999 - role1 - 60000 - 40 - - - - - - - 2 - emp2First - emp2Last - emp2Middle - 22/Dec/1975 - 1/Jul/2003 - role2 - 47000 - 40 - - - - - - - - - - - - - - 3 - emp3First - emp3Last - emp3Middle - 5/Sep/1972 - 15/Aug/2002 - role3 - 67.00 - 19 - - - - - - - 4 - emp4First - emp4Last - emp4Middle - 6/Sep/1973 - 15/Apr/2001 - role4 - 37.00 - - - - - - - 5 - emp5First - emp5Last - emp5Middle - 5/Jul/1962 - 15/Aug/1998 - role5 - 73000 - - - - - - - - - - - - - - - diff --git a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/mylib/mylibForQueryTests.xml b/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/mylib/mylibForQueryTests.xml deleted file mode 100644 index ee000b321..000000000 --- a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/mylib/mylibForQueryTests.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - 1 - 4 - 4 - 4 - 4 - 4.0 - 4.0 - 4.0 - 4.0 - - - - 2 - -4 - -4 - -4 - -4 - -4.0 - -4.0 - -4.0 - -4.0 - - - - 1 - 10 - 10 - - - - 2 - 20 - 20 - - - - 3 - O - O - Even - - diff --git a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/order/order.xml b/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/order/order.xml deleted file mode 100644 index ab37946df..000000000 --- a/tck/src/main/resources/testdata/org/apache/jdo/tck/pc/order/order.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - Order instances for CompletenessTest of compound identity - - - - - - - - - - - 1 - 3 - - - - - - - - - - - - 1 - - - SunRay - 15 - - - - - - - 1 - - - Sun Ultra 40 - 3 - - - - - From c24a2ed5f0dfdd51ace600de4977df6b5567b991 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 26 Oct 2025 19:02:03 +0100 Subject: [PATCH 38/43] Update Variable.java --- .../java/org/apache/jdo/tck/query/result/Variable.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tck/src/main/java/org/apache/jdo/tck/query/result/Variable.java b/tck/src/main/java/org/apache/jdo/tck/query/result/Variable.java index e7f67099d..fd9fb6acf 100644 --- a/tck/src/main/java/org/apache/jdo/tck/query/result/Variable.java +++ b/tck/src/main/java/org/apache/jdo/tck/query/result/Variable.java @@ -212,7 +212,7 @@ public void testNavigation() { /** */ @SuppressWarnings("unchecked") @Test - // @Execution(ExecutionMode.CONCURRENT) + @Execution(ExecutionMode.CONCURRENT) public void testNoNavigation() { List expected = getTransientCompanyModelInstancesAsList( @@ -296,7 +296,7 @@ public void testMultipleProjectionWithConstraints() { /** */ @SuppressWarnings("unchecked") @Test - // @Execution(ExecutionMode.CONCURRENT) TODO fails! + @Execution(ExecutionMode.CONCURRENT) public void testNavigationWithCompanyAndDepartmentAndEmployeeAndProject() { Object expected = Arrays.asList( @@ -352,7 +352,7 @@ public void testNavigationWithCompanyAndDepartmentAndEmployeeAndProject() { /** */ @SuppressWarnings("unchecked") @Test - // @Execution(ExecutionMode.CONCURRENT) // TODO this fixed it + @Execution(ExecutionMode.CONCURRENT) public void testNavigationWithCompanyAndEmployeeAndProject() { Object expected = Arrays.asList( @@ -652,7 +652,7 @@ public void testNavigationWithThisConstraint() { /** */ @SuppressWarnings("unchecked") @Test - // @Execution(ExecutionMode.CONCURRENT) + @Execution(ExecutionMode.CONCURRENT) public void testNavigationWithCompanyConstraint() { Object expected = Arrays.asList( From bdb8b7d29cbfd00ebebf3e00d02f514051ff24a8 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sun, 26 Oct 2025 19:05:36 +0100 Subject: [PATCH 39/43] Remove XML files --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d7b4fa281..f01fb1e5a 100644 --- a/README.md +++ b/README.md @@ -158,7 +158,7 @@ While running the TCK, maven uses the following configuration files in src/conf: * test configuration files (*.conf). Each of these files sets values for * jdo.tck.testdescription : An optional string describing the purpose of these tests * jdo.tck.classes : A list of one or more test classes (required) - * jdo.tck.testdata : The fully qualified file name of the class that creates test data file(optional) + * jdo.tck.testdata : The fully qualified file name of the class that creates test data (optional) * jdo.tck.mapping : The file designator that maven.xml uses to build a javax.jdo.option.Mapping value and corresponding schema name (required) * exclude.list : A list of test classes NOT to execute during a TCK test run From 7e28e9c24a7c6581e6fca6e6fb1ea079e217f422 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Sat, 15 Nov 2025 18:42:53 +0100 Subject: [PATCH 40/43] Fixed wildcard imports --- .../jdo/tck/pc/company/CompanyModelReader.java | 4 +++- .../tck/pc/company/data/EmbeddedTestData.java | 15 +++++++++++++-- .../tck/pc/company/data/NavigationTestData.java | 16 ++++++++++++++-- .../jdo/tck/pc/company/data/QueryTestData.java | 17 +++++++++++++++-- .../pc/company/data/Relationships1_1Data.java | 14 ++++++++++++-- .../pc/company/data/Relationships1_MData.java | 14 ++++++++++++-- .../pc/company/data/RelationshipsAllData.java | 15 +++++++++++++-- .../pc/company/data/RelationshipsM_MData.java | 14 ++++++++++++-- .../pc/company/data/RelationshipsNoData.java | 14 ++++++++++++-- .../pc/company/data/SampleQueryTestData.java | 17 +++++++++++++++-- .../tck/pc/company/data/SubqueryTestData.java | 14 +++++++++++--- .../CompanyModelReader.java | 4 +++- .../CompanyModelTestData.java | 4 +++- .../CompanyModelReader.java | 4 +++- .../CompanyModelTestData.java | 4 +++- .../jdo/tck/pc/order/OrderModelTestData.java | 2 +- .../org/apache/jdo/tck/util/DataSourceUtil.java | 8 +++++++- .../util/DefaultListableInstanceFactory.java | 5 ++++- .../apache/jdo/tck/util/jndi/MockContext.java | 8 +++++++- 19 files changed, 163 insertions(+), 30 deletions(-) diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java index 2f002d9d3..25b561407 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java @@ -17,7 +17,9 @@ package org.apache.jdo.tck.pc.company; -import java.util.*; +import java.util.Date; +import java.util.Locale; + import org.apache.jdo.tck.util.ConversionHelper; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; import org.apache.jdo.tck.util.JDOCustomDateEditor; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java index 65dfb6078..60d920857 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java @@ -17,10 +17,21 @@ package org.apache.jdo.tck.pc.company.data; -import static org.apache.jdo.tck.util.DataSourceUtil.*; +import static org.apache.jdo.tck.util.DataSourceUtil.date; +import static org.apache.jdo.tck.util.DataSourceUtil.toMap; +import static org.apache.jdo.tck.util.DataSourceUtil.toSet; import java.math.BigDecimal; -import org.apache.jdo.tck.pc.company.*; + +import org.apache.jdo.tck.pc.company.CompanyFactory; +import org.apache.jdo.tck.pc.company.IAddress; +import org.apache.jdo.tck.pc.company.ICompany; +import org.apache.jdo.tck.pc.company.IDentalInsurance; +import org.apache.jdo.tck.pc.company.IDepartment; +import org.apache.jdo.tck.pc.company.IFullTimeEmployee; +import org.apache.jdo.tck.pc.company.IMedicalInsurance; +import org.apache.jdo.tck.pc.company.IPartTimeEmployee; +import org.apache.jdo.tck.pc.company.IProject; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; public class EmbeddedTestData implements CompanyDataSource { diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java index 08dc79252..fd5906cb0 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java @@ -17,10 +17,22 @@ package org.apache.jdo.tck.pc.company.data; -import static org.apache.jdo.tck.util.DataSourceUtil.*; +import static org.apache.jdo.tck.util.DataSourceUtil.date; +import static org.apache.jdo.tck.util.DataSourceUtil.toMap; +import static org.apache.jdo.tck.util.DataSourceUtil.toSet; import java.math.BigDecimal; -import org.apache.jdo.tck.pc.company.*; + +import org.apache.jdo.tck.pc.company.CompanyFactory; +import org.apache.jdo.tck.pc.company.IAddress; +import org.apache.jdo.tck.pc.company.ICompany; +import org.apache.jdo.tck.pc.company.IDentalInsurance; +import org.apache.jdo.tck.pc.company.IDepartment; +import org.apache.jdo.tck.pc.company.IFullTimeEmployee; +import org.apache.jdo.tck.pc.company.IMedicalInsurance; +import org.apache.jdo.tck.pc.company.IMeetingRoom; +import org.apache.jdo.tck.pc.company.IPartTimeEmployee; +import org.apache.jdo.tck.pc.company.IProject; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; public class NavigationTestData implements CompanyDataSource { diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java index 9cfcf902e..db00897a3 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java @@ -17,10 +17,23 @@ package org.apache.jdo.tck.pc.company.data; -import static org.apache.jdo.tck.util.DataSourceUtil.*; +import static org.apache.jdo.tck.util.DataSourceUtil.date; +import static org.apache.jdo.tck.util.DataSourceUtil.toList; +import static org.apache.jdo.tck.util.DataSourceUtil.toMap; +import static org.apache.jdo.tck.util.DataSourceUtil.toSet; import java.math.BigDecimal; -import org.apache.jdo.tck.pc.company.*; + +import org.apache.jdo.tck.pc.company.CompanyFactory; +import org.apache.jdo.tck.pc.company.IAddress; +import org.apache.jdo.tck.pc.company.ICompany; +import org.apache.jdo.tck.pc.company.IDentalInsurance; +import org.apache.jdo.tck.pc.company.IDepartment; +import org.apache.jdo.tck.pc.company.IFullTimeEmployee; +import org.apache.jdo.tck.pc.company.IMedicalInsurance; +import org.apache.jdo.tck.pc.company.IMeetingRoom; +import org.apache.jdo.tck.pc.company.IPartTimeEmployee; +import org.apache.jdo.tck.pc.company.IProject; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; public class QueryTestData implements CompanyDataSource { diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java index bcbeded7d..2bc033b72 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java @@ -17,10 +17,20 @@ package org.apache.jdo.tck.pc.company.data; -import static org.apache.jdo.tck.util.DataSourceUtil.*; +import static org.apache.jdo.tck.util.DataSourceUtil.date; +import static org.apache.jdo.tck.util.DataSourceUtil.toSet; import java.math.BigDecimal; -import org.apache.jdo.tck.pc.company.*; + +import org.apache.jdo.tck.pc.company.CompanyFactory; +import org.apache.jdo.tck.pc.company.IAddress; +import org.apache.jdo.tck.pc.company.ICompany; +import org.apache.jdo.tck.pc.company.IDentalInsurance; +import org.apache.jdo.tck.pc.company.IDepartment; +import org.apache.jdo.tck.pc.company.IFullTimeEmployee; +import org.apache.jdo.tck.pc.company.IMedicalInsurance; +import org.apache.jdo.tck.pc.company.IPartTimeEmployee; +import org.apache.jdo.tck.pc.company.IProject; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; public class Relationships1_1Data implements CompanyDataSource { diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java index 5171199b4..cda25676a 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java @@ -17,10 +17,20 @@ package org.apache.jdo.tck.pc.company.data; -import static org.apache.jdo.tck.util.DataSourceUtil.*; +import static org.apache.jdo.tck.util.DataSourceUtil.date; +import static org.apache.jdo.tck.util.DataSourceUtil.toSet; import java.math.BigDecimal; -import org.apache.jdo.tck.pc.company.*; + +import org.apache.jdo.tck.pc.company.CompanyFactory; +import org.apache.jdo.tck.pc.company.IAddress; +import org.apache.jdo.tck.pc.company.ICompany; +import org.apache.jdo.tck.pc.company.IDentalInsurance; +import org.apache.jdo.tck.pc.company.IDepartment; +import org.apache.jdo.tck.pc.company.IFullTimeEmployee; +import org.apache.jdo.tck.pc.company.IMedicalInsurance; +import org.apache.jdo.tck.pc.company.IPartTimeEmployee; +import org.apache.jdo.tck.pc.company.IProject; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; public class Relationships1_MData implements CompanyDataSource { diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java index eb13a672e..a08f41bfb 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java @@ -17,10 +17,21 @@ package org.apache.jdo.tck.pc.company.data; -import static org.apache.jdo.tck.util.DataSourceUtil.*; +import static org.apache.jdo.tck.util.DataSourceUtil.date; +import static org.apache.jdo.tck.util.DataSourceUtil.toMap; +import static org.apache.jdo.tck.util.DataSourceUtil.toSet; import java.math.BigDecimal; -import org.apache.jdo.tck.pc.company.*; + +import org.apache.jdo.tck.pc.company.CompanyFactory; +import org.apache.jdo.tck.pc.company.IAddress; +import org.apache.jdo.tck.pc.company.ICompany; +import org.apache.jdo.tck.pc.company.IDentalInsurance; +import org.apache.jdo.tck.pc.company.IDepartment; +import org.apache.jdo.tck.pc.company.IFullTimeEmployee; +import org.apache.jdo.tck.pc.company.IMedicalInsurance; +import org.apache.jdo.tck.pc.company.IPartTimeEmployee; +import org.apache.jdo.tck.pc.company.IProject; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; public class RelationshipsAllData implements CompanyDataSource { diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java index f85acaacf..ff1eb7c93 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java @@ -17,10 +17,20 @@ package org.apache.jdo.tck.pc.company.data; -import static org.apache.jdo.tck.util.DataSourceUtil.*; +import static org.apache.jdo.tck.util.DataSourceUtil.date; +import static org.apache.jdo.tck.util.DataSourceUtil.toSet; import java.math.BigDecimal; -import org.apache.jdo.tck.pc.company.*; + +import org.apache.jdo.tck.pc.company.CompanyFactory; +import org.apache.jdo.tck.pc.company.IAddress; +import org.apache.jdo.tck.pc.company.ICompany; +import org.apache.jdo.tck.pc.company.IDentalInsurance; +import org.apache.jdo.tck.pc.company.IDepartment; +import org.apache.jdo.tck.pc.company.IFullTimeEmployee; +import org.apache.jdo.tck.pc.company.IMedicalInsurance; +import org.apache.jdo.tck.pc.company.IPartTimeEmployee; +import org.apache.jdo.tck.pc.company.IProject; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; public class RelationshipsM_MData implements CompanyDataSource { diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java index 0e6334dfe..1d287bbc9 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java @@ -17,10 +17,20 @@ package org.apache.jdo.tck.pc.company.data; -import static org.apache.jdo.tck.util.DataSourceUtil.*; +import static org.apache.jdo.tck.util.DataSourceUtil.date; +import static org.apache.jdo.tck.util.DataSourceUtil.toSet; import java.math.BigDecimal; -import org.apache.jdo.tck.pc.company.*; + +import org.apache.jdo.tck.pc.company.CompanyFactory; +import org.apache.jdo.tck.pc.company.IAddress; +import org.apache.jdo.tck.pc.company.ICompany; +import org.apache.jdo.tck.pc.company.IDentalInsurance; +import org.apache.jdo.tck.pc.company.IDepartment; +import org.apache.jdo.tck.pc.company.IFullTimeEmployee; +import org.apache.jdo.tck.pc.company.IMedicalInsurance; +import org.apache.jdo.tck.pc.company.IPartTimeEmployee; +import org.apache.jdo.tck.pc.company.IProject; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; public class RelationshipsNoData implements CompanyDataSource { diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java index 0edbbfac1..783f8fe9c 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java @@ -17,10 +17,23 @@ package org.apache.jdo.tck.pc.company.data; -import static org.apache.jdo.tck.util.DataSourceUtil.*; +import static org.apache.jdo.tck.util.DataSourceUtil.date; +import static org.apache.jdo.tck.util.DataSourceUtil.toList; +import static org.apache.jdo.tck.util.DataSourceUtil.toMap; +import static org.apache.jdo.tck.util.DataSourceUtil.toSet; import java.math.BigDecimal; -import org.apache.jdo.tck.pc.company.*; + +import org.apache.jdo.tck.pc.company.CompanyFactory; +import org.apache.jdo.tck.pc.company.IAddress; +import org.apache.jdo.tck.pc.company.ICompany; +import org.apache.jdo.tck.pc.company.IDentalInsurance; +import org.apache.jdo.tck.pc.company.IDepartment; +import org.apache.jdo.tck.pc.company.IFullTimeEmployee; +import org.apache.jdo.tck.pc.company.IMedicalInsurance; +import org.apache.jdo.tck.pc.company.IMeetingRoom; +import org.apache.jdo.tck.pc.company.IPartTimeEmployee; +import org.apache.jdo.tck.pc.company.IProject; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; public class SampleQueryTestData implements CompanyDataSource { diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java index 01296c655..1062cd123 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SubqueryTestData.java @@ -17,9 +17,17 @@ package org.apache.jdo.tck.pc.company.data; -import static org.apache.jdo.tck.util.DataSourceUtil.*; - -import org.apache.jdo.tck.pc.company.*; +import static org.apache.jdo.tck.util.DataSourceUtil.date; +import static org.apache.jdo.tck.util.DataSourceUtil.toList; +import static org.apache.jdo.tck.util.DataSourceUtil.toSet; + +import org.apache.jdo.tck.pc.company.CompanyFactory; +import org.apache.jdo.tck.pc.company.IAddress; +import org.apache.jdo.tck.pc.company.ICompany; +import org.apache.jdo.tck.pc.company.IDepartment; +import org.apache.jdo.tck.pc.company.IFullTimeEmployee; +import org.apache.jdo.tck.pc.company.IMeetingRoom; +import org.apache.jdo.tck.pc.company.IPartTimeEmployee; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; public class SubqueryTestData implements CompanyDataSource { diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java index 8827c28e9..912683fb5 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java @@ -17,7 +17,9 @@ package org.apache.jdo.tck.pc.companyListWithoutJoin; -import java.util.*; +import java.util.Date; +import java.util.Locale; + import org.apache.jdo.tck.util.ConversionHelper; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; import org.apache.jdo.tck.util.JDOCustomDateEditor; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelTestData.java index 49db73355..117a93167 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelTestData.java @@ -17,7 +17,9 @@ package org.apache.jdo.tck.pc.companyListWithoutJoin; -import static org.apache.jdo.tck.util.DataSourceUtil.*; +import static org.apache.jdo.tck.util.DataSourceUtil.date; +import static org.apache.jdo.tck.util.DataSourceUtil.toList; +import static org.apache.jdo.tck.util.DataSourceUtil.toSet; import org.apache.jdo.tck.util.DataSource; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java index 45bd93ac0..3a4893315 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java @@ -17,7 +17,9 @@ package org.apache.jdo.tck.pc.companyMapWithoutJoin; -import java.util.*; +import java.util.Date; +import java.util.Locale; + import org.apache.jdo.tck.util.ConversionHelper; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; import org.apache.jdo.tck.util.JDOCustomDateEditor; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelTestData.java index 460489069..8984e8fd6 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelTestData.java @@ -17,7 +17,9 @@ package org.apache.jdo.tck.pc.companyMapWithoutJoin; -import static org.apache.jdo.tck.util.DataSourceUtil.*; +import static org.apache.jdo.tck.util.DataSourceUtil.date; +import static org.apache.jdo.tck.util.DataSourceUtil.toMap; +import static org.apache.jdo.tck.util.DataSourceUtil.toSet; import org.apache.jdo.tck.util.DataSource; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelTestData.java index 523a0f4fa..6a204c079 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/order/OrderModelTestData.java @@ -17,7 +17,7 @@ package org.apache.jdo.tck.pc.order; -import static org.apache.jdo.tck.util.DataSourceUtil.*; +import static org.apache.jdo.tck.util.DataSourceUtil.toSet; import org.apache.jdo.tck.util.DataSource; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; diff --git a/tck/src/main/java/org/apache/jdo/tck/util/DataSourceUtil.java b/tck/src/main/java/org/apache/jdo/tck/util/DataSourceUtil.java index 4062a315f..4e325a44e 100644 --- a/tck/src/main/java/org/apache/jdo/tck/util/DataSourceUtil.java +++ b/tck/src/main/java/org/apache/jdo/tck/util/DataSourceUtil.java @@ -17,7 +17,13 @@ package org.apache.jdo.tck.util; -import java.util.*; +import java.util.Arrays; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; diff --git a/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java b/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java index 4a6bdfe4c..bee9e272f 100644 --- a/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java +++ b/tck/src/main/java/org/apache/jdo/tck/util/DefaultListableInstanceFactory.java @@ -2,7 +2,10 @@ import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; public class DefaultListableInstanceFactory { diff --git a/tck/src/main/java/org/apache/jdo/tck/util/jndi/MockContext.java b/tck/src/main/java/org/apache/jdo/tck/util/jndi/MockContext.java index 3a469a987..61a106a1a 100644 --- a/tck/src/main/java/org/apache/jdo/tck/util/jndi/MockContext.java +++ b/tck/src/main/java/org/apache/jdo/tck/util/jndi/MockContext.java @@ -19,7 +19,13 @@ import java.util.Hashtable; import java.util.Map; -import javax.naming.*; +import javax.naming.Binding; +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NameClassPair; +import javax.naming.NameParser; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; public class MockContext implements Context { private final Map map; From 67f67edba216d99d833c482c82cb85069909c012 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Mon, 17 Nov 2025 21:43:43 +0100 Subject: [PATCH 41/43] Fix README.md and field name in AbstractReaderTest.java --- README.md | 2 +- exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java | 2 +- tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java | 2 +- .../org/apache/jdo/tck/mapping/AbstractRelationshipTest.java | 2 +- .../java/org/apache/jdo/tck/mapping/CompletenessTest.java | 4 ++-- .../java/org/apache/jdo/tck/mapping/CompletenessTestJPA.java | 4 ++-- .../java/org/apache/jdo/tck/mapping/CompletenessTestList.java | 4 ++-- .../java/org/apache/jdo/tck/mapping/CompletenessTestMap.java | 4 ++-- .../org/apache/jdo/tck/mapping/CompletenessTestOrder.java | 4 ++-- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index f01fb1e5a..3afdd4422 100644 --- a/README.md +++ b/README.md @@ -158,7 +158,7 @@ While running the TCK, maven uses the following configuration files in src/conf: * test configuration files (*.conf). Each of these files sets values for * jdo.tck.testdescription : An optional string describing the purpose of these tests * jdo.tck.classes : A list of one or more test classes (required) - * jdo.tck.testdata : The fully qualified file name of the class that creates test data (optional) + * jdo.tck.testdata : The fully qualified name of the class that creates test data (optional) * jdo.tck.mapping : The file designator that maven.xml uses to build a javax.jdo.option.Mapping value and corresponding schema name (required) * exclude.list : A list of test classes NOT to execute during a TCK test run diff --git a/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java b/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java index 0b5e17320..078e62a01 100644 --- a/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java +++ b/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java @@ -103,7 +103,7 @@ public class RunTCK extends AbstractTCKMojo { private String cleanupaftertest; /** JVM properties. */ - @Parameter(property = "jdo.tck.jvmproperties", defaultValue = "-Xmx512m") + @Parameter(property = "jdo.tck.jvmproperties", defaultValue = "-Xmx4G") private String jvmproperties; /** Location of tck log file. */ diff --git a/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java b/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java index 3f76dea32..2bfe56879 100644 --- a/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java +++ b/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java @@ -38,7 +38,7 @@ public abstract class AbstractReaderTest extends JDO_Test { protected static final String ROOT_NAME = "root"; /** The name of the file containing the bean collection (test data). */ - protected final String inputFilename = System.getProperty("jdo.tck.testdata"); + protected final String inputClassname = System.getProperty("jdo.tck.testdata"); /** The map of String (bean name) to Object (bean). */ protected final Map oidMap = new HashMap<>(); diff --git a/tck/src/main/java/org/apache/jdo/tck/mapping/AbstractRelationshipTest.java b/tck/src/main/java/org/apache/jdo/tck/mapping/AbstractRelationshipTest.java index e54a964d0..6acd8b403 100644 --- a/tck/src/main/java/org/apache/jdo/tck/mapping/AbstractRelationshipTest.java +++ b/tck/src/main/java/org/apache/jdo/tck/mapping/AbstractRelationshipTest.java @@ -44,7 +44,7 @@ protected void localSetUp() { if (isTestToBePerformed()) { getPM(); CompanyFactoryRegistry.registerFactory(pm); - reader = new CompanyModelReader(inputFilename); + reader = new CompanyModelReader(inputClassname); addTearDownClass(reader.getTearDownClassesFromFactory()); // persist test data pm.currentTransaction().begin(); diff --git a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTest.java b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTest.java index 6e32e391b..56e89e91d 100644 --- a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTest.java +++ b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTest.java @@ -45,7 +45,7 @@ protected void localSetUp() { if (isTestToBePerformed()) { getPM(); CompanyFactoryRegistry.registerFactory(pm); - CompanyModelReader reader = new CompanyModelReader(inputFilename); + CompanyModelReader reader = new CompanyModelReader(inputClassname); addTearDownClass(reader.getTearDownClassesFromFactory()); // persist test data pm.currentTransaction().begin(); @@ -67,7 +67,7 @@ public void test() { // register the default factory CompanyFactoryRegistry.registerFactory(); // get new obj graph to compare persistent graph with - CompanyModelReader reader = new CompanyModelReader(inputFilename); + CompanyModelReader reader = new CompanyModelReader(inputClassname); List rootList = getRootList(reader); getPM(); diff --git a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestJPA.java b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestJPA.java index 8c157b07b..0126834a8 100644 --- a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestJPA.java +++ b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestJPA.java @@ -48,7 +48,7 @@ protected void localSetUp() { if (runsWithApplicationIdentity()) { getPM(); CompanyFactoryRegistry.registerFactory(pm); - CompanyModelReader reader = new CompanyModelReader(inputFilename); + CompanyModelReader reader = new CompanyModelReader(inputClassname); addTearDownClass(reader.getTearDownClassesFromFactory()); // persist test data pm.currentTransaction().begin(); @@ -70,7 +70,7 @@ public void test() { // register the default factory CompanyFactoryRegistry.registerFactory(); // get new obj graph to compare persistent graph with - CompanyModelReader reader = new CompanyModelReader(inputFilename); + CompanyModelReader reader = new CompanyModelReader(inputClassname); List rootList = getRootList(reader); getPM(); diff --git a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestList.java b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestList.java index 942fdddb7..ae020406e 100644 --- a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestList.java +++ b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestList.java @@ -48,7 +48,7 @@ protected void localSetUp() { if (isTestToBePerformed) { getPM(); CompanyFactoryRegistry.registerFactory(pm); - CompanyModelReader reader = new CompanyModelReader(inputFilename); + CompanyModelReader reader = new CompanyModelReader(inputClassname); addTearDownClass(reader.getTearDownClassesFromFactory()); // persist test data pm.currentTransaction().begin(); @@ -70,7 +70,7 @@ public void test() { // register the default factory CompanyFactoryRegistry.registerFactory(); // get new obj graph to compare persistent graph with - CompanyModelReader reader = new CompanyModelReader(inputFilename); + CompanyModelReader reader = new CompanyModelReader(inputClassname); List rootList = getRootList(reader); getPM(); diff --git a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestMap.java b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestMap.java index c32ed40a8..99890a975 100644 --- a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestMap.java +++ b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestMap.java @@ -48,7 +48,7 @@ protected void localSetUp() { if (isTestToBePerformed) { getPM(); CompanyFactoryRegistry.registerFactory(pm); - CompanyModelReader reader = new CompanyModelReader(inputFilename); + CompanyModelReader reader = new CompanyModelReader(inputClassname); addTearDownClass(reader.getTearDownClassesFromFactory()); // persist test data pm.currentTransaction().begin(); @@ -70,7 +70,7 @@ public void test() { // register the default factory CompanyFactoryRegistry.registerFactory(); // get new obj graph to compare persistent graph with - CompanyModelReader reader = new CompanyModelReader(inputFilename); + CompanyModelReader reader = new CompanyModelReader(inputClassname); List rootList = getRootList(reader); getPM(); diff --git a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestOrder.java b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestOrder.java index 0e4682753..bfb5ae527 100644 --- a/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestOrder.java +++ b/tck/src/main/java/org/apache/jdo/tck/mapping/CompletenessTestOrder.java @@ -48,7 +48,7 @@ protected void localSetUp() { if (runsWithApplicationIdentity()) { getPM(); OrderFactoryRegistry.registerFactory(pm); - OrderModelReader reader = new OrderModelReader(inputFilename); + OrderModelReader reader = new OrderModelReader(inputClassname); addTearDownClass(reader.getTearDownClassesFromFactory()); // persist test data pm.currentTransaction().begin(); @@ -70,7 +70,7 @@ public void test() { // register the default factory OrderFactoryRegistry.registerFactory(); // get new obj graph to compare persistent graph with - OrderModelReader reader = new OrderModelReader(inputFilename); + OrderModelReader reader = new OrderModelReader(inputClassname); List rootList = getRootList(reader); getPM(); From 2b9cd6c40bb9670efc173c0e275949fdba3ae6c9 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Mon, 17 Nov 2025 21:46:40 +0100 Subject: [PATCH 42/43] Field name doc in AbstractReaderTest.java --- tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java b/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java index 2bfe56879..23a28eb5b 100644 --- a/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java +++ b/tck/src/main/java/org/apache/jdo/tck/AbstractReaderTest.java @@ -37,7 +37,7 @@ public abstract class AbstractReaderTest extends JDO_Test { /** The name of the root object in the bean collection. */ protected static final String ROOT_NAME = "root"; - /** The name of the file containing the bean collection (test data). */ + /** The name of the class that creates the test data). */ protected final String inputClassname = System.getProperty("jdo.tck.testdata"); /** The map of String (bean name) to Object (bean). */ From 0bebe1781f1073a6d367e529c5e63569bb9bbaf1 Mon Sep 17 00:00:00 2001 From: Tilmann Date: Mon, 17 Nov 2025 22:03:37 +0100 Subject: [PATCH 43/43] Fix formatting --- exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java | 2 +- .../java/org/apache/jdo/tck/pc/company/CompanyModelReader.java | 1 - .../org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java | 1 - .../org/apache/jdo/tck/pc/company/data/NavigationTestData.java | 1 - .../java/org/apache/jdo/tck/pc/company/data/QueryTestData.java | 1 - .../apache/jdo/tck/pc/company/data/Relationships1_1Data.java | 1 - .../apache/jdo/tck/pc/company/data/Relationships1_MData.java | 1 - .../apache/jdo/tck/pc/company/data/RelationshipsAllData.java | 1 - .../apache/jdo/tck/pc/company/data/RelationshipsM_MData.java | 1 - .../org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java | 1 - .../org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java | 1 - .../jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java | 1 - .../jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java | 1 - 13 files changed, 1 insertion(+), 13 deletions(-) diff --git a/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java b/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java index 078e62a01..f3d76e58c 100644 --- a/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java +++ b/exectck/src/main/java/org/apache/jdo/exectck/RunTCK.java @@ -103,7 +103,7 @@ public class RunTCK extends AbstractTCKMojo { private String cleanupaftertest; /** JVM properties. */ - @Parameter(property = "jdo.tck.jvmproperties", defaultValue = "-Xmx4G") + @Parameter(property = "jdo.tck.jvmproperties", defaultValue = "-Xmx1g") private String jvmproperties; /** Location of tck log file. */ diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java index 25b561407..7c978aff1 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/CompanyModelReader.java @@ -19,7 +19,6 @@ import java.util.Date; import java.util.Locale; - import org.apache.jdo.tck.util.ConversionHelper; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; import org.apache.jdo.tck.util.JDOCustomDateEditor; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java index 60d920857..478e3bedd 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/EmbeddedTestData.java @@ -22,7 +22,6 @@ import static org.apache.jdo.tck.util.DataSourceUtil.toSet; import java.math.BigDecimal; - import org.apache.jdo.tck.pc.company.CompanyFactory; import org.apache.jdo.tck.pc.company.IAddress; import org.apache.jdo.tck.pc.company.ICompany; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java index fd5906cb0..1c7bbf3f0 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/NavigationTestData.java @@ -22,7 +22,6 @@ import static org.apache.jdo.tck.util.DataSourceUtil.toSet; import java.math.BigDecimal; - import org.apache.jdo.tck.pc.company.CompanyFactory; import org.apache.jdo.tck.pc.company.IAddress; import org.apache.jdo.tck.pc.company.ICompany; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java index db00897a3..be8e7a587 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/QueryTestData.java @@ -23,7 +23,6 @@ import static org.apache.jdo.tck.util.DataSourceUtil.toSet; import java.math.BigDecimal; - import org.apache.jdo.tck.pc.company.CompanyFactory; import org.apache.jdo.tck.pc.company.IAddress; import org.apache.jdo.tck.pc.company.ICompany; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java index 2bc033b72..001b3054f 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_1Data.java @@ -21,7 +21,6 @@ import static org.apache.jdo.tck.util.DataSourceUtil.toSet; import java.math.BigDecimal; - import org.apache.jdo.tck.pc.company.CompanyFactory; import org.apache.jdo.tck.pc.company.IAddress; import org.apache.jdo.tck.pc.company.ICompany; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java index cda25676a..741e1e7ae 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/Relationships1_MData.java @@ -21,7 +21,6 @@ import static org.apache.jdo.tck.util.DataSourceUtil.toSet; import java.math.BigDecimal; - import org.apache.jdo.tck.pc.company.CompanyFactory; import org.apache.jdo.tck.pc.company.IAddress; import org.apache.jdo.tck.pc.company.ICompany; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java index a08f41bfb..a979dfff1 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsAllData.java @@ -22,7 +22,6 @@ import static org.apache.jdo.tck.util.DataSourceUtil.toSet; import java.math.BigDecimal; - import org.apache.jdo.tck.pc.company.CompanyFactory; import org.apache.jdo.tck.pc.company.IAddress; import org.apache.jdo.tck.pc.company.ICompany; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java index ff1eb7c93..26b9ba9a3 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsM_MData.java @@ -21,7 +21,6 @@ import static org.apache.jdo.tck.util.DataSourceUtil.toSet; import java.math.BigDecimal; - import org.apache.jdo.tck.pc.company.CompanyFactory; import org.apache.jdo.tck.pc.company.IAddress; import org.apache.jdo.tck.pc.company.ICompany; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java index 1d287bbc9..e80d244cd 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/RelationshipsNoData.java @@ -21,7 +21,6 @@ import static org.apache.jdo.tck.util.DataSourceUtil.toSet; import java.math.BigDecimal; - import org.apache.jdo.tck.pc.company.CompanyFactory; import org.apache.jdo.tck.pc.company.IAddress; import org.apache.jdo.tck.pc.company.ICompany; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java index 783f8fe9c..1552b9a91 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/company/data/SampleQueryTestData.java @@ -23,7 +23,6 @@ import static org.apache.jdo.tck.util.DataSourceUtil.toSet; import java.math.BigDecimal; - import org.apache.jdo.tck.pc.company.CompanyFactory; import org.apache.jdo.tck.pc.company.IAddress; import org.apache.jdo.tck.pc.company.ICompany; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java index 912683fb5..5c49d35fe 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyListWithoutJoin/CompanyModelReader.java @@ -19,7 +19,6 @@ import java.util.Date; import java.util.Locale; - import org.apache.jdo.tck.util.ConversionHelper; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; import org.apache.jdo.tck.util.JDOCustomDateEditor; diff --git a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java index 3a4893315..3bff8a4e8 100644 --- a/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java +++ b/tck/src/main/java/org/apache/jdo/tck/pc/companyMapWithoutJoin/CompanyModelReader.java @@ -19,7 +19,6 @@ import java.util.Date; import java.util.Locale; - import org.apache.jdo.tck.util.ConversionHelper; import org.apache.jdo.tck.util.DefaultListableInstanceFactory; import org.apache.jdo.tck.util.JDOCustomDateEditor;