jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1303954 - in /jackrabbit/oak/trunk/oak-core/src/test: java/org/apache/jackrabbit/oak/query/QueryTest.java java/org/apache/jackrabbit/oak/query/index/FilterTest.java resources/org/apache/jackrabbit/oak/query/queryTest.txt
Date Thu, 22 Mar 2012 18:22:42 GMT
Author: thomasm
Date: Thu Mar 22 18:22:41 2012
New Revision: 1303954

URL: http://svn.apache.org/viewvc?rev=1303954&view=rev
Log:
OAK-33 Values in oak-core (within the query engine)

Modified:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/FilterTest.java
    jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/queryTest.txt

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java?rev=1303954&r1=1303953&r2=1303954&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java
Thu Mar 22 18:22:41 2012
@@ -64,8 +64,8 @@ public class QueryTest {
     @Test
     public void bindVariableTest() throws Exception {
         head = mk.commit("/", "+ \"test\": { \"hello\": {\"id\": \"1\"}, \"world\": {\"id\":
\"2\"}}", null, null);
-        HashMap<String, Value> sv = new HashMap<String, Value>();
-        ValueFactory vf = new ValueFactory();
+        HashMap<String, ScalarImpl> sv = new HashMap<String, ScalarImpl>();
+        ScalarFactory vf = new ScalarFactory();
         sv.put("id", vf.createValue("1"));
         Iterator<Row> result;
         result = qe.executeQuery(QueryEngine.SQL2, "select * from [nt:base] where id = $id",
sv);
@@ -76,6 +76,12 @@ public class QueryTest {
         result = qe.executeQuery(QueryEngine.SQL2, "select * from [nt:base] where id = $id",
sv);
         assertTrue(result.hasNext());
         assertEquals("/test/world", result.next().getPath());
+
+
+        qe.executeQuery(QueryEngine.SQL2, "explain select * from [nt:base] where id = 1 order
by id", null);
+
+
+
     }
 
     private void test(String file) throws Exception {
@@ -164,12 +170,12 @@ public class QueryTest {
 
     private String readRow(String query, Row row) {
         StringBuilder buff = new StringBuilder();
-        Value[] values = row.getValues();
+        ScalarImpl[] values = row.getValues();
         for (int i = 0; i < values.length; i++) {
             if (i > 0) {
                 buff.append(", ");
             }
-            Value v = values[i];
+            ScalarImpl v = values[i];
             buff.append(v == null ? "null" : v.getString());
         }
         return buff.toString();

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/FilterTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/FilterTest.java?rev=1303954&r1=1303953&r2=1303954&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/FilterTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/FilterTest.java
Thu Mar 22 18:22:41 2012
@@ -23,8 +23,8 @@ import static org.junit.Assert.assertTru
 import static org.junit.Assert.fail;
 import java.util.ArrayList;
 import java.util.Random;
-import org.apache.jackrabbit.oak.query.Value;
-import org.apache.jackrabbit.oak.query.ValueFactory;
+import org.apache.jackrabbit.oak.query.ScalarImpl;
+import org.apache.jackrabbit.oak.query.ScalarFactory;
 import org.apache.jackrabbit.oak.query.ast.Operator;
 import org.apache.jackrabbit.oak.query.index.Filter.PathRestriction;
 import org.junit.Test;
@@ -36,8 +36,8 @@ public class FilterTest {
 
     @Test
     public void propertyRestriction() {
-        Value one = new ValueFactory().createValue("1");
-        Value two = new ValueFactory().createValue("2");
+        ScalarImpl one = new ScalarFactory().createValue("1");
+        ScalarImpl two = new ScalarFactory().createValue("2");
 
         Filter f = new Filter(null);
         assertTrue(null == f.getPropertyRestriction("x"));

Modified: jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/queryTest.txt
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/queryTest.txt?rev=1303954&r1=1303953&r2=1303954&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/queryTest.txt
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/queryTest.txt
Thu Mar 22 18:22:41 2012
@@ -8,6 +8,8 @@
 
 + "test": { "jcr:resource": {}, "resource": { "x" : {}}}
 
+select * from [nt:base] where id = -1
+
 explain select * from [nt:base] as b where ischildnode(b, '/test')
 nt:base AS b /* traverse "/test/*" */
 



Mime
View raw message