Search in sources :

Example 66 with Row

use of com.airhacks.enhydrator.in.Row in project enhydrator by AdamBien.

the class PojoSinkTest method notExistingField.

@Test(expected = IllegalArgumentException.class)
public void notExistingField() {
    final double expected = 1.5;
    Row row = new Row();
    row.addColumn(-1, "SHOULD-NOT-EXIST", expected);
    this.cut.processRow(row);
}
Also used : Row(com.airhacks.enhydrator.in.Row) Test(org.junit.Test)

Example 67 with Row

use of com.airhacks.enhydrator.in.Row in project enhydrator by AdamBien.

the class Pump method sink.

void sink(Sink sink, Map<String, Row> groupByDestinations) {
    String destination = sink.getName();
    if (destination == null) {
        this.flowListener.accept(sink + " has a null destination, skipping");
        return;
    }
    Row entriesForSink = groupByDestinations.get(destination);
    if (entriesForSink != null) {
        this.flowListener.accept("Processing entries " + entriesForSink + " with " + destination);
        sink.processRow(entriesForSink);
        this.flowListener.accept("Entries processed!");
    } else {
        this.flowListener.accept("No entries found for: " + destination);
    }
}
Also used : Row(com.airhacks.enhydrator.in.Row)

Example 68 with Row

use of com.airhacks.enhydrator.in.Row in project enhydrator by AdamBien.

the class Pump method transformRow.

void transformRow(Row currentRow) {
    Row entryColumns = applyRowTransformations(this.beforeTransformations, currentRow);
    this.flowListener.accept("Pre Row transformations processed");
    applyExpressions(currentRow);
    this.flowListener.accept("Row expressions processed");
    columnTransformations(entryColumns);
    this.flowListener.accept("Column transformations processed");
    Row afterProcessed = applyRowTransformations(this.afterTransformations, entryColumns);
    if (afterProcessed == null) {
        return;
    }
    this.flowListener.accept("Post Row transformations processed: " + afterProcessed.getNumberOfColumns() + " entries");
    this.sink(afterProcessed);
    this.flowListener.accept("Result processed by sinks");
}
Also used : Row(com.airhacks.enhydrator.in.Row)

Aggregations

Row (com.airhacks.enhydrator.in.Row)68 Test (org.junit.Test)54 VirtualSinkSource (com.airhacks.enhydrator.in.VirtualSinkSource)10 Column (com.airhacks.enhydrator.in.Column)8 Memory (com.airhacks.enhydrator.transform.Memory)8 ArrayList (java.util.ArrayList)5 LogSink (com.airhacks.enhydrator.out.LogSink)4 HashMap (java.util.HashMap)4 PipelineTest (com.airhacks.enhydrator.flexpipe.PipelineTest)3 CSVFileSource (com.airhacks.enhydrator.in.CSVFileSource)3 Source (com.airhacks.enhydrator.in.Source)3 SkipFirstRow (com.airhacks.enhydrator.transform.SkipFirstRow)3 List (java.util.List)3 Map (java.util.Map)3 Bindings (javax.script.Bindings)3 Pump (com.airhacks.enhydrator.Pump)2 NamedSink (com.airhacks.enhydrator.out.NamedSink)2 RowTransformer (com.airhacks.enhydrator.transform.RowTransformer)2 Date (java.util.Date)2 Function (java.util.function.Function)2