jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1401717 - /jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryTest.java
Date Wed, 24 Oct 2012 14:53:55 GMT
Author: thomasm
Date: Wed Oct 24 14:53:55 2012
New Revision: 1401717

URL: http://svn.apache.org/viewvc?rev=1401717&view=rev
Log:
OAK-361 QueryEngine JCR-SQL 'ESCAPE' parsing & support
OAK-347 QueryEngine 'like' interpretation error for paths

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryTest.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryTest.java?rev=1401717&r1=1401716&r2=1401717&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/query/QueryTest.java
Wed Oct 24 14:53:55 2012
@@ -46,7 +46,11 @@ public class QueryTest extends AbstractR
         Session session = getAdminSession();
         Node hello = session.getRootNode().addNode("hello");
         hello.setProperty("id",  "1");
-        hello.setProperty("text",  "hello world");
+        hello.setProperty("text",  "hello_world");
+        session.save();
+        Node hello2 = session.getRootNode().addNode("hello2");
+        hello2.setProperty("id",  "2");
+        hello2.setProperty("text",  "hello world");
         session.save();
 
         ValueFactory vf = session.getValueFactory();
@@ -61,7 +65,7 @@ public class QueryTest extends AbstractR
         RowIterator it = r.getRows();
         assertTrue(it.hasNext());
         Row row = it.nextRow();
-        assertEquals("hello world", row.getValue("text").getString());
+        assertEquals("hello_world", row.getValue("text").getString());
         String[] columns = r.getColumnNames();
         assertEquals(1, columns.length);
         assertEquals("text", columns[0]);
@@ -71,19 +75,24 @@ public class QueryTest extends AbstractR
         NodeIterator nodeIt = r.getNodes();
         assertTrue(nodeIt.hasNext());
         Node n = nodeIt.nextNode();
-        assertEquals("hello world", n.getProperty("text").getString());
+        assertEquals("hello_world", n.getProperty("text").getString());
         assertFalse(it.hasNext());
 
         // SQL
 
-        q = qm.createQuery("select text from [nt:base] where id = 1", Query.SQL);
+        q = qm.createQuery("select text from [nt:base] where text like 'hello\\_world' escape
'\\'", Query.SQL);
         r = q.execute();
         columns = r.getColumnNames();
         assertEquals(3, columns.length);
         assertEquals("text", columns[0]);
         assertEquals("jcr:path", columns[1]);
         assertEquals("jcr:score", columns[2]);
-
+        nodeIt = r.getNodes();
+        assertTrue(nodeIt.hasNext());
+        n = nodeIt.nextNode();
+        assertEquals("hello_world", n.getProperty("text").getString());
+        assertFalse(nodeIt.hasNext());
+        
         // XPath
 
         q = qm.createQuery("//*[@id=1]", Query.XPATH);



Mime
View raw message