You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by fa...@apache.org on 2009/09/03 18:22:06 UTC

svn commit: r811012 - /openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/AbstractCriteriaTestCase.java

Author: fancy
Date: Thu Sep  3 16:22:06 2009
New Revision: 811012

URL: http://svn.apache.org/viewvc?rev=811012&view=rev
Log:
Fix testcase : SQL assertion for Derby only

Modified:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/AbstractCriteriaTestCase.java

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/AbstractCriteriaTestCase.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/AbstractCriteriaTestCase.java?rev=811012&r1=811011&r2=811012&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/AbstractCriteriaTestCase.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/AbstractCriteriaTestCase.java Thu Sep  3 16:22:06 2009
@@ -50,6 +50,7 @@
     protected abstract OpenJPAEntityManagerFactorySPI getEntityManagerFactory();
     
     protected abstract EntityManager getEntityManager();
+    private DBDictionary dict = null;
 
     /**
      * Create an entity manager factory for persistence unit <code>pu</code>. Put {@link #CLEAR_TABLES} in this list to
@@ -84,7 +85,7 @@
 
     void setDictionary() {
         JDBCConfiguration conf = (JDBCConfiguration) getEntityManagerFactory().getConfiguration();
-        DBDictionary dict = conf.getDBDictionaryInstance();
+        dict = conf.getDBDictionaryInstance();
         dict.requiresCastForComparisons = false;
         dict.requiresCastForMathFunctions = false;
     }
@@ -181,7 +182,10 @@
                     .get(i));
             }
         }
-        
+
+        if (!(dict instanceof DerbyDictionary))
+            return;
+
         if (expectedSQL != null) {
             assertEquals("SQL for JPQL and ExpectedSQL for " + jpql + " is different", jSQL.get(0), 
                     expectedSQL);
@@ -190,9 +194,6 @@
     }
 
     void executeAndCompareSQL(String jpql, String expectedSQL) {
-        JDBCConfiguration conf = (JDBCConfiguration) getEntityManagerFactory().getConfiguration();
-        DBDictionary dict = conf.getDBDictionaryInstance();
-
         Query jQ = getEntityManager().createQuery(jpql);
 
         List<String> jSQL = null;
@@ -218,9 +219,6 @@
     }
 
     void executeAndCompareSQL(Query jQ, String expectedSQL) {
-        JDBCConfiguration conf = (JDBCConfiguration) getEntityManagerFactory().getConfiguration();
-        DBDictionary dict = conf.getDBDictionaryInstance();
-
         List<String> jSQL = null;
         try {
             jSQL = executeQueryAndCollectSQL(jQ);