Search in sources :

Example 1 with MockDruidTranquilityController

use of org.apache.nifi.controller.druid.MockDruidTranquilityController in project nifi by apache.

the class PutDruidRecordTest method setUp.

@Before
public void setUp() throws Exception {
    runner = TestRunners.newTestRunner(PutDruidRecord.class);
    druidTranquilityController = new MockDruidTranquilityController(2, 3);
    recordReader = new MockRecordParser();
    recordWriter = new MockRecordWriter(null, true, 2);
    runner.addControllerService("reader", recordReader);
    runner.enableControllerService(recordReader);
    runner.addControllerService("writer", recordWriter);
    runner.enableControllerService(recordWriter);
    runner.addControllerService("tranquility", druidTranquilityController);
    runner.setProperty(druidTranquilityController, DruidTranquilityController.DATASOURCE, "test");
    runner.setProperty(druidTranquilityController, DruidTranquilityController.ZOOKEEPER_CONNECTION_STRING, "localhost:2181");
    runner.setProperty(druidTranquilityController, DruidTranquilityController.AGGREGATOR_JSON, "[{\"type\": \"count\", \"name\": \"count\"}]");
    runner.setProperty(druidTranquilityController, DruidTranquilityController.DIMENSIONS_LIST, "dim1,dim2");
    runner.assertValid(druidTranquilityController);
    runner.enableControllerService(druidTranquilityController);
    runner.setProperty(PutDruidRecord.RECORD_READER_FACTORY, "reader");
    runner.setProperty(PutDruidRecord.RECORD_WRITER_FACTORY, "writer");
    runner.setProperty(PutDruidRecord.DRUID_TRANQUILITY_SERVICE, "tranquility");
}
Also used : MockRecordWriter(org.apache.nifi.serialization.record.MockRecordWriter) MockDruidTranquilityController(org.apache.nifi.controller.druid.MockDruidTranquilityController) MockRecordParser(org.apache.nifi.serialization.record.MockRecordParser) Before(org.junit.Before)

Aggregations

MockDruidTranquilityController (org.apache.nifi.controller.druid.MockDruidTranquilityController)1 MockRecordParser (org.apache.nifi.serialization.record.MockRecordParser)1 MockRecordWriter (org.apache.nifi.serialization.record.MockRecordWriter)1 Before (org.junit.Before)1