use of com.enonic.xp.blob.ProviderConfig in project xp by enonic.
the class BlobStoreFactory method execute.
BlobStore execute() {
final BlobStore providerStore = provider.get();
final ProviderConfig config = provider.config();
final BlobStore builtStore = populateWithReadThroughIfApplicable(config, providerStore);
if (!this.config.cache()) {
return builtStore;
}
return CachedBlobStore.create().memoryCapacity(this.config.memoryCapacity()).sizeTreshold(this.config.cacheSizeThreshold()).blobStore(builtStore).build();
}
use of com.enonic.xp.blob.ProviderConfig in project xp by enonic.
the class BlobStoreActivatorTest method activate.
@Test
public void activate() throws Exception {
final BlobStoreConfig blobStoreConfig = Mockito.mock(BlobStoreConfig.class);
Mockito.when(blobStoreConfig.providerName()).thenReturn("file");
final MemoryBlobStore blobStore = new MemoryBlobStore();
final MemoryBlobStoreProvider provider = new MemoryBlobStoreProvider("memoey", blobStore, new ProviderConfig() {
@Override
public String readThroughProvider() {
return null;
}
@Override
public boolean readThroughEnabled() {
return false;
}
@Override
public long readThroughSizeThreshold() {
return 0;
}
@Override
public boolean isValid() {
return true;
}
});
final BundleContext bundleContext = Mockito.mock(BundleContext.class);
final BlobStoreActivator blobStoreActivator = new BlobStoreActivator();
blobStoreActivator.addProvider(provider);
blobStoreActivator.setConfig(blobStoreConfig);
blobStoreActivator.activate(bundleContext);
final BundleContext context = Mockito.mock(BundleContext.class);
blobStoreActivator.activate(context);
}
Aggregations