From 42c1fc20fd76f0797685690e0eb4acfd676b1cfd Mon Sep 17 00:00:00 2001 From: Erik Brakkee Date: Wed, 12 May 2010 16:39:11 +0000 Subject: [PATCH] --- test/README.txt | 3 + test/jpatest-eclipselink/pom.xml | 62 +++++++++++++++++++ .../eclipselink/EclipselinkJpaCustomizer.java | 59 ++++++++++++++++++ .../eclipselink/EclipselinkTables.java | 34 ++++++++++ ....wamblee.support.persistence.JpaCustomizer | 1 + .../eclipselink/DatabaseUtilsTest.java | 27 ++++++++ .../eclipselink/MyEntityExampleTest.java | 25 ++++++++ test/jpatest-hibernate/pom.xml | 48 ++++++++++++++ .../hibernate/HibernateJpaCustomizer.java | 61 ++++++++++++++++++ .../hibernate/HibernateTables.java | 34 ++++++++++ ....wamblee.support.persistence.JpaCustomizer | 1 + .../hibernate/DatabaseUtilsTest.java | 27 ++++++++ .../hibernate/MyEntityExampleTest.java | 25 ++++++++ .../TransactionProxyFactoryTest.java | 8 +++ test/jpatest-toplink-essentials/pom.xml | 58 +++++++++++++++++ .../toplink/ToplinkJpaCustomizer.java | 61 ++++++++++++++++++ .../persistence/toplink/ToplinkTables.java | 34 ++++++++++ ....wamblee.support.persistence.JpaCustomizer | 1 + .../toplink/DatabaseUtilsTest.java | 27 ++++++++ .../toplink/MyEntityExampleTest.java | 25 ++++++++ 20 files changed, 621 insertions(+) create mode 100644 test/jpatest-eclipselink/pom.xml create mode 100644 test/jpatest-eclipselink/src/main/java/org/wamblee/support/persistence/eclipselink/EclipselinkJpaCustomizer.java create mode 100644 test/jpatest-eclipselink/src/main/java/org/wamblee/support/persistence/eclipselink/EclipselinkTables.java create mode 100644 test/jpatest-eclipselink/src/main/resources/META-INF/services/org.wamblee.support.persistence.JpaCustomizer create mode 100644 test/jpatest-eclipselink/src/test/java/org/wamblee/support/persistence/eclipselink/DatabaseUtilsTest.java create mode 100644 test/jpatest-eclipselink/src/test/java/org/wamblee/support/persistence/eclipselink/MyEntityExampleTest.java create mode 100644 test/jpatest-hibernate/pom.xml create mode 100644 test/jpatest-hibernate/src/main/java/org/wamblee/support/persistence/hibernate/HibernateJpaCustomizer.java create mode 100644 test/jpatest-hibernate/src/main/java/org/wamblee/support/persistence/hibernate/HibernateTables.java create mode 100644 test/jpatest-hibernate/src/main/resources/META-INF/services/org.wamblee.support.persistence.JpaCustomizer create mode 100644 test/jpatest-hibernate/src/test/java/org/wamblee/support/persistence/hibernate/DatabaseUtilsTest.java create mode 100644 test/jpatest-hibernate/src/test/java/org/wamblee/support/persistence/hibernate/MyEntityExampleTest.java create mode 100644 test/jpatest-hibernate/src/test/java/org/wamblee/support/persistence/hibernate/TransactionProxyFactoryTest.java create mode 100644 test/jpatest-toplink-essentials/pom.xml create mode 100644 test/jpatest-toplink-essentials/src/main/java/org/wamblee/support/persistence/toplink/ToplinkJpaCustomizer.java create mode 100644 test/jpatest-toplink-essentials/src/main/java/org/wamblee/support/persistence/toplink/ToplinkTables.java create mode 100644 test/jpatest-toplink-essentials/src/main/resources/META-INF/services/org.wamblee.support.persistence.JpaCustomizer create mode 100644 test/jpatest-toplink-essentials/src/test/java/org/wamblee/support/persistence/toplink/DatabaseUtilsTest.java create mode 100644 test/jpatest-toplink-essentials/src/test/java/org/wamblee/support/persistence/toplink/MyEntityExampleTest.java diff --git a/test/README.txt b/test/README.txt index 48a58473..6879926d 100644 --- a/test/README.txt +++ b/test/README.txt @@ -2,3 +2,6 @@ Behavior which requires a persistence provider but does not use the persistence provider extensively is only tested with hibernate. +Test code for each of the JPA providers is in a separate 'jpatest-' project. This is +required to remove the dependence on the JPA provider from the pom, allowing them to +be deployed to the central maven repo. diff --git a/test/jpatest-eclipselink/pom.xml b/test/jpatest-eclipselink/pom.xml new file mode 100644 index 00000000..d7de88ff --- /dev/null +++ b/test/jpatest-eclipselink/pom.xml @@ -0,0 +1,62 @@ + + + + org.wamblee + wamblee-utils + 0.2.4-SNAPSHOT + + + 4.0.0 + org.wamblee + wamblee-test-jpatest-eclipselink + jar + /test/eclipselink + http://wamblee.org + + + + org.wamblee + wamblee-test-enterprise + 0.2.4-SNAPSHOT + + + + org.wamblee + wamblee-test-enterprise + 0.2.4-SNAPSHOT + test-jar + + + + org.dbunit + dbunit + + + + org.eclipse.persistence + javax.persistence + 2.0.0 + + + + javax.persistence + persistence-api + + + + org.eclipse.persistence + eclipselink + + + + + + + EclipseLink Repo + http://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/rt/eclipselink/maven.repo + + + + + + diff --git a/test/jpatest-eclipselink/src/main/java/org/wamblee/support/persistence/eclipselink/EclipselinkJpaCustomizer.java b/test/jpatest-eclipselink/src/main/java/org/wamblee/support/persistence/eclipselink/EclipselinkJpaCustomizer.java new file mode 100644 index 00000000..1679942b --- /dev/null +++ b/test/jpatest-eclipselink/src/main/java/org/wamblee/support/persistence/eclipselink/EclipselinkJpaCustomizer.java @@ -0,0 +1,59 @@ +/* + * Copyright 2005-2010 the original author or authors. + * + * 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.wamblee.support.persistence.eclipselink; + +import org.dbunit.dataset.filter.ITableFilterSimple; + +import org.wamblee.io.FileSystemUtils; +import org.wamblee.support.persistence.JpaCustomizer; +import org.wamblee.support.persistence.PersistenceUnitDescription; + +import java.io.File; +import java.util.Map; + +/** + * + * @author $author$ + * @version $Revision$ + */ +public class EclipselinkJpaCustomizer implements JpaCustomizer { + /** + * Creates a new EclipselinkJpaCustomizer object. + */ + public EclipselinkJpaCustomizer() { + // Empty + } + + @Override + public void customize(PersistenceUnitDescription aPersistenceUnit, + Map aJpaProperties) { + + // DDL generation + aJpaProperties.put("eclipselink.ddl-generation", "create-tables"); + + // DDL generation + FileSystemUtils.createDir(new File("target/sql")); + aJpaProperties.put("eclipselink.application-location", "target/sql"); + aJpaProperties.put("eclipselink.create-ddl-jdbc-file-name", "create-schema.sql"); + aJpaProperties.put("eclipselink.drop-ddl-jdbc-file-name", "drop-schema.sql"); + aJpaProperties.put("eclipselink.ddl-generation.output-mode", "both"); + } + + @Override + public ITableFilterSimple getJpaTables() { + return new EclipselinkTables(); + } +} diff --git a/test/jpatest-eclipselink/src/main/java/org/wamblee/support/persistence/eclipselink/EclipselinkTables.java b/test/jpatest-eclipselink/src/main/java/org/wamblee/support/persistence/eclipselink/EclipselinkTables.java new file mode 100644 index 00000000..29872d01 --- /dev/null +++ b/test/jpatest-eclipselink/src/main/java/org/wamblee/support/persistence/eclipselink/EclipselinkTables.java @@ -0,0 +1,34 @@ +/* + * Copyright 2005-2010 the original author or authors. + * + * 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.wamblee.support.persistence.eclipselink; + +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.filter.ITableFilterSimple; + +import java.util.Arrays; +import java.util.List; + +/** + * Toplink-specific tables. + */ +public class EclipselinkTables implements ITableFilterSimple { + private static final List TABLES = Arrays + .asList(new String[] { "SEQUENCE" }); + + public boolean accept(String aTableName) throws DataSetException { + return TABLES.contains(aTableName); + } +} diff --git a/test/jpatest-eclipselink/src/main/resources/META-INF/services/org.wamblee.support.persistence.JpaCustomizer b/test/jpatest-eclipselink/src/main/resources/META-INF/services/org.wamblee.support.persistence.JpaCustomizer new file mode 100644 index 00000000..35638de1 --- /dev/null +++ b/test/jpatest-eclipselink/src/main/resources/META-INF/services/org.wamblee.support.persistence.JpaCustomizer @@ -0,0 +1 @@ +org.wamblee.support.persistence.eclipselink.EclipselinkJpaCustomizer diff --git a/test/jpatest-eclipselink/src/test/java/org/wamblee/support/persistence/eclipselink/DatabaseUtilsTest.java b/test/jpatest-eclipselink/src/test/java/org/wamblee/support/persistence/eclipselink/DatabaseUtilsTest.java new file mode 100644 index 00000000..3fbf2f20 --- /dev/null +++ b/test/jpatest-eclipselink/src/test/java/org/wamblee/support/persistence/eclipselink/DatabaseUtilsTest.java @@ -0,0 +1,27 @@ +/* + * Copyright 2005-2010 the original author or authors. + * + * 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.wamblee.support.persistence.eclipselink; + +import org.wamblee.support.persistence.DatabaseUtilsTestBase; + +/** + * + * @author $author$ + * @version $Revision$ + */ +public class DatabaseUtilsTest extends DatabaseUtilsTestBase { + // Empty, all tests inherited +} diff --git a/test/jpatest-eclipselink/src/test/java/org/wamblee/support/persistence/eclipselink/MyEntityExampleTest.java b/test/jpatest-eclipselink/src/test/java/org/wamblee/support/persistence/eclipselink/MyEntityExampleTest.java new file mode 100644 index 00000000..e95afb8f --- /dev/null +++ b/test/jpatest-eclipselink/src/test/java/org/wamblee/support/persistence/eclipselink/MyEntityExampleTest.java @@ -0,0 +1,25 @@ +/* + * Copyright 2005-2010 the original author or authors. + * + * 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.wamblee.support.persistence.eclipselink; + +import org.wamblee.support.persistence.MyEntityExampleTestBase; + +/** + * This class shows an example of how to test an entity using jpa. + */ +public class MyEntityExampleTest extends MyEntityExampleTestBase { + // Empty, all tests are inherited +} diff --git a/test/jpatest-hibernate/pom.xml b/test/jpatest-hibernate/pom.xml new file mode 100644 index 00000000..a13fe256 --- /dev/null +++ b/test/jpatest-hibernate/pom.xml @@ -0,0 +1,48 @@ + + + + org.wamblee + wamblee-utils + 0.2.4-SNAPSHOT + + + 4.0.0 + org.wamblee + wamblee-test-jpatest-hibernate + jar + /test/hibernate + http://wamblee.org + + + + org.wamblee + wamblee-test-enterprise + 0.2.4-SNAPSHOT + + + + org.wamblee + wamblee-test-enterprise + 0.2.4-SNAPSHOT + test-jar + + + + org.dbunit + dbunit + + + + javax.persistence + persistence-api + + + + org.wamblee + wamblee-hibernate-jpa + 0.2.4-SNAPSHOT + + + + + diff --git a/test/jpatest-hibernate/src/main/java/org/wamblee/support/persistence/hibernate/HibernateJpaCustomizer.java b/test/jpatest-hibernate/src/main/java/org/wamblee/support/persistence/hibernate/HibernateJpaCustomizer.java new file mode 100644 index 00000000..71bbb18c --- /dev/null +++ b/test/jpatest-hibernate/src/main/java/org/wamblee/support/persistence/hibernate/HibernateJpaCustomizer.java @@ -0,0 +1,61 @@ +/* + * Copyright 2005-2010 the original author or authors. + * + * 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.wamblee.support.persistence.hibernate; + +import org.dbunit.dataset.filter.ITableFilterSimple; + +import org.wamblee.support.persistence.JpaCustomizer; +import org.wamblee.support.persistence.PersistenceUnitDescription; + +import java.util.Map; + +/** + * + * @author $author$ + * @version $Revision$ + */ +public class HibernateJpaCustomizer implements JpaCustomizer { + /** + * Creates a new HibernateJpaCustomizer object. + */ + public HibernateJpaCustomizer() { + // Empty + } + + @Override + public void customize(PersistenceUnitDescription aPersistenceUnit, + Map aJpaProperties) { + + System.setProperty("hibernate.temp.use_jdbc_metadata_defaults", "true"); + + // Set non-JPA connection properties for older versions of hibernate + System.getProperties().remove("hibernate.connection.datasource"); + if (System.getProperty("hibernate.connection.datasource") != null ) { + throw new RuntimeException("ERROR"); + } + System.setProperty("hibernate.connection.url", aJpaProperties.get("javax.persistence.jdbc.url")); + System.setProperty("hibernate.connection.username", aJpaProperties.get("javax.persistence.jdbc.user")); + System.setProperty("hibernate.connection.password", aJpaProperties.get("javax.persistence.jdbc.password")); + + // Hibernate schema generation + aJpaProperties.put("hibernate.hbm2ddl.auto", "create"); + } + + @Override + public ITableFilterSimple getJpaTables() { + return new HibernateTables(); + } +} diff --git a/test/jpatest-hibernate/src/main/java/org/wamblee/support/persistence/hibernate/HibernateTables.java b/test/jpatest-hibernate/src/main/java/org/wamblee/support/persistence/hibernate/HibernateTables.java new file mode 100644 index 00000000..f58ea8e9 --- /dev/null +++ b/test/jpatest-hibernate/src/main/java/org/wamblee/support/persistence/hibernate/HibernateTables.java @@ -0,0 +1,34 @@ +/* + * Copyright 2005-2010 the original author or authors. + * + * 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.wamblee.support.persistence.hibernate; + +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.filter.ITableFilterSimple; + +import java.util.Arrays; +import java.util.List; + +/** + * Toplink-specific tables. + */ +public class HibernateTables implements ITableFilterSimple { + private static final List TABLES = Arrays + .asList(new String[] { "" }); + + public boolean accept(String aTableName) throws DataSetException { + return TABLES.contains(aTableName); + } +} diff --git a/test/jpatest-hibernate/src/main/resources/META-INF/services/org.wamblee.support.persistence.JpaCustomizer b/test/jpatest-hibernate/src/main/resources/META-INF/services/org.wamblee.support.persistence.JpaCustomizer new file mode 100644 index 00000000..d057634d --- /dev/null +++ b/test/jpatest-hibernate/src/main/resources/META-INF/services/org.wamblee.support.persistence.JpaCustomizer @@ -0,0 +1 @@ +org.wamblee.support.persistence.hibernate.HibernateJpaCustomizer diff --git a/test/jpatest-hibernate/src/test/java/org/wamblee/support/persistence/hibernate/DatabaseUtilsTest.java b/test/jpatest-hibernate/src/test/java/org/wamblee/support/persistence/hibernate/DatabaseUtilsTest.java new file mode 100644 index 00000000..6059c956 --- /dev/null +++ b/test/jpatest-hibernate/src/test/java/org/wamblee/support/persistence/hibernate/DatabaseUtilsTest.java @@ -0,0 +1,27 @@ +/* + * Copyright 2005-2010 the original author or authors. + * + * 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.wamblee.support.persistence.hibernate; + +import org.wamblee.support.persistence.DatabaseUtilsTestBase; + +/** + * + * @author $author$ + * @version $Revision$ + */ +public class DatabaseUtilsTest extends DatabaseUtilsTestBase { + // Empty, all tests inherited +} diff --git a/test/jpatest-hibernate/src/test/java/org/wamblee/support/persistence/hibernate/MyEntityExampleTest.java b/test/jpatest-hibernate/src/test/java/org/wamblee/support/persistence/hibernate/MyEntityExampleTest.java new file mode 100644 index 00000000..3ac32a5d --- /dev/null +++ b/test/jpatest-hibernate/src/test/java/org/wamblee/support/persistence/hibernate/MyEntityExampleTest.java @@ -0,0 +1,25 @@ +/* + * Copyright 2005-2010 the original author or authors. + * + * 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.wamblee.support.persistence.hibernate; + +import org.wamblee.support.persistence.MyEntityExampleTestBase; + +/** + * This class shows an example of how to test an entity using jpa. + */ +public class MyEntityExampleTest extends MyEntityExampleTestBase { + // Empty, all tests are inherited +} diff --git a/test/jpatest-hibernate/src/test/java/org/wamblee/support/persistence/hibernate/TransactionProxyFactoryTest.java b/test/jpatest-hibernate/src/test/java/org/wamblee/support/persistence/hibernate/TransactionProxyFactoryTest.java new file mode 100644 index 00000000..df057b5a --- /dev/null +++ b/test/jpatest-hibernate/src/test/java/org/wamblee/support/persistence/hibernate/TransactionProxyFactoryTest.java @@ -0,0 +1,8 @@ +package org.wamblee.support.persistence.hibernate; + +import org.wamblee.support.persistence.TransactionProxyFactoryTestBase; + +public class TransactionProxyFactoryTest extends + TransactionProxyFactoryTestBase { + +} diff --git a/test/jpatest-toplink-essentials/pom.xml b/test/jpatest-toplink-essentials/pom.xml new file mode 100644 index 00000000..df6c33a9 --- /dev/null +++ b/test/jpatest-toplink-essentials/pom.xml @@ -0,0 +1,58 @@ + + + + org.wamblee + wamblee-utils + 0.2.4-SNAPSHOT + + + 4.0.0 + org.wamblee + wamblee-test-jpatest-toplink-essentials + jar + /test/toplinkessentials + http://wamblee.org + + + + org.wamblee + wamblee-test-enterprise + 0.2.4-SNAPSHOT + + + + org.wamblee + wamblee-test-enterprise + 0.2.4-SNAPSHOT + test-jar + + + + org.dbunit + dbunit + + + + javax.persistence + persistence-api + + + + toplink.essentials + toplink-essentials + + + + + + + + javaee + Java EE repo at SUN + http://download.java.net/maven/1 + legacy + + + + + diff --git a/test/jpatest-toplink-essentials/src/main/java/org/wamblee/support/persistence/toplink/ToplinkJpaCustomizer.java b/test/jpatest-toplink-essentials/src/main/java/org/wamblee/support/persistence/toplink/ToplinkJpaCustomizer.java new file mode 100644 index 00000000..1b3808f0 --- /dev/null +++ b/test/jpatest-toplink-essentials/src/main/java/org/wamblee/support/persistence/toplink/ToplinkJpaCustomizer.java @@ -0,0 +1,61 @@ +/* + * Copyright 2005-2010 the original author or authors. + * + * 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.wamblee.support.persistence.toplink; + +import java.io.File; +import java.util.Map; + +import org.dbunit.dataset.filter.ITableFilterSimple; +import org.wamblee.io.FileSystemUtils; +import org.wamblee.support.persistence.JpaCustomizer; +import org.wamblee.support.persistence.PersistenceUnitDescription; + +/** + * + * @author $author$ + * @version $Revision$ + */ +public class ToplinkJpaCustomizer implements JpaCustomizer { + /** + * Creates a new ToplinkJpaCustomizer object. + */ + public ToplinkJpaCustomizer() { + // Empty + } + + @Override + public void customize(PersistenceUnitDescription aPersistenceUnit, + Map aJpaProperties) { + + // Custom datasource properties. + aJpaProperties.put("toplink.jdbc.url", aJpaProperties.get("javax.persistence.jdbc.url")); + aJpaProperties.put("toplink.jdbc.user", aJpaProperties.get("javax.persistence.jdbc.user")); + aJpaProperties.put("toplink.jdbc.password", aJpaProperties.get("javax.persistence.jdbc.password")); + + // DDL generation for toplink + aJpaProperties.put("toplink.ddl-generation", "create-tables"); + + // DDL generation + FileSystemUtils.createDir(new File("target/sql")); + aJpaProperties.put("toplink.create-ddl-jdbc-file-name", "target/sql/create-schema.sql"); + aJpaProperties.put("toplink.drop-ddl-jdbc-file-name", "target/sql/drop-schema.sql"); + } + + @Override + public ITableFilterSimple getJpaTables() { + return new ToplinkTables(); + } +} diff --git a/test/jpatest-toplink-essentials/src/main/java/org/wamblee/support/persistence/toplink/ToplinkTables.java b/test/jpatest-toplink-essentials/src/main/java/org/wamblee/support/persistence/toplink/ToplinkTables.java new file mode 100644 index 00000000..4a99d7de --- /dev/null +++ b/test/jpatest-toplink-essentials/src/main/java/org/wamblee/support/persistence/toplink/ToplinkTables.java @@ -0,0 +1,34 @@ +/* + * Copyright 2005-2010 the original author or authors. + * + * 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.wamblee.support.persistence.toplink; + +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.filter.ITableFilterSimple; + +import java.util.Arrays; +import java.util.List; + +/** + * Toplink-specific tables. + */ +public class ToplinkTables implements ITableFilterSimple { + private static final List TABLES = Arrays + .asList(new String[] { "SEQUENCE" }); + + public boolean accept(String aTableName) throws DataSetException { + return TABLES.contains(aTableName); + } +} diff --git a/test/jpatest-toplink-essentials/src/main/resources/META-INF/services/org.wamblee.support.persistence.JpaCustomizer b/test/jpatest-toplink-essentials/src/main/resources/META-INF/services/org.wamblee.support.persistence.JpaCustomizer new file mode 100644 index 00000000..82d1265a --- /dev/null +++ b/test/jpatest-toplink-essentials/src/main/resources/META-INF/services/org.wamblee.support.persistence.JpaCustomizer @@ -0,0 +1 @@ +org.wamblee.support.persistence.toplink.ToplinkJpaCustomizer diff --git a/test/jpatest-toplink-essentials/src/test/java/org/wamblee/support/persistence/toplink/DatabaseUtilsTest.java b/test/jpatest-toplink-essentials/src/test/java/org/wamblee/support/persistence/toplink/DatabaseUtilsTest.java new file mode 100644 index 00000000..c45ea93c --- /dev/null +++ b/test/jpatest-toplink-essentials/src/test/java/org/wamblee/support/persistence/toplink/DatabaseUtilsTest.java @@ -0,0 +1,27 @@ +/* + * Copyright 2005-2010 the original author or authors. + * + * 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.wamblee.support.persistence.toplink; + +import org.wamblee.support.persistence.DatabaseUtilsTestBase; + +/** + * + * @author $author$ + * @version $Revision$ + */ +public class DatabaseUtilsTest extends DatabaseUtilsTestBase { + // Empty, all tests inherited +} diff --git a/test/jpatest-toplink-essentials/src/test/java/org/wamblee/support/persistence/toplink/MyEntityExampleTest.java b/test/jpatest-toplink-essentials/src/test/java/org/wamblee/support/persistence/toplink/MyEntityExampleTest.java new file mode 100644 index 00000000..8d60e75e --- /dev/null +++ b/test/jpatest-toplink-essentials/src/test/java/org/wamblee/support/persistence/toplink/MyEntityExampleTest.java @@ -0,0 +1,25 @@ +/* + * Copyright 2005-2010 the original author or authors. + * + * 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.wamblee.support.persistence.toplink; + +import org.wamblee.support.persistence.MyEntityExampleTestBase; + +/** + * This class shows an example of how to test an entity using jpa. + */ +public class MyEntityExampleTest extends MyEntityExampleTestBase { + // Empty, all tests are inherited +} -- 2.31.1