use of org.exist.util.FileUtils in project exist by eXist-db.
the class JournalTest method getFiles.
@Test
public void getFiles() throws IOException {
List<String> input = Arrays.asList(new String[] { "0000000001.log" });
Path mockJournalDir = createTempDirWithFiles(input);
List<String> actual = Journal.getFiles(mockJournalDir).map(FileUtils::fileName).collect(Collectors.toList());
assertEquals(input, actual);
input = Arrays.asList(new String[] { "0000000001.log", "0000000002.log", "000000000a.log" });
mockJournalDir = createTempDirWithFiles(input);
actual = Journal.getFiles(mockJournalDir).map(FileUtils::fileName).collect(Collectors.toList());
Collections.sort(input);
Collections.sort(actual);
assertEquals(input, actual);
input = Arrays.asList(new String[] { "0000000001.log", "0000000001.log" + Journal.BAK_FILE_SUFFIX, "0000000001_index.log", "journal.lck" });
mockJournalDir = createTempDirWithFiles(input);
actual = Journal.getFiles(mockJournalDir).map(FileUtils::fileName).collect(Collectors.toList());
assertEquals(Arrays.asList(new String[] { "0000000001.log" }), actual);
}
use of org.exist.util.FileUtils in project exist by eXist-db.
the class LuceneIndex method remove.
@Override
public void remove() throws DBException {
close();
Path dir = getDataDir().resolve(getDirName());
try (Stream<Path> stream = Files.list(dir)) {
stream.forEach(FileUtils::deleteQuietly);
} catch (Exception e) {
// never abort at this point, so recovery can continue
LOG.warn(e.getMessage(), e);
}
}
Aggregations