You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by dw...@apache.org on 2010/04/08 22:05:55 UTC

svn commit: r932085 - /openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestTimeoutException.java

Author: dwoods
Date: Thu Apr  8 20:05:54 2010
New Revision: 932085

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

Modified:
    openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestTimeoutException.java

Modified: openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestTimeoutException.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestTimeoutException.java?rev=932085&r1=932084&r2=932085&view=diff
==============================================================================
--- openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestTimeoutException.java (original)
+++ openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestTimeoutException.java Thu Apr  8 20:05:54 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);