use of com.airhacks.enhydrator.in.Column in project enhydrator by AdamBien.
the class ColumnCopierTest method executeWithoutMappings.
@Test
public void executeWithoutMappings() {
Row row = new Row();
row.addColumn(new Column(0, "duke", "42"));
Row withCopiedColumns = this.cut.execute(row);
assertFalse(withCopiedColumns.isEmpty());
assertThat(withCopiedColumns.getColumns().size(), is(1));
}
use of com.airhacks.enhydrator.in.Column in project enhydrator by AdamBien.
the class DestinationMapperTest method mapping.
@Test
public void mapping() {
Row input = new Row();
final int INDEX = 0;
input.addColumn(INDEX, "name", "duke");
final String expectedSink = "customSink";
final String expectedObject = "targetObject";
this.cut.addMapping(INDEX, new TargetMapping(expectedSink, expectedObject));
Row output = this.cut.execute(input);
Column column = output.getColumnByIndex(INDEX);
assertThat(column.getTargetObject(), is(expectedObject));
assertThat(column.getTargetSink(), is(expectedSink));
}
use of com.airhacks.enhydrator.in.Column in project enhydrator by AdamBien.
the class CSVFileSinkTest method getEntries.
Row getEntries() {
Row row = new Row();
Column e = new Column(5, "Column Five (empty)", null);
row.addColumn(e);
row.addColumn(2, "Column Two", "tengah");
row.addColumn(4, "Column Four", "groovy");
row.addColumn(1, "Column One", "java");
Column c = new Column(3, "Column Three (empty)", null);
row.addColumn(c);
return row;
}
use of com.airhacks.enhydrator.in.Column in project enhydrator by AdamBien.
the class ColumnCopier method copy.
Column copy(String name, Column column) {
Column clone = column.clone();
clone.setName(name);
return clone;
}
use of com.airhacks.enhydrator.in.Column in project enhydrator by AdamBien.
the class ConvertToIntAndCopyTest method scenario.
@Test
public void scenario() {
Row row = new Row();
row.addColumn(new Column(0, "question", "21"));
this.input.getRows().add(row);
Memory result = this.pump.start();
assertThat(result.getErroneousRowCount(), is(0l));
assertThat(result.getProcessedRowCount(), is(1l));
Row first = this.output.getRow(0);
assertThat(first.getColumns().size(), is(3));
Column answerColumn = first.getColumnByName("answer");
assertThat(answerColumn.getValue(), is(42));
Column originColumn = first.getColumnByName("origin");
assertThat(originColumn.getValue(), is("21"));
Column questionColumn = first.getColumnByName("question");
assertThat(questionColumn.getValue(), is("21"));
}
Aggregations