Search in sources :

Example 31 with Input

use of org.neo4j.unsafe.impl.batchimport.input.Input in project neo4j by neo4j.

the class CsvInputTest method shouldPropagateExceptionFromFailingDecorator.

@Test
public void shouldPropagateExceptionFromFailingDecorator() throws Exception {
    // GIVEN
    RuntimeException failure = new RuntimeException("FAILURE");
    Iterable<DataFactory<InputNode>> data = DataFactories.nodeData(CsvInputTest.<InputNode>data(":ID,name\n1,Mattias", new FailingNodeDecorator(failure)));
    Input input = new CsvInput(data, defaultFormatNodeFileHeader(), null, null, IdType.INTEGER, config(COMMAS), silentBadCollector(0), getRuntime().availableProcessors());
    // WHEN
    try (InputIterator<InputNode> nodes = input.nodes().iterator()) {
        nodes.next();
    } catch (RuntimeException e) {
        // THEN
        assertTrue(e == failure);
    }
}
Also used : InputNode(org.neo4j.unsafe.impl.batchimport.input.InputNode) Input(org.neo4j.unsafe.impl.batchimport.input.Input) Test(org.junit.Test)

Aggregations

Input (org.neo4j.unsafe.impl.batchimport.input.Input)31 Test (org.junit.Test)30 InputNode (org.neo4j.unsafe.impl.batchimport.input.InputNode)21 InputRelationship (org.neo4j.unsafe.impl.batchimport.input.InputRelationship)9 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)6 Matchers.anyString (org.mockito.Matchers.anyString)6 InputException (org.neo4j.unsafe.impl.batchimport.input.InputException)4 Collector (org.neo4j.unsafe.impl.batchimport.input.Collector)3 BadCollector (org.neo4j.unsafe.impl.batchimport.input.BadCollector)2 Group (org.neo4j.unsafe.impl.batchimport.input.Group)2 Groups (org.neo4j.unsafe.impl.batchimport.input.Groups)2 CsvInput (org.neo4j.unsafe.impl.batchimport.input.csv.CsvInput)2 BufferedOutputStream (java.io.BufferedOutputStream)1 File (java.io.File)1 IOException (java.io.IOException)1 OutputStream (java.io.OutputStream)1 PrintStream (java.io.PrintStream)1 Charset (java.nio.charset.Charset)1 Charset.defaultCharset (java.nio.charset.Charset.defaultCharset)1 CharReadable (org.neo4j.csv.reader.CharReadable)1