Search in sources :

Example 1 with Row

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

the class ExpressionTest method emptyList.

@Test
public void emptyList() {
    Row row = new Row();
    row.addColumn(-1, "chief", "duke");
    Row execute = this.cut.execute(row, "$EMPTY");
    assertTrue(execute.isEmpty());
}
Also used : Row(com.airhacks.enhydrator.in.Row) Test(org.junit.Test)

Example 2 with Row

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

the class ExpressionTest method accessToColumn.

@Test
public void accessToColumn() {
    Row row = new Row();
    final String inputValue = "duke";
    row.addColumn(-1, "chief", inputValue);
    Row result = this.cut.execute(row, "$EMPTY.addColumn(-1,'new_duke',chief.value + '_modified');$EMPTY;");
    Column column = result.getColumnByName("new_duke");
    assertNotNull(column);
    Object value = column.getValue();
    assertNotNull(value);
    assertThat(value, is(inputValue + "_modified"));
}
Also used : Column(com.airhacks.enhydrator.in.Column) Row(com.airhacks.enhydrator.in.Row) Test(org.junit.Test)

Example 3 with Row

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

the class ExpressionTest method bindingsAreWorking.

@Test
public void bindingsAreWorking() {
    String expression = "print($ROW); print($ROW.numberOfColumns);$ROW";
    Row row = new Row();
    row.addColumn(-1, "chief", "duke");
    row.addColumn(-1, "master", "juggy");
    Row execute = this.cut.execute(row, expression);
    assertFalse(execute.isEmpty());
}
Also used : Row(com.airhacks.enhydrator.in.Row) Test(org.junit.Test)

Example 4 with Row

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

the class FilterExpressionTest method drop.

@Test
public void drop() {
    Boolean result = this.fe.execute(new Row(), "false");
    assertFalse(result);
}
Also used : Row(com.airhacks.enhydrator.in.Row) Test(org.junit.Test)

Example 5 with Row

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

the class FilterExpressionTest method accept.

@Test
public void accept() {
    Boolean result = this.fe.execute(new Row(), "true");
    assertTrue(result);
}
Also used : Row(com.airhacks.enhydrator.in.Row) 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