jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1384344 - in /jackrabbit/oak/trunk/oak-core/src/test: java/org/apache/jackrabbit/oak/query/ resources/org/apache/jackrabbit/oak/query/
Date Thu, 13 Sep 2012 14:30:00 GMT
Author: thomasm
Date: Thu Sep 13 14:29:59 2012
New Revision: 1384344

URL: http://svn.apache.org/viewvc?rev=1384344&view=rev
Log:
OAK-288 QueryTests should use the NodeStore apis - re-enable the sql2_explain test

Modified:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/QueryTest.java
    jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt
    jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_explain.txt

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java?rev=1384344&r1=1384343&r2=1384344&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java
Thu Sep 13 14:29:59 2012
@@ -16,8 +16,8 @@
  */
 package org.apache.jackrabbit.oak.query;
 
-import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
+import org.apache.jackrabbit.mk.index.IndexWrapper;
 import org.apache.jackrabbit.oak.AbstractOakTest;
 import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.api.ContentSession;
@@ -44,10 +44,15 @@ public abstract class AbstractQueryTest 
 
     @Override
     protected ContentRepository createRepository() {
-        MicroKernel mk = new MicroKernelImpl();
-        Indexer indexer = new Indexer(mk);
-        PropertyIndexer pi = new PropertyIndexer(indexer);
+        
+        // the property and prefix index currently require the index wrapper
+        IndexWrapper mk = new IndexWrapper(new MicroKernelImpl());
+        Indexer indexer = mk.getIndexer();
+        
+        // MicroKernel mk = new MicroKernelImpl();
+        // Indexer indexer = new Indexer(mk);
 
+        PropertyIndexer pi = new PropertyIndexer(indexer);
         QueryIndexProvider qip = new CompositeQueryIndexProvider(pi);
         CompositeHook hook = new CompositeHook(pi);
         return new ContentRepositoryImpl(mk, qip, hook);

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=1384344&r1=1384343&r2=1384344&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 Sep 13 14:29:59 2012
@@ -211,7 +211,7 @@ public class QueryTest extends AbstractQ
             lines.add(e.toString());
         }
         time = System.currentTimeMillis() - time;
-        if (time > 3000) {
+        if (time > 3000 && !isDebugModeEnabled()) {
             fail("Query took too long: " + query + " took " + time + " ms");
         }
         return lines;
@@ -234,4 +234,14 @@ public class QueryTest extends AbstractQ
         return qe.executeQuery(statement, language, Long.MAX_VALUE, 0, sv, null);
     }
 
+    /**
+     * Check whether the test is running in debug mode.
+     * 
+     * @return true if debug most is (most likely) enabled
+     */
+    private static boolean isDebugModeEnabled() {
+        return java.lang.management.ManagementFactory.getRuntimeMXBean().
+                getInputArguments().toString().indexOf("-agentlib:jdwp") > 0;
+    }
+
 }

Modified: jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt?rev=1384344&r1=1384343&r2=1384344&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2.txt
Thu Sep 13 14:29:59 2012
@@ -116,6 +116,8 @@ select * from [nt:base] as b where local
 
 select * from [nt:base] as x where isdescendantnode(x, '/') and not isdescendantnode(x, '/jcr:system')
 /jcr:system
+/oak-index
+/oak-index/indexes
 /test
 /test/jcr:resource
 /test/resource
@@ -139,6 +141,7 @@ select * from [nt:base] as [p] where [p]
 select * from [nt:base] as p inner join [nt:base] as p2 on ischildnode(p2, p) where p.[jcr:path]
= '/'
 /, /children
 /, /jcr:system
+/, /oak-index
 /, /parents
 
 select * from [nt:base] as p inner join [nt:base] as p2 on isdescendantnode(p2, p) where
p.[jcr:path] = '/parents'
@@ -163,8 +166,8 @@ select id from [nt:base] where id is not
 0
 
 measure select * from [nt:base] as c right outer join [nt:base] as p on p.id = c.p where
p.id is not null and not isdescendantnode(p, '/jcr:system')
-c, 624
-p, 208
+c, 630
+p, 210
 query, 4
 
 select * from [nt:base] as c right outer join [nt:base] as p on p.id = c.p where p.id is
not null and not isdescendantnode(p, '/jcr:system')
@@ -174,8 +177,8 @@ select * from [nt:base] as c right outer
 null, /parents/p0
 
 measure select * from [nt:base] as p left outer join [nt:base] as c on p.id = c.p where p.id
is not null
-c, 624
-p, 208
+c, 630
+p, 210
 query, 4
 
 select * from [nt:base] as p left outer join [nt:base] as c on p.id = c.p where p.id is not
null
@@ -185,16 +188,16 @@ select * from [nt:base] as p left outer 
 /parents/p2, /children/c3
 
 measure select * from [nt:base] as p left outer join [nt:base] as c on p.id = c.p where p.id
is not null and c.p is null
-c, 624
-p, 208
+c, 630
+p, 210
 query, 1
 
 select * from [nt:base] as p left outer join [nt:base] as c on p.id = c.p where p.id is not
null and c.p is null
 /parents/p0, null
 
 measure select * from [nt:base] as p left outer join [nt:base] as c on p.id = c.p where p.id
is not null and c.p is not null
-c, 624
-p, 208
+c, 630
+p, 210
 query, 3
 
 select * from [nt:base] as p left outer join [nt:base] as c on p.id = c.p where p.id is not
null and c.p is not null
@@ -206,8 +209,8 @@ explain select * from [nt:base] as p inn
 [nt:base] as p /* traverse "//*" where p.id is not null */ inner join [nt:base] as c /* traverse
"//*" where c.p is not null */ on p.id = c.p
 
 measure select * from [nt:base] as p inner join [nt:base] as c on p.id = c.p
-c, 624
-p, 208
+c, 630
+p, 210
 query, 3
 
 select * from [nt:base] as p inner join [nt:base] as c on p.id = c.p
@@ -224,6 +227,8 @@ commit / + "test2": { "id":"1", "x": "2"
 select * from [nt:base] where not isdescendantnode('/jcr:system')
 /
 /jcr:system
+/oak-index
+/oak-index/indexes
 /test
 /test/hello
 /test/world
@@ -242,12 +247,16 @@ select * from [nt:base] where id = '1' o
 select * from [nt:base] where not (id = '1' or x = '2') and not isdescendantnode('/jcr:system')
 /
 /jcr:system
+/oak-index
+/oak-index/indexes
 /test
 /test/hello
 
 select * from [nt:base] where x is null and not isdescendantnode('/jcr:system')
 /
 /jcr:system
+/oak-index
+/oak-index/indexes
 /test
 
 commit / - "test"

Modified: jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_explain.txt
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_explain.txt?rev=1384344&r1=1384343&r2=1384344&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_explain.txt
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/resources/org/apache/jackrabbit/oak/query/sql2_explain.txt
Thu Sep 13 14:29:59 2012
@@ -37,14 +37,14 @@ select * from [nt:base] where property([
 /test/a
 
 commit / + "oak-index": {}
-commit /oak-index + "indexes": {}
+commit /oak-index + "indexes": { "type": "property" }
 commit /oak-index/indexes + "prefix@ref:": {}
 
-# explain select * from [nt:base] where property([*], 'REFERENCE') = CAST('123' AS REFERENCE)
-# [nt:base] as nt:base /* prefixIndex "ref:123" where property(nt:base.*, 'reference') =
cast('123' as reference) */
+explain select * from [nt:base] where property([*], 'REFERENCE') = CAST('123' AS REFERENCE)
+[nt:base] as nt:base /* prefixIndex "ref:123" where property(nt:base.*, 'reference') = cast('123'
as reference) */
 
-# explain select * from [nt:base] where property(id, 'REFERENCE') = CAST('123' AS REFERENCE)
-# [nt:base] as nt:base /* prefixIndex "ref:123" where property(nt:base.id, 'reference')
= cast('123' as reference) */
+explain select * from [nt:base] where property(id, 'REFERENCE') = CAST('123' AS REFERENCE)
+[nt:base] as nt:base /* prefixIndex "ref:123" where property(nt:base.id, 'reference') = cast('123'
as reference) */
 
 select * from [nt:base] where property([*], 'REFERENCE') = CAST('123' AS REFERENCE)
 /test/a
@@ -69,8 +69,8 @@ select * from [nt:base] where id is not 
 /test/a
 /test/b
 
-# explain select * from [nt:base] where id = '10'
-# [nt:base] as nt:base /* propertyIndex "id [10..10]" where nt:base.id = cast('10' as
string) */
+explain select * from [nt:base] where id = '10'
+[nt:base] as nt:base /* propertyIndex "id [10..10]" where nt:base.id = cast('10' as string)
*/
 
 select * from [nt:base] where id = '10'
 /test/a



Mime
View raw message