Search in sources :

Example 56 with Row

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

the class FunctionScriptLoaderTest method rowTransfomerLoadingAndExecution.

@Test
public void rowTransfomerLoadingAndExecution() throws Exception {
    Row input = new Row();
    input.addColumn(-1, "chief", "duke");
    RowTransformer function = this.cut.getRowTransformer("noop");
    assertNotNull(function);
    Row transformedEntries = function.execute(input);
    assertThat(transformedEntries, is(input));
}
Also used : Row(com.airhacks.enhydrator.in.Row) Test(org.junit.Test)

Example 57 with Row

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

the class FunctionScriptLoaderTest method nullInputIsIgnored.

@Test
public void nullInputIsIgnored() {
    RowTransformer rowTransformer = this.cut.getRowTransformer("does-not-matter");
    Row output = rowTransformer.execute(null);
    assertNull(output);
}
Also used : Row(com.airhacks.enhydrator.in.Row) Test(org.junit.Test)

Example 58 with Row

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

the class FunctionScriptLoaderTest method counterIsWorking.

@Test
public void counterIsWorking() {
    Row input = new Row();
    input.useMemory(new Memory());
    final String inputValue = "duke";
    input.addColumn(-1, "name", inputValue);
    RowTransformer function = this.cut.getRowTransformer("count");
    Row output = function.execute(input);
    assertNotNull(output);
    Memory memory = output.getMemory();
    assertNotNull(memory);
    assertThat(memory.counterValue(), is(1l));
}
Also used : Row(com.airhacks.enhydrator.in.Row) Test(org.junit.Test)

Example 59 with Row

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

the class FunctionScriptLoaderTest method propertyIsStoredInMemory.

@Test
public void propertyIsStoredInMemory() {
    Row input = new Row();
    input.useMemory(new Memory());
    final String inputValue = "duke";
    input.addColumn(-1, "name", inputValue);
    RowTransformer function = this.cut.getRowTransformer("store");
    Row output = function.execute(input);
    Memory memory = output.getMemory();
    assertThat(memory.get("from"), is("script"));
}
Also used : Row(com.airhacks.enhydrator.in.Row) Test(org.junit.Test)

Example 60 with Row

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

the class IndexMapperTest method setUp.

@Before
public void setUp() {
    row = new Row();
    row.addColumn(-1, "height", "tall");
    row.addColumn(-1, "age", "20");
    row.addColumn(-1, "name", "duke");
    row.addColumn(-1, "weight", "light-weight");
    row.addColumn(1, "resetIndexOne", "resetIndex");
    row.addColumn(2, "resetIndexTwo", "resetIndex");
}
Also used : Row(com.airhacks.enhydrator.in.Row) Before(org.junit.Before)

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