use of org.neo4j.collection.RawIterator in project neo4j by neo4j.
the class CsvInputTest method shouldReportDuplicateNodeSourceFiles.
@Test
public void shouldReportDuplicateNodeSourceFiles() {
// given
String sourceDescription = "The single data source";
Supplier<CharReadable> source = () -> wrap(dataWithSourceDescription(":ID", sourceDescription), 3);
Iterable<DataFactory> data = datas(config -> new Data() {
@Override
public RawIterator<CharReadable, IOException> stream() {
// Contains two of the same file
return asRawIterator(iterator(source.get(), source.get()));
}
@Override
public Decorator decorator() {
return NO_DECORATOR;
}
});
CsvInput.Monitor monitor = mock(CsvInput.Monitor.class);
// when
new CsvInput(data, defaultFormatNodeFileHeader(), datas(), defaultFormatRelationshipFileHeader(), IdType.INTEGER, COMMAS, monitor, INSTANCE);
// then
verify(monitor).duplicateSourceFile(sourceDescription);
}
use of org.neo4j.collection.RawIterator in project neo4j by neo4j.
the class CsvInputTest method shouldReportNoNodeLabels.
@Test
public void shouldReportNoNodeLabels() {
// given
String sourceDescription = "source";
Supplier<CharReadable> headerSource = () -> wrap(dataWithSourceDescription(":ID", sourceDescription), 3);
Iterable<DataFactory> data = datas(config -> new Data() {
@Override
public RawIterator<CharReadable, IOException> stream() {
return asRawIterator(iterator(headerSource.get()));
}
@Override
public Decorator decorator() {
return NO_DECORATOR;
}
});
CsvInput.Monitor monitor = mock(CsvInput.Monitor.class);
// when
new CsvInput(data, defaultFormatNodeFileHeader(), datas(), defaultFormatRelationshipFileHeader(), IdType.INTEGER, COMMAS, monitor, INSTANCE);
// then
verify(monitor).noNodeLabelsSpecified(sourceDescription);
}
use of org.neo4j.collection.RawIterator in project neo4j by neo4j.
the class CsvInputTest method shouldReportDuplicateRelationshipSourceFiles.
@Test
public void shouldReportDuplicateRelationshipSourceFiles() {
// given
String sourceDescription = "The single data source";
Supplier<CharReadable> source = () -> wrap(dataWithSourceDescription(":START_ID,:END_ID,:TYPE", sourceDescription), 3);
Iterable<DataFactory> data = datas(config -> new Data() {
@Override
public RawIterator<CharReadable, IOException> stream() {
// Contains two of the same file
return asRawIterator(iterator(source.get(), source.get()));
}
@Override
public Decorator decorator() {
return NO_DECORATOR;
}
});
CsvInput.Monitor monitor = mock(CsvInput.Monitor.class);
// when
new CsvInput(datas(), defaultFormatNodeFileHeader(), data, defaultFormatRelationshipFileHeader(), IdType.INTEGER, COMMAS, monitor, INSTANCE);
// then
verify(monitor).duplicateSourceFile(sourceDescription);
}
Aggregations