public DataStore getDataStore() throws RepositoryException { FileDataStore datastore=new FileDataStore(); datastore.setPath(""+repoHomeDir+"/repository/datastore"); datastore.setMinRecordLength(100); return null; } };
private DataStoreBlobStore createDataStore() { FileDataStore fds = new OakFileDataStore(); fds.setPath(dir.getAbsolutePath()); fds.setMinRecordLength(maxInlineSize); fds.init(null); return new DataStoreBlobStore(fds); }
private DataStoreBlobStore createDataStore() { FileDataStore fds = new OakFileDataStore(); fds.setPath(dir.getAbsolutePath()); fds.setMinRecordLength(maxInlineSize); fds.init(null); return new DataStoreBlobStore(fds); }
private DataStoreBlobStore createDataStore() { FileDataStore fds = new OakFileDataStore(); fds.setPath(dir.getAbsolutePath()); fds.setMinRecordLength(maxInlineSize); fds.init(null); return new DataStoreBlobStore(fds); }
@Override protected DataStore createDataStore() throws RepositoryException { FileDataStore fds = new FileDataStore(); Properties props = loadProperties("/fs.properties"); String pathValue = props.getProperty(FSBackend.FS_BACKEND_PATH); if (pathValue != null && !"".equals(pathValue.trim())) { fsPath = pathValue + "/fds" + "-" + String.valueOf(randomGen.nextInt(100000)) + "-" + String.valueOf(randomGen.nextInt(100000)); } else { fsPath = dataStoreDir + "/repository/datastore"; } LOG.info("path [{}] set.", fsPath); fds.setPath(fsPath); fds.init(dataStoreDir); return fds; }
private void testGetAllIdentifiers(String path, String unnormalizedPath) throws Exception { File testDir = new File(path); FileUtils.touch(new File(testDir, "ab/cd/ef/abcdef")); FileUtils.touch(new File(testDir, "bc/de/fg/bcdefg")); FileUtils.touch(new File(testDir, "cd/ef/gh/cdefgh")); FileUtils.touch(new File(testDir, "c")); FileDataStore fds = new OakFileDataStore(); fds.setPath(unnormalizedPath); fds.init(null); Iterator<DataIdentifier> dis = fds.getAllIdentifiers(); Set<String> fileNames = Sets.newHashSet(Iterators.transform(dis, new Function<DataIdentifier, String>() { @Override public String apply(@Nullable DataIdentifier input) { return input.toString(); } })); Set<String> expectedNames = Sets.newHashSet("abcdef","bcdefg","cdefgh"); assertEquals(expectedNames, fileNames); FileUtils.cleanDirectory(testDir); }
private void testGetAllIdentifiers(String path, String unnormalizedPath) throws Exception { File testDir = new File(path); FileUtils.touch(new File(testDir, "ab/cd/ef/abcdef")); FileUtils.touch(new File(testDir, "bc/de/fg/bcdefg")); FileUtils.touch(new File(testDir, "cd/ef/gh/cdefgh")); FileUtils.touch(new File(testDir, "c")); FileDataStore fds = new OakFileDataStore(); fds.setPath(unnormalizedPath); fds.init(null); Iterator<DataIdentifier> dis = fds.getAllIdentifiers(); Set<String> fileNames = Sets.newHashSet(Iterators.transform(dis, new Function<DataIdentifier, String>() { @Override public String apply(@Nullable DataIdentifier input) { return input.toString(); } })); Set<String> expectedNames = Sets.newHashSet("abcdef","bcdefg","cdefgh"); assertEquals(expectedNames, fileNames); FileUtils.cleanDirectory(testDir); }
public void testFile() throws Exception { FileDataStore store = new FileDataStore(); store.setPath(TEST_DIR + "/fs"); store.init(TEST_DIR + "/fs"); store.setMinRecordLength(0); doTest(store); }
@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); } }
} else if (bsType == Type.FAKE) { FileDataStore fakeDs = new DummyDataStore(); fakeDs.setPath(bsopts.getFakeDataStorePath()); fakeDs.init(null); delegate = fakeDs; delegate = fds; if (bsopts.getFDSPath() != null) { fds.setPath(bsopts.getFDSPath()); } else { String cfgPath = bsopts.getFDSConfigPath();
} else if (bsType == Type.FAKE) { FileDataStore fakeDs = new DummyDataStore(); fakeDs.setPath(bsopts.getFakeDataStorePath()); fakeDs.init(null); delegate = fakeDs; delegate = fds; if (bsopts.getFDSPath() != null) { fds.setPath(bsopts.getFDSPath()); } else { String cfgPath = bsopts.getFDSConfigPath();
private BlobStore createBlobStore() { FileDataStore fds = new OakFileDataStore(); fdsDir = "target/fds-" + codec + copyOnRW + minRecordLength + mergePolicy; fds.setPath(fdsDir); if (minRecordLength > 0) { fds.setMinRecordLength(minRecordLength); } fds.init(null); dataStoreBlobStore = new DataStoreBlobStore(fds); StatisticsProvider sp = new DefaultStatisticsProvider(scheduledExecutorService); BlobStatsCollector collector = new BlobStoreStats(sp); dataStoreBlobStore.setBlobStatsCollector(collector); return dataStoreBlobStore; }