openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mik...@apache.org
Subject svn commit: r985551 - /openjpa/branches/2.0.x/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestPessimisticLocks.java
Date Sat, 14 Aug 2010 18:09:19 GMT
Author: mikedd
Date: Sat Aug 14 18:09:18 2010
New Revision: 985551

URL: http://svn.apache.org/viewvc?rev=985551&view=rev
Log:
Check if database supports query timeouts, merged from Fay's changes for OPENJPA-1726

Modified:
    openjpa/branches/2.0.x/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestPessimisticLocks.java

Modified: openjpa/branches/2.0.x/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestPessimisticLocks.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.0.x/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestPessimisticLocks.java?rev=985551&r1=985550&r2=985551&view=diff
==============================================================================
--- openjpa/branches/2.0.x/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestPessimisticLocks.java
(original)
+++ openjpa/branches/2.0.x/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestPessimisticLocks.java
Sat Aug 14 18:09:18 2010
@@ -34,6 +34,7 @@ import junit.framework.AssertionFailedEr
 import org.apache.openjpa.jdbc.conf.JDBCConfiguration;
 import org.apache.openjpa.jdbc.sql.DBDictionary;
 import org.apache.openjpa.persistence.LockTimeoutException;
+import org.apache.openjpa.persistence.OpenJPAEntityManagerFactorySPI;
 import org.apache.openjpa.persistence.test.SQLListenerTestCase;
 import org.apache.openjpa.util.OpenJPAException;
 
@@ -46,6 +47,23 @@ public class TestPessimisticLocks extend
     private DBDictionary dict = null;
 
     public void setUp() {
+        // Disable tests for any DB that has supportsQueryTimeout==false, like Postgres
+        OpenJPAEntityManagerFactorySPI tempEMF = emf;
+        if (tempEMF == null) {
+            tempEMF = createEMF();
+        }
+        assertNotNull(tempEMF);
+        DBDictionary dict = ((JDBCConfiguration)tempEMF.getConfiguration()).getDBDictionaryInstance();
+        assertNotNull(dict);
+        if (!dict.supportsQueryTimeout)
+            setTestsDisabled(true);
+        if (emf == null) {
+            closeEMF(tempEMF);
+        }
+
+        if (isTestsDisabled())
+            return;
+        
         setUp(CLEAR_TABLES, Employee.class, Department.class, "openjpa.LockManager", "mixed");
 
         EntityManager em = null;



Mime
View raw message