use of org.neo4j.unsafe.impl.batchimport.input.InputException in project neo4j by neo4j.
the class ParallelInputEntityDeserializer method close.
@Override
public void close() {
processing.close();
try {
decorator.close();
source.close();
} catch (IOException e) {
throw new InputException("Couldn't close source of data chunks", e);
} finally {
super.close();
}
}
use of org.neo4j.unsafe.impl.batchimport.input.InputException in project neo4j by neo4j.
the class ImportToolTest method shouldFailIfHeaderHasLessColumnsThanData.
@Test
public void shouldFailIfHeaderHasLessColumnsThanData() throws Exception {
// GIVEN
List<String> nodeIds = nodeIds();
Configuration config = Configuration.TABS;
// WHEN data file contains more columns than header file
int extraColumns = 3;
try {
importTool("--into", dbRule.getStoreDirAbsolutePath(), "--delimiter", "TAB", "--array-delimiter", String.valueOf(config.arrayDelimiter()), "--nodes", nodeHeader(config).getAbsolutePath() + MULTI_FILE_DELIMITER + nodeData(false, config, nodeIds, TRUE, Charset.defaultCharset(), extraColumns).getAbsolutePath(), "--relationships", relationshipHeader(config).getAbsolutePath() + MULTI_FILE_DELIMITER + relationshipData(false, config, nodeIds, TRUE, true).getAbsolutePath());
fail("Should have thrown exception");
} catch (InputException e) {
// THEN
assertFalse(suppressOutput.getErrorVoice().containsMessage(e.getClass().getName()));
assertTrue(e.getMessage().contains("Extra column not present in header on line"));
}
}
use of org.neo4j.unsafe.impl.batchimport.input.InputException in project neo4j by neo4j.
the class DataFactoriesTest method shouldFailOnUnexpectedNodeHeaderType.
@Test
public void shouldFailOnUnexpectedNodeHeaderType() throws Exception {
// GIVEN
CharSeeker seeker = seeker(":ID,:START_ID");
IdType idType = IdType.ACTUAL;
// WHEN
try {
Header header = DataFactories.defaultFormatNodeFileHeader().create(seeker, COMMAS, idType);
fail("Should have failed");
} catch (InputException e) {
// THEN
assertThat(e.getMessage(), containsString("START_ID"));
}
}
Aggregations