use of org.apache.jackrabbit.core.data.CachingFDS in project jackrabbit-oak by apache.
the class DataStoreServiceTest method configCachingFDS.
/**
*
* Test @CachingFDS is returned when cacheSize > 0
*/
@Test
public void configCachingFDS() throws Exception {
System.setProperty(JR2_CACHING_PROP, "true");
try {
String nasPath = folder.getRoot().getAbsolutePath() + "/NASPath";
String cachePath = folder.getRoot().getAbsolutePath() + "/cachePath";
long cacheSize = 100L;
Map<String, Object> config = new HashMap<String, Object>();
config.put("repository.home", folder.getRoot().getAbsolutePath());
config.put(FileDataStoreService.CACHE_SIZE, cacheSize);
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 CachingFDS", ds instanceof CachingFDS);
CachingFDS cds = (CachingFDS) ds;
assertEquals("cachesize not equal", cacheSize, cds.getCacheSize());
assertEquals("cachepath not equal", cachePath, cds.getPath());
Backend backend = cds.getBackend();
Properties props = (Properties) getField(backend);
assertEquals("path not equal", nasPath, props.getProperty(FSBackend.FS_BACKEND_PATH));
} finally {
System.clearProperty(JR2_CACHING_PROP);
}
}
Aggregations