Search in sources :

Example 21 with Row

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

the class JDBCSinkTest method emptyValueList.

@Test
public void emptyValueList() {
    String columns = JDBCSink.valueList(new Row());
    assertNull(columns);
}
Also used : Row(com.airhacks.enhydrator.in.Row) Test(org.junit.Test)

Example 22 with Row

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

the class JDBCSinkTest method generateInsertStatement.

@Test
public void generateInsertStatement() {
    String expected = "INSERT INTO TARGET_TABLE (a,b) VALUES ('java','tengah')";
    Row row = getEntries();
    String actual = this.cut.generateInsertStatement(row);
    assertThat(actual, is(expected));
}
Also used : Row(com.airhacks.enhydrator.in.Row) Test(org.junit.Test)

Example 23 with Row

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

the class PojoSinkTest method stringMapping.

@Test
public void stringMapping() {
    final String expected = "duke";
    Row row = new Row();
    row.addColumn(-1, "name", expected);
    this.cut.processRow(row);
    Developer dev = getDeveloper();
    String actual = dev.getName();
    assertThat(actual, is(expected));
}
Also used : Row(com.airhacks.enhydrator.in.Row) Test(org.junit.Test)

Example 24 with Row

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

the class PojoSinkTest method intMapping.

@Test
public void intMapping() {
    final int expected = 42;
    Row row = new Row();
    row.addColumn(-1, "age", expected);
    this.cut.processRow(row);
    Developer dev = getDeveloper();
    int actual = dev.getAge();
    assertThat(actual, is(expected));
}
Also used : Row(com.airhacks.enhydrator.in.Row) Test(org.junit.Test)

Example 25 with Row

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

the class PojoSinkTest method notExistingFieldWithDevNull.

@Test
public void notExistingFieldWithDevNull() {
    Consumer<Map<String, Object>> devNull = Mockito.mock(Consumer.class);
    PojoSink pojoSink = new PojoSink(Developer.class, this.cachingConsumer, devNull);
    final double expected = 1.5;
    Row row = new Row();
    row.addColumn(-1, "SHOULD-NOT-EXIST", expected);
    pojoSink.processRow(row);
    verify(devNull).accept(Matchers.anyObject());
}
Also used : Row(com.airhacks.enhydrator.in.Row) Map(java.util.Map) Test(org.junit.Test)

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