jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1532371 - in /jackrabbit/oak/trunk/oak-jcr/src: main/java/org/apache/jackrabbit/oak/jcr/query/QueryImpl.java test/java/org/apache/jackrabbit/oak/jcr/query/QueryTest.java
Date Tue, 15 Oct 2013 14:56:31 GMT
Author: alexparvulescu
Date: Tue Oct 15 14:56:31 2013
New Revision: 1532371

URL: http://svn.apache.org/r1532371
Log:
OAK-1096 QueryManager does not have autorefresh
 - fix and test


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

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryImpl.java?rev=1532371&r1=1532370&r2=1532371&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryImpl.java
Tue Oct 15 14:56:31 2013
@@ -34,9 +34,10 @@ import javax.jcr.version.VersionExceptio
 
 import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.oak.commons.PathUtils;
+import org.apache.jackrabbit.oak.jcr.delegate.NodeDelegate;
 import org.apache.jackrabbit.oak.jcr.session.NodeImpl;
 import org.apache.jackrabbit.oak.jcr.session.SessionContext;
-import org.apache.jackrabbit.oak.jcr.delegate.NodeDelegate;
+import org.apache.jackrabbit.oak.jcr.session.operation.SessionOperation;
 
 /**
  * The implementation of the corresponding JCR interface.
@@ -86,7 +87,14 @@ public class QueryImpl implements Query 
 
     @Override
     public QueryResult execute() throws RepositoryException {
-        return manager.executeQuery(statement, language, limit, offset, bindVariableMap);
+        return sessionContext.getSessionDelegate().perform(
+                new SessionOperation<QueryResult>() {
+                    @Override
+                    public QueryResult perform() throws RepositoryException {
+                        return manager.executeQuery(statement, language, limit,
+                                offset, bindVariableMap);
+                    }
+                });
     }
 
     @Override

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=1532371&r1=1532370&r2=1532371&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
Tue Oct 15 14:56:31 2013
@@ -370,4 +370,28 @@ public class QueryTest extends AbstractR
         Row row = it.nextRow();
         assertEquals("p1 p2", row.getValues()[0].getString());
     }
+
+    @Test
+    public void testOak1096() throws RepositoryException, InterruptedException {
+        Session writer = createAdminSession();
+        Session reader = createAdminSession();
+        try {
+            Node rootNode = writer.getRootNode();
+            Node node = rootNode.addNode("test", "nt:unstructured");
+            node.setProperty("text", "find me");
+            writer.save();
+
+            QueryManager qm = reader.getWorkspace().getQueryManager();
+            Query q = qm.createQuery("select * from 'nt:base' where contains(*, 'find me')",
Query.JCR_SQL2);
+            NodeIterator res = q.execute().getNodes();
+            assertEquals("False amount of hits", 1, res.getSize());
+        } finally {
+            if (reader != null) {
+                reader.logout();
+            }
+            if (writer != null) {
+                writer.logout();
+            }
+        }
+    }
 }



Mime
View raw message