mirror of https://github.com/apache/openjpa.git
Exclude TestAutoIncrement if datbase does not support auto-increment
git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/2.0.x@1159898 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
82a6d093ab
commit
d7d14443ff
|
@ -19,18 +19,32 @@
|
||||||
package org.apache.openjpa.persistence.jdbc.auto;
|
package org.apache.openjpa.persistence.jdbc.auto;
|
||||||
|
|
||||||
import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
|
import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
|
||||||
|
import org.apache.openjpa.jdbc.sql.DBDictionary;
|
||||||
|
import org.apache.openjpa.jdbc.sql.OracleDictionary;
|
||||||
|
import org.apache.openjpa.jdbc.sql.SQLServerDictionary;
|
||||||
|
import org.apache.openjpa.jdbc.sql.SybaseDictionary;
|
||||||
import org.apache.openjpa.persistence.test.SingleEMTestCase;
|
import org.apache.openjpa.persistence.test.SingleEMTestCase;
|
||||||
|
|
||||||
public class TestAutoIncrement extends SingleEMTestCase {
|
public class TestAutoIncrement extends SingleEMTestCase {
|
||||||
|
boolean disabled = false;
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
super.setUp(DROP_TABLES, AutoIncrementEntity.class);
|
super.setUp(DROP_TABLES, AutoIncrementEntity.class);
|
||||||
if (!((JDBCConfiguration) emf.getConfiguration()).getDBDictionaryInstance().supportsAutoAssign) {
|
DBDictionary dic = ((JDBCConfiguration)emf.getConfiguration()).getDBDictionaryInstance();
|
||||||
|
if (!dic.supportsAutoAssign) {
|
||||||
|
disabled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (dic instanceof SQLServerDictionary || dic instanceof OracleDictionary || dic instanceof SybaseDictionary) {
|
||||||
|
disabled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
createZeroIdEntity();
|
createZeroIdEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void test() {
|
public void test() {
|
||||||
|
if (disabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
em.getTransaction().begin();
|
em.getTransaction().begin();
|
||||||
AutoIncrementEntity e1 = em.find(AutoIncrementEntity.class, 0);
|
AutoIncrementEntity e1 = em.find(AutoIncrementEntity.class, 0);
|
||||||
assertNotNull(e1);
|
assertNotNull(e1);
|
||||||
|
|
Loading…
Reference in New Issue