use of com.apple.foundationdb.record.lucene.directory.FDBDirectory in project fdb-record-layer by FoundationDB.
the class LuceneIndexTest method assertEntriesAndSegmentInfoStoredInCompoundFile.
private static void assertEntriesAndSegmentInfoStoredInCompoundFile(@Nonnull Subspace subspace, @Nonnull FDBRecordContext context, @Nonnull String segment, boolean cleanFiles) {
try (final FDBDirectory directory = new FDBDirectory(subspace, context)) {
final FDBLuceneFileReference reference = directory.getFDBLuceneFileReference(segment).join();
Assertions.assertNotNull(reference);
Assertions.assertTrue(reference.getEntries().length > 0);
Assertions.assertTrue(reference.getSegmentInfo().length > 0);
assertOnlyCompoundFileExisting(subspace, context, directory, cleanFiles);
}
}
use of com.apple.foundationdb.record.lucene.directory.FDBDirectory in project fdb-record-layer by FoundationDB.
the class LuceneIndexTest method assertOnlyCompoundFileExisting.
private static void assertOnlyCompoundFileExisting(@Nonnull Subspace subspace, @Nonnull FDBRecordContext context, @Nullable FDBDirectory fdbDirectory, boolean cleanFiles) {
final FDBDirectory directory = fdbDirectory == null ? new FDBDirectory(subspace, context) : fdbDirectory;
String[] allFiles = directory.listAll();
for (String file : allFiles) {
Assertions.assertTrue(FDBDirectory.isCompoundFile(file) || file.startsWith(IndexFileNames.SEGMENTS));
if (cleanFiles) {
try {
directory.deleteFile(file);
} catch (IOException ex) {
Assertions.fail("Failed to clean file: " + file);
}
}
}
}
Aggregations