use of org.neo4j.internal.batchimport.input.IdType in project neo4j by neo4j.
the class DataFactoriesTest method shouldParseDefaultRelationshipFileHeaderCorrectly.
@Test
public void shouldParseDefaultRelationshipFileHeaderCorrectly() throws Exception {
// GIVEN
CharSeeker seeker = seeker(":START_ID\t:END_ID\ttype:TYPE\tdate:long\tmore:long[]");
IdType idType = IdType.ACTUAL;
Extractors extractors = new Extractors('\t');
// WHEN
Header header = defaultFormatRelationshipFileHeader().create(seeker, TABS, idType, groups);
// THEN
assertArrayEquals(array(entry(null, Type.START_ID, CsvInput.idExtractor(idType, extractors)), entry(null, Type.END_ID, CsvInput.idExtractor(idType, extractors)), entry("type", Type.TYPE, extractors.string()), entry("date", Type.PROPERTY, extractors.long_()), entry("more", Type.PROPERTY, extractors.longArray())), header.entries());
seeker.close();
}
use of org.neo4j.internal.batchimport.input.IdType in project neo4j by neo4j.
the class DataFactoriesTest method shouldParseGroupName.
@Test
public void shouldParseGroupName() throws Exception {
// GIVEN
String groupOneName = "GroupOne";
String groupTwoName = "GroupTwo";
CharSeeker seeker = seeker(":START_ID(" + groupOneName + ")\t:END_ID(" + groupTwoName + ")\ttype:TYPE\tdate:long\tmore:long[]");
IdType idType = IdType.ACTUAL;
Extractors extractors = new Extractors('\t');
groups.getOrCreate(groupOneName);
groups.getOrCreate(groupTwoName);
// WHEN
Header header = defaultFormatRelationshipFileHeader().create(seeker, TABS, idType, groups);
// THEN
assertArrayEquals(array(entry(null, Type.START_ID, "GroupOne", CsvInput.idExtractor(idType, extractors)), entry(null, Type.END_ID, "GroupTwo", CsvInput.idExtractor(idType, extractors)), entry("type", Type.TYPE, extractors.string()), entry("date", Type.PROPERTY, extractors.long_()), entry("more", Type.PROPERTY, extractors.longArray())), header.entries());
seeker.close();
}
use of org.neo4j.internal.batchimport.input.IdType in project neo4j by neo4j.
the class DataFactoriesTest method shouldParsetRelationshipArrayTypesFileHeaderCorrectly.
@Test
public void shouldParsetRelationshipArrayTypesFileHeaderCorrectly() throws Exception {
// GIVEN
CharSeeker seeker = seeker(":START_ID\t:END_ID\ttype:TYPE\tlongArray:long[]\tpointArray:Point[]{crs:WGS-84}" + "\ttimeArray:time[]{timezone:+02:00}\tdateTimeArray:datetime[]{timezone:+02:00}");
IdType idType = IdType.ACTUAL;
Extractors extractors = new Extractors('\t');
// WHEN
Header header = defaultFormatRelationshipFileHeader().create(seeker, TABS, idType, groups);
// THEN
assertArrayEquals(array(entry(null, Type.START_ID, CsvInput.idExtractor(idType, extractors)), entry(null, Type.END_ID, CsvInput.idExtractor(idType, extractors)), entry("type", Type.TYPE, extractors.string()), entry("longArray", Type.PROPERTY, extractors.longArray()), entry("pointArray", Type.PROPERTY, extractors.pointArray(), PointValue.parseHeaderInformation("{crs:WGS-84}")), entry("timeArray", Type.PROPERTY, extractors.timeArray(), TimeValue.parseHeaderInformation("{timezone:+02:00}")), entry("dateTimeArray", Type.PROPERTY, extractors.dateTimeArray(), DateTimeValue.parseHeaderInformation("{timezone:+02:00}"))), header.entries());
seeker.close();
}
use of org.neo4j.internal.batchimport.input.IdType in project neo4j by neo4j.
the class DataFactoriesTest method shouldHaveEmptyHeadersBeInterpretedAsIgnored.
@Test
public void shouldHaveEmptyHeadersBeInterpretedAsIgnored() throws Exception {
// GIVEN
CharSeeker seeker = seeker("one:id\ttwo\t\tdate:long");
IdType idType = IdType.ACTUAL;
Extractors extractors = new Extractors('\t');
// WHEN
Header header = defaultFormatNodeFileHeader().create(seeker, TABS, idType, groups);
// THEN
assertArrayEquals(array(entry("one", Type.ID, extractors.long_()), entry("two", Type.PROPERTY, extractors.string()), entry(null, Type.IGNORE, null), entry("date", Type.PROPERTY, extractors.long_())), header.entries());
seeker.close();
}
use of org.neo4j.internal.batchimport.input.IdType in project neo4j by neo4j.
the class DataFactoriesTest method shouldParseNodeArrayTypesHeaderCorrectly.
@Test
public void shouldParseNodeArrayTypesHeaderCorrectly() throws Exception {
// GIVEN
CharSeeker seeker = seeker("ID:ID,longArray:long[],pointArray:Point[]{crs:WGS-84},timeArray:time[]{timezone:+02:00}," + "dateTimeArray:datetime[]{timezone:+02:00}");
IdType idType = IdType.STRING;
Extractors extractors = new Extractors(',');
// WHEN
Header header = defaultFormatNodeFileHeader().create(seeker, COMMAS, idType, groups);
// THEN
assertArrayEquals(array(entry("ID", Type.ID, CsvInput.idExtractor(idType, extractors)), entry("longArray", Type.PROPERTY, extractors.longArray()), entry("pointArray", Type.PROPERTY, extractors.pointArray(), PointValue.parseHeaderInformation("{crs:WGS-84}")), entry("timeArray", Type.PROPERTY, extractors.timeArray(), TimeValue.parseHeaderInformation("{timezone:+02:00}")), entry("dateTimeArray", Type.PROPERTY, extractors.dateTimeArray(), DateTimeValue.parseHeaderInformation("{timezone:+02:00}"))), header.entries());
seeker.close();
}
Aggregations