use of org.neo4j.csv.reader.Extractors in project neo4j by neo4j.
the class HumanUnderstandableExecutionMonitorIT method shouldReportProgressOfNodeImport.
@Test
void shouldReportProgressOfNodeImport() throws Exception {
// given
CapturingMonitor progress = new CapturingMonitor();
HumanUnderstandableExecutionMonitor monitor = new HumanUnderstandableExecutionMonitor(progress);
IdType idType = IdType.INTEGER;
Input input = new DataGeneratorInput(NODE_COUNT, RELATIONSHIP_COUNT, idType, random.seed(), 0, bareboneNodeHeader(idType, new Extractors(';')), bareboneRelationshipHeader(idType, new Extractors(';')), 1, 1, 0, 0);
Configuration configuration = new Configuration.Overridden(Configuration.DEFAULT) {
@Override
public long pageCacheMemory() {
return mebiBytes(8);
}
};
// when
try (JobScheduler jobScheduler = new ThreadPoolJobScheduler()) {
new ParallelBatchImporter(databaseLayout, fileSystem, NULL, configuration, NullLogService.getInstance(), monitor, EMPTY, defaults(), LATEST_RECORD_FORMATS, ImportLogic.NO_MONITOR, jobScheduler, Collector.EMPTY, LogFilesInitializer.NULL, IndexImporterFactory.EMPTY, EmptyMemoryTracker.INSTANCE).doImport(input);
// then
progress.assertAllProgressReachedEnd();
}
}
use of org.neo4j.csv.reader.Extractors 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.csv.reader.Extractors 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.csv.reader.Extractors 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.csv.reader.Extractors 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();
}
Aggregations