openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fayw...@apache.org
Subject svn commit: r799061 - in /openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria: CriteriaTest.java TestEmbeddableCriteria.java
Date Wed, 29 Jul 2009 20:32:42 GMT
Author: faywang
Date: Wed Jul 29 20:32:42 2009
New Revision: 799061

URL: http://svn.apache.org/viewvc?rev=799061&view=rev
Log:
OPENJPA-1143: fix test case

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

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/CriteriaTest.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/CriteriaTest.java?rev=799061&r1=799060&r2=799061&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/CriteriaTest.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/CriteriaTest.java
Wed Jul 29 20:32:42 2009
@@ -241,8 +241,6 @@
     void executeAndCompareSQL(String jpql, String expectedSQL) {
         JDBCConfiguration conf = (JDBCConfiguration) emf.getConfiguration();
         DBDictionary dict = conf.getDBDictionaryInstance();
-        if (!(dict instanceof DerbyDictionary))
-            return;
 
         Query jQ = em.createQuery(jpql);
 
@@ -257,6 +255,9 @@
         
         printSQL("Target SQL for JPQL", jSQL);
         
+        if (!(dict instanceof DerbyDictionary))
+            return;
+
         for (int i = 0; i < jSQL.size(); i++) {
             if (!jSQL.get(i).equals(expectedSQL)) {
                 printSQL("SQL for JPQL", jSQL.get(i));
@@ -270,8 +271,6 @@
     void executeAndCompareSQL(Query jQ, String expectedSQL) {
         JDBCConfiguration conf = (JDBCConfiguration) emf.getConfiguration();
         DBDictionary dict = conf.getDBDictionaryInstance();
-        if (!(dict instanceof DerbyDictionary))
-            return;
 
         List<String> jSQL = null;
         try {
@@ -281,6 +280,9 @@
             e.printStackTrace(new PrintWriter(w));
         }
         
+        if (!(dict instanceof DerbyDictionary))
+            return;
+
         printSQL("Expected SQL", expectedSQL);
         String jSql = jSQL.get(0).trim();
         if (jSql.indexOf("optimize for 1 row") != -1)

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestEmbeddableCriteria.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestEmbeddableCriteria.java?rev=799061&r1=799060&r2=799061&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestEmbeddableCriteria.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/criteria/TestEmbeddableCriteria.java
Wed Jul 29 20:32:42 2009
@@ -803,7 +803,7 @@
         String expectedSQL = "SELECT t1.element, t0.intVal2 " + 
         "FROM TBL5A t0 INNER JOIN TBL5A_otherIntVals t1 ON t0.id = t1.EMBED_COLL_INTEGER_ID
WHERE (EXISTS (" + 
         "SELECT t2.id FROM TBL5A t2 INNER JOIN TBL5A_otherIntVals t3 ON t2.id = t3.EMBED_COLL_INTEGER_ID
WHERE " + 
-        "(t3.element > ? AND 1 = 1) ) AND 1 = 1) ORDER BY t1.element ASC";
+        "(t3.element > ? AND 1 = 1)) AND 1 = 1) ORDER BY t1.element ASC";
 
         executeAndCompareSQL(q, expectedSQL);
         
@@ -1034,7 +1034,7 @@
             "FROM TBL1A t0 INNER JOIN TBL1A_embeds t1 ON t0.id = t1.ENTITYA_COLL_EMBED_EMBED_ID
WHERE " + 
             "(t1.intVal1 < ANY (" + 
             "SELECT t3.intVal2 FROM TBL1A t2 " +
-            "INNER JOIN TBL1A_embeds t3 ON t2.id = t3.ENTITYA_COLL_EMBED_EMBED_ID )) " +

+            "INNER JOIN TBL1A_embeds t3 ON t2.id = t3.ENTITYA_COLL_EMBED_EMBED_ID)) " + 
             "ORDER BY t1.intVal3 ASC";
         
         executeAndCompareSQL(q, expectedSQL);
@@ -1061,7 +1061,7 @@
             "FROM TBL1A t0 INNER JOIN TBL1A_embeds t1 ON t0.id = t1.ENTITYA_COLL_EMBED_EMBED_ID
WHERE "  +
             "(t1.intVal1 < ALL (" + 
             "SELECT t3.intVal2 FROM TBL1A t2 " +
-            "INNER JOIN TBL1A_embeds t3 ON t2.id = t3.ENTITYA_COLL_EMBED_EMBED_ID )) " +

+            "INNER JOIN TBL1A_embeds t3 ON t2.id = t3.ENTITYA_COLL_EMBED_EMBED_ID)) " + 
             "ORDER BY t1.intVal3 ASC";
         executeAndCompareSQL(q, expectedSQL);
         
@@ -1086,7 +1086,7 @@
         String expectedSQL = "SELECT t1.IntVal1x, t1.IntVal2x, t1.IntVal3x, t1.intVal1, t1.intVal2,
t1.intVal3 " + 
         "FROM TBL1A t0 INNER JOIN TBL1A_embeds t1 ON t0.id = t1.ENTITYA_COLL_EMBED_EMBED_ID
" +
         "WHERE (t1.intVal1 <= ANY (" + 
-        "SELECT t3.intVal2 FROM TBL1A t2 INNER JOIN TBL1A_embeds t3 ON t2.id = t3.ENTITYA_COLL_EMBED_EMBED_ID
)) " + 
+        "SELECT t3.intVal2 FROM TBL1A t2 INNER JOIN TBL1A_embeds t3 ON t2.id = t3.ENTITYA_COLL_EMBED_EMBED_ID))
" + 
         "ORDER BY t1.intVal3 ASC";
     
         executeAndCompareSQL(q, expectedSQL);
@@ -1110,7 +1110,7 @@
         String expectedSQL = "SELECT t1.IntVal1x, t1.IntVal2x, t1.IntVal3x, t1.intVal1, t1.intVal2,
t1.intVal3 " + 
         "FROM TBL1A t0 INNER JOIN TBL1A_embeds t1 ON t0.id = t1.ENTITYA_COLL_EMBED_EMBED_ID
WHERE " + 
         "(t1.intVal1 > ALL (" + 
-        "SELECT t3.intVal2 FROM TBL1A t2 INNER JOIN TBL1A_embeds t3 ON t2.id = t3.ENTITYA_COLL_EMBED_EMBED_ID
)) " + 
+        "SELECT t3.intVal2 FROM TBL1A t2 INNER JOIN TBL1A_embeds t3 ON t2.id = t3.ENTITYA_COLL_EMBED_EMBED_ID))
" + 
         "ORDER BY t1.intVal3 ASC";
     
         executeAndCompareSQL(q, expectedSQL);
@@ -1134,7 +1134,7 @@
         String expectedSQL = "SELECT t1.IntVal1x, t1.IntVal2x, t1.IntVal3x, t1.intVal1, t1.intVal2,
t1.intVal3 " + 
         "FROM TBL1A t0 INNER JOIN TBL1A_embeds t1 ON t0.id = t1.ENTITYA_COLL_EMBED_EMBED_ID
WHERE " + 
         "(t1.intVal1 < ANY (SELECT t2.intVal2 FROM  TBL1A_embeds t2, TBL1A t3 " + 
-        "WHERE (t2.ENTITYA_COLL_EMBED_EMBED_ID = t3.id) AND (t0.id = t2.ENTITYA_COLL_EMBED_EMBED_ID)
)) " +
+        "WHERE (t2.ENTITYA_COLL_EMBED_EMBED_ID = t3.id) AND (t0.id = t2.ENTITYA_COLL_EMBED_EMBED_ID)))
" +
         "ORDER BY t1.intVal3 ASC";
         executeAndCompareSQL(q, expectedSQL);
         //assertEquivalence(q, jpql);
@@ -1159,7 +1159,7 @@
         String expectedSQL = "SELECT t1.IntVal1x, t1.IntVal2x, t1.IntVal3x, t1.intVal1, t1.intVal2,
t1.intVal3 " + 
         "FROM TBL1A t0 INNER JOIN TBL1A_embeds t1 ON t0.id = t1.ENTITYA_COLL_EMBED_EMBED_ID
WHERE " + 
         "(t1.intVal1 < ALL (SELECT t2.intVal2 FROM  TBL1A_embeds t2, TBL1A t3 " + 
-        "WHERE (t2.ENTITYA_COLL_EMBED_EMBED_ID = t3.id) AND (t0.id = t2.ENTITYA_COLL_EMBED_EMBED_ID)
)) " + 
+        "WHERE (t2.ENTITYA_COLL_EMBED_EMBED_ID = t3.id) AND (t0.id = t2.ENTITYA_COLL_EMBED_EMBED_ID)))
" + 
         "ORDER BY t1.intVal3 ASC";
         executeAndCompareSQL(q, expectedSQL);
     }
@@ -1183,7 +1183,7 @@
         String expectedSQL = "SELECT t1.IntVal1x, t1.IntVal2x, t1.IntVal3x, t1.intVal1, t1.intVal2,
t1.intVal3 " + 
         "FROM TBL1A t0 INNER JOIN TBL1A_embeds t1 ON t0.id = t1.ENTITYA_COLL_EMBED_EMBED_ID
WHERE " + 
         "(t1.intVal1 <= ANY (SELECT t2.intVal2 FROM  TBL1A_embeds t2, TBL1A t3 " + 
-        "WHERE (t2.ENTITYA_COLL_EMBED_EMBED_ID = t3.id) AND (t0.id = t2.ENTITYA_COLL_EMBED_EMBED_ID)
)) " + 
+        "WHERE (t2.ENTITYA_COLL_EMBED_EMBED_ID = t3.id) AND (t0.id = t2.ENTITYA_COLL_EMBED_EMBED_ID)))
" + 
         "ORDER BY t1.intVal3 ASC";
         executeAndCompareSQL(q, expectedSQL);
     }
@@ -1207,7 +1207,7 @@
         String expectedSQL = "SELECT t1.IntVal1x, t1.IntVal2x, t1.IntVal3x, t1.intVal1, t1.intVal2,
t1.intVal3 " + 
         "FROM TBL1A t0 INNER JOIN TBL1A_embeds t1 ON t0.id = t1.ENTITYA_COLL_EMBED_EMBED_ID
WHERE " + 
         "(t1.intVal1 > ALL (SELECT t2.intVal2 FROM  TBL1A_embeds t2, TBL1A t3 " + 
-        "WHERE (t2.ENTITYA_COLL_EMBED_EMBED_ID = t3.id) AND (t0.id = t2.ENTITYA_COLL_EMBED_EMBED_ID)
)) " + 
+        "WHERE (t2.ENTITYA_COLL_EMBED_EMBED_ID = t3.id) AND (t0.id = t2.ENTITYA_COLL_EMBED_EMBED_ID)))
" + 
         "ORDER BY t1.intVal3 ASC";
         executeAndCompareSQL(q, expectedSQL);
     }
@@ -1342,7 +1342,7 @@
         String expectedSQL = "SELECT t3.A1, t3.A2, t3.A3 " + 
         "FROM TBL4A t2 INNER JOIN TBL4A_embeds t3 ON t2.id = t3.EMBED_COLL_EMBED_ID WHERE
(" + 
         "EXISTS (SELECT t1.A1 FROM TBL4A t0 INNER JOIN TBL4A_embeds t1 ON t0.id = t1.EMBED_COLL_EMBED_ID
" + 
-        "WHERE (t1.A2 = ? AND 1 = 1) ) AND 1 = 1) ORDER BY t3.A1 ASC, t3.A2 ASC, t3.A3 ASC";
+        "WHERE (t1.A2 = ? AND 1 = 1)) AND 1 = 1) ORDER BY t3.A1 ASC, t3.A2 ASC, t3.A3 ASC";
 
         executeAndCompareSQL(q, expectedSQL);
 



Mime
View raw message