jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1400034 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/ main/java/org/apache/jackrabbit/oak/core/ test/java/org/apache/jackrabbit/oak/ test/java/org/apache/jackrabbit/oak/plugins/index/lucene/ test/java/org/ap...
Date Fri, 19 Oct 2012 10:39:31 GMT
Author: jukka
Date: Fri Oct 19 10:39:31 2012
New Revision: 1400034

URL: http://svn.apache.org/viewvc?rev=1400034&view=rev
Log:
OAK-352: Oak builder for simplified repository construction

Add the ability to specify initializers. Simplify more tests.

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/RootTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/TreeTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexQueryTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/old/QueryTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexQueryTest.java
    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/index/TraversingIndexQueryTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java?rev=1400034&r1=1400033&r2=1400034&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java Fri Oct
19 10:39:31 2012
@@ -16,6 +16,8 @@
  */
 package org.apache.jackrabbit.oak;
 
+import static com.google.common.base.Preconditions.checkNotNull;
+
 import java.util.List;
 import javax.annotation.Nonnull;
 import javax.jcr.NoSuchWorkspaceException;
@@ -28,8 +30,8 @@ import org.apache.jackrabbit.oak.api.Con
 import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.api.Root;
 import org.apache.jackrabbit.oak.core.ContentRepositoryImpl;
+import org.apache.jackrabbit.oak.core.OrderedChildrenEditor;
 import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
-import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.CompositeHook;
 import org.apache.jackrabbit.oak.spi.commit.CompositeValidatorProvider;
@@ -37,12 +39,12 @@ import org.apache.jackrabbit.oak.spi.com
 import org.apache.jackrabbit.oak.spi.commit.ValidatingHook;
 import org.apache.jackrabbit.oak.spi.commit.Validator;
 import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
+import org.apache.jackrabbit.oak.spi.lifecycle.MicroKernelTracker;
 import org.apache.jackrabbit.oak.spi.query.CompositeQueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider;
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
 import org.apache.jackrabbit.oak.spi.state.NodeState;
-import org.apache.jackrabbit.oak.spi.state.NodeStore;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -60,6 +62,8 @@ public class Oak {
 
     private final MicroKernel kernel;
 
+    private final List<MicroKernelTracker> initializers = Lists.newArrayList();
+
     private final List<QueryIndexProvider> queryIndexProviders = Lists.newArrayList();
 
     private final List<CommitHook> commitHooks = Lists.newArrayList();
@@ -78,6 +82,12 @@ public class Oak {
         this(new MicroKernelImpl());
     }
 
+    @Nonnull
+    public Oak with(@Nonnull MicroKernelTracker initializer) {
+       initializers.add(checkNotNull(initializer));
+       return this;
+    }
+
     /**
      * Associates the given query index provider with the repository to
      * be created.
@@ -177,11 +187,15 @@ public class Oak {
     }
 
     public ContentRepository createContentRepository() {
+        KernelNodeStore store = new KernelNodeStore(kernel);
+        for (MicroKernelTracker initializer : initializers) {
+            initializer.available(store);
+        }
+        store.setHook(createCommitHook());
         return new ContentRepositoryImpl(
-                kernel,
-                CompositeQueryIndexProvider.compose(queryIndexProviders),
-                createCommitHook(),
+                store,
                 conflictHandler,
+                CompositeQueryIndexProvider.compose(queryIndexProviders),
                 securityProvider);
     }
 
@@ -235,25 +249,8 @@ public class Oak {
 
     private CommitHook createCommitHook() {
         withValidatorHook();
+        commitHooks.add(new OrderedChildrenEditor()); // FIXME don't hardcode
         return CompositeHook.compose(commitHooks);
     }
 
-    /**
-     * Creates a {@link NodeStore} based on the previously set micro kernel,
-     * hooks and validators.
-     * <p/>
-     * This method will return an in memory node store without hooks nor
-     * validators if no {@link MicroKernel} was set.
-     *
-     * @return a {@link NodeStore}.
-     */
-    public NodeStore createNodeStore() {
-        if (kernel != null) {
-            KernelNodeStore nodeStore = new KernelNodeStore(kernel);
-            nodeStore.setHook(createCommitHook());
-            return nodeStore;
-        } else {
-            return new MemoryNodeStore();
-        }
-    }
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java?rev=1400034&r1=1400033&r2=1400034&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
Fri Oct 19 10:39:31 2012
@@ -24,9 +24,6 @@ import javax.security.auth.login.LoginEx
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.api.ContentSession;
-import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
-import org.apache.jackrabbit.oak.spi.commit.CommitHook;
-import org.apache.jackrabbit.oak.spi.commit.CompositeHook;
 import org.apache.jackrabbit.oak.spi.commit.ConflictHandler;
 import org.apache.jackrabbit.oak.spi.query.CompositeQueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
@@ -59,24 +56,6 @@ public class ContentRepositoryImpl imple
      * Creates an content repository instance based on the given, already
      * initialized components.
      *
-     * @param microKernel   underlying kernel instance
-     * @param indexProvider index provider
-     * @param commitHook    the commit hook
-     * @param securityProvider The configured security provider or {@code null} if
-     * default implementations should be used.
-     */
-    public ContentRepositoryImpl(MicroKernel microKernel,
-                                 QueryIndexProvider indexProvider,
-                                 CommitHook commitHook,
-                                 ConflictHandler conflictHandler,
-                                 SecurityProvider securityProvider) {
-        this(createNodeStore(microKernel, commitHook), conflictHandler, indexProvider, securityProvider);
-    }
-
-    /**
-     * Creates an content repository instance based on the given, already
-     * initialized components.
-     *
      * @param nodeStore the node store this repository is based upon.
      * @param indexProvider index provider
      * @param securityProvider The configured security provider or {@code null} if
@@ -114,11 +93,4 @@ public class ContentRepositoryImpl imple
                 nodeStore, conflictHandler, indexProvider);
     }
 
-    //--------------------------------------------------------------------------
-    private static NodeStore createNodeStore(MicroKernel microKernel, CommitHook commitHook)
{
-        KernelNodeStore nodeStore = new KernelNodeStore(microKernel);
-        commitHook = new CompositeHook(commitHook, new OrderedChildrenEditor());
-        nodeStore.setHook(commitHook);
-        return nodeStore;
-    }
 }

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/RootTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/RootTest.java?rev=1400034&r1=1400033&r2=1400034&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/RootTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/RootTest.java Fri
Oct 19 10:39:31 2012
@@ -26,28 +26,35 @@ import org.apache.jackrabbit.oak.api.Roo
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.plugins.commit.AnnotatingConflictHandler;
 import org.apache.jackrabbit.oak.plugins.commit.ConflictValidator;
-import org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 
 /**
  * Contains tests related to {@link Root}
  */
-public class RootTest extends AbstractOakTest {
+public class RootTest {
 
-    @Override
-    protected ContentRepository createRepository() {
-        return new Oak()
-                .with(new OpenSecurityProvider())
-                .with(new ConflictValidator())
-                .with(new AnnotatingConflictHandler())
-                .createContentRepository();
+    private ContentRepository repository;
+
+    @Before
+    public void setUp() {
+        repository = new Oak()
+            .with(new ConflictValidator())
+            .with(new AnnotatingConflictHandler())
+            .createContentRepository();
+    }
+
+    @After
+    public void tearDown() {
+        repository = null;
     }
 
     @Test
     @Ignore("OAK-169")
     public void copyOrderableNodes() throws Exception {
-        ContentSession s = createAdminSession();
+        ContentSession s = repository.login(null, null);
         try {
             Root r = s.getLatestRoot();
             Tree t = r.getTree("/");
@@ -68,7 +75,7 @@ public class RootTest extends AbstractOa
     @Test
     @Ignore("OAK-169")
     public void moveOrderableNodes() throws Exception {
-        ContentSession s = createAdminSession();
+        ContentSession s = repository.login(null, null);
         try {
             Root r = s.getLatestRoot();
             Tree t = r.getTree("/");

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/TreeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/TreeTest.java?rev=1400034&r1=1400033&r2=1400034&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/TreeTest.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/TreeTest.java Fri
Oct 19 10:39:31 2012
@@ -28,7 +28,8 @@ import org.apache.jackrabbit.oak.api.Roo
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.plugins.commit.AnnotatingConflictHandler;
 import org.apache.jackrabbit.oak.plugins.commit.ConflictValidator;
-import org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
 
 import static org.apache.jackrabbit.oak.OakAssert.assertSequence;
@@ -37,19 +38,26 @@ import static org.junit.Assert.assertEqu
 /**
  * Contains tests related to {@link Tree}
  */
-public class TreeTest extends AbstractOakTest {
+public class TreeTest {
 
-    @Override
-    protected ContentRepository createRepository() {
-        return new Oak()
-                .with(new OpenSecurityProvider())
-                .with(new ConflictValidator())
-                .with(new AnnotatingConflictHandler())
-                .createContentRepository();
+    private ContentRepository repository;
+
+    @Before
+    public void setUp() {
+        repository = new Oak()
+            .with(new ConflictValidator())
+            .with(new AnnotatingConflictHandler())
+            .createContentRepository();
+    }
+
+    @After
+    public void tearDown() {
+        repository = null;
     }
+
     @Test
     public void orderBefore() throws Exception {
-        ContentSession s = createAdminSession();
+        ContentSession s = repository.login(null, null);
         try {
             Root r = s.getLatestRoot();
             Tree t = r.getTree("/");
@@ -87,7 +95,7 @@ public class TreeTest extends AbstractOa
 
     @Test
     public void concurrentAddChildOrderable() throws Exception {
-        ContentSession s1 = createAdminSession();
+        ContentSession s1 = repository.login(null, null);
         try {
             Root r1 = s1.getLatestRoot();
             Tree t1 = r1.getTree("/");
@@ -95,7 +103,7 @@ public class TreeTest extends AbstractOa
             t1.addChild("node2");
             t1.addChild("node3");
             r1.commit();
-            ContentSession s2 = createAdminSession();
+            ContentSession s2 = repository.login(null, null);
             try {
                 Root r2 = s2.getLatestRoot();
                 Tree t2 = r2.getTree("/");
@@ -128,7 +136,7 @@ public class TreeTest extends AbstractOa
 
     @Test
     public void concurrentAddChild() throws Exception {
-        ContentSession s1 = createAdminSession();
+        ContentSession s1 = repository.login(null, null);
         try {
             Root r1 = s1.getLatestRoot();
             Tree t1 = r1.getTree("/");
@@ -136,7 +144,7 @@ public class TreeTest extends AbstractOa
             t1.addChild("node2");
             t1.addChild("node3");
             r1.commit();
-            ContentSession s2 = createAdminSession();
+            ContentSession s2 = repository.login(null, null);
             try {
                 Root r2 = s2.getLatestRoot();
                 Tree t2 = r2.getTree("/");

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexQueryTest.java?rev=1400034&r1=1400033&r2=1400034&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexQueryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexQueryTest.java
Fri Oct 19 10:39:31 2012
@@ -16,42 +16,33 @@
  */
 package org.apache.jackrabbit.oak.plugins.index.lucene;
 
-import org.apache.jackrabbit.mk.api.MicroKernel;
-import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.api.Tree;
-import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
+import org.apache.jackrabbit.oak.plugins.nodetype.InitialContent;
 import org.apache.jackrabbit.oak.query.AbstractQueryTest;
-import org.apache.jackrabbit.oak.spi.commit.CommitHook;
-import org.apache.jackrabbit.oak.spi.commit.CompositeHook;
-import org.apache.jackrabbit.oak.spi.query.CompositeQueryIndexProvider;
-import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
 
 /**
  * Tests the query engine using the default index implementation: the
  * {@link LuceneIndexProvider}
  */
-public class LuceneIndexQueryTest extends AbstractQueryTest implements
-        LuceneIndexConstants {
+public class LuceneIndexQueryTest extends AbstractQueryTest {
 
     @Override
     protected void createTestIndexNode() throws Exception {
         Tree index = root.getTree("/");
-        createTestIndexNode(index, TYPE_LUCENE);
+        createTestIndexNode(index, LuceneIndexConstants.TYPE_LUCENE);
         root.commit();
     }
 
     @Override
     protected ContentRepository createRepository() {
-        QueryIndexProvider qip = new CompositeQueryIndexProvider(
-                new LuceneIndexProvider(TEST_INDEX_HOME));
-        CommitHook ch = new CompositeHook(
-                new LuceneReindexHook(TEST_INDEX_HOME), new LuceneHook(
-                        TEST_INDEX_HOME));
-        MicroKernel mk = new MicroKernelImpl();
-        createDefaultKernelTracker().available(new KernelNodeStore(mk));
-        return new Oak(mk).with(qip).with(ch).with(getSecurityProvider()).createContentRepository();
+        return new Oak()
+            .with(new InitialContent())
+            .with(new LuceneIndexProvider(TEST_INDEX_HOME))
+            .with(new LuceneReindexHook(TEST_INDEX_HOME))
+            .with(new LuceneHook(TEST_INDEX_HOME))
+            .createContentRepository();
     }
 
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/old/QueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/old/QueryTest.java?rev=1400034&r1=1400033&r2=1400034&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/old/QueryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/old/QueryTest.java
Fri Oct 19 10:39:31 2012
@@ -17,10 +17,11 @@ import org.apache.jackrabbit.mk.core.Mic
 import org.apache.jackrabbit.mk.index.IndexWrapper;
 import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.api.ContentRepository;
-import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
+import org.apache.jackrabbit.oak.plugins.index.lucene.LuceneHook;
+import org.apache.jackrabbit.oak.plugins.index.lucene.LuceneReindexHook;
+import org.apache.jackrabbit.oak.plugins.nodetype.InitialContent;
 import org.apache.jackrabbit.oak.query.AbstractQueryTest;
-import org.apache.jackrabbit.oak.spi.commit.CompositeHook;
-import org.apache.jackrabbit.oak.spi.query.CompositeQueryIndexProvider;
+import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -32,20 +33,19 @@ public class QueryTest extends AbstractQ
 
     @Override
     protected ContentRepository createRepository() {
-
         // the property and prefix index currently require the index wrapper
         IndexWrapper mk = new IndexWrapper(new MicroKernelImpl(),
                 TEST_INDEX_HOME + INDEX_DEFINITIONS_NAME + "/indexes");
-        Indexer indexer = mk.getIndexer();
 
-        // MicroKernel mk = new MicroKernelImpl();
-        // Indexer indexer = new Indexer(mk);
+        PropertyIndexer indexer = new PropertyIndexer(mk.getIndexer());
 
-        PropertyIndexer pi = new PropertyIndexer(indexer);
-        QueryIndexProvider qip = new CompositeQueryIndexProvider(pi);
-        CompositeHook hook = new CompositeHook(pi);
-        createDefaultKernelTracker().available(new KernelNodeStore(mk));
-        return new Oak(mk).with(qip).with(hook).with(getSecurityProvider()).createContentRepository();
+        return new Oak(mk)
+            .with(new InitialContent())
+            .with((QueryIndexProvider) indexer)
+            .with((CommitHook) indexer)
+            .with(new LuceneReindexHook(TEST_INDEX_HOME))
+            .with(new LuceneHook(TEST_INDEX_HOME))
+            .createContentRepository();
     }
 
     @Test

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexQueryTest.java?rev=1400034&r1=1400033&r2=1400034&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexQueryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexQueryTest.java
Fri Oct 19 10:39:31 2012
@@ -16,16 +16,10 @@
  */
 package org.apache.jackrabbit.oak.plugins.index.property;
 
-import org.apache.jackrabbit.mk.api.MicroKernel;
-import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.api.ContentRepository;
-import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
+import org.apache.jackrabbit.oak.plugins.nodetype.InitialContent;
 import org.apache.jackrabbit.oak.query.AbstractQueryTest;
-import org.apache.jackrabbit.oak.spi.commit.CommitHook;
-import org.apache.jackrabbit.oak.spi.commit.CompositeHook;
-import org.apache.jackrabbit.oak.spi.query.CompositeQueryIndexProvider;
-import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
 
 /**
  * Tests the query engine using the default index implementation: the
@@ -35,12 +29,11 @@ public class PropertyIndexQueryTest exte
 
     @Override
     protected ContentRepository createRepository() {
-        QueryIndexProvider qip = new CompositeQueryIndexProvider(
-                new PropertyIndexProvider());
-        CommitHook ch = new CompositeHook(new PropertyIndexHook());
-        MicroKernel mk = new MicroKernelImpl();
-        createDefaultKernelTracker().available(new KernelNodeStore(mk));
-        return new Oak(mk).with(qip).with(ch).with(getSecurityProvider()).createContentRepository();
+        return new Oak()
+            .with(new InitialContent())
+            .with(new PropertyIndexProvider())
+            .with(new PropertyIndexHook())
+            .createContentRepository();
     }
 
 }
\ No newline at end of file

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=1400034&r1=1400033&r2=1400034&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
Fri Oct 19 10:39:31 2012
@@ -32,7 +32,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.jackrabbit.JcrConstants;
-import org.apache.jackrabbit.oak.AbstractOakTest;
+import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.api.PropertyValue;
 import org.apache.jackrabbit.oak.api.Result;
@@ -57,8 +57,7 @@ import static org.junit.Assert.fail;
 /**
  * AbstractQueryTest...
  */
-public abstract class AbstractQueryTest extends AbstractOakTest implements
-        IndexConstants {
+public abstract class AbstractQueryTest implements IndexConstants {
 
     protected static final String TEST_INDEX_NAME = "test-index";
     protected static final String TEST_INDEX_HOME = DEFAULT_INDEX_HOME;
@@ -68,16 +67,16 @@ public abstract class AbstractQueryTest 
     protected ContentSession session;
     protected Root root;
 
-    @Override
     @Before
     public void before() throws Exception {
-        super.before();
-        session = createAdminSession();
+        session = createRepository().login(null, null);
         root = session.getLatestRoot();
         qe = root.getQueryEngine();
         createTestIndexNode();
     }
 
+    protected abstract ContentRepository createRepository();
+
     /**
      * Override this method to add your default index definition
      * 

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/TraversingIndexQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/TraversingIndexQueryTest.java?rev=1400034&r1=1400033&r2=1400034&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/TraversingIndexQueryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/TraversingIndexQueryTest.java
Fri Oct 19 10:39:31 2012
@@ -13,11 +13,9 @@
  */
 package org.apache.jackrabbit.oak.query.index;
 
-import org.apache.jackrabbit.mk.api.MicroKernel;
-import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.api.ContentRepository;
-import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
+import org.apache.jackrabbit.oak.plugins.nodetype.InitialContent;
 import org.apache.jackrabbit.oak.query.AbstractQueryTest;
 
 /**
@@ -28,9 +26,9 @@ public class TraversingIndexQueryTest ex
 
     @Override
     protected ContentRepository createRepository() {
-        MicroKernel mk = new MicroKernelImpl();
-        createDefaultKernelTracker().available(new KernelNodeStore(mk));
-        return new Oak(mk).with(getSecurityProvider()).createContentRepository();
+        return new Oak()
+            .with(new InitialContent())
+            .createContentRepository();
     }
 
 }



Mime
View raw message