Search in sources :

Example 21 with MemoryNodeStore

use of org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore in project jackrabbit-oak by apache.

the class AsyncIndexUpdateTest method disableCheckpointCleanup.

@Test
public void disableCheckpointCleanup() throws Exception {
    String propertyName = "oak.async.checkpointCleanupIntervalMinutes";
    MemoryNodeStore store = new MemoryNodeStore();
    IndexEditorProvider provider = new PropertyIndexEditorProvider();
    try {
        System.setProperty(propertyName, "-1");
        final AtomicBoolean cleaned = new AtomicBoolean();
        AsyncIndexUpdate async = new AsyncIndexUpdate("async", store, provider) {

            @Override
            void cleanUpCheckpoints() {
                cleaned.set(true);
                super.cleanUpCheckpoints();
            }
        };
        async.run();
        assertFalse(cleaned.get());
    } finally {
        System.clearProperty(propertyName);
    }
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) PropertyIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider) PropertyIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Test(org.junit.Test)

Example 22 with MemoryNodeStore

use of org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore in project jackrabbit-oak by apache.

the class AsyncIndexerServiceTest method nonClusterableNodeStoreAndLeaseTimeout.

@Test
public void nonClusterableNodeStoreAndLeaseTimeout() throws Exception {
    nodeStore = new MemoryNodeStore();
    injectDefaultServices();
    Map<String, Object> config = ImmutableMap.<String, Object>of("asyncConfigs", new String[] { "async:5" }, "leaseTimeOutMinutes", "20");
    MockOsgi.activate(service, context.bundleContext(), config);
    AsyncIndexUpdate indexUpdate = getIndexUpdate("async");
    assertEquals(0, indexUpdate.getLeaseTimeOut());
}
Also used : MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) Test(org.junit.Test)

Example 23 with MemoryNodeStore

use of org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore in project jackrabbit-oak by apache.

the class SimpleNodeAggregatorTest method testStarNameMoreLevels.

@Test
public void testStarNameMoreLevels() {
    NodeState root = new MemoryNodeStore().getRoot();
    NodeBuilder builder = root.builder();
    NodeBuilder file = builder.child("file");
    file.setProperty(JCR_PRIMARYTYPE, NT_FILE);
    file.child(JCR_CONTENT);
    SimpleNodeAggregator agg = new SimpleNodeAggregator().newRuleWithName(NT_FILE, newArrayList("*", "*/*", "*/*/*", "*/*/*/*"));
    String path = "/file/jcr:content";
    List<String> actual = newArrayList(agg.getParents(builder.getNodeState(), path));
    assertEquals(newArrayList("/file"), actual);
}
Also used : NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) Test(org.junit.Test)

Example 24 with MemoryNodeStore

use of org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore in project jackrabbit-oak by apache.

the class SimpleNodeAggregatorTest method testStarNameWrongParentType.

@Test
public void testStarNameWrongParentType() {
    NodeState root = new MemoryNodeStore().getRoot();
    NodeBuilder builder = root.builder();
    NodeBuilder file = builder.child("file");
    file.setProperty(JCR_PRIMARYTYPE, NT_FILE + "_");
    file.child(JCR_CONTENT);
    SimpleNodeAggregator agg = new SimpleNodeAggregator().newRuleWithName(NT_FILE, newArrayList(INCLUDE_ALL));
    String path = "/file/jcr:content";
    List<String> actual = newArrayList(agg.getParents(builder.getNodeState(), path));
    assertTrue(actual.isEmpty());
}
Also used : NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) Test(org.junit.Test)

Example 25 with MemoryNodeStore

use of org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore in project jackrabbit-oak by apache.

the class CompositeNodeStoreBuilderTest method builderRejectsTooManyReadWriteStores_mixed.

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

Aggregations

MemoryNodeStore (org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore)121 Test (org.junit.Test)83 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)73 NodeStore (org.apache.jackrabbit.oak.spi.state.NodeStore)46 PropertyIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider)39 NodeState (org.apache.jackrabbit.oak.spi.state.NodeState)36 MountInfoProvider (org.apache.jackrabbit.oak.spi.mount.MountInfoProvider)21 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)20 Oak (org.apache.jackrabbit.oak.Oak)14 ProxyNodeStore (org.apache.jackrabbit.oak.spi.state.ProxyNodeStore)14 InitialContent (org.apache.jackrabbit.oak.InitialContent)11 OpenSecurityProvider (org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider)11 Before (org.junit.Before)10 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)7 MountedNodeStore (org.apache.jackrabbit.oak.composite.MountedNodeStore)7 AsyncIndexStats (org.apache.jackrabbit.oak.plugins.index.AsyncIndexUpdate.AsyncIndexStats)7 EditorHook (org.apache.jackrabbit.oak.spi.commit.EditorHook)7 Nonnull (javax.annotation.Nonnull)6 AbstractSecurityTest (org.apache.jackrabbit.oak.AbstractSecurityTest)6 PropertyIndexLookup (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexLookup)6