use of com.thinkbiganalytics.kylo.nifi.teradata.tdch.api.TdchConnectionService in project kylo by Teradata.
the class TdchExportHiveToTeradataTest method testTeradataTruncate.
@Test
public void testTeradataTruncate() throws InitializationException {
final TestRunner runner = TestRunners.newTestRunner(TdchExportHiveToTeradata.class);
TdchConnectionService tdchConnectionService = new DummyTdchConnectionService();
runner.addControllerService(CONNECTION_SERVICE_ID, tdchConnectionService);
runner.assertValid(tdchConnectionService);
runner.enableControllerService(tdchConnectionService);
runner.setProperty(TdchExportHiveToTeradata.TDCH_CONNECTION_SERVICE, CONNECTION_SERVICE_ID);
runner.setProperty(TdchExportHiveToTeradata.HIVE_DATABASE, "hive_db");
runner.setProperty(TdchExportHiveToTeradata.HIVE_TABLE, "hive_table");
runner.setProperty(TdchExportHiveToTeradata.TERADATA_DATABASE_TABLE, "teradata_db.teradata_table");
runner.assertValid();
Assert.assertEquals("false", runner.getProcessor().getPropertyDescriptor(TdchExportHiveToTeradata.TERADATA_TRUNCATE_TABLE_NAME).getDefaultValue());
Assert.assertFalse(runner.getProcessor().getPropertyDescriptor(TdchExportHiveToTeradata.TERADATA_TRUNCATE_TABLE_NAME).isRequired());
Assert.assertTrue(runner.getProcessor().getPropertyDescriptor(TdchExportHiveToTeradata.TERADATA_TRUNCATE_TABLE_NAME).isExpressionLanguageSupported());
ValidationResult result = runner.setProperty(TdchExportHiveToTeradata.TERADATA_TRUNCATE_TABLE, "true");
Assert.assertTrue(result.isValid());
result = runner.setProperty(TdchExportHiveToTeradata.TERADATA_TRUNCATE_TABLE, "");
Assert.assertFalse(result.isValid());
result = runner.setProperty(TdchExportHiveToTeradata.TERADATA_TRUNCATE_TABLE, "not-boolean-value");
Assert.assertFalse(result.isValid());
runner.removeProperty(TdchExportHiveToTeradata.TERADATA_TRUNCATE_TABLE);
runner.assertValid();
}
use of com.thinkbiganalytics.kylo.nifi.teradata.tdch.api.TdchConnectionService in project kylo by Teradata.
the class StandardTdchConnectionService_Set1_Test method testPassword.
@Test
public void testPassword() throws InitializationException {
ValidationResult validationResult;
final TestRunner runner = TestRunners.newTestRunner(TestTdchProcessorForTestingTdchConnectionService.class);
final TdchConnectionService standardTdchConnectionService = new DummyTdchConnectionService();
runner.addControllerService(CONNECTION_SERVICE_ID, standardTdchConnectionService);
runner.assertValid(standardTdchConnectionService);
// Password
validationResult = runner.setProperty(standardTdchConnectionService, StandardTdchConnectionService.PASSWORD, "");
Assert.assertEquals(StandardTdchConnectionService.PASSWORD.getDisplayName(), validationResult.getSubject());
Assert.assertFalse(validationResult.isValid());
runner.assertNotValid(standardTdchConnectionService);
validationResult = runner.setProperty(standardTdchConnectionService, StandardTdchConnectionService.PASSWORD, "mypwd");
Assert.assertEquals(StandardTdchConnectionService.PASSWORD.getDisplayName(), validationResult.getSubject());
Assert.assertTrue(validationResult.isValid());
runner.assertValid(standardTdchConnectionService);
}
use of com.thinkbiganalytics.kylo.nifi.teradata.tdch.api.TdchConnectionService in project kylo by Teradata.
the class StandardTdchConnectionService_Set1_Test method testJdbcConnectionUrl.
@Test
public void testJdbcConnectionUrl() throws InitializationException {
ValidationResult validationResult;
final TestRunner runner = TestRunners.newTestRunner(TestTdchProcessorForTestingTdchConnectionService.class);
final TdchConnectionService standardTdchConnectionService = new DummyTdchConnectionService();
runner.addControllerService(CONNECTION_SERVICE_ID, standardTdchConnectionService);
runner.assertValid(standardTdchConnectionService);
// JDBC Connection URL
validationResult = runner.setProperty(standardTdchConnectionService, StandardTdchConnectionService.JDBC_CONNECTION_URL, "");
Assert.assertEquals(StandardTdchConnectionService.JDBC_CONNECTION_URL.getDisplayName(), validationResult.getSubject());
Assert.assertFalse(validationResult.isValid());
runner.assertNotValid(standardTdchConnectionService);
validationResult = runner.setProperty(standardTdchConnectionService, StandardTdchConnectionService.JDBC_CONNECTION_URL, StandardTdchConnectionService.DEFAULT_JDBC_CONNECTION_URL + DATABASE_SPEC_IN_CONNECTION_URL);
Assert.assertEquals(StandardTdchConnectionService.JDBC_CONNECTION_URL.getDisplayName(), validationResult.getSubject());
Assert.assertFalse(validationResult.isValid());
runner.assertNotValid(standardTdchConnectionService);
validationResult = runner.setProperty(standardTdchConnectionService, StandardTdchConnectionService.JDBC_CONNECTION_URL, StandardTdchConnectionService.DEFAULT_JDBC_CONNECTION_URL);
Assert.assertEquals(StandardTdchConnectionService.JDBC_CONNECTION_URL.getDisplayName(), validationResult.getSubject());
Assert.assertTrue(validationResult.isValid());
runner.assertValid(standardTdchConnectionService);
}
use of com.thinkbiganalytics.kylo.nifi.teradata.tdch.api.TdchConnectionService in project kylo by Teradata.
the class AbstractTdchProcessorTest method testControllerServiceConfiguration.
@Test
public void testControllerServiceConfiguration() throws InitializationException {
final String CONNECTION_SERVICE_ID = "tdch-conn-service";
final TestRunner runner = TestRunners.newTestRunner(TestAbstractTdchProcessor.class);
final TdchConnectionService tdchConnectionService = new StandardTdchConnectionService();
final Map<String, String> tdchConnectionServiceProperties = new HashMap<>();
runner.addControllerService(CONNECTION_SERVICE_ID, tdchConnectionService, tdchConnectionServiceProperties);
runner.assertValid();
String jdbcDriverClass = runner.getControllerService(CONNECTION_SERVICE_ID).getPropertyDescriptor(StandardTdchConnectionService.JDBC_DRIVER_CLASS_NAME.getName()).getDefaultValue();
Assert.assertEquals("com.teradata.jdbc.TeraDriver", jdbcDriverClass);
String jdbcConnectionUrl = runner.getControllerService(CONNECTION_SERVICE_ID).getPropertyDescriptor(StandardTdchConnectionService.JDBC_CONNECTION_URL.getName()).getDefaultValue();
Assert.assertEquals("jdbc:teradata://localhost", jdbcConnectionUrl);
String user = runner.getControllerService(CONNECTION_SERVICE_ID).getPropertyDescriptor(StandardTdchConnectionService.USERNAME.getName()).getDefaultValue();
Assert.assertEquals("dbc", user);
String password = runner.getControllerService(CONNECTION_SERVICE_ID).getPropertyDescriptor(StandardTdchConnectionService.PASSWORD.getName()).getDefaultValue();
Assert.assertNull(password);
String tdchJarPath = runner.getControllerService(CONNECTION_SERVICE_ID).getPropertyDescriptor(StandardTdchConnectionService.TDCH_JAR_PATH.getName()).getDefaultValue();
Assert.assertEquals("/usr/lib/tdch/1.5/lib/teradata-connector-1.5.4.jar", tdchJarPath);
String hiveConfPath = runner.getControllerService(CONNECTION_SERVICE_ID).getPropertyDescriptor(StandardTdchConnectionService.HIVE_CONF_PATH.getName()).getDefaultValue();
Assert.assertEquals("/usr/hdp/current/hive-client/conf", hiveConfPath);
String hiveLibPath = runner.getControllerService(CONNECTION_SERVICE_ID).getPropertyDescriptor(StandardTdchConnectionService.HIVE_LIB_PATH.getName()).getDefaultValue();
Assert.assertEquals("/usr/hdp/current/hive-client/lib", hiveLibPath);
}
Aggregations