openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From allee8...@apache.org
Subject svn commit: r1073539 - /openjpa/branches/2.1.x/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestNamedQueryLockMode.java
Date Tue, 22 Feb 2011 23:07:31 GMT
Author: allee8285
Date: Tue Feb 22 23:07:31 2011
New Revision: 1073539

URL: http://svn.apache.org/viewvc?rev=1073539&view=rev
Log:
Fix test cases running in DB2 due to 1) dict.forUpdateClause must be obtained after emf is
created because specific dictionary may override the value of this attribute, 2) The forUpdateClause
in DB2 is LockMode type dependent, (i.e. WITH RR/RS) therefore can not depends on this attribute
for positive test case comparison, negative test ok.

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

Modified: openjpa/branches/2.1.x/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestNamedQueryLockMode.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.1.x/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestNamedQueryLockMode.java?rev=1073539&r1=1073538&r2=1073539&view=diff
==============================================================================
--- openjpa/branches/2.1.x/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestNamedQueryLockMode.java
(original)
+++ openjpa/branches/2.1.x/openjpa-persistence-locking/src/test/java/org/apache/openjpa/persistence/lockmgr/TestNamedQueryLockMode.java
Tue Feb 22 23:07:31 2011
@@ -22,6 +22,7 @@ import javax.persistence.EntityManager;
 import javax.persistence.LockModeType;
 import javax.persistence.Query;
 
+import org.apache.openjpa.jdbc.sql.DB2Dictionary;
 import org.apache.openjpa.persistence.FetchPlan;
 import org.apache.openjpa.persistence.OpenJPAEntityManager;
 import org.apache.openjpa.persistence.OpenJPAEntityManagerSPI;
@@ -76,8 +77,12 @@ public class TestNamedQueryLockMode exte
         EntityManager em = emf.createEntityManager();
         em.getTransaction().begin();
         lockClause = getForUpdateClause();
-        assertClauseAbsentInSQL(lockClause, em.createNamedQuery("findEmployeeById").setParameter("id",
0));
-        assertClauseAbsentInSQL(lockClause, em.createNamedQuery("findEmployeeById").setParameter("id",
0));
+		if (!DB2Dictionary.class.isAssignableFrom(getDBDictionary().getClass())) {
+			// Skip test because "for update" clause in DB2 depends on LockMode type (i.e. WITH RR/RS)
+			// plus dict.forUpdateClause is not sensitive to this implementation.  
+            assertClausePresentInSQL(lockClause, em.createNamedQuery("findEmployeeById").setParameter("id",
0));
+            assertClausePresentInSQL(lockClause, em.createNamedQuery("findEmployeeById").setParameter("id",
0));
+        }
         
         OpenJPAEntityManager oem = (OpenJPAEntityManager)em;
         OpenJPAQuery<?> q = oem.createNamedQuery("findEmployeeById").setParameter("id",
0); 



Mime
View raw message