use of org.neo4j.internal.batchimport.InputIterator in project neo4j by neo4j.
the class CsvInputTest method shouldNotHaveIdSetAsPropertyIfIdHeaderEntryIsNamedForActualIds.
@Test
public void shouldNotHaveIdSetAsPropertyIfIdHeaderEntryIsNamedForActualIds() throws Exception {
// GIVEN
DataFactory data = data("myId:ID,name:string,level:int\n" + "0,Mattias,1\n" + // this node is anonymous
"1,Johan,2\n");
Iterable<DataFactory> dataIterable = dataIterable(data);
Input input = new CsvInput(dataIterable, defaultFormatNodeFileHeader(), datas(), defaultFormatRelationshipFileHeader(), ACTUAL, config(), NO_MONITOR, INSTANCE);
// WHEN
try (InputIterator nodes = input.nodes(EMPTY).iterator()) {
// THEN
assertNextNode(nodes, 0L, new Object[] { "name", "Mattias", "level", 1 }, labels());
assertNextNode(nodes, 1L, new Object[] { "name", "Johan", "level", 2 }, labels());
assertFalse(readNext(nodes));
}
}
use of org.neo4j.internal.batchimport.InputIterator in project neo4j by neo4j.
the class CsvInputTest method shouldDoWithoutRelationshipTypeHeaderIfDefaultSupplied.
@Test
public void shouldDoWithoutRelationshipTypeHeaderIfDefaultSupplied() throws Exception {
// GIVEN relationship data w/o :TYPE header
String defaultType = "HERE";
DataFactory data = data(":START_ID,:END_ID,name\n" + "0,1,First\n" + "2,3,Second\n", InputEntityDecorators.defaultRelationshipType(defaultType));
Iterable<DataFactory> dataIterable = dataIterable(data);
Input input = new CsvInput(datas(), defaultFormatNodeFileHeader(), dataIterable, defaultFormatRelationshipFileHeader(), ACTUAL, config(), NO_MONITOR, INSTANCE);
// WHEN
try (InputIterator relationships = input.relationships(EMPTY).iterator()) {
// THEN
assertNextRelationship(relationships, 0L, 1L, defaultType, properties("name", "First"));
assertNextRelationship(relationships, 2L, 3L, defaultType, properties("name", "Second"));
assertFalse(readNext(relationships));
}
}
Aggregations