Search in sources :

Example 26 with LogMessage

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

the class TdchUtilsTest method testGetExportHiveToTeradataJobExitCode_EmptyCode.

@Test
public void testGetExportHiveToTeradataJobExitCode_EmptyCode() {
    TestRunner runner = TestRunners.newTestRunner(TestAbstractTdchProcessor.class);
    MockComponentLog componentLog = runner.getLogger();
    TdchUtils tdchUtils = new TdchUtils();
    long code = tdchUtils.getExportHiveToTeradataJobExitCode(getTdchProcessResultWithEmptyExitCode(), componentLog);
    Assert.assertEquals(-1, code);
    List<LogMessage> warnMessages = componentLog.getWarnMessages();
    Assert.assertEquals(1, warnMessages.size());
    Assert.assertTrue(warnMessages.get(0).getMsg().endsWith("Skipping attempt to retrieve TDCH exit code"));
}
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 27 with LogMessage

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

the class TdchUtilsTest method testGetExportHiveToTeradataJobExitCode_FailureCode.

@Test
public void testGetExportHiveToTeradataJobExitCode_FailureCode() {
    TestRunner runner = TestRunners.newTestRunner(TestAbstractTdchProcessor.class);
    MockComponentLog componentLog = runner.getLogger();
    TdchUtils tdchUtils = new TdchUtils();
    long code = tdchUtils.getExportHiveToTeradataJobExitCode(getTdchProcessResultWithFailureExitCode(), componentLog);
    Assert.assertEquals(-1, code);
    List<LogMessage> warnMessages = componentLog.getWarnMessages();
    Assert.assertEquals(1, warnMessages.size());
    Assert.assertTrue(warnMessages.get(0).getMsg().endsWith("Skipping attempt to retrieve TDCH exit code"));
}
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 28 with LogMessage

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

the class TdchUtilsTest method testGetExportHiveToTeradataJobExitCode_NoCode.

@Test
public void testGetExportHiveToTeradataJobExitCode_NoCode() {
    TestRunner runner = TestRunners.newTestRunner(TestAbstractTdchProcessor.class);
    MockComponentLog componentLog = runner.getLogger();
    TdchUtils tdchUtils = new TdchUtils();
    long code = tdchUtils.getExportHiveToTeradataJobExitCode(getTdchProcessResultWithNoExitCode(), componentLog);
    Assert.assertEquals(-1, code);
    List<LogMessage> warnMessages = componentLog.getWarnMessages();
    Assert.assertEquals(1, warnMessages.size());
    Assert.assertTrue(warnMessages.get(0).getMsg().endsWith("Skipping attempt to retrieve TDCH exit code"));
}
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 29 with LogMessage

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

the class TdchUtilsTest method testGetExportHiveToTeradataJobTimeTaken_InvalidTimeTakenLong.

@Test
public void testGetExportHiveToTeradataJobTimeTaken_InvalidTimeTakenLong() {
    TestRunner runner = TestRunners.newTestRunner(TestAbstractTdchProcessor.class);
    MockComponentLog componentLog = runner.getLogger();
    TdchUtils tdchUtils = new TdchUtils();
    String timeTaken = tdchUtils.getExportHiveToTeradataJobTimeTaken(getTdchProcessResultWithLongInvalidTimeTaken(), componentLog);
    Assert.assertEquals("Unable to determine time taken", timeTaken);
    List<LogMessage> warnMessages = componentLog.getWarnMessages();
    Assert.assertEquals(1, warnMessages.size());
    Assert.assertTrue(warnMessages.get(0).getMsg().endsWith("Unable to get valid value for time taken by TDCH job"));
}
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 30 with LogMessage

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

the class TdchUtilsTest method testGetExportHiveToTeradataJobTimeTaken_NoTimeTaken.

@Test
public void testGetExportHiveToTeradataJobTimeTaken_NoTimeTaken() {
    TestRunner runner = TestRunners.newTestRunner(TestAbstractTdchProcessor.class);
    MockComponentLog componentLog = runner.getLogger();
    TdchUtils tdchUtils = new TdchUtils();
    String timeTaken = tdchUtils.getExportHiveToTeradataJobTimeTaken(getTdchProcessResultWithNoTimeTaken(), componentLog);
    Assert.assertEquals("Unable to determine time taken", timeTaken);
    List<LogMessage> warnMessages = componentLog.getWarnMessages();
    Assert.assertEquals(1, warnMessages.size());
    Assert.assertTrue(warnMessages.get(0).getMsg().endsWith("Skipping attempt to retrieve time taken by TDCH job"));
}
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