Index: cpactf/pom.xml
===================================================================
--- cpactf/pom.xml (revision 8692)
+++ cpactf/pom.xml (working copy)
@@ -61,17 +61,30 @@
org.codehaus.mojo
castor-maven-plugin
-
- ${basedir}/src/main/resources/org/castor/cpa/test/framework/cpactf-conf.xsd
- ${basedir}/src/main/resources/org/castor/cpa/test/framework/cpactf-conf.builder.properties
- org.castor.cpa.test.framework.xml
-
+ execution1
+
+ ${basedir}/src/main/resources/org/castor/cpa/test/framework/cpactf-conf.xsd
+ ${basedir}/src/main/resources/org/castor/cpa/test/framework/cpactf-conf.builder.properties
+ org.castor.cpa.test.framework.xml
+
generate
+
+ execution2
+
+ ${basedir}/src/test/resources/schema.xsd
+ ${basedir}/src/test/resources/binding.generation.properties
+ true
+ true
+
+
+ generate
+
+
@@ -166,6 +179,13 @@
test
+
+ org.dbunit
+ dbunit
+ 2.2.3
+ test
+
+
Index: cpactf/src/test/ddl/org/castor/cpa/test/test2996/onetomany/derby-create.sql
===================================================================
--- cpactf/src/test/ddl/org/castor/cpa/test/test2996/onetomany/derby-create.sql (revision 0)
+++ cpactf/src/test/ddl/org/castor/cpa/test/test2996/onetomany/derby-create.sql (revision 0)
@@ -0,0 +1,13 @@
+create table test2996_onetomany_house(
+ id INTEGER NOT NULL,
+ PRIMARY KEY(id)
+);
+
+create table test2996_onetomany_flat(
+ id INTEGER NOT NULL,
+ house_id INTEGER NOT NULL,
+ PRIMARY KEY(id),
+ FOREIGN KEY (house_id)
+ REFERENCES test2996_onetomany_house(id)
+);
+
Index: cpactf/src/test/ddl/org/castor/cpa/test/test2996/onetomany/derby-drop.sql
===================================================================
--- cpactf/src/test/ddl/org/castor/cpa/test/test2996/onetomany/derby-drop.sql (revision 0)
+++ cpactf/src/test/ddl/org/castor/cpa/test/test2996/onetomany/derby-drop.sql (revision 0)
@@ -0,0 +1,2 @@
+drop table test2996_onetomany_flat;
+drop table test2996_onetomany_house;
Index: cpactf/src/test/ddl/org/castor/cpa/test/test2996/onetomany/mysql-create.sql
===================================================================
--- cpactf/src/test/ddl/org/castor/cpa/test/test2996/onetomany/mysql-create.sql (revision 0)
+++ cpactf/src/test/ddl/org/castor/cpa/test/test2996/onetomany/mysql-create.sql (revision 0)
@@ -0,0 +1,12 @@
+create table test2996_onetomany_house(
+ id INTEGER NOT NULL,
+ PRIMARY KEY(id)
+);
+
+create table test2996_onetomany_flat(
+ id INTEGER NOT NULL,
+ house_id INTEGER NOT NULL,
+ PRIMARY KEY(id),
+ FOREIGN KEY (house_id)
+ REFERENCES test2996_onetomany_house(id)
+);
\ No newline at end of file
Index: cpactf/src/test/ddl/org/castor/cpa/test/test2996/onetomany/mysql-drop.sql
===================================================================
--- cpactf/src/test/ddl/org/castor/cpa/test/test2996/onetomany/mysql-drop.sql (revision 0)
+++ cpactf/src/test/ddl/org/castor/cpa/test/test2996/onetomany/mysql-drop.sql (revision 0)
@@ -0,0 +1,3 @@
+drop table if exists test2996_onetomany_flat;
+drop table if exists test2996_onetomany_house;
+
Index: cpactf/src/test/ddl/org/castor/cpa/test/test2996/onetoone/derby-create.sql
===================================================================
--- cpactf/src/test/ddl/org/castor/cpa/test/test2996/onetoone/derby-create.sql (revision 0)
+++ cpactf/src/test/ddl/org/castor/cpa/test/test2996/onetoone/derby-create.sql (revision 0)
@@ -0,0 +1,12 @@
+create table test2996_onetoone_address(
+ id INTEGER NOT NULL,
+ PRIMARY KEY (id)
+);
+
+create table test2996_onetoone_employee(
+ id INTEGER NOT NULL,
+ address_id INTEGER NOT NULL,
+ PRIMARY KEY (id),
+ FOREIGN KEY (address_id)
+ REFERENCES test2996_onetoone_address(id)
+);
Index: cpactf/src/test/ddl/org/castor/cpa/test/test2996/onetoone/derby-drop.sql
===================================================================
--- cpactf/src/test/ddl/org/castor/cpa/test/test2996/onetoone/derby-drop.sql (revision 0)
+++ cpactf/src/test/ddl/org/castor/cpa/test/test2996/onetoone/derby-drop.sql (revision 0)
@@ -0,0 +1,2 @@
+drop table test2996_onetoone_employee;
+drop table test2996_onetoone_address;
Index: cpactf/src/test/ddl/org/castor/cpa/test/test2996/onetoone/mysql-create.sql
===================================================================
--- cpactf/src/test/ddl/org/castor/cpa/test/test2996/onetoone/mysql-create.sql (revision 0)
+++ cpactf/src/test/ddl/org/castor/cpa/test/test2996/onetoone/mysql-create.sql (revision 0)
@@ -0,0 +1,12 @@
+create table test2996_onetoone_address(
+ id INTEGER NOT NULL,
+ PRIMARY KEY (id)
+);
+
+create table test2996_onetoone_employee(
+ id INTEGER NOT NULL,
+ address_id INTEGER NOT NULL,
+ PRIMARY KEY (id),
+ FOREIGN KEY (address_id)
+ REFERENCES test2996_onetoone_address(id)
+);
Index: cpactf/src/test/ddl/org/castor/cpa/test/test2996/onetoone/mysql-drop.sql
===================================================================
--- cpactf/src/test/ddl/org/castor/cpa/test/test2996/onetoone/mysql-drop.sql (revision 0)
+++ cpactf/src/test/ddl/org/castor/cpa/test/test2996/onetoone/mysql-drop.sql (revision 0)
@@ -0,0 +1,3 @@
+drop table if exists test2996_onetoone_employee;
+drop table if exists test2996_onetoone_address;
+
Index: cpactf/src/test/ddl/org/castor/cpa/test/test2996/single/derby-create.sql
===================================================================
--- cpactf/src/test/ddl/org/castor/cpa/test/test2996/single/derby-create.sql (revision 0)
+++ cpactf/src/test/ddl/org/castor/cpa/test/test2996/single/derby-create.sql (revision 0)
@@ -0,0 +1,5 @@
+create table test2996_single_book(
+ isbn INTEGER NOT NULL,
+ title VARCHAR(200) NOT NULL,
+ PRIMARY KEY (isbn)
+);
Index: cpactf/src/test/ddl/org/castor/cpa/test/test2996/single/derby-drop.sql
===================================================================
--- cpactf/src/test/ddl/org/castor/cpa/test/test2996/single/derby-drop.sql (revision 0)
+++ cpactf/src/test/ddl/org/castor/cpa/test/test2996/single/derby-drop.sql (revision 0)
@@ -0,0 +1 @@
+drop table test2996_single_book;
Index: cpactf/src/test/ddl/org/castor/cpa/test/test2996/single/mysql-create.sql
===================================================================
--- cpactf/src/test/ddl/org/castor/cpa/test/test2996/single/mysql-create.sql (revision 0)
+++ cpactf/src/test/ddl/org/castor/cpa/test/test2996/single/mysql-create.sql (revision 0)
@@ -0,0 +1,5 @@
+create table test2996_single_book(
+ isbn INTEGER NOT NULL,
+ title VARCHAR(200) NOT NULL,
+ PRIMARY KEY (isbn)
+);
Index: cpactf/src/test/ddl/org/castor/cpa/test/test2996/single/mysql-drop.sql
===================================================================
--- cpactf/src/test/ddl/org/castor/cpa/test/test2996/single/mysql-drop.sql (revision 0)
+++ cpactf/src/test/ddl/org/castor/cpa/test/test2996/single/mysql-drop.sql (revision 0)
@@ -0,0 +1 @@
+drop table if exists test2996_single_book;
Index: cpactf/src/test/java/org/castor/cpa/test/test2996/onetomany/AbstractTestOneToMany.java
===================================================================
--- cpactf/src/test/java/org/castor/cpa/test/test2996/onetomany/AbstractTestOneToMany.java (revision 0)
+++ cpactf/src/test/java/org/castor/cpa/test/test2996/onetomany/AbstractTestOneToMany.java (revision 0)
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2008 Tobias Hochwallner, Ralf Joachim
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.castor.cpa.test.test2996.onetomany;
+
+import java.io.FileInputStream;
+import java.sql.Connection;
+
+import org.castor.cpa.test.framework.CPATestCase;
+import org.dbunit.DefaultDatabaseTester;
+import org.dbunit.IDatabaseTester;
+import org.dbunit.database.DatabaseConnection;
+import org.dbunit.dataset.xml.XmlDataSet;
+import org.exolab.castor.jdo.Database;
+import org.exolab.castor.jdo.JDOManager;
+import org.exolab.castor.jdo.OQLQuery;
+import org.exolab.castor.jdo.QueryResults;
+import org.exolab.castor.mapping.MappingException;
+
+/**
+ * Abstract base class for testing XML and class mapping with classes
+ * having a one to many relation.
+ */
+public abstract class AbstractTestOneToMany extends CPATestCase {
+ private static final String DATA_SET_FILE_SETUP = "dbunit-setup.xml";
+
+ private JDOManager _jdo;
+
+ public AbstractTestOneToMany(final String name) {
+ super(name);
+ }
+
+ protected abstract JDOManager getJDOManager() throws MappingException;
+
+ /**
+ * Creates data objects used by these tests
+ */
+ public final void setUp() throws Exception {
+ // Open transaction in order to perform JDO operations
+ _jdo = getJDOManager();
+
+ Connection conn = _jdo.getConnectionFactory().createConnection();
+ String filename = getClass().getResource(DATA_SET_FILE_SETUP).getFile();
+ IDatabaseTester dbtester = new DefaultDatabaseTester(new DatabaseConnection(conn));
+ dbtester.setDataSet(new XmlDataSet(new FileInputStream(filename)));
+ dbtester.onSetup();
+ }
+
+ /**
+ * Tests if loading an flat element from database works.
+ */
+ public void testLoadFlat() throws Exception {
+ Database db = _jdo.getDatabase();
+
+ db.begin();
+ Flat flat = db.load(Flat.class, new Long(1));
+ assertNotNull(flat);
+ assertEquals(1, flat.getId());
+ db.commit();
+
+ db.close();
+ }
+
+ /**
+ * Tests if loading an house element from database including a flat works.
+ */
+ public void testLoadHouseOneFlat() throws Exception {
+ Database db = _jdo.getDatabase();
+
+ db.begin();
+ House house = db.load(House.class, new Long(100));
+ assertNotNull(house);
+ assertEquals(100, house.getId());
+ Flat[] flats = house.getFlats();
+ assertNotNull(flats);
+ assertEquals(1, flats.length);
+ Flat flat = house.getFlats()[0];
+ assertEquals(1, flat.getId());
+ db.commit();
+
+ db.close();
+ }
+
+ /**
+ * Tests if loading an house element from database including more flats works.
+ */
+ public void testLoadHouseFlats() throws Exception {
+ Database db = _jdo.getDatabase();
+
+ db.begin();
+ House house = db.load(House.class, new Long(101));
+ assertNotNull(house);
+ assertEquals(101, house.getId());
+ Flat[] flats = house.getFlats();
+ assertNotNull(flats);
+ assertEquals(2, flats.length);
+
+ db.commit();
+
+ db.close();
+ }
+
+ /**
+ * Tests a simple OQL query.
+ */
+ public void testSelectQuery() throws Exception {
+ Database db = _jdo.getDatabase();
+
+ db.begin();
+ OQLQuery query = db.getOQLQuery("SELECT h FROM "
+ + House.class.getName() + " h WHERE h.flats.id = $1");
+ query.bind(2);
+ QueryResults result = query.execute();
+ House e = (House) result.next();
+ assertEquals(101, e.getId());
+ assertEquals(2, e.getFlats().length);
+ result.close();
+ db.commit();
+
+ db.close();
+ }
+}
Index: cpactf/src/test/java/org/castor/cpa/test/test2996/onetomany/TestOneToManyClassMapping.java
===================================================================
--- cpactf/src/test/java/org/castor/cpa/test/test2996/onetomany/TestOneToManyClassMapping.java (revision 0)
+++ cpactf/src/test/java/org/castor/cpa/test/test2996/onetomany/TestOneToManyClassMapping.java (revision 0)
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2008 Lukas Lang, Ralf Joachim
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.castor.cpa.test.test2996.onetomany;
+
+import org.castor.cpa.test.framework.xml.types.DatabaseEngineType;
+import org.castor.jdo.util.JDOConfFactory;
+import org.exolab.castor.jdo.JDOManager;
+import org.exolab.castor.mapping.MappingException;
+
+/**
+ * Tests one to one relation with class mapping.
+ */
+public class TestOneToManyClassMapping extends AbstractTestOneToMany {
+ private static final String DBNAME = "test2996-onetomany-class";
+ private static final String MAPPING_HOUSE = House.class.getName();
+ private static final String MAPPING_FLAT = Flat.class.getName();
+
+ public TestOneToManyClassMapping(final String name) {
+ super(name);
+ }
+
+ // Test are only included/excluded for engines that have been tested with this test suite.
+
+ public boolean include(final DatabaseEngineType engine) {
+ return (engine == DatabaseEngineType.DERBY)
+ || (engine == DatabaseEngineType.MYSQL);
+ }
+
+ @Override
+ protected JDOManager getJDOManager() throws MappingException {
+ org.castor.jdo.conf.Database dbConfig = getDbConfig(DBNAME);
+ dbConfig.addClassMapping(JDOConfFactory.createClassMapping(MAPPING_HOUSE));
+ dbConfig.addClassMapping(JDOConfFactory.createClassMapping(MAPPING_FLAT));
+ return getJDOManager(dbConfig);
+ }
+}
Index: cpactf/src/test/java/org/castor/cpa/test/test2996/onetomany/TestOneToManyMixedMapping1.java
===================================================================
--- cpactf/src/test/java/org/castor/cpa/test/test2996/onetomany/TestOneToManyMixedMapping1.java (revision 0)
+++ cpactf/src/test/java/org/castor/cpa/test/test2996/onetomany/TestOneToManyMixedMapping1.java (revision 0)
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Tobias Hochwallner, Ralf Joachim
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.castor.cpa.test.test2996.onetomany;
+
+import org.castor.cpa.test.framework.xml.types.DatabaseEngineType;
+import org.castor.jdo.util.JDOConfFactory;
+import org.exolab.castor.jdo.JDOManager;
+import org.exolab.castor.mapping.MappingException;
+
+/**
+ * Tests one to many relation with mixed XML and class mapping.
+ */
+public class TestOneToManyMixedMapping1 extends AbstractTestOneToMany {
+ private static final String DBNAME = "test2996-onetomany-mixed1";
+ private static final String MAPPING_HOUSE = House.class.getName();
+ private static final String MAPPING_FLAT =
+ "/org/castor/cpa/test/test2996/onetomany/mapping-flat.xml";
+
+ public TestOneToManyMixedMapping1(final String name) {
+ super(name);
+ }
+
+ // Test are only included/excluded for engines that have been tested with this test suite.
+
+ public boolean include(final DatabaseEngineType engine) {
+ return (engine == DatabaseEngineType.DERBY)
+ || (engine == DatabaseEngineType.MYSQL);
+ }
+
+ @Override
+ protected JDOManager getJDOManager() throws MappingException {
+ org.castor.jdo.conf.Database dbConfig = getDbConfig(DBNAME);
+ dbConfig.addClassMapping(JDOConfFactory.createClassMapping(MAPPING_HOUSE));
+ dbConfig.addMapping(JDOConfFactory.createXmlMapping(MAPPING_FLAT));
+ return getJDOManager(dbConfig);
+ }
+}
Index: cpactf/src/test/java/org/castor/cpa/test/test2996/onetomany/TestOneToManyMixedMapping2.java
===================================================================
--- cpactf/src/test/java/org/castor/cpa/test/test2996/onetomany/TestOneToManyMixedMapping2.java (revision 0)
+++ cpactf/src/test/java/org/castor/cpa/test/test2996/onetomany/TestOneToManyMixedMapping2.java (revision 0)
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Tobias Hochwallner, Ralf Joachim
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.castor.cpa.test.test2996.onetomany;
+
+import org.castor.cpa.test.framework.xml.types.DatabaseEngineType;
+import org.castor.jdo.util.JDOConfFactory;
+import org.exolab.castor.jdo.JDOManager;
+import org.exolab.castor.mapping.MappingException;
+
+/**
+ * Tests one to many relation with mixed XML and class mapping.
+ */
+public class TestOneToManyMixedMapping2 extends AbstractTestOneToMany {
+ private static final String DBNAME = "test2996-onetomany-mixed2";
+ private static final String MAPPING_HOUSE =
+ "/org/castor/cpa/test/test2996/onetomany/mapping-house.xml";
+ private static final String MAPPING_FLAT = Flat.class.getName();
+
+ public TestOneToManyMixedMapping2(final String name) {
+ super(name);
+ }
+
+ // Test are only included/excluded for engines that have been tested with this test suite.
+
+ public boolean include(final DatabaseEngineType engine) {
+ return (engine == DatabaseEngineType.DERBY)
+ || (engine == DatabaseEngineType.MYSQL);
+ }
+
+ @Override
+ protected JDOManager getJDOManager() throws MappingException {
+ org.castor.jdo.conf.Database dbConfig = getDbConfig(DBNAME);
+ dbConfig.addMapping(JDOConfFactory.createXmlMapping(MAPPING_HOUSE));
+ dbConfig.addClassMapping(JDOConfFactory.createClassMapping(MAPPING_FLAT));
+ return getJDOManager(dbConfig);
+ }
+}
Index: cpactf/src/test/java/org/castor/cpa/test/test2996/onetomany/TestOneToManyXmlMapping.java
===================================================================
--- cpactf/src/test/java/org/castor/cpa/test/test2996/onetomany/TestOneToManyXmlMapping.java (revision 0)
+++ cpactf/src/test/java/org/castor/cpa/test/test2996/onetomany/TestOneToManyXmlMapping.java (revision 0)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2008 Lukas Lang, Ralf Joachim
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.castor.cpa.test.test2996.onetomany;
+
+import org.castor.cpa.test.framework.xml.types.DatabaseEngineType;
+import org.exolab.castor.jdo.JDOManager;
+import org.exolab.castor.mapping.MappingException;
+
+/**
+ * Tests one to many relation with XML mapping.
+ */
+public class TestOneToManyXmlMapping extends AbstractTestOneToMany {
+ private static final String DBNAME = "test2996-onetomany-xml";
+ private static final String MAPPING = "/org/castor/cpa/test/test2996/onetomany/mapping.xml";
+
+ public TestOneToManyXmlMapping(final String name) {
+ super(name);
+ }
+
+ // Test are only included/excluded for engines that have been tested with this test suite.
+
+ public boolean include(final DatabaseEngineType engine) {
+ return (engine == DatabaseEngineType.DERBY)
+ || (engine == DatabaseEngineType.MYSQL);
+ }
+
+ @Override
+ protected JDOManager getJDOManager() throws MappingException {
+ return getJDOManager(DBNAME, MAPPING);
+ }
+}
Index: cpactf/src/test/java/org/castor/cpa/test/test2996/onetoone/AbstractTestOneToOne.java
===================================================================
--- cpactf/src/test/java/org/castor/cpa/test/test2996/onetoone/AbstractTestOneToOne.java (revision 0)
+++ cpactf/src/test/java/org/castor/cpa/test/test2996/onetoone/AbstractTestOneToOne.java (revision 0)
@@ -0,0 +1,163 @@
+/*
+ * Copyright 2008 Lukas Lang, Ralf Joachim
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.castor.cpa.test.test2996.onetoone;
+
+import java.io.FileInputStream;
+import java.sql.Connection;
+
+import org.castor.cpa.test.framework.CPATestCase;
+import org.dbunit.Assertion;
+import org.dbunit.DefaultDatabaseTester;
+import org.dbunit.IDatabaseTester;
+import org.dbunit.database.DatabaseConnection;
+import org.dbunit.dataset.IDataSet;
+import org.dbunit.dataset.ITable;
+import org.dbunit.dataset.xml.XmlDataSet;
+import org.exolab.castor.jdo.Database;
+import org.exolab.castor.jdo.JDOManager;
+import org.exolab.castor.mapping.MappingException;
+
+/**
+ * Abstract base class for testing XML and class mapping with classes
+ * having a one to one relation.
+ */
+public abstract class AbstractTestOneToOne extends CPATestCase {
+ private static final String DATA_SET_FILE_SETUP = "dbunit-setup.xml";
+ private static final String DATA_SET_FILE_INSERTED = "dbunit-inserted.xml";
+ private static final String DATA_SET_FILE_REMOVED = "dbunit-removed.xml";
+ private static final String DATA_SET_FILE_UPDATED = "dbunit-updated.xml";
+
+ private JDOManager _jdo;
+
+ public AbstractTestOneToOne(final String name) {
+ super(name);
+ }
+
+ protected abstract JDOManager getJDOManager() throws MappingException;
+
+ /**
+ * Creates data objects used by these tests
+ */
+ public final void setUp() throws Exception {
+ // Open transaction in order to perform JDO operations
+ _jdo = getJDOManager();
+
+ Connection conn = _jdo.getConnectionFactory().createConnection();
+ String filename = getClass().getResource(DATA_SET_FILE_SETUP).getFile();
+ IDatabaseTester dbtester = new DefaultDatabaseTester(new DatabaseConnection(conn));
+ dbtester.setDataSet(new XmlDataSet(new FileInputStream(filename)));
+ dbtester.onSetup();
+ }
+
+ public final void testLoadAddress() throws Exception {
+ Database db = _jdo.getDatabase();
+
+ db.begin();
+ Address address = db.load(Address.class, new Long(2));
+ assertNotNull(address);
+ assertEquals(2, address.getId());
+ db.commit();
+
+ db.close();
+ }
+
+ public final void testLoadEmployeeAddress() throws Exception {
+ Database db = _jdo.getDatabase();
+
+ db.begin();
+ Employee employee = db.load(Employee.class, new Long(1));
+ assertNotNull(employee);
+ assertEquals(1, employee.getId());
+ assertNotNull(employee.getAddress());
+ Address address = employee.getAddress();
+ assertEquals(2, address.getId());
+ db.commit();
+
+ db.close();
+ }
+
+ public final void testCreateEmployee() throws Exception {
+ Database db = _jdo.getDatabase();
+
+ db.begin();
+ Employee emp = new Employee();
+ emp.setId(666);
+ Address addr = new Address();
+ addr.setId(999);
+ emp.setAddress(addr);
+ assertEquals(999, emp.getAddress().getId());
+ db.create(addr);
+ db.create(emp);
+ assertNotNull(db.load(Employee.class, new Long(666)));
+ db.commit();
+
+ db.begin();
+ assertNotNull(db.load(Employee.class, new Long(666)));
+ db.commit();
+
+ db.close();
+
+ assertDataset(DATA_SET_FILE_INSERTED);
+ }
+
+ public final void testRemoveEmployee() throws Exception {
+ Database db = _jdo.getDatabase();
+
+ db.begin();
+ Employee emp = db.load(Employee.class, new Long(1));
+ db.remove(emp);
+ db.commit();
+
+ db.close();
+
+ assertDataset(DATA_SET_FILE_REMOVED);
+ }
+
+ public final void testUpdateEmployee() throws Exception {
+ Database db = _jdo.getDatabase();
+
+ db.begin();
+ Employee emp = db.load(Employee.class, new Long(1));
+ Address addr = new Address();
+ addr.setId(666);
+ db.create(addr);
+ emp.setAddress(addr);
+ db.commit();
+
+ db.close();
+
+ assertDataset(DATA_SET_FILE_UPDATED);
+ }
+
+ private void assertDataset(final String datasetlocation) throws Exception {
+ String tablename1 = "test2996_onetoone_employee";
+ String tablename2 = "test2996_onetoone_address";
+ String[] tables = new String[] {tablename1, tablename2};
+
+ Connection conn = _jdo.getConnectionFactory().createConnection();
+ String filename = getClass().getResource(datasetlocation).getFile();
+ IDataSet actualDataSet = new DefaultDatabaseTester(
+ new DatabaseConnection(conn)).getConnection().createDataSet(tables);
+ IDataSet expectedDataSet = new XmlDataSet(new FileInputStream(filename));
+ Assertion.assertEquals(expectedDataSet, actualDataSet);
+
+ for (int i = 0; i < tables.length; i++) {
+ ITable actualTable = actualDataSet.getTable(tables[i]);
+ ITable expectedTable = expectedDataSet.getTable(tables[i]);
+ Assertion.assertEquals(expectedTable, actualTable);
+ }
+ }
+}
Index: cpactf/src/test/java/org/castor/cpa/test/test2996/onetoone/TestOneToOneClassMapping.java
===================================================================
--- cpactf/src/test/java/org/castor/cpa/test/test2996/onetoone/TestOneToOneClassMapping.java (revision 0)
+++ cpactf/src/test/java/org/castor/cpa/test/test2996/onetoone/TestOneToOneClassMapping.java (revision 0)
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2008 Tobias Hochwallner, Ralf Joachim
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.castor.cpa.test.test2996.onetoone;
+
+import org.castor.cpa.test.framework.xml.types.DatabaseEngineType;
+import org.castor.jdo.util.JDOConfFactory;
+import org.exolab.castor.jdo.JDOManager;
+import org.exolab.castor.mapping.MappingException;
+
+/**
+ * Tests one to one relation with class mapping.
+ */
+public class TestOneToOneClassMapping extends AbstractTestOneToOne {
+ private static final String DBNAME = "test2996-onetoone-class";
+ private static final String MAPPING_ADDRESS = Address.class.getName();
+ private static final String MAPPING_EMPLOYEE = Employee.class.getName();
+
+ public TestOneToOneClassMapping(final String name) {
+ super(name);
+ }
+
+ // Test are only included/excluded for engines that have been tested with this test suite.
+
+ public boolean include(final DatabaseEngineType engine) {
+ return (engine == DatabaseEngineType.DERBY)
+ || (engine == DatabaseEngineType.MYSQL);
+ }
+
+ @Override
+ protected JDOManager getJDOManager() throws MappingException {
+ org.castor.jdo.conf.Database dbConfig = getDbConfig(DBNAME);
+ dbConfig.addClassMapping(JDOConfFactory.createClassMapping(MAPPING_ADDRESS));
+ dbConfig.addClassMapping(JDOConfFactory.createClassMapping(MAPPING_EMPLOYEE));
+ return getJDOManager(dbConfig);
+ }
+}
Index: cpactf/src/test/java/org/castor/cpa/test/test2996/onetoone/TestOneToOneMixedMapping1.java
===================================================================
--- cpactf/src/test/java/org/castor/cpa/test/test2996/onetoone/TestOneToOneMixedMapping1.java (revision 0)
+++ cpactf/src/test/java/org/castor/cpa/test/test2996/onetoone/TestOneToOneMixedMapping1.java (revision 0)
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Tobias Hochwallner, Ralf Joachim
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.castor.cpa.test.test2996.onetoone;
+
+import org.castor.cpa.test.framework.xml.types.DatabaseEngineType;
+import org.castor.jdo.util.JDOConfFactory;
+import org.exolab.castor.jdo.JDOManager;
+import org.exolab.castor.mapping.MappingException;
+
+/**
+ * Tests one to one relation with mixed XML and class mapping.
+ */
+public final class TestOneToOneMixedMapping1 extends AbstractTestOneToOne {
+ private static final String DBNAME = "test2996-onetoone-mixed1";
+ private static final String MAPPING_ADDRESS = Address.class.getName();
+ private static final String MAPPING_EMPLOYEE =
+ "/org/castor/cpa/test/test2996/onetoone/mapping-employee.xml";
+
+ public TestOneToOneMixedMapping1(final String name) {
+ super(name);
+ }
+
+ // Test are only included/excluded for engines that have been tested with this test suite.
+
+ public boolean include(final DatabaseEngineType engine) {
+ return (engine == DatabaseEngineType.DERBY)
+ || (engine == DatabaseEngineType.MYSQL);
+ }
+
+ @Override
+ protected JDOManager getJDOManager() throws MappingException {
+ org.castor.jdo.conf.Database dbConfig = getDbConfig(DBNAME);
+ dbConfig.addClassMapping(JDOConfFactory.createClassMapping(MAPPING_ADDRESS));
+ dbConfig.addMapping(JDOConfFactory.createXmlMapping(MAPPING_EMPLOYEE));
+ return getJDOManager(dbConfig);
+ }
+}
Index: cpactf/src/test/java/org/castor/cpa/test/test2996/onetoone/TestOneToOneMixedMapping2.java
===================================================================
--- cpactf/src/test/java/org/castor/cpa/test/test2996/onetoone/TestOneToOneMixedMapping2.java (revision 0)
+++ cpactf/src/test/java/org/castor/cpa/test/test2996/onetoone/TestOneToOneMixedMapping2.java (revision 0)
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Tobias Hochwallner, Ralf Joachim
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.castor.cpa.test.test2996.onetoone;
+
+import org.castor.cpa.test.framework.xml.types.DatabaseEngineType;
+import org.castor.jdo.util.JDOConfFactory;
+import org.exolab.castor.jdo.JDOManager;
+import org.exolab.castor.mapping.MappingException;
+
+/**
+ * Tests one to one relation with mixed XML and class mapping.
+ */
+public final class TestOneToOneMixedMapping2 extends AbstractTestOneToOne {
+ private static final String DBNAME = "test2996-onetoone-mixed2";
+ private static final String MAPPING_ADDRESS =
+ "/org/castor/cpa/test/test2996/onetoone/mapping-address.xml";
+ private static final String MAPPING_EMPLOYEE = Employee.class.getName();
+
+ public TestOneToOneMixedMapping2(final String name) {
+ super(name);
+ }
+
+ // Test are only included/excluded for engines that have been tested with this test suite.
+
+ public boolean include(final DatabaseEngineType engine) {
+ return (engine == DatabaseEngineType.DERBY)
+ || (engine == DatabaseEngineType.MYSQL);
+ }
+
+ @Override
+ protected JDOManager getJDOManager() throws MappingException {
+ org.castor.jdo.conf.Database dbConfig = getDbConfig(DBNAME);
+ dbConfig.addMapping(JDOConfFactory.createXmlMapping(MAPPING_ADDRESS));
+ dbConfig.addClassMapping(JDOConfFactory.createClassMapping(MAPPING_EMPLOYEE));
+ return getJDOManager(dbConfig);
+ }
+}
Index: cpactf/src/test/java/org/castor/cpa/test/test2996/onetoone/TestOneToOneXmlMapping.java
===================================================================
--- cpactf/src/test/java/org/castor/cpa/test/test2996/onetoone/TestOneToOneXmlMapping.java (revision 0)
+++ cpactf/src/test/java/org/castor/cpa/test/test2996/onetoone/TestOneToOneXmlMapping.java (revision 0)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2008 Tobias Hochwallner, Ralf Joachim
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.castor.cpa.test.test2996.onetoone;
+
+import org.castor.cpa.test.framework.xml.types.DatabaseEngineType;
+import org.exolab.castor.jdo.JDOManager;
+import org.exolab.castor.mapping.MappingException;
+
+/**
+ * Tests one to one relation with XML mapping.
+ */
+public final class TestOneToOneXmlMapping extends AbstractTestOneToOne {
+ private static final String DBNAME = "test2996-onetoone-xml";
+ private static final String MAPPING = "/org/castor/cpa/test/test2996/onetoone/mapping.xml";
+
+ public TestOneToOneXmlMapping(final String name) {
+ super(name);
+ }
+
+ // Test are only included/excluded for engines that have been tested with this test suite.
+
+ public boolean include(final DatabaseEngineType engine) {
+ return (engine == DatabaseEngineType.DERBY)
+ || (engine == DatabaseEngineType.MYSQL);
+ }
+
+ @Override
+ protected JDOManager getJDOManager() throws MappingException {
+ return getJDOManager(DBNAME, MAPPING);
+ }
+}
Index: cpactf/src/test/java/org/castor/cpa/test/test2996/single/AbstractTestSingle.java
===================================================================
--- cpactf/src/test/java/org/castor/cpa/test/test2996/single/AbstractTestSingle.java (revision 0)
+++ cpactf/src/test/java/org/castor/cpa/test/test2996/single/AbstractTestSingle.java (revision 0)
@@ -0,0 +1,200 @@
+/*
+ * Copyright 2009 Tobias Hochwallner, Ralf Joachim
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.castor.cpa.test.test2996.single;
+
+import java.io.FileInputStream;
+import java.sql.Connection;
+
+import org.castor.cpa.test.framework.CPATestCase;
+import org.dbunit.Assertion;
+import org.dbunit.DefaultDatabaseTester;
+import org.dbunit.IDatabaseTester;
+import org.dbunit.database.DatabaseConnection;
+import org.dbunit.dataset.IDataSet;
+import org.dbunit.dataset.ITable;
+import org.dbunit.dataset.xml.XmlDataSet;
+import org.exolab.castor.jdo.Database;
+import org.exolab.castor.jdo.JDOManager;
+import org.exolab.castor.jdo.OQLQuery;
+import org.exolab.castor.jdo.ObjectNotFoundException;
+import org.exolab.castor.jdo.QueryResults;
+import org.exolab.castor.mapping.MappingException;
+
+/**
+ * Abstract base class for testing XML and class mapping with a single class.
+ */
+public abstract class AbstractTestSingle extends CPATestCase {
+ private static final String DATA_SET_FILE_SETUP = "dbunit-setup.xml";
+ private static final String DATA_SET_FILE_INSERTED = "dbunit-inserted.xml";
+ private static final String DATA_SET_FILE_UPDATED = "dbunit-updated.xml";
+ private static final String DATA_SET_FILE_EMTY = "dbunit-empty.xml";
+
+ private JDOManager _jdo;
+
+ public AbstractTestSingle(final String name) {
+ super(name);
+ }
+
+ protected abstract JDOManager getJDOManager() throws MappingException;
+
+ /**
+ * Creates data objects used by these tests
+ */
+ public final void setUp() throws Exception {
+ // Open transaction in order to perform JDO operations
+ _jdo = getJDOManager();
+
+ Connection conn = _jdo.getConnectionFactory().createConnection();
+ String filename = getClass().getResource(DATA_SET_FILE_SETUP).getFile();
+ IDatabaseTester dbtester = new DefaultDatabaseTester(new DatabaseConnection(conn));
+ dbtester.setDataSet(new XmlDataSet(new FileInputStream(filename)));
+ dbtester.onSetup();
+ }
+
+ public final void testLoadBook() throws Exception {
+ Database db = _jdo.getDatabase();
+ db.begin();
+
+ Book lookup = db.load(Book.class, new Long(1234));
+ assertNotNull(lookup);
+
+ assertEquals(1234, lookup.getIsbn());
+ assertEquals("Heart of Darkness", lookup.getTitle());
+
+ db.commit();
+ db.close();
+ }
+
+ public final void testCreateBook() throws Exception {
+ Book myBook = new Book();
+ myBook.setIsbn(1235);
+ myBook.setTitle("My Definition");
+
+ Database db = _jdo.getDatabase();
+ db.begin();
+ db.create(myBook);
+ db.commit();
+
+ db.begin();
+ Book lookup = db.load(Book.class, new Long(1235));
+ assertNotNull(lookup);
+ assertEquals(1235, lookup.getIsbn());
+ assertEquals("My Definition", lookup.getTitle());
+ db.commit();
+ db.close();
+
+ assertDataset(DATA_SET_FILE_INSERTED);
+ }
+
+ public final void testRemoveBook() throws Exception {
+ Database db = _jdo.getDatabase();
+ db.begin();
+
+ Book lookup = db.load(Book.class, new Long(1234));
+ assertNotNull(lookup);
+ assertEquals(1234, lookup.getIsbn());
+ assertEquals("Heart of Darkness", lookup.getTitle());
+ db.remove(lookup);
+
+ Book lookup2 = null;
+ try {
+ lookup2 = db.load(Book.class, new Long(1234));
+ fail("object not found excetion expected!");
+ } catch (ObjectNotFoundException e) {
+ assertNull(lookup2);
+ } catch (Exception e) {
+ fail();
+ }
+ db.commit();
+
+ assertDataset(DATA_SET_FILE_EMTY);
+
+ db.begin();
+ try {
+ lookup2 = db.load(Book.class, new Long(1234));
+ fail("object not found excetion expected!");
+ } catch (ObjectNotFoundException e) {
+ assertNull(lookup2);
+ } catch (Exception e) {
+ fail();
+ }
+ db.commit();
+
+ db.close();
+ }
+
+ public final void testSelectQuery() throws Exception {
+ Database db = _jdo.getDatabase();
+ db.begin();
+
+ String oql = "SELECT b FROM " + Book.class.getName() + " b WHERE b.title = $1";
+ OQLQuery query = db.getOQLQuery(oql);
+ query.bind("Heart of Darkness");
+ QueryResults result = query.execute();
+
+ int count = 0;
+ Book b = null;
+ while (result.hasMore()) {
+ b = (Book) result.next();
+ count++;
+ }
+
+ assertEquals(1, count);
+ assertEquals(1234, b.getIsbn());
+ assertEquals("Heart of Darkness", b.getTitle());
+
+ db.commit();
+ db.close();
+ }
+
+ public final void testUpdateBook() throws Exception {
+ Database db = _jdo.getDatabase();
+
+ db.begin();
+ Book lookup = db.load(Book.class, new Long(1234));
+ assertNotNull(lookup);
+ assertEquals(1234, lookup.getIsbn());
+ assertEquals("Heart of Darkness", lookup.getTitle());
+ lookup.setTitle("Heart of Light");
+ db.commit();
+
+ assertDataset(DATA_SET_FILE_UPDATED);
+
+ db.begin();
+ Book lookup2 = db.load(Book.class, new Long(1234));
+ assertEquals("Heart of Light", lookup2.getTitle());
+ db.commit();
+
+ db.close();
+ }
+
+ private void assertDataset(final String datasetlocation) throws Exception {
+ String[] tables = new String[] {"test2996_single_book"};
+
+ Connection conn = _jdo.getConnectionFactory().createConnection();
+ String filename = getClass().getResource(datasetlocation).getFile();
+ IDataSet actualDataSet = new DefaultDatabaseTester(
+ new DatabaseConnection(conn)).getConnection().createDataSet(tables);
+ IDataSet expectedDataSet = new XmlDataSet(new FileInputStream(filename));
+ Assertion.assertEquals(expectedDataSet, actualDataSet);
+
+ for (int i = 0; i < tables.length; i++) {
+ ITable actualTable = actualDataSet.getTable(tables[i]);
+ ITable expectedTable = expectedDataSet.getTable(tables[i]);
+ Assertion.assertEquals(expectedTable, actualTable);
+ }
+ }
+}
Index: cpactf/src/test/java/org/castor/cpa/test/test2996/single/TestSingleClassMapping.java
===================================================================
--- cpactf/src/test/java/org/castor/cpa/test/test2996/single/TestSingleClassMapping.java (revision 0)
+++ cpactf/src/test/java/org/castor/cpa/test/test2996/single/TestSingleClassMapping.java (revision 0)
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2009 Tobias Hochwallner, Ralf Joachim
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.castor.cpa.test.test2996.single;
+
+import org.castor.cpa.test.framework.xml.types.DatabaseEngineType;
+import org.castor.jdo.util.JDOConfFactory;
+import org.exolab.castor.jdo.JDOManager;
+import org.exolab.castor.mapping.MappingException;
+
+/**
+ * Tests to load Book with class mapping.
+ */
+public final class TestSingleClassMapping extends AbstractTestSingle {
+ private static final String DBNAME = "test2996-single-class";
+ private static final String MAPPING = Book.class.getName();
+
+ public TestSingleClassMapping(final String name) {
+ super(name);
+ }
+
+ // Test are only included/excluded for engines that have been tested with this test suite.
+
+ public boolean include(final DatabaseEngineType engine) {
+ return (engine == DatabaseEngineType.DERBY)
+ || (engine == DatabaseEngineType.MYSQL);
+ }
+
+ @Override
+ protected JDOManager getJDOManager() throws MappingException {
+ org.castor.jdo.conf.Database dbConfig = getDbConfig(DBNAME);
+ dbConfig.addClassMapping(JDOConfFactory.createClassMapping(MAPPING));
+ return getJDOManager(dbConfig);
+ }
+}
Index: cpactf/src/test/java/org/castor/cpa/test/test2996/single/TestSingleXmlMapping.java
===================================================================
--- cpactf/src/test/java/org/castor/cpa/test/test2996/single/TestSingleXmlMapping.java (revision 0)
+++ cpactf/src/test/java/org/castor/cpa/test/test2996/single/TestSingleXmlMapping.java (revision 0)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2009 Tobias Hochwallner, Ralf Joachim
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.castor.cpa.test.test2996.single;
+
+import org.castor.cpa.test.framework.xml.types.DatabaseEngineType;
+import org.exolab.castor.jdo.JDOManager;
+import org.exolab.castor.mapping.MappingException;
+
+/**
+ * Tests to load Book with XML mapping.
+ */
+public final class TestSingleXmlMapping extends AbstractTestSingle {
+ private static final String DBNAME = "test2996-single-xml";
+ private static final String MAPPING = "/org/castor/cpa/test/test2996/single/mapping.xml";
+
+ public TestSingleXmlMapping(final String name) {
+ super(name);
+ }
+
+ // Test are only included/excluded for engines that have been tested with this test suite.
+
+ public boolean include(final DatabaseEngineType engine) {
+ return (engine == DatabaseEngineType.DERBY)
+ || (engine == DatabaseEngineType.MYSQL);
+ }
+
+ @Override
+ protected JDOManager getJDOManager() throws MappingException {
+ return getJDOManager(DBNAME, MAPPING);
+ }
+}
Index: cpactf/src/test/resources/binding.generation.properties
===================================================================
--- cpactf/src/test/resources/binding.generation.properties (revision 0)
+++ cpactf/src/test/resources/binding.generation.properties (revision 0)
@@ -0,0 +1,10 @@
+# To enable bound properties uncomment the following line. Please
+# note that currently *all* fields will be treated as bound properties
+# when enabled. This will change in the future when we introduce
+# fine grained control over each class and it's properties.
+#
+org.exolab.castor.builder.javaclassmapping=type
+org.exolab.castor.builder.nspackages=\
+ http://castor.org/cpa/test/test2996/single=org.castor.cpa.test.test2996.single,\
+ http://castor.org/cpa/test/test2996/onetoone=org.castor.cpa.test.test2996.onetoone,\
+ http://castor.org/cpa/test/test2996/onetomany=org.castor.cpa.test.test2996.onetomany
\ No newline at end of file
Index: cpactf/src/test/resources/schema.xsd
===================================================================
--- cpactf/src/test/resources/schema.xsd (revision 0)
+++ cpactf/src/test/resources/schema.xsd (revision 0)
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
\ No newline at end of file
Index: cpactf/src/test/resources/org/castor/cpa/test/test2996/onetomany/dbunit-setup.xml
===================================================================
--- cpactf/src/test/resources/org/castor/cpa/test/test2996/onetomany/dbunit-setup.xml (revision 0)
+++ cpactf/src/test/resources/org/castor/cpa/test/test2996/onetomany/dbunit-setup.xml (revision 0)
@@ -0,0 +1,27 @@
+
+
+ id
+
+ 100
+
+
+ 101
+
+
+
+ id
+ house_id
+
+ 1
+ 100
+
+
+ 2
+ 101
+
+
+ 3
+ 101
+
+
+
Index: cpactf/src/test/resources/org/castor/cpa/test/test2996/onetomany/mapping-flat.xml
===================================================================
--- cpactf/src/test/resources/org/castor/cpa/test/test2996/onetomany/mapping-flat.xml (revision 0)
+++ cpactf/src/test/resources/org/castor/cpa/test/test2996/onetomany/mapping-flat.xml (revision 0)
@@ -0,0 +1,12 @@
+
+
+
+
+ Flat
+
+
+
+
+
+
Index: cpactf/src/test/resources/org/castor/cpa/test/test2996/onetomany/mapping-house.xml
===================================================================
--- cpactf/src/test/resources/org/castor/cpa/test/test2996/onetomany/mapping-house.xml (revision 0)
+++ cpactf/src/test/resources/org/castor/cpa/test/test2996/onetomany/mapping-house.xml (revision 0)
@@ -0,0 +1,15 @@
+
+
+
+
+ House
+
+
+
+
+
+
+
+
+
Index: cpactf/src/test/resources/org/castor/cpa/test/test2996/onetomany/mapping.xml
===================================================================
--- cpactf/src/test/resources/org/castor/cpa/test/test2996/onetomany/mapping.xml (revision 0)
+++ cpactf/src/test/resources/org/castor/cpa/test/test2996/onetomany/mapping.xml (revision 0)
@@ -0,0 +1,22 @@
+
+
+
+
+ Flat
+
+
+
+
+
+
+ House
+
+
+
+
+
+
+
+
+
Index: cpactf/src/test/resources/org/castor/cpa/test/test2996/onetomany/schema.xsd
===================================================================
--- cpactf/src/test/resources/org/castor/cpa/test/test2996/onetomany/schema.xsd (revision 0)
+++ cpactf/src/test/resources/org/castor/cpa/test/test2996/onetomany/schema.xsd (revision 0)
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+ id
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: cpactf/src/test/resources/org/castor/cpa/test/test2996/onetoone/dbunit-inserted.xml
===================================================================
--- cpactf/src/test/resources/org/castor/cpa/test/test2996/onetoone/dbunit-inserted.xml (revision 0)
+++ cpactf/src/test/resources/org/castor/cpa/test/test2996/onetoone/dbunit-inserted.xml (revision 0)
@@ -0,0 +1,23 @@
+
+
+
+ id
+ address_id
+
+ 1
+ 2
+
+
+ 666
+ 999
+
+
+
Index: cpactf/src/test/resources/org/castor/cpa/test/test2996/onetoone/dbunit-removed.xml
===================================================================
--- cpactf/src/test/resources/org/castor/cpa/test/test2996/onetoone/dbunit-removed.xml (revision 0)
+++ cpactf/src/test/resources/org/castor/cpa/test/test2996/onetoone/dbunit-removed.xml (revision 0)
@@ -0,0 +1,12 @@
+
+
+
+
Index: cpactf/src/test/resources/org/castor/cpa/test/test2996/onetoone/dbunit-setup.xml
===================================================================
--- cpactf/src/test/resources/org/castor/cpa/test/test2996/onetoone/dbunit-setup.xml (revision 0)
+++ cpactf/src/test/resources/org/castor/cpa/test/test2996/onetoone/dbunit-setup.xml (revision 0)
@@ -0,0 +1,16 @@
+
+
+
+ id
+ address_id
+
+ 1
+ 2
+
+
+
Index: cpactf/src/test/resources/org/castor/cpa/test/test2996/onetoone/dbunit-updated.xml
===================================================================
--- cpactf/src/test/resources/org/castor/cpa/test/test2996/onetoone/dbunit-updated.xml (revision 0)
+++ cpactf/src/test/resources/org/castor/cpa/test/test2996/onetoone/dbunit-updated.xml (revision 0)
@@ -0,0 +1,19 @@
+
+
+
+ id
+ address_id
+
+ 1
+ 666
+
+
+
Index: cpactf/src/test/resources/org/castor/cpa/test/test2996/onetoone/mapping-address.xml
===================================================================
--- cpactf/src/test/resources/org/castor/cpa/test/test2996/onetoone/mapping-address.xml (revision 0)
+++ cpactf/src/test/resources/org/castor/cpa/test/test2996/onetoone/mapping-address.xml (revision 0)
@@ -0,0 +1,12 @@
+
+
+
+
+ Address
+
+
+
+
+
+
Index: cpactf/src/test/resources/org/castor/cpa/test/test2996/onetoone/mapping-employee.xml
===================================================================
--- cpactf/src/test/resources/org/castor/cpa/test/test2996/onetoone/mapping-employee.xml (revision 0)
+++ cpactf/src/test/resources/org/castor/cpa/test/test2996/onetoone/mapping-employee.xml (revision 0)
@@ -0,0 +1,16 @@
+
+
+
+
+ Employee
+
+
+
+
+
+
+
+
+
Index: cpactf/src/test/resources/org/castor/cpa/test/test2996/onetoone/mapping.xml
===================================================================
--- cpactf/src/test/resources/org/castor/cpa/test/test2996/onetoone/mapping.xml (revision 0)
+++ cpactf/src/test/resources/org/castor/cpa/test/test2996/onetoone/mapping.xml (revision 0)
@@ -0,0 +1,23 @@
+
+
+
+
+ Address
+
+
+
+
+
+
+ Employee
+
+
+
+
+
+
+
+
+
Index: cpactf/src/test/resources/org/castor/cpa/test/test2996/onetoone/schema.xsd
===================================================================
--- cpactf/src/test/resources/org/castor/cpa/test/test2996/onetoone/schema.xsd (revision 0)
+++ cpactf/src/test/resources/org/castor/cpa/test/test2996/onetoone/schema.xsd (revision 0)
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+ id
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: cpactf/src/test/resources/org/castor/cpa/test/test2996/single/dbunit-empty.xml
===================================================================
--- cpactf/src/test/resources/org/castor/cpa/test/test2996/single/dbunit-empty.xml (revision 0)
+++ cpactf/src/test/resources/org/castor/cpa/test/test2996/single/dbunit-empty.xml (revision 0)
@@ -0,0 +1,6 @@
+
+
+
Index: cpactf/src/test/resources/org/castor/cpa/test/test2996/single/dbunit-inserted.xml
===================================================================
--- cpactf/src/test/resources/org/castor/cpa/test/test2996/single/dbunit-inserted.xml (revision 0)
+++ cpactf/src/test/resources/org/castor/cpa/test/test2996/single/dbunit-inserted.xml (revision 0)
@@ -0,0 +1,14 @@
+
+
+ isbn
+ title
+
+ 1234
+ Heart of Darkness
+
+
+ 1235
+ My Definition
+
+
+
Index: cpactf/src/test/resources/org/castor/cpa/test/test2996/single/dbunit-setup.xml
===================================================================
--- cpactf/src/test/resources/org/castor/cpa/test/test2996/single/dbunit-setup.xml (revision 0)
+++ cpactf/src/test/resources/org/castor/cpa/test/test2996/single/dbunit-setup.xml (revision 0)
@@ -0,0 +1,10 @@
+
+
+ isbn
+ title
+
+ 1234
+ Heart of Darkness
+
+
+
Index: cpactf/src/test/resources/org/castor/cpa/test/test2996/single/dbunit-updated.xml
===================================================================
--- cpactf/src/test/resources/org/castor/cpa/test/test2996/single/dbunit-updated.xml (revision 0)
+++ cpactf/src/test/resources/org/castor/cpa/test/test2996/single/dbunit-updated.xml (revision 0)
@@ -0,0 +1,10 @@
+
+
+ isbn
+ title
+
+ 1234
+ Heart of Light
+
+
+
Index: cpactf/src/test/resources/org/castor/cpa/test/test2996/single/mapping.xml
===================================================================
--- cpactf/src/test/resources/org/castor/cpa/test/test2996/single/mapping.xml (revision 0)
+++ cpactf/src/test/resources/org/castor/cpa/test/test2996/single/mapping.xml (revision 0)
@@ -0,0 +1,15 @@
+
+
+
+
+ Book
+
+
+
+
+
+
+
+
+
Index: cpactf/src/test/resources/org/castor/cpa/test/test2996/single/schema.xsd
===================================================================
--- cpactf/src/test/resources/org/castor/cpa/test/test2996/single/schema.xsd (revision 0)
+++ cpactf/src/test/resources/org/castor/cpa/test/test2996/single/schema.xsd (revision 0)
@@ -0,0 +1,42 @@
+
+
+
+
+ This is a test XML Schema with appinfo annotations for Entity testcase.
+
+
+
+
+
+
+
+
+
+
+
+ isbn
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: src/doc/release-notes.xml
===================================================================
--- src/doc/release-notes.xml (revision 8704)
+++ src/doc/release-notes.xml (working copy)
@@ -70,6 +70,26 @@
+
+
+ Integrated tests of jdo-extension-it into CPACTF.
+
+
+ Ralf Joachim
+ ralf.joachim@syscon.eu
+
+
+ Ralf Joachim
+ ralf.joachim@syscon.eu
+
+
+ Ralf Joachim
+ ralf.joachim@syscon.eu
+
+ Enh.
+ JDO
+ 20100907
+
Removed requirement to specify default mapping/configuration for CPACTF.