Search in sources :

Example 1 with MergeHiveTableMetadata

use of com.thinkbiganalytics.nifi.v2.elasticsearch.MergeHiveTableMetadata in project kylo by Teradata.

the class MergeHiveTableMetadataTest method runProcessor.

private void runProcessor(InputStream testDocument) {
    TestRunner nifiTestRunner = TestRunners.newTestRunner(new MergeHiveTableMetadata());
    nifiTestRunner.setValidateExpressionUsage(true);
    nifiTestRunner.setProperty(MergeHiveTableMetadata.DATABASE_NAME, "NAME");
    nifiTestRunner.setProperty(MergeHiveTableMetadata.DATABASE_OWNER, "OWNER_NAME");
    nifiTestRunner.setProperty(MergeHiveTableMetadata.TABLE_CREATE_TIME, "CREATE_TIME");
    nifiTestRunner.setProperty(MergeHiveTableMetadata.TABLE_NAME, "TBL_NAME");
    nifiTestRunner.setProperty(MergeHiveTableMetadata.TABLE_TYPE, "TBL_TYPE");
    nifiTestRunner.setProperty(MergeHiveTableMetadata.COLUMN_NAME, "COLUMN_NAME");
    nifiTestRunner.setProperty(MergeHiveTableMetadata.COLUMN_TYPE, "TYPE_NAME");
    nifiTestRunner.assertValid();
    nifiTestRunner.enqueue(testDocument, new HashMap<String, String>() {

        {
            put("doc_id", "8736522777");
        }
    });
    nifiTestRunner.run(1, true, true);
    nifiTestRunner.assertAllFlowFilesTransferred(IndexElasticSearch.REL_SUCCESS, 1);
    final MockFlowFile out = nifiTestRunner.getFlowFilesForRelationship(IndexElasticSearch.REL_SUCCESS).get(0);
    String outgoingJson = new String(out.toByteArray());
    assertNotNull(out);
    out.assertAttributeEquals("doc_id", "8736522777");
}
Also used : MockFlowFile(org.apache.nifi.util.MockFlowFile) TestRunner(org.apache.nifi.util.TestRunner) MergeHiveTableMetadata(com.thinkbiganalytics.nifi.v2.elasticsearch.MergeHiveTableMetadata)

Aggregations

MergeHiveTableMetadata (com.thinkbiganalytics.nifi.v2.elasticsearch.MergeHiveTableMetadata)1 MockFlowFile (org.apache.nifi.util.MockFlowFile)1 TestRunner (org.apache.nifi.util.TestRunner)1