Search in sources :

Example 26 with MemoryNodeStore

use of org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore 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 27 with MemoryNodeStore

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

the class CompositeMemoryStoreFixture method createNodeStore.

@Override
public NodeStore createNodeStore() {
    MountInfoProvider mip = Mounts.newBuilder().readOnlyMount("temp", MOUNT_PATH).build();
    NodeStore globalStore = new MemoryNodeStore();
    NodeStore tempMount = new MemoryNodeStore();
    return new CompositeNodeStore.Builder(mip, globalStore).addMount("temp", tempMount).build();
}
Also used : NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) MountInfoProvider(org.apache.jackrabbit.oak.spi.mount.MountInfoProvider)

Example 28 with MemoryNodeStore

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

the class MultiplexingLucenePropertyIndexTest method createRepository.

@Override
protected ContentRepository createRepository() {
    IndexCopier copier = null;
    try {
        copier = new IndexCopier(executorService, temporaryFolder.getRoot());
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    LuceneIndexEditorProvider editorProvider = new LuceneIndexEditorProvider(copier, new ExtractedTextCache(10 * FileUtils.ONE_MB, 100), null, mip);
    LuceneIndexProvider provider = new LuceneIndexProvider(new IndexTracker(new DefaultIndexReaderFactory(mip, copier)));
    nodeStore = new MemoryNodeStore();
    return new Oak(nodeStore).with(new InitialContent()).with(new OpenSecurityProvider()).with((QueryIndexProvider) provider).with((Observer) provider).with(editorProvider).with(new PropertyIndexEditorProvider()).with(new NodeTypeIndexProvider()).createContentRepository();
}
Also used : NodeTypeIndexProvider(org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) PropertyIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider) IOException(java.io.IOException) QueryIndexProvider(org.apache.jackrabbit.oak.spi.query.QueryIndexProvider) InitialContent(org.apache.jackrabbit.oak.InitialContent) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) Oak(org.apache.jackrabbit.oak.Oak) DefaultIndexReaderFactory(org.apache.jackrabbit.oak.plugins.index.lucene.reader.DefaultIndexReaderFactory)

Example 29 with MemoryNodeStore

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

the class NodeStoreBinaryResourceProviderTest method countBinaries.

@Test
public void countBinaries() throws Exception {
    NodeBuilder builder = root.builder();
    createFileNode(builder, "a", new IdBlob("hello", null), "text/plain");
    createFileNode(builder, "b", new IdBlob("hello", "id1"), "text/plain");
    createFileNode(builder.child("a2"), "c", new IdBlob("hello", "id2"), "text/foo").setProperty(JcrConstants.JCR_ENCODING, "bar");
    NodeStore store = new MemoryNodeStore(builder.getNodeState());
    BlobStore blobStore = new MemoryBlobStore();
    NodeStoreBinaryResourceProvider extractor = new NodeStoreBinaryResourceProvider(store, blobStore);
    assertEquals(2, extractor.getBinaries("/").size());
    assertEquals(1, extractor.getBinaries("/a2").size());
    BinaryResource bs = extractor.getBinaries("/a2").first().get();
    assertEquals("text/foo", bs.getMimeType());
    assertEquals("bar", bs.getEncoding());
    assertEquals("id2", bs.getBlobId());
}
Also used : NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) MemoryBlobStore(org.apache.jackrabbit.oak.spi.blob.MemoryBlobStore) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) BlobStore(org.apache.jackrabbit.oak.spi.blob.BlobStore) MemoryBlobStore(org.apache.jackrabbit.oak.spi.blob.MemoryBlobStore) Test(org.junit.Test)

Example 30 with MemoryNodeStore

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

the class NodeStoreBinaryResourceProviderTest method csvGenerator.

@Test
public void csvGenerator() throws Exception {
    File csv = new File(temporaryFolder.getRoot(), "test.csv");
    BlobStore blobStore = new MemoryBlobStore();
    NodeBuilder builder = root.builder();
    createFileNode(builder, "a", blobOf("foo", blobStore), "text/plain");
    createFileNode(builder, "b", blobOf("hello", blobStore), "text/plain");
    NodeStore store = new MemoryNodeStore(builder.getNodeState());
    NodeStoreBinaryResourceProvider extractor = new NodeStoreBinaryResourceProvider(store, blobStore);
    CSVFileGenerator generator = new CSVFileGenerator(csv);
    generator.generate(extractor.getBinaries("/"));
    CSVFileBinaryResourceProvider csvbrp = new CSVFileBinaryResourceProvider(csv, blobStore);
    assertEquals(2, csvbrp.getBinaries("/").size());
    csvbrp.close();
}
Also used : NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) MemoryBlobStore(org.apache.jackrabbit.oak.spi.blob.MemoryBlobStore) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) File(java.io.File) BlobStore(org.apache.jackrabbit.oak.spi.blob.BlobStore) MemoryBlobStore(org.apache.jackrabbit.oak.spi.blob.MemoryBlobStore) 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