Search in sources :

Example 41 with MountInfoProvider

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

the class ReferenceIndexTest method referenceHandlingWithMounts.

@Test
public void referenceHandlingWithMounts() throws Exception {
    NodeState root = INITIAL_CONTENT;
    NodeBuilder builder = root.builder();
    NodeState before = builder.getNodeState();
    builder.child("a").child("x").setProperty(createProperty("foo", "u1", Type.REFERENCE));
    builder.child("b").setProperty(createProperty("foo", "u1", Type.REFERENCE));
    builder.child("c").setProperty(createProperty("foo", "u1", Type.WEAKREFERENCE));
    builder.child("d").setProperty(createProperty("foo", "u2", Type.WEAKREFERENCE));
    builder.child("a").child("y").setProperty(createProperty("foo", "u1", Type.WEAKREFERENCE));
    NodeState after = builder.getNodeState();
    MountInfoProvider mip = Mounts.newBuilder().mount("foo", "/a").build();
    EditorHook hook = new EditorHook(new IndexUpdateProvider(new ReferenceEditorProvider().with(mip)));
    ReferenceIndex referenceIndex = new ReferenceIndex(mip);
    NodeState indexed = hook.processCommit(before, after, CommitInfo.EMPTY);
    FilterImpl f = createFilter(indexed, NT_BASE);
    f.restrictProperty("*", Operator.EQUAL, newReference("u1"), PropertyType.REFERENCE);
    // System.out.println(NodeStateUtils.toString(NodeStateUtils.getNode(indexed, "/oak:index/reference")));
    assertFilter(f, referenceIndex, indexed, of("/a/x", "/b"));
    FilterImpl f2 = createFilter(indexed, NT_BASE);
    f2.restrictProperty("*", Operator.EQUAL, newReference("u1"), PropertyType.WEAKREFERENCE);
    assertFilter(f2, referenceIndex, indexed, of("/c", "/a/y"));
}
Also used : IndexUpdateProvider(org.apache.jackrabbit.oak.plugins.index.IndexUpdateProvider) NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) FilterImpl(org.apache.jackrabbit.oak.query.index.FilterImpl) EditorHook(org.apache.jackrabbit.oak.spi.commit.EditorHook) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) MountInfoProvider(org.apache.jackrabbit.oak.spi.mount.MountInfoProvider) Test(org.junit.Test)

Example 42 with MountInfoProvider

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

the class PrivateStoreValidatorProviderTest method testValidatorServiceNotRegistered.

@Test
public void testValidatorServiceNotRegistered() {
    // test service registration, for default mount there should be no service for the validator provider
    MountInfoProvider mountInfoProvider = createMountInfoProvider();
    context.registerService(MountInfoProvider.class, mountInfoProvider);
    registerValidatorProvider(privateStoreValidatorProvider, true);
    EditorProvider validator = context.getService(EditorProvider.class);
    assertNull("No PrivateStoreValidatorProvider should be registered for default mounts!", validator);
}
Also used : MountInfoProvider(org.apache.jackrabbit.oak.spi.mount.MountInfoProvider) EditorProvider(org.apache.jackrabbit.oak.spi.commit.EditorProvider) Test(org.junit.Test)

Example 43 with MountInfoProvider

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

the class CompositeNodeStoreBuilderTest method mismatchBetweenMountNameAndStoreName.

@Test(expected = NullPointerException.class)
public void mismatchBetweenMountNameAndStoreName() {
    MountInfoProvider mip = Mounts.newBuilder().mount("temp", "/tmp").build();
    new CompositeNodeStore.Builder(mip, new MemoryNodeStore()).addMount("not-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 44 with MountInfoProvider

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

the class CompositeNodeStoreBuilderTest method mismatchBetweenMountsAndStoresIsRejected.

@Test(expected = IllegalArgumentException.class)
public void mismatchBetweenMountsAndStoresIsRejected() {
    MountInfoProvider mip = Mounts.newBuilder().mount("temp", "/tmp").build();
    new CompositeNodeStore.Builder(mip, 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 45 with MountInfoProvider

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

the class CugUtilTest method testGetSupportedPathsMountsAboveSupportedPath.

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

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