use of org.neo4j.internal.batchimport.input.csv.DataFactory in project neo4j by neo4j.
the class ImportPanicIT method shouldExitAndThrowExceptionOnPanic.
/**
* There was this problem where some steps and in particular parallel CSV input parsing that
* paniced would hang the import entirely.
*/
@Test
void shouldExitAndThrowExceptionOnPanic() throws Exception {
try (JobScheduler jobScheduler = new ThreadPoolJobScheduler()) {
BatchImporter importer = new ParallelBatchImporter(databaseLayout, testDirectory.getFileSystem(), PageCacheTracer.NULL, Configuration.DEFAULT, NullLogService.getInstance(), ExecutionMonitor.INVISIBLE, AdditionalInitialIds.EMPTY, Config.defaults(), StandardV3_4.RECORD_FORMATS, ImportLogic.NO_MONITOR, jobScheduler, Collector.EMPTY, LogFilesInitializer.NULL, IndexImporterFactory.EMPTY, EmptyMemoryTracker.INSTANCE);
Iterable<DataFactory> nodeData = DataFactories.datas(DataFactories.data(InputEntityDecorators.NO_DECORATOR, fileAsCharReadable(nodeCsvFileWithBrokenEntries())));
Input brokenCsvInput = new CsvInput(nodeData, DataFactories.defaultFormatNodeFileHeader(), DataFactories.datas(), DataFactories.defaultFormatRelationshipFileHeader(), IdType.ACTUAL, csvConfigurationWithLowBufferSize(), CsvInput.NO_MONITOR, INSTANCE);
var e = assertThrows(InputException.class, () -> importer.doImport(brokenCsvInput));
assertTrue(e.getCause() instanceof DataAfterQuoteException);
}
}
Aggregations