use of org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore in project jackrabbit-oak by apache.
the class ReadOnlyBlobStoreWrapperTest method readOnly.
@Test
public void readOnly() throws Exception {
FileDataStore fds = new FileDataStore();
fds.setPath(temporaryFolder.getRoot().getAbsolutePath());
fds.init(null);
DataStoreBlobStore writableBS = new DataStoreBlobStore(fds);
BlobStore readOnly = ReadOnlyBlobStoreWrapper.wrap(writableBS);
try {
readOnly.writeBlob(new ByteArrayInputStream("foo".getBytes()));
fail();
} catch (Exception ignore) {
}
String blobId = writableBS.writeBlob(new ByteArrayInputStream("foo".getBytes()));
try (InputStream is = readOnly.getInputStream(blobId)) {
assertNotNull(is);
}
}
use of org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore in project jackrabbit-oak by apache.
the class LuceneIndexProviderServiceTest method blobStoreRegistered.
@Test
public void blobStoreRegistered() throws Exception {
MockOsgi.activate(service, context.bundleContext(), getDefaultConfig());
LuceneIndexEditorProvider editorProvider = (LuceneIndexEditorProvider) context.getService(IndexEditorProvider.class);
assertNull(editorProvider.getBlobStore());
/* Register a blob store */
CachingFileDataStore ds = DataStoreUtils.createCachingFDS(folder.newFolder().getAbsolutePath(), folder.newFolder().getAbsolutePath());
service.bindBlobStore(new DataStoreBlobStore(ds));
assertNotNull(editorProvider.getBlobStore());
}
use of org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore in project jackrabbit-oak by apache.
the class LuceneBlobCacheTest method setUp.
@Before
public void setUp() throws Exception {
fileDataStore = new ReadAccessCountingDataStore();
fileDataStore.init(tempFolder.newFolder().getAbsolutePath());
FileStoreBuilder fileStoreBuilder = FileStoreBuilder.fileStoreBuilder(tempFolder.newFolder()).withBlobStore(new DataStoreBlobStore(fileDataStore)).withMaxFileSize(256).withSegmentCacheSize(64).withMemoryMapping(false);
store = fileStoreBuilder.build();
NodeStore nodeStore = SegmentNodeStoreBuilders.builder(store).build();
root = nodeStore.getRoot();
builder = root.builder();
}
use of org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore in project jackrabbit-oak by apache.
the class FileDataStoreFactory method create.
@Override
public BlobStore create(Closer closer) {
OakFileDataStore delegate = new OakFileDataStore();
delegate.setPath(directory);
delegate.init(null);
closer.register(asCloseable(delegate));
if (ignoreMissingBlobs) {
return new SafeDataStoreBlobStore(delegate);
} else {
return new DataStoreBlobStore(delegate);
}
}
use of org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore in project jackrabbit-oak by apache.
the class S3DataStoreFactory method create.
@Override
public BlobStore create(Closer closer) throws IOException {
S3DataStore delegate = new S3DataStore();
delegate.setProperties(props);
delegate.setPath(directory);
try {
delegate.init(tempHomeDir.getPath());
} catch (RepositoryException e) {
throw new IOException(e);
}
closer.register(asCloseable(delegate, tempHomeDir));
if (ignoreMissingBlobs) {
return new SafeDataStoreBlobStore(delegate);
} else {
return new DataStoreBlobStore(delegate);
}
}
Aggregations