Search in sources :

Example 1 with TableInfo

use of org.apache.apex.malhar.lib.util.TableInfo in project apex-malhar by apache.

the class MemcachePOJOOperatorTest method testMemcacheOutputOperatorInternal.

@SuppressWarnings("unchecked")
@Test
public void testMemcacheOutputOperatorInternal() throws Exception {
    MemcachePOJOOutputOperator operator = new MemcachePOJOOutputOperator();
    operator.setStore(store);
    TableInfo tableInfo = new TableInfo();
    tableInfo.setRowOrIdExpression(TestPOJO.getRowExpression());
    tableInfo.setFieldsInfo(TestPOJO.getFieldsInfo());
    tableInfo.setRowOrIdExpression(TestPOJO.getRowExpression());
    operator.setTableInfo(tableInfo);
    operator.setup(null);
    TupleGenerator<TestPOJO> generator = new TupleGenerator<TestPOJO>(TestPOJO.class);
    for (int i = 0; i < TUPLE_SIZE; ++i) {
        operator.processTuple(generator.getNextTuple());
    }
    readDataAndVerify(operator.getStore(), generator);
}
Also used : TupleGenerator(org.apache.apex.malhar.contrib.util.TupleGenerator) TableInfo(org.apache.apex.malhar.lib.util.TableInfo) TestPOJO(org.apache.apex.malhar.contrib.util.TestPOJO) Test(org.junit.Test)

Example 2 with TableInfo

use of org.apache.apex.malhar.lib.util.TableInfo in project apex-malhar by apache.

the class GeodePOJOOperatorTest method testGeodeOutputOperatorInternal.

@SuppressWarnings("unchecked")
@Test
public void testGeodeOutputOperatorInternal() throws Exception {
    GeodePOJOOutputOperator operator = new GeodePOJOOutputOperator();
    operator.setStore(store);
    TableInfo tableInfo = new TableInfo();
    tableInfo.setRowOrIdExpression(TestPOJO.getRowExpression());
    tableInfo.setFieldsInfo(TestPOJO.getFieldsInfo());
    tableInfo.setRowOrIdExpression(TestPOJO.getRowExpression());
    operator.setTableInfo(tableInfo);
    operator.setup(null);
    TupleGenerator<TestPOJO> generator = new TupleGenerator<TestPOJO>(TestPOJO.class);
    for (int i = 0; i < TUPLE_SIZE; ++i) {
        operator.processTuple(generator.getNextTuple());
    }
    generator.reset();
    for (int i = 0; i < TUPLE_SIZE; ++i) {
        operator.processTuple(generator.getNextTuple());
    }
// readDataAndVerify(operator.getStore(), generator);
}
Also used : TupleGenerator(org.apache.apex.malhar.contrib.util.TupleGenerator) TableInfo(org.apache.apex.malhar.lib.util.TableInfo) TestPOJO(org.apache.apex.malhar.contrib.util.TestPOJO) Test(org.junit.Test)

Example 3 with TableInfo

use of org.apache.apex.malhar.lib.util.TableInfo in project apex-malhar by apache.

the class HBasePOJOInputOperatorTest method setupOperators.

protected void setupOperators() {
    TableInfo<HBaseFieldInfo> tableInfo = new TableInfo<HBaseFieldInfo>();
    tableInfo.setRowOrIdExpression("row");
    List<HBaseFieldInfo> fieldsInfo = new ArrayList<HBaseFieldInfo>();
    fieldsInfo.add(new HBaseFieldInfo("name", "name", SupportType.STRING, "f0"));
    fieldsInfo.add(new HBaseFieldInfo("age", "age", SupportType.INTEGER, "f1"));
    fieldsInfo.add(new HBaseFieldInfo("address", "address", SupportType.STRING, "f1"));
    tableInfo.setFieldsInfo(fieldsInfo);
    hbaseInputOperator.setTableInfo(tableInfo);
    hbaseOutputOperator.setTableInfo(tableInfo);
    store = new HBaseStore();
    store.setTableName("test");
    store.setZookeeperQuorum("localhost");
    store.setZookeeperClientPort(2181);
    hbaseInputOperator.setStore(store);
    hbaseOutputOperator.setStore(store);
    OperatorContext context = mockOperatorContext(OPERATOR_ID, new AttributeMap.DefaultAttributeMap());
    hbaseInputOperator.setup(context);
    hbaseOutputOperator.setup(context);
}
Also used : AttributeMap(com.datatorrent.api.Attribute.AttributeMap) OperatorContextTestHelper.mockOperatorContext(org.apache.apex.malhar.lib.helper.OperatorContextTestHelper.mockOperatorContext) OperatorContext(com.datatorrent.api.Context.OperatorContext) ArrayList(java.util.ArrayList) TableInfo(org.apache.apex.malhar.lib.util.TableInfo)

Aggregations

TableInfo (org.apache.apex.malhar.lib.util.TableInfo)3 TestPOJO (org.apache.apex.malhar.contrib.util.TestPOJO)2 TupleGenerator (org.apache.apex.malhar.contrib.util.TupleGenerator)2 Test (org.junit.Test)2 AttributeMap (com.datatorrent.api.Attribute.AttributeMap)1 OperatorContext (com.datatorrent.api.Context.OperatorContext)1 ArrayList (java.util.ArrayList)1 OperatorContextTestHelper.mockOperatorContext (org.apache.apex.malhar.lib.helper.OperatorContextTestHelper.mockOperatorContext)1