Author: mikedd
Date: Sat Aug 20 19:02:01 2011
New Revision: 1159898
URL: http://svn.apache.org/viewvc?rev=1159898&view=rev
Log:
Exclude TestAutoIncrement if datbase does not support auto-increment
Modified:
openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/auto/TestAutoIncrement.java
Modified: openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/auto/TestAutoIncrement.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/auto/TestAutoIncrement.java?rev=1159898&r1=1159897&r2=1159898&view=diff
==============================================================================
--- openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/auto/TestAutoIncrement.java
(original)
+++ openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jdbc/auto/TestAutoIncrement.java
Sat Aug 20 19:02:01 2011
@@ -19,18 +19,32 @@
package org.apache.openjpa.persistence.jdbc.auto;
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;
public class TestAutoIncrement extends SingleEMTestCase {
+ boolean disabled = false;
public void setUp() {
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;
}
createZeroIdEntity();
}
public void test() {
+ if (disabled) {
+ return;
+ }
em.getTransaction().begin();
AutoIncrementEntity e1 = em.find(AutoIncrementEntity.class, 0);
assertNotNull(e1);
|