Search in sources :

Example 16 with TdchUtils

use of com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.processor.export.utils.TdchUtils in project kylo by Teradata.

the class TdchUtilsTest method testMaskTdchCredentials_MaskingNotApplicable.

@Test
public void testMaskTdchCredentials_MaskingNotApplicable() {
    TdchUtils tdchUtils = new TdchUtils();
    String tdchCommand = "This is a command with no -my_key my_value parameters to mask";
    String maskedTdchCommand = tdchUtils.maskTdchCredentials(tdchCommand);
    Assert.assertEquals("This is a command with no -my_key my_value parameters to mask", maskedTdchCommand);
}
Also used : TdchUtils(com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.processor.export.utils.TdchUtils) Test(org.junit.Test)

Example 17 with TdchUtils

use of com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.processor.export.utils.TdchUtils 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 18 with TdchUtils

use of com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.processor.export.utils.TdchUtils 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 19 with TdchUtils

use of com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.processor.export.utils.TdchUtils 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 20 with TdchUtils

use of com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.processor.export.utils.TdchUtils 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

TdchUtils (com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.processor.export.utils.TdchUtils)27 Test (org.junit.Test)26 LogMessage (org.apache.nifi.util.LogMessage)24 MockComponentLog (org.apache.nifi.util.MockComponentLog)24 TestRunner (org.apache.nifi.util.TestRunner)24 TdchConnectionService (com.thinkbiganalytics.kylo.nifi.teradata.tdch.api.TdchConnectionService)1 KerberosConfig (com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.common.KerberosConfig)1 TdchProcessResult (com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.processor.base.TdchProcessResult)1 TdchProcessRunner (com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.processor.base.TdchProcessRunner)1 TdchBuilder (com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.processor.export.utils.TdchBuilder)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 FlowFile (org.apache.nifi.flowfile.FlowFile)1 ComponentLog (org.apache.nifi.logging.ComponentLog)1 StopWatch (org.apache.nifi.util.StopWatch)1