db-jdo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bra...@apache.org
Subject svn commit: r348923 - /incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/QueryTest.java
Date Fri, 25 Nov 2005 10:03:46 GMT
Author: brazil
Date: Fri Nov 25 02:03:41 2005
New Revision: 348923

URL: http://svn.apache.org/viewcvs?rev=348923&view=rev
Log:
Bug fix related to JDO-165: The inner compile method in QuerTest has been added an exception
handler silently catching JDOUserExceptions. JDOUserExceptions may be thrown by PersistenceManager.newQuery
methods in case of negative tests. 

Modified:
    incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/QueryTest.java

Modified: incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/QueryTest.java
URL: http://svn.apache.org/viewcvs/incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/QueryTest.java?rev=348923&r1=348922&r2=348923&view=diff
==============================================================================
--- incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/QueryTest.java (original)
+++ incubator/jdo/trunk/tck20/test/java/org/apache/jdo/tck/query/QueryTest.java Fri Nov 25
02:03:41 2005
@@ -789,17 +789,28 @@
             QueryElementHolder queryElementHolder, boolean asSingleString,  
             String singleStringQuery, boolean positive) {
         PersistenceManager pm = getPM();
-        Query query;
-        if (queryElementHolder != null) {
-            if (asSingleString) {
-                query = queryElementHolder.getSingleStringQuery(pm);
+        try {
+            Query query;
+            if (queryElementHolder != null) {
+                if (asSingleString) {
+                    query = queryElementHolder.getSingleStringQuery(pm);
+                } else {
+                    query = queryElementHolder.getAPIQuery(pm);
+                }
             } else {
-                query = queryElementHolder.getAPIQuery(pm);
+                query = getPM().newQuery(singleStringQuery);
+            }
+            compile(assertion, query, singleStringQuery, positive);
+        } catch (JDOUserException e) {
+            // This exception handler considers a JDOUserException
+            // to be thrown in newQuery methods.
+            // A JDOUserException may be expected in case of negative tests. 
+            if (positive) {
+                fail(assertion + "Query '" + queryElementHolder +
+                        "' must be compilable. The exception message is: " + 
+                        e.getMessage());
             }
-        } else {
-            query = getPM().newQuery(singleStringQuery);
         }
-        compile(assertion, query, singleStringQuery, positive);
     }
     
     /**



Mime
View raw message