Search in sources :

Example 21 with MountInfoProvider

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

the class CompositeNodeStoreBuilderTest method builderAcceptsMultipleReadOnlyStores.

@Test
public void builderAcceptsMultipleReadOnlyStores() {
    MountInfoProvider mip = Mounts.newBuilder().readOnlyMount("readOnly", "/readOnly").readOnlyMount("readOnly2", "/readOnly2").build();
    new CompositeNodeStore.Builder(mip, new MemoryNodeStore()).addMount("readOnly", new MemoryNodeStore()).addMount("readOnly2", new MemoryNodeStore()).build();
}
Also used : MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) MountInfoProvider(org.apache.jackrabbit.oak.spi.mount.MountInfoProvider) Test(org.junit.Test)

Example 22 with MountInfoProvider

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

the class CompositeNodeStoreBuilderTest method builderRejectsTooManyReadWriteStores_oneExtra.

@Test(expected = IllegalArgumentException.class)
public void builderRejectsTooManyReadWriteStores_oneExtra() {
    MountInfoProvider mip = Mounts.newBuilder().mount("temp", "/tmp").build();
    new CompositeNodeStore.Builder(mip, new MemoryNodeStore()).addMount("temp", new MemoryNodeStore()).build();
}
Also used : MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) MountInfoProvider(org.apache.jackrabbit.oak.spi.mount.MountInfoProvider) Test(org.junit.Test)

Example 23 with MountInfoProvider

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

the class CompositeSegmentStoreFixture method createNodeStore.

@Override
public NodeStore createNodeStore() {
    try {
        MountInfoProvider mip = Mounts.newBuilder().readOnlyMount("temp", MOUNT_PATH).build();
        NodeStore globalStore = SegmentNodeStoreBuilders.builder(new MemoryStore()).build();
        NodeStore tempMount = SegmentNodeStoreBuilders.builder(new MemoryStore()).build();
        return new CompositeNodeStore.Builder(mip, globalStore).addMount("temp", tempMount).build();
    } catch (IOException e) {
        throw new RuntimeException();
    }
}
Also used : MemoryStore(org.apache.jackrabbit.oak.segment.memory.MemoryStore) NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) IOException(java.io.IOException) MountInfoProvider(org.apache.jackrabbit.oak.spi.mount.MountInfoProvider)

Example 24 with MountInfoProvider

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

the class PrivateStoreValidatorProviderTest method testValidatorServiceRegistered.

@Test
public void testValidatorServiceRegistered() {
    // test service registration, there should be a service for the PrivateStoreValidatorProvider
    MountInfoProvider mountInfoProvider = createMountInfoProvider("/content/readonly");
    context.registerService(MountInfoProvider.class, mountInfoProvider);
    registerValidatorProvider(privateStoreValidatorProvider, true);
    EditorProvider validator = context.getService(EditorProvider.class);
    assertNotNull("No PrivateStoreValidatorProvider available!", validator);
    assertTrue(validator instanceof PrivateStoreValidatorProvider);
    assertTrue(((PrivateStoreValidatorProvider) validator).isFailOnDetection());
    MockOsgi.deactivate(privateStoreValidatorProvider, context.bundleContext());
    assertNull(context.getService(EditorProvider.class));
}
Also used : MountInfoProvider(org.apache.jackrabbit.oak.spi.mount.MountInfoProvider) EditorProvider(org.apache.jackrabbit.oak.spi.commit.EditorProvider) Test(org.junit.Test)

Example 25 with MountInfoProvider

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

the class PrivateStoreValidatorProviderTest method configureMountInfoProvider.

/**
     * Register a {@link MountInfoProvider} service
     * If the given path array is empty, the {@code MountInfoProvider.DEFAULT} will be registered.
     *
     * @param readOnlyPaths - contains the string paths mounted on a read-only store
     */
private void configureMountInfoProvider(String... readOnlyPaths) {
    MountInfoProvider mountInfoProvider = createMountInfoProvider(readOnlyPaths);
    privateStoreValidatorProvider.setMountInfoProvider(mountInfoProvider);
    privateStoreValidatorProvider.setFailOnDetection(true);
}
Also used : 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