Search in sources :

Example 21 with FileDataStore

use of org.apache.jackrabbit.core.data.FileDataStore in project jackrabbit-oak by apache.

the class DataStoreServiceTest method configFileDataStore.

/**
 * Test to verify @FileDataStore is returned if cacheSize is not configured.
 */
@Test
public void configFileDataStore() throws Exception {
    String nasPath = folder.getRoot().getAbsolutePath() + "/NASPath";
    String cachePath = folder.getRoot().getAbsolutePath() + "/cachePath";
    Map<String, Object> config = new HashMap<String, Object>();
    config.put("repository.home", folder.getRoot().getAbsolutePath());
    config.put(FileDataStoreService.PATH, nasPath);
    config.put(FileDataStoreService.CACHE_PATH, cachePath);
    FileDataStoreService fdsSvc = new FileDataStoreService();
    DataStore ds = fdsSvc.createDataStore(context.componentContext(), config);
    PropertiesUtil.populate(ds, config, false);
    ds.init(folder.getRoot().getAbsolutePath());
    assertTrue("not instance of FileDataStore", ds instanceof FileDataStore);
    FileDataStore fds = (FileDataStore) ds;
    assertEquals("path not equal", nasPath, fds.getPath());
}
Also used : HashMap(java.util.HashMap) DataStore(org.apache.jackrabbit.core.data.DataStore) FileDataStore(org.apache.jackrabbit.core.data.FileDataStore) FileDataStore(org.apache.jackrabbit.core.data.FileDataStore) Test(org.junit.Test)

Example 22 with FileDataStore

use of org.apache.jackrabbit.core.data.FileDataStore in project jackrabbit-oak by apache.

the class FSBlobSerializer method createDataStore.

private DataStoreBlobStore createDataStore() {
    FileDataStore fds = new OakFileDataStore();
    fds.setPath(dir.getAbsolutePath());
    fds.setMinRecordLength(maxInlineSize);
    fds.init(null);
    return new DataStoreBlobStore(fds);
}
Also used : OakFileDataStore(org.apache.jackrabbit.oak.plugins.blob.datastore.OakFileDataStore) FileDataStore(org.apache.jackrabbit.core.data.FileDataStore) OakFileDataStore(org.apache.jackrabbit.oak.plugins.blob.datastore.OakFileDataStore) DataStoreBlobStore(org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore)

Aggregations

FileDataStore (org.apache.jackrabbit.core.data.FileDataStore)22 DataStoreBlobStore (org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore)14 Test (org.junit.Test)13 File (java.io.File)10 ByteArrayInputStream (java.io.ByteArrayInputStream)8 DataRecord (org.apache.jackrabbit.core.data.DataRecord)5 Random (java.util.Random)4 Blob (org.apache.jackrabbit.oak.api.Blob)4 InputStream (java.io.InputStream)3 OakFileDataStore (org.apache.jackrabbit.oak.plugins.blob.datastore.OakFileDataStore)3 AbstractBlob (org.apache.jackrabbit.oak.plugins.memory.AbstractBlob)3 FileBlob (org.apache.jackrabbit.oak.segment.file.FileBlob)3 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)3 DataIdentifier (org.apache.jackrabbit.core.data.DataIdentifier)2 DataStore (org.apache.jackrabbit.core.data.DataStore)2 PropertyState (org.apache.jackrabbit.oak.api.PropertyState)2 BlobStoreBlob (org.apache.jackrabbit.oak.plugins.blob.BlobStoreBlob)2 BlobStoreStats (org.apache.jackrabbit.oak.plugins.blob.BlobStoreStats)2 BlobStore (org.apache.jackrabbit.oak.spi.blob.BlobStore)2 Function (com.google.common.base.Function)1