use of com.airhacks.enhydrator.in.Row in project enhydrator by AdamBien.
the class JDBCSinkTest method processEmptyRow.
@Test
public void processEmptyRow() {
this.cut.processRow(null);
this.cut.processRow(new Row());
}
use of com.airhacks.enhydrator.in.Row in project enhydrator by AdamBien.
the class JDBCSinkTest method getEntries.
Row getEntries() {
Row row = new Row();
row.addColumn(-1, "a", "java");
row.addColumn(-1, "b", "tengah");
return row;
}
use of com.airhacks.enhydrator.in.Row in project enhydrator by AdamBien.
the class Pump method applyRowTransformations.
static Row applyRowTransformations(List<Function<Row, Row>> trafos, Row convertedColumns) {
if (trafos == null || trafos.isEmpty()) {
return convertedColumns;
}
final Function<Row, Row> composition = trafos.stream().reduce((i, j) -> i.andThen(j)).get();
Row result = composition.apply(convertedColumns);
if (result == null) {
return null;
} else {
return result;
}
}
use of com.airhacks.enhydrator.in.Row in project enhydrator by AdamBien.
the class PumpIT method applyRowTransformationsWitDevNull.
@Test
public void applyRowTransformationsWitDevNull() {
Row input = getEntries();
List<Function<Row, Row>> funcs = new ArrayList<>();
funcs.add(l -> new Row());
Row output = Pump.applyRowTransformations(funcs, input);
assertTrue(output.isEmpty());
}
use of com.airhacks.enhydrator.in.Row in project enhydrator by AdamBien.
the class PumpTest method columnExpressionTransformer.
@Test
public void columnExpressionTransformer() {
Map<String, Object> bindings = new HashMap<>();
bindings.put("prefix", "java");
Row row = new Row();
row.addColumn(0, "developer", "duke");
VirtualSinkSource input = new VirtualSinkSource();
input.addRow(row);
VirtualSinkSource output = new VirtualSinkSource();
Pump pump = new Pump.Engine().from(input).homeScriptFolder(EXISTING_HOME_FOLDER, bindings).withColumnExpression("developer", "function execute(column){return prefix + ' ' + column}").to(output).build();
Memory memory = pump.start();
assertThat(memory.areErrorsOccured(), is(false));
Row first = output.getRow(0);
Object expected = "java duke";
Object actual = first.getColumnValue("developer");
assertThat(expected, is(actual.toString()));
}
Aggregations