OPENJPA-1374 The @DatabasePlatform no longer works, as Derby will always be on the classpath. Switching 3 junits over to use setSupportedDatabases() in their setUp() routines instead....

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@901419 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Donald Woods 2010-01-20 22:53:02 +00:00
parent acafc94a5e
commit 5a0b97302b
3 changed files with 37 additions and 17 deletions

View File

@ -27,6 +27,7 @@ import javax.persistence.Persistence;
import org.apache.openjpa.conf.OpenJPAConfiguration;
import org.apache.openjpa.enhance.TestEnhancementWithMultiplePUs;
import org.apache.openjpa.jdbc.schema.DataSourceFactory;
import org.apache.openjpa.jdbc.sql.DerbyDictionary;
import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
import org.apache.openjpa.persistence.OpenJPAPersistence;
import org.apache.openjpa.persistence.common.utils.AbstractTestCase;
@ -49,10 +50,7 @@ import junit.framework.TestCase;
*
*/
// Specifies that the test runs only if the driver is available in the
// execution classpath
@DatabasePlatform("org.apache.derby.jdbc.EmbeddedDriver")
public class TestEquivalentConfiguration extends SingleEMFTestCase {
private EntityManagerFactory emf;
@ -97,6 +95,13 @@ public class TestEquivalentConfiguration extends SingleEMFTestCase {
*/
@Override
public void setUp() throws Exception {
// Only run on Derby
setSupportedDatabases(
org.apache.openjpa.jdbc.sql.DerbyDictionary.class);
if (isTestsDisabled()) {
return;
}
_system = backup();
clear(_system);
}

View File

@ -23,6 +23,7 @@ import java.util.List;
import javax.persistence.EntityManager;
import org.apache.openjpa.jdbc.sql.DerbyDictionary;
import org.apache.openjpa.persistence.OpenJPAEntityManager;
import org.apache.openjpa.persistence.OpenJPAPersistence;
import org.apache.openjpa.persistence.test.AllowFailure;
@ -43,22 +44,28 @@ import org.apache.openjpa.persistence.test.SingleEMFTestCase;
* @author Pinaki Poddar
* @author Michael Vorburger
*/
// Because we use DDL specific to Derby
@DatabasePlatform("org.apache.derby.jdbc.EmbeddedDriver")
@DatabasePlatform("org.apache.derby.jdbc.EmbeddedDriver")
public class TestCompundIdWithNull extends SingleEMFTestCase {
private static boolean tablesCreated = false;
public void setUp() throws Exception {
// do not use CLEAR_TABLES or DROP_TABLES
super.setUp(SimpleCompoundIdTestEntity.class, ComplexCompoundIdTestEntity.class, TypeEntity.class);
if (!tablesCreated) {
createTables(emf.createEntityManager());
tablesCreated = true;
}
}
public void setUp() throws Exception {
// Only run on Derby because we use DDL specific to Derby
setSupportedDatabases(
org.apache.openjpa.jdbc.sql.DerbyDictionary.class);
if (isTestsDisabled()) {
return;
}
// do not use CLEAR_TABLES or DROP_TABLES
super.setUp(SimpleCompoundIdTestEntity.class, ComplexCompoundIdTestEntity.class, TypeEntity.class);
if (!tablesCreated) {
createTables(emf.createEntityManager());
tablesCreated = true;
}
}
public void testSimpleCompoundIdTestEntity() throws Exception {
public void testSimpleCompoundIdTestEntity() throws Exception {
EntityManager em = emf.createEntityManager();
String jpql = "SELECT o FROM SimpleCompoundIdTestEntity o ORDER BY o.secondId";
List<SimpleCompoundIdTestEntity> list = em.createQuery(jpql,SimpleCompoundIdTestEntity.class)

View File

@ -22,6 +22,7 @@ import javax.persistence.EntityManager;
import javax.persistence.PersistenceException;
import javax.persistence.Query;
import org.apache.openjpa.jdbc.sql.OracleDictionary;
import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
import org.apache.openjpa.persistence.OpenJPAEntityManagerSPI;
import org.apache.openjpa.persistence.test.DatabasePlatform;
@ -46,7 +47,14 @@ import org.apache.openjpa.persistence.test.SingleEMFTestCase;
@DatabasePlatform("oracle.jdbc.driver.OracleDriver")
public class TestAutoIncrement extends SingleEMFTestCase {
public void setUp() throws Exception {
public void setUp() throws Exception {
// Only run on Oracle
setSupportedDatabases(
org.apache.openjpa.jdbc.sql.OracleDictionary.class);
if (isTestsDisabled()) {
return;
}
if ("testAutoIncrementIdentityWithNamedSequence".equals(getName())) {
String sequence = "autoIncrementSequence";
createSequence(sequence);
@ -58,7 +66,7 @@ public class TestAutoIncrement extends SingleEMFTestCase {
"openjpa.jdbc.DBDictionary",
"oracle(UseTriggersForAutoAssign=true)");
}
}
}
public void testAutoIncrementIdentityWithNamedSequence() {
EntityManager em = emf.createEntityManager();