Search in sources :

Example 6 with LogMessage

use of org.apache.nifi.util.LogMessage in project kylo by Teradata.

the class TdchUtilsTest method testGetExportHiveToTeradataInputRecordsCount_InvalidRecordCountLong.

@Test
public void testGetExportHiveToTeradataInputRecordsCount_InvalidRecordCountLong() {
    TestRunner runner = TestRunners.newTestRunner(TestAbstractTdchProcessor.class);
    MockComponentLog componentLog = runner.getLogger();
    TdchUtils tdchUtils = new TdchUtils();
    long count = tdchUtils.getExportHiveToTeradataInputRecordsCount(getTdchProcessResultWithInvalidInputRecordCountLongLineInfo(), componentLog);
    Assert.assertEquals(-1, count);
    List<LogMessage> warnMessages = componentLog.getWarnMessages();
    Assert.assertEquals(1, warnMessages.size());
    Assert.assertTrue(warnMessages.get(0).getMsg().contains("Unable to parse number of input records processed"));
}
Also used : TdchUtils(com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.processor.export.utils.TdchUtils) LogMessage(org.apache.nifi.util.LogMessage) TestRunner(org.apache.nifi.util.TestRunner) MockComponentLog(org.apache.nifi.util.MockComponentLog) Test(org.junit.Test)

Example 7 with LogMessage

use of org.apache.nifi.util.LogMessage in project kylo by Teradata.

the class TdchUtilsTest method testGetExportHiveToTeradataInputRecordsCount_EmptyRecordCount.

@Test
public void testGetExportHiveToTeradataInputRecordsCount_EmptyRecordCount() {
    TestRunner runner = TestRunners.newTestRunner(TestAbstractTdchProcessor.class);
    MockComponentLog componentLog = runner.getLogger();
    TdchUtils tdchUtils = new TdchUtils();
    long count = tdchUtils.getExportHiveToTeradataInputRecordsCount(getTdchProcessResultWithEmptyInputRecordCountInfo(), componentLog);
    Assert.assertEquals(-1, count);
    List<LogMessage> warnMessages = componentLog.getWarnMessages();
    Assert.assertEquals(1, warnMessages.size());
    Assert.assertTrue(warnMessages.get(0).getMsg().endsWith("Skipping attempt to retrieve number of input records"));
}
Also used : TdchUtils(com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.processor.export.utils.TdchUtils) LogMessage(org.apache.nifi.util.LogMessage) TestRunner(org.apache.nifi.util.TestRunner) MockComponentLog(org.apache.nifi.util.MockComponentLog) Test(org.junit.Test)

Example 8 with LogMessage

use of org.apache.nifi.util.LogMessage in project kylo by Teradata.

the class TdchUtilsTest method testGetExportHiveToTeradataOutputRecordsCount_EmptyRecordCount.

@Test
public void testGetExportHiveToTeradataOutputRecordsCount_EmptyRecordCount() {
    TestRunner runner = TestRunners.newTestRunner(TestAbstractTdchProcessor.class);
    MockComponentLog componentLog = runner.getLogger();
    TdchUtils tdchUtils = new TdchUtils();
    long count = tdchUtils.getExportHiveToTeradataOutputRecordsCount(getTdchProcessResultWithEmptyOutputRecordCountInfo(), componentLog);
    Assert.assertEquals(-1, count);
    List<LogMessage> warnMessages = componentLog.getWarnMessages();
    Assert.assertEquals(1, warnMessages.size());
    Assert.assertTrue(warnMessages.get(0).getMsg().endsWith("Skipping attempt to retrieve number of output records"));
}
Also used : TdchUtils(com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.processor.export.utils.TdchUtils) LogMessage(org.apache.nifi.util.LogMessage) TestRunner(org.apache.nifi.util.TestRunner) MockComponentLog(org.apache.nifi.util.MockComponentLog) Test(org.junit.Test)

Example 9 with LogMessage

use of org.apache.nifi.util.LogMessage in project kylo by Teradata.

the class TdchUtilsTest method testGetExportHiveToTeradataJobTimeTaken_ValidTimeAndSuccessExitCode.

@Test
public void testGetExportHiveToTeradataJobTimeTaken_ValidTimeAndSuccessExitCode() {
    TestRunner runner = TestRunners.newTestRunner(TestAbstractTdchProcessor.class);
    MockComponentLog componentLog = runner.getLogger();
    TdchUtils tdchUtils = new TdchUtils();
    String timeTaken = tdchUtils.getExportHiveToTeradataJobTimeTaken(getTdchProcessResultWithTimeTakenAndSuccessExitCode(), componentLog);
    Assert.assertEquals("33s", timeTaken);
    List<LogMessage> warnMessages = componentLog.getWarnMessages();
    Assert.assertEquals(0, warnMessages.size());
}
Also used : TdchUtils(com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.processor.export.utils.TdchUtils) LogMessage(org.apache.nifi.util.LogMessage) TestRunner(org.apache.nifi.util.TestRunner) MockComponentLog(org.apache.nifi.util.MockComponentLog) Test(org.junit.Test)

Example 10 with LogMessage

use of org.apache.nifi.util.LogMessage in project kylo by Teradata.

the class TdchUtilsTest method testGetExportHiveToTeradataInputRecordsCount_NoRecordCount.

@Test
public void testGetExportHiveToTeradataInputRecordsCount_NoRecordCount() {
    TestRunner runner = TestRunners.newTestRunner(TestAbstractTdchProcessor.class);
    MockComponentLog componentLog = runner.getLogger();
    TdchUtils tdchUtils = new TdchUtils();
    long count = tdchUtils.getExportHiveToTeradataInputRecordsCount(getTdchProcessResultWithNoInputRecordCountInfo(), componentLog);
    Assert.assertEquals(-1, count);
    List<LogMessage> warnMessages = componentLog.getWarnMessages();
    Assert.assertEquals(1, warnMessages.size());
    Assert.assertTrue(warnMessages.get(0).getMsg().endsWith("Skipping attempt to retrieve number of input records"));
}
Also used : TdchUtils(com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.processor.export.utils.TdchUtils) LogMessage(org.apache.nifi.util.LogMessage) TestRunner(org.apache.nifi.util.TestRunner) MockComponentLog(org.apache.nifi.util.MockComponentLog) Test(org.junit.Test)

Aggregations

LogMessage (org.apache.nifi.util.LogMessage)30 Test (org.junit.Test)30 TestRunner (org.apache.nifi.util.TestRunner)29 MockComponentLog (org.apache.nifi.util.MockComponentLog)25 TdchUtils (com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.processor.export.utils.TdchUtils)24 ProcessContext (org.apache.nifi.processor.ProcessContext)3 MockFlowFile (org.apache.nifi.util.MockFlowFile)3 TdchBuilder (com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.processor.export.utils.TdchBuilder)1