jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1083722 - in /jackrabbit/trunk/jackrabbit-spi-commons/src/test: java/org/apache/jackrabbit/spi/commons/query/sql2/ParserTest.java resources/org/apache/jackrabbit/spi/commons/query/sql2/test.sql2.txt
Date Mon, 21 Mar 2011 09:55:33 GMT
Author: thomasm
Date: Mon Mar 21 09:55:33 2011
New Revision: 1083722

URL: http://svn.apache.org/viewvc?rev=1083722&view=rev
Log:
JCR-2923 SQL2 parser: improved error message for ambiguous properties in joins

Modified:
    jackrabbit/trunk/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/query/sql2/ParserTest.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/test/resources/org/apache/jackrabbit/spi/commons/query/sql2/test.sql2.txt

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/query/sql2/ParserTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/query/sql2/ParserTest.java?rev=1083722&r1=1083721&r2=1083722&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/query/sql2/ParserTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/query/sql2/ParserTest.java
Mon Mar 21 09:55:33 2011
@@ -41,6 +41,7 @@ import javax.jcr.query.qom.QueryObjectMo
 import javax.jcr.query.qom.Source;
 import javax.jcr.version.VersionException;
 import junit.framework.TestCase;
+import org.apache.jackrabbit.commons.query.sql2.Parser;
 import org.apache.jackrabbit.commons.query.sql2.QOMFormatter;
 import org.apache.jackrabbit.spi.commons.conversion.DefaultNamePathResolver;
 import org.apache.jackrabbit.spi.commons.conversion.DummyNamespaceResolver;
@@ -55,7 +56,7 @@ import org.apache.jackrabbit.spi.commons
  */
 public class ParserTest extends TestCase {
 
-    protected Parser parser;
+    protected org.apache.jackrabbit.commons.query.sql2.Parser parser;
 
     protected Random random = new Random();
 
@@ -84,6 +85,7 @@ public class ParserTest extends TestCase
         }
 
         public void bindValue(String varName, Value value) throws IllegalArgumentException,
RepositoryException {
+            // ignore
         }
 
         public QueryResult execute() throws InvalidQueryException, RepositoryException {
@@ -107,9 +109,11 @@ public class ParserTest extends TestCase
         }
 
         public void setLimit(long limit) {
+            // ignore
         }
 
         public void setOffset(long offset) {
+            // ignore
         }
 
         public Node storeAsNode(String absPath) throws ItemExistsException, PathNotFoundException,
VersionException,
@@ -171,11 +175,14 @@ public class ParserTest extends TestCase
                 fuzz(line);
             } catch (Exception e) {
                 line = reader.readLine();
+                String message = e.getMessage();
+                message = message.replace('\n', ' ');
                 if (line == null || !line.startsWith("> exception")) {
                     e.printStackTrace();
                     assertTrue("Unexpected exception for query " + query + ": "
                             + e, false);
                 }
+                assertEquals("Expected exception message: " + message, "> exception: "
+ message, line);
             }
         }
         reader.close();

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/test/resources/org/apache/jackrabbit/spi/commons/query/sql2/test.sql2.txt
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/test/resources/org/apache/jackrabbit/spi/commons/query/sql2/test.sql2.txt?rev=1083722&r1=1083721&r2=1083722&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/test/resources/org/apache/jackrabbit/spi/commons/query/sql2/test.sql2.txt
(original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/test/resources/org/apache/jackrabbit/spi/commons/query/sql2/test.sql2.txt
Mon Mar 21 09:55:33 2011
@@ -221,14 +221,16 @@ select x.*, x.id as i, y.*, y.name from 
 
 #errors
 select * from parent as p inner join child as c on issamenode(p, c, a/b)
-> exception
+> exception: Query: select * from parent as p inner join child as c on issamenode(p, c,
a/(*)b); expected: )
 select * from parent as p inner join child as c on issamenode(p, c, d, e)
-> exception
+> exception: Query: select * from parent as p inner join child as c on issamenode(p, c,
d,(*)e); expected: )
 select * from 
-> exception
+> exception: Query: select * fro(*)m; expected: a token
 select * from parent as p inner join child as c on ischildnode(p, c, a)
-> exception
+> exception: Query: select * from parent as p inner join child as c on ischildnode(p,
c,(*)a); expected: )
 select * from parent as p inner join child as c on isdescendantnode(p)
-> exception
+> exception: Query: select * from parent as p inner join child as c on isdescendantnode(p(*));
expected: ,
 select * from parent as p inner join child as c on isdescendantnode(a, b, c)
-> exception
+> exception: Query: select * from parent as p inner join child as c on isdescendantnode(a,
b,(*)c); expected: )
+select id from parent inner join child on parent.id=child.parentid
+> exception: Query: select id(*)from parent inner join child on parent.id=child.parentid;
expected: Need to specify the selector name for "id" because the query contains more than
one selector.
\ No newline at end of file



Mime
View raw message