Search in sources :

Example 6 with MountInfoProvider

use of org.apache.jackrabbit.oak.spi.mount.MountInfoProvider in project jackrabbit-oak by apache.

the class CugUtilTest method testGetSupportedPathsMountsBelowSupportedPath.

@Test(expected = IllegalStateException.class)
public void testGetSupportedPathsMountsBelowSupportedPath() {
    MountInfoProvider mip = Mounts.newBuilder().mount("private", "/libs", "/apps").build();
    CugUtil.getSupportedPaths(ConfigurationParameters.of(PARAM_CUG_SUPPORTED_PATHS, new String[] { "/" }), mip);
}
Also used : MountInfoProvider(org.apache.jackrabbit.oak.spi.mount.MountInfoProvider) Test(org.junit.Test)

Example 7 with MountInfoProvider

use of org.apache.jackrabbit.oak.spi.mount.MountInfoProvider in project jackrabbit-oak by apache.

the class CugUtilTest method testGetSupportedPathsMountsAboveSupportedPath2.

@Test(expected = IllegalStateException.class)
public void testGetSupportedPathsMountsAboveSupportedPath2() {
    MountInfoProvider mip = Mounts.newBuilder().mount("private", PathUtils.getAncestorPath(SUPPORTED_PATH3, 2)).build();
    CugUtil.getSupportedPaths(CUG_CONFIG, mip);
}
Also used : MountInfoProvider(org.apache.jackrabbit.oak.spi.mount.MountInfoProvider) Test(org.junit.Test)

Example 8 with MountInfoProvider

use of org.apache.jackrabbit.oak.spi.mount.MountInfoProvider in project jackrabbit-oak by apache.

the class CugUtilTest method testGetSupportedPathsMountsAtSupportedPath.

@Test(expected = IllegalStateException.class)
public void testGetSupportedPathsMountsAtSupportedPath() {
    MountInfoProvider mip = Mounts.newBuilder().mount("private", "/libs", SUPPORTED_PATH3).build();
    CugUtil.getSupportedPaths(CUG_CONFIG, mip);
}
Also used : MountInfoProvider(org.apache.jackrabbit.oak.spi.mount.MountInfoProvider) Test(org.junit.Test)

Example 9 with MountInfoProvider

use of org.apache.jackrabbit.oak.spi.mount.MountInfoProvider in project jackrabbit-oak by apache.

the class CompositeNodeStoreTest method initStore.

@Before
public void initStore() throws Exception {
    MountInfoProvider mip = Mounts.newBuilder().mount("temp", "/tmp").mount("deep", "/libs/mount").mount("empty", "/nowhere").readOnlyMount("readOnly", "/readOnly").build();
    globalStore = register(root.create(null));
    mountedStore = register(mounts.create("temp"));
    deepMountedStore = register(mounts.create("deep"));
    readOnlyStore = register(mounts.create("readOnly"));
    // this NodeStore will always be empty
    NodeStore emptyStore = register(mounts.create("empty"));
    // create a property on the root node
    NodeBuilder builder = globalStore.getRoot().builder();
    builder.setProperty("prop", "val");
    globalStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
    assertTrue(globalStore.getRoot().hasProperty("prop"));
    // create a different sub-tree on the root store
    builder = globalStore.getRoot().builder();
    NodeBuilder libsBuilder = builder.child("libs");
    libsBuilder.child("first");
    libsBuilder.child("second");
    // create an empty /apps node with a property
    builder.child("apps").setProperty("prop", "val");
    globalStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
    assertThat(globalStore.getRoot().getChildNodeCount(10), equalTo(2l));
    // create a /tmp child on the mounted store and set a property
    builder = mountedStore.getRoot().builder();
    NodeBuilder tmpBuilder = builder.child("tmp");
    tmpBuilder.setProperty("prop1", "val1");
    tmpBuilder.child("child1").setProperty("prop1", "val1");
    tmpBuilder.child("child2");
    mountedStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
    assertTrue(mountedStore.getRoot().hasChildNode("tmp"));
    assertThat(mountedStore.getRoot().getChildNode("tmp").getChildNodeCount(10), equalTo(2l));
    // populate /libs/mount/third in the deep mount, and include a property
    builder = deepMountedStore.getRoot().builder();
    builder.child("libs").child("mount").child("third").setProperty("mounted", "true");
    deepMountedStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
    assertTrue(deepMountedStore.getRoot().getChildNode("libs").getChildNode("mount").getChildNode("third").hasProperty("mounted"));
    // populate /readonly with a single node
    builder = readOnlyStore.getRoot().builder();
    builder.child("readOnly");
    readOnlyStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
    // don't use the builder since it would fail due to too many read-write stores
    // but for the purposes of testing the general correctness it's fine
    List<MountedNodeStore> nonDefaultStores = Lists.newArrayList();
    nonDefaultStores.add(new MountedNodeStore(mip.getMountByName("temp"), mountedStore));
    nonDefaultStores.add(new MountedNodeStore(mip.getMountByName("deep"), deepMountedStore));
    nonDefaultStores.add(new MountedNodeStore(mip.getMountByName("empty"), emptyStore));
    nonDefaultStores.add(new MountedNodeStore(mip.getMountByName("readOnly"), readOnlyStore));
    store = new CompositeNodeStore(mip, globalStore, nonDefaultStores);
}
Also used : SegmentNodeStore(org.apache.jackrabbit.oak.segment.SegmentNodeStore) DocumentNodeStore(org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore) NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) MountInfoProvider(org.apache.jackrabbit.oak.spi.mount.MountInfoProvider) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) Before(org.junit.Before)

Example 10 with MountInfoProvider

use of org.apache.jackrabbit.oak.spi.mount.MountInfoProvider in project jackrabbit-oak by apache.

the class HybridIndexClusterIT method customize.

@Override
protected Jcr customize(Jcr jcr) {
    IndexCopier copier;
    try {
        copier = new IndexCopier(executorService, temporaryFolder.getRoot());
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    MountInfoProvider mip = defaultMountInfoProvider();
    NRTIndexFactory nrtIndexFactory = new NRTIndexFactory(copier, clock, TimeUnit.MILLISECONDS.toSeconds(refreshDelta), StatisticsProvider.NOOP);
    LuceneIndexReaderFactory indexReaderFactory = new DefaultIndexReaderFactory(mip, copier);
    IndexTracker tracker = new IndexTracker(indexReaderFactory, nrtIndexFactory);
    LuceneIndexProvider provider = new LuceneIndexProvider(tracker);
    DocumentQueue queue = new DocumentQueue(100, tracker, sameThreadExecutor());
    LuceneIndexEditorProvider editorProvider = new LuceneIndexEditorProvider(copier, tracker, null, null, mip);
    editorProvider.setIndexingQueue(queue);
    LocalIndexObserver localIndexObserver = new LocalIndexObserver(queue, StatisticsProvider.NOOP);
    ExternalIndexObserver externalIndexObserver = new ExternalIndexObserver(queue, tracker, StatisticsProvider.NOOP);
    QueryEngineSettings qs = new QueryEngineSettings();
    qs.setFailTraversal(true);
    jcr.with((QueryIndexProvider) provider).with((Observer) provider).with(localIndexObserver).with(externalIndexObserver).with(editorProvider).with(qs).withAsyncIndexing("async", TimeUnit.DAYS.toSeconds(1));
    return jcr;
}
Also used : IndexTracker(org.apache.jackrabbit.oak.plugins.index.lucene.IndexTracker) QueryEngineSettings(org.apache.jackrabbit.oak.query.QueryEngineSettings) IOException(java.io.IOException) LuceneIndexReaderFactory(org.apache.jackrabbit.oak.plugins.index.lucene.reader.LuceneIndexReaderFactory) IndexCopier(org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier) LuceneIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider) Observer(org.apache.jackrabbit.oak.spi.commit.Observer) DefaultIndexReaderFactory(org.apache.jackrabbit.oak.plugins.index.lucene.reader.DefaultIndexReaderFactory) LuceneIndexProvider(org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider) Mounts.defaultMountInfoProvider(org.apache.jackrabbit.oak.spi.mount.Mounts.defaultMountInfoProvider) MountInfoProvider(org.apache.jackrabbit.oak.spi.mount.MountInfoProvider)

Aggregations

MountInfoProvider (org.apache.jackrabbit.oak.spi.mount.MountInfoProvider)47 Test (org.junit.Test)38 MemoryNodeStore (org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore)14 NodeStore (org.apache.jackrabbit.oak.spi.state.NodeStore)9 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)7 NodeState (org.apache.jackrabbit.oak.spi.state.NodeState)7 AbstractSecurityTest (org.apache.jackrabbit.oak.AbstractSecurityTest)6 Mount (org.apache.jackrabbit.oak.spi.mount.Mount)6 IndexUpdateProvider (org.apache.jackrabbit.oak.plugins.index.IndexUpdateProvider)5 EditorHook (org.apache.jackrabbit.oak.spi.commit.EditorHook)5 Mounts.defaultMountInfoProvider (org.apache.jackrabbit.oak.spi.mount.Mounts.defaultMountInfoProvider)5 SimpleMountInfoProvider (org.apache.jackrabbit.oak.spi.mount.SimpleMountInfoProvider)5 IOException (java.io.IOException)4 IndexCopier (org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier)3 IndexTracker (org.apache.jackrabbit.oak.plugins.index.lucene.IndexTracker)3 LuceneIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider)3 LuceneIndexProvider (org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider)3 DefaultIndexReaderFactory (org.apache.jackrabbit.oak.plugins.index.lucene.reader.DefaultIndexReaderFactory)3 LuceneIndexReaderFactory (org.apache.jackrabbit.oak.plugins.index.lucene.reader.LuceneIndexReaderFactory)3 DefaultNodeStateDiff (org.apache.jackrabbit.oak.spi.state.DefaultNodeStateDiff)3