Search in sources :

Example 6 with Column

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));
}
Also used : Column(com.airhacks.enhydrator.in.Column) Row(com.airhacks.enhydrator.in.Row) Test(org.junit.Test)

Example 7 with Column

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));
}
Also used : Column(com.airhacks.enhydrator.in.Column) Row(com.airhacks.enhydrator.in.Row) Test(org.junit.Test)

Example 8 with Column

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;
}
Also used : Column(com.airhacks.enhydrator.in.Column) Row(com.airhacks.enhydrator.in.Row)

Example 9 with Column

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;
}
Also used : Column(com.airhacks.enhydrator.in.Column)

Example 10 with Column

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"));
}
Also used : Column(com.airhacks.enhydrator.in.Column) Memory(com.airhacks.enhydrator.transform.Memory) Row(com.airhacks.enhydrator.in.Row) Test(org.junit.Test)

Aggregations

Column (com.airhacks.enhydrator.in.Column)10 Row (com.airhacks.enhydrator.in.Row)9 Test (org.junit.Test)8 Memory (com.airhacks.enhydrator.transform.Memory)2 Pump (com.airhacks.enhydrator.Pump)1 VirtualSinkSource (com.airhacks.enhydrator.in.VirtualSinkSource)1 LogSink (com.airhacks.enhydrator.out.LogSink)1 ColumnCopier (com.airhacks.enhydrator.transform.ColumnCopier)1 Datatype (com.airhacks.enhydrator.transform.Datatype)1 DatatypeNameMapper (com.airhacks.enhydrator.transform.DatatypeNameMapper)1 CoreMatchers.is (org.hamcrest.CoreMatchers.is)1 Assert.assertThat (org.junit.Assert.assertThat)1 Before (org.junit.Before)1