openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwo...@apache.org
Subject svn commit: r932082 - /openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestTimeoutException.java
Date Thu, 08 Apr 2010 19:55:08 GMT
Author: dwoods
Date: Thu Apr  8 19:55:08 2010
New Revision: 932082

URL: http://svn.apache.org/viewvc?rev=932082&view=rev
Log:
OPENJPA-1616 Exclude TestTimeoutException tests on HSQLDB as it uses supportsSelectForUpdate=false

Modified:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestTimeoutException.java

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestTimeoutException.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestTimeoutException.java?rev=932082&r1=932081&r2=932082&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestTimeoutException.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestTimeoutException.java
Thu Apr  8 19:55:08 2010
@@ -24,10 +24,11 @@ import javax.persistence.PessimisticLock
 import javax.persistence.Query;
 import javax.persistence.QueryTimeoutException;
 
-import junit.framework.AssertionFailedError;
-
+import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
 import org.apache.openjpa.jdbc.sql.DB2Dictionary;
+import org.apache.openjpa.jdbc.sql.DBDictionary;
 import org.apache.openjpa.jdbc.sql.OracleDictionary;
+import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
 import org.apache.openjpa.persistence.exception.PObject;
 import org.apache.openjpa.persistence.test.SingleEMFTestCase;
 import org.apache.openjpa.util.OpenJPAException;
@@ -42,7 +43,23 @@ public class TestTimeoutException extend
     private final Class<?> entityClass = PObject.class;
 
     public void setUp() {
+        // TODO - Hack until OPENJPA-1594 is addressed
         setUnsupportedDatabases(OracleDictionary.class, DB2Dictionary.class);
+        
+        // Disable tests for any DB that has supportsSelectForUpdate==false, like HSQLDictionary
+        OpenJPAEntityManagerFactorySPI tempEMF = emf;
+        if (tempEMF == null) {
+            tempEMF = createEMF();
+        }
+        assertNotNull(tempEMF);
+        DBDictionary dict = ((JDBCConfiguration)tempEMF.getConfiguration()).getDBDictionaryInstance();
+        assertNotNull(dict);
+        if (!dict.supportsSelectForUpdate)
+            setTestsDisabled(true);
+        if (emf == null) {
+            closeEMF(tempEMF);
+        }
+
         if (isTestsDisabled())
             return;
         super.setUp(entityClass, CLEAR_TABLES);



Mime
View raw message