jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1536705 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/query/ main/java/org/apache/jackrabbit/oak/query/ast/ test/java/org/apache/jackrabbit/oak/query/
Date Tue, 29 Oct 2013 13:38:05 GMT
Author: alexparvulescu
Date: Tue Oct 29 13:38:05 2013
New Revision: 1536705

URL: http://svn.apache.org/r1536705
Log:
OAK-1108 Query constraints marked as invalid in the case of an mvp
 - test case (ignored)

Added:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/FilterTest.java
  (with props)
Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/JoinImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SourceImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryImpl.java?rev=1536705&r1=1536704&r2=1536705&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/QueryImpl.java
Tue Oct 29 13:38:05 2013
@@ -424,6 +424,16 @@ public class QueryImpl implements Query 
         prepared = true;
         source.prepare();
     }
+ 
+    /**
+     * <b>!Test purpose only! <b>
+     * 
+     * this creates a filter for the given query
+     * 
+     */
+    Filter createFilter(boolean preparing) {
+        return source.createFilter(preparing);
+    }
 
     /**
      * An iterator over result rows.

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/JoinImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/JoinImpl.java?rev=1536705&r1=1536704&r2=1536705&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/JoinImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/JoinImpl.java
Tue Oct 29 13:38:05 2013
@@ -14,6 +14,7 @@
 package org.apache.jackrabbit.oak.query.ast;
 
 import org.apache.jackrabbit.oak.query.QueryImpl;
+import org.apache.jackrabbit.oak.spi.query.Filter;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 
 /**
@@ -140,6 +141,12 @@ public class JoinImpl extends SourceImpl
     }
 
     @Override
+    public Filter createFilter(boolean preparing) {
+        // TODO is a join filter needed?
+        return left.createFilter(preparing);
+    }
+
+    @Override
     public boolean next() {
         if (end) {
             return false;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java?rev=1536705&r1=1536704&r2=1536705&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SelectorImpl.java
Tue Oct 29 13:38:05 2013
@@ -228,7 +228,8 @@ public class SelectorImpl extends Source
      * @param preparing whether a filter for the prepare phase should be made 
      * @return the filter
      */
-    private Filter createFilter(boolean preparing) {
+    @Override
+    public Filter createFilter(boolean preparing) {
         FilterImpl f = new FilterImpl(this, query.getStatement());
         f.setPreparing(preparing);
         if (joinCondition != null) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SourceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SourceImpl.java?rev=1536705&r1=1536704&r2=1536705&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SourceImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ast/SourceImpl.java
Tue Oct 29 13:38:05 2013
@@ -21,6 +21,7 @@ package org.apache.jackrabbit.oak.query.
 import java.util.ArrayList;
 
 import org.apache.jackrabbit.oak.query.QueryImpl;
+import org.apache.jackrabbit.oak.spi.query.Filter;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
 
 /**
@@ -170,4 +171,12 @@ public abstract class SourceImpl extends
 
     abstract void setParent(JoinConditionImpl joinCondition);
 
+    /**
+     * <b>!Test purpose only! <b>
+     * 
+     * this creates a filter for the given query
+     * 
+     */
+    abstract public Filter createFilter(boolean preparing);
+
 }

Added: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/FilterTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/FilterTest.java?rev=1536705&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/FilterTest.java
(added)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/FilterTest.java
Tue Oct 29 13:38:05 2013
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jackrabbit.oak.query;
+
+import static junit.framework.Assert.assertFalse;
+import static org.apache.jackrabbit.JcrConstants.JCR_SYSTEM;
+import static org.apache.jackrabbit.oak.plugins.nodetype.NodeTypeConstants.JCR_NODE_TYPES;
+import static org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent.INITIAL_CONTENT;
+
+import java.text.ParseException;
+
+import org.apache.jackrabbit.oak.query.xpath.XPathToSQL2Converter;
+import org.apache.jackrabbit.oak.spi.query.Filter;
+import org.apache.jackrabbit.oak.spi.state.NodeState;
+import org.junit.Ignore;
+import org.junit.Test;
+
+public class FilterTest {
+
+    private final NodeState types = INITIAL_CONTENT.getChildNode(JCR_SYSTEM)
+            .getChildNode(JCR_NODE_TYPES);
+
+    private final SQL2Parser p = new SQL2Parser(types);
+
+    private Filter createFilter(String xpath) throws ParseException {
+        String sql = new XPathToSQL2Converter().convert(xpath);
+        QueryImpl q = (QueryImpl) p.parse(sql);
+        return q.createFilter(true);
+    }
+
+    @Test
+    @Ignore("OAK-1108")
+    public void mvp() throws Exception {
+        // this can refer to a multi-valued property
+        Filter f = createFilter("//*[(@prop = 'aaa' and @prop = 'bbb' and @prop = 'ccc')]");
+        assertFalse(f.isAlwaysFalse());
+    }
+
+}

Propchange: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/FilterTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message