use of org.neo4j.unsafe.impl.batchimport.input.csv.Configuration in project neo4j by neo4j.
the class ImportToolTest method shouldWarnIfHeaderHasLessColumnsThanDataWhenToldTo.
@Test
public void shouldWarnIfHeaderHasLessColumnsThanDataWhenToldTo() throws Exception {
// GIVEN
List<String> nodeIds = nodeIds();
Configuration config = Configuration.TABS;
File bad = badFile();
// WHEN data file contains more columns than header file
int extraColumns = 3;
importTool("--into", dbRule.getStoreDirAbsolutePath(), "--bad", bad.getAbsolutePath(), "--bad-tolerance", Integer.toString(nodeIds.size() * extraColumns), "--ignore-extra-columns", "--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());
// THEN
String badContents = FileUtils.readTextFile(bad, Charset.defaultCharset());
assertTrue(badContents.contains("Extra column not present in header on line"));
}
use of org.neo4j.unsafe.impl.batchimport.input.csv.Configuration in project neo4j by neo4j.
the class ImportToolTest method shouldAcceptSpecialTabCharacterAsDelimiterConfiguration.
@Test
public void shouldAcceptSpecialTabCharacterAsDelimiterConfiguration() throws Exception {
// GIVEN
List<String> nodeIds = nodeIds();
Configuration config = Configuration.TABS;
// WHEN
importTool("--into", dbRule.getStoreDirAbsolutePath(), "--delimiter", "\\t", "--array-delimiter", String.valueOf(config.arrayDelimiter()), "--nodes", nodeData(true, config, nodeIds, TRUE).getAbsolutePath(), "--relationships", relationshipData(true, config, nodeIds, TRUE, true).getAbsolutePath());
// THEN
verifyData();
}
Aggregations