From bdb09074a7dd8ab317d28e5f7e11ebe3f668efb9 Mon Sep 17 00:00:00 2001 From: Fay Wang Date: Wed, 28 Jul 2010 15:35:13 +0000 Subject: [PATCH] OPENJPA-1726: exclude the test case from running on Postgres as Postgres does not support setQueryTimeout. git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@980101 13f79535-47bb-0310-9956-ffa450edef68 --- .../lockmgr/TestPessimisticLocks.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestPessimisticLocks.java b/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestPessimisticLocks.java index 6d2a75548..1b7c879dd 100644 --- a/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestPessimisticLocks.java +++ b/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestPessimisticLocks.java @@ -34,6 +34,7 @@ import junit.framework.AssertionFailedError; 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 extends SQLListenerTestCase { 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;