Search in sources :

Example 36 with BlobStore

use of org.apache.jackrabbit.oak.spi.blob.BlobStore in project jackrabbit-oak by apache.

the class LoopbackBlobStoreTest method writingBinariesWithBlobOptsIsNotSupported.

@Test(expected = UnsupportedOperationException.class)
public void writingBinariesWithBlobOptsIsNotSupported() throws IOException {
    given: {
        final BlobStore blobStore = new LoopbackBlobStore();
        final BlobOptions blobOptions = new BlobOptions();
        when: {
            blobStore.writeBlob(adaptToUtf8InputStream("Test"), blobOptions);
        }
    }
}
Also used : BlobOptions(org.apache.jackrabbit.oak.spi.blob.BlobOptions) BlobStore(org.apache.jackrabbit.oak.spi.blob.BlobStore) Test(org.junit.Test)

Example 37 with BlobStore

use of org.apache.jackrabbit.oak.spi.blob.BlobStore in project jackrabbit-oak by apache.

the class AbstractBlobGCRegistrationTest method testBlobGcRegistered.

@Test
public void testBlobGcRegistered() throws Exception {
    registerNodeStoreService();
    assertServiceNotActivated();
    registerBlobStore();
    assertServiceActivated();
    BlobGCMBean mbean = context.getService(BlobGCMBean.class);
    assertNotNull(mbean);
    // Check repository id present
    BlobStore store = context.getService(BlobStore.class);
    assertNotNull(((DataStoreBlobStore) store).getRepositoryId());
    unregisterNodeStoreService();
    unregisterBlobStore();
}
Also used : BlobStore(org.apache.jackrabbit.oak.spi.blob.BlobStore) DataStoreBlobStore(org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore) Test(org.junit.Test)

Example 38 with BlobStore

use of org.apache.jackrabbit.oak.spi.blob.BlobStore in project jackrabbit-oak by apache.

the class AbstractBlobTrackerRegistrationTest method registerBlobTrackingStore.

@Test
public void registerBlobTrackingStore() throws Exception {
    registerNodeStoreService();
    assertServiceNotActivated();
    registerTrackingBlobStore();
    assertServiceActivated();
    BlobStore blobStore = context.getService(BlobStore.class);
    assertTrue(blobStore instanceof BlobTrackingStore);
    BlobTrackingStore trackingStore = (BlobTrackingStore) blobStore;
    assertNotNull(trackingStore.getTracker());
}
Also used : BlobStore(org.apache.jackrabbit.oak.spi.blob.BlobStore) DataStoreBlobStore(org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore) Test(org.junit.Test)

Example 39 with BlobStore

use of org.apache.jackrabbit.oak.spi.blob.BlobStore in project jackrabbit-oak by apache.

the class AbstractMigratorTest method setup.

@Before
public void setup() throws CommitFailedException, IllegalArgumentException, IOException {
    Path target = FileSystems.getDefault().getPath("target");
    repository = java.nio.file.Files.createTempDirectory(target, "migrate-").toFile();
    BlobStore oldBlobStore = createOldBlobStore(repository);
    NodeStore originalNodeStore = createNodeStore(oldBlobStore, repository);
    createContent(originalNodeStore);
    closeNodeStore();
    newBlobStore = createNewBlobStore(repository);
    DefaultSplitBlobStore splitBlobStore = new DefaultSplitBlobStore(repository.getPath(), oldBlobStore, newBlobStore);
    nodeStore = createNodeStore(splitBlobStore, repository);
    migrator = new BlobMigrator(splitBlobStore, nodeStore);
    // see OAK-6066
    NodeBuilder builder = nodeStore.getRoot().builder();
    builder.setProperty("foo", "bar");
    nodeStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
}
Also used : Path(java.nio.file.Path) NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) DefaultSplitBlobStore(org.apache.jackrabbit.oak.spi.blob.split.DefaultSplitBlobStore) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) DefaultSplitBlobStore(org.apache.jackrabbit.oak.spi.blob.split.DefaultSplitBlobStore) BlobStore(org.apache.jackrabbit.oak.spi.blob.BlobStore) Before(org.junit.Before)

Example 40 with BlobStore

use of org.apache.jackrabbit.oak.spi.blob.BlobStore in project jackrabbit-oak by apache.

the class FileBlobStoreService method activate.

@Activate
protected void activate(ComponentContext context, Map<String, Object> config) {
    String homeDir = lookup(context, PROP_HOME);
    if (homeDir != null) {
        log.info("Initializing the FileBlobStore with homeDir [{}]", homeDir);
    }
    BlobStore blobStore = new FileBlobStore(FilenameUtils.concat(homeDir, "datastore"));
    PropertiesUtil.populate(blobStore, config, false);
    Dictionary<String, Object> props = new Hashtable<String, Object>();
    if (context.getProperties().get(PROP_SPLIT_BLOBSTORE) != null) {
        props.put(PROP_SPLIT_BLOBSTORE, context.getProperties().get(PROP_SPLIT_BLOBSTORE));
    }
    reg = context.getBundleContext().registerService(new String[] { BlobStore.class.getName(), GarbageCollectableBlobStore.class.getName() }, blobStore, props);
}
Also used : Hashtable(java.util.Hashtable) FileBlobStore(org.apache.jackrabbit.oak.spi.blob.FileBlobStore) GarbageCollectableBlobStore(org.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore) BlobStore(org.apache.jackrabbit.oak.spi.blob.BlobStore) FileBlobStore(org.apache.jackrabbit.oak.spi.blob.FileBlobStore) Activate(org.apache.felix.scr.annotations.Activate)

Aggregations

BlobStore (org.apache.jackrabbit.oak.spi.blob.BlobStore)64 Test (org.junit.Test)32 DataStoreBlobStore (org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore)19 File (java.io.File)17 GarbageCollectableBlobStore (org.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore)16 NodeStore (org.apache.jackrabbit.oak.spi.state.NodeStore)12 IOException (java.io.IOException)11 DataStoreUtils.getBlobStore (org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreUtils.getBlobStore)11 ByteArrayInputStream (java.io.ByteArrayInputStream)6 DataStore (org.apache.jackrabbit.core.data.DataStore)5 InputStream (java.io.InputStream)4 Parameters (junitparams.Parameters)4 FileStore (org.apache.jackrabbit.oak.segment.file.FileStore)4 MemoryBlobStore (org.apache.jackrabbit.oak.spi.blob.MemoryBlobStore)4 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)4 Before (org.junit.Before)4 Closer (com.google.common.io.Closer)3 ArrayList (java.util.ArrayList)3 RepositoryException (javax.jcr.RepositoryException)3 BlobAccessProvider (org.apache.jackrabbit.oak.api.blob.BlobAccessProvider)3