use of com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.controllerservice.DummyTdchConnectionService in project kylo by Teradata.
the class TdchExportHiveToTeradataTest method testTeradataBatchSize.
@Test
public void testTeradataBatchSize() 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("10000", runner.getProcessor().getPropertyDescriptor(TdchExportHiveToTeradata.TERADATA_BATCH_SIZE_NAME).getDefaultValue());
Assert.assertFalse(runner.getProcessor().getPropertyDescriptor(TdchExportHiveToTeradata.TERADATA_BATCH_SIZE_NAME).isRequired());
Assert.assertTrue(runner.getProcessor().getPropertyDescriptor(TdchExportHiveToTeradata.TERADATA_BATCH_SIZE_NAME).isExpressionLanguageSupported());
ValidationResult result = runner.setProperty(TdchExportHiveToTeradata.TERADATA_BATCH_SIZE, "10000");
Assert.assertTrue(result.isValid());
result = runner.setProperty(TdchExportHiveToTeradata.TERADATA_BATCH_SIZE, "");
Assert.assertFalse(result.isValid());
result = runner.setProperty(TdchExportHiveToTeradata.TERADATA_BATCH_SIZE, "-1");
Assert.assertFalse(result.isValid());
result = runner.setProperty(TdchExportHiveToTeradata.TERADATA_BATCH_SIZE, "not-an-integer");
Assert.assertFalse(result.isValid());
runner.removeProperty(TdchExportHiveToTeradata.TERADATA_BATCH_SIZE);
runner.assertValid();
}
use of com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.controllerservice.DummyTdchConnectionService in project kylo by Teradata.
the class TdchExportHiveToTeradataTest method testHiveConfigurationFileHdfsPath.
@Test
public void testHiveConfigurationFileHdfsPath() 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.assertNull(runner.getProcessor().getPropertyDescriptor(TdchExportHiveToTeradata.HIVE_CONFIGURATION_FILE_HDFS_PATH_NAME).getDefaultValue());
Assert.assertFalse(runner.getProcessor().getPropertyDescriptor(TdchExportHiveToTeradata.HIVE_CONFIGURATION_FILE_HDFS_PATH_NAME).isRequired());
Assert.assertTrue(runner.getProcessor().getPropertyDescriptor(TdchExportHiveToTeradata.HIVE_CONFIGURATION_FILE_HDFS_PATH_NAME).isExpressionLanguageSupported());
ValidationResult result = runner.setProperty(TdchExportHiveToTeradata.HIVE_CONFIGURATION_FILE_HDFS_PATH, "/abc/xyz/hive-site-invalid.xml");
Assert.assertFalse(result.isValid());
result = runner.setProperty(TdchExportHiveToTeradata.HIVE_CONFIGURATION_FILE_HDFS_PATH, "/abc/xyz/invalid-hive-site.xml");
Assert.assertFalse(result.isValid());
result = runner.setProperty(TdchExportHiveToTeradata.HIVE_CONFIGURATION_FILE_HDFS_PATH, "/abc/xyz/hive-site.xml");
Assert.assertTrue(result.isValid());
runner.removeProperty(TdchExportHiveToTeradata.HIVE_CONFIGURATION_FILE_HDFS_PATH);
runner.assertValid();
}
use of com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.controllerservice.DummyTdchConnectionService in project kylo by Teradata.
the class TdchExportHiveToTeradataTest method testTeradataStagingTable.
@Test
public void testTeradataStagingTable() 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(null, runner.getProcessor().getPropertyDescriptor(TdchExportHiveToTeradata.TERADATA_STAGING_TABLE_NAME).getDefaultValue());
Assert.assertFalse(runner.getProcessor().getPropertyDescriptor(TdchExportHiveToTeradata.TERADATA_STAGING_TABLE_NAME).isRequired());
Assert.assertTrue(runner.getProcessor().getPropertyDescriptor(TdchExportHiveToTeradata.TERADATA_STAGING_TABLE_NAME).isExpressionLanguageSupported());
ValidationResult result = runner.setProperty(TdchExportHiveToTeradata.TERADATA_STAGING_TABLE, "td_staging_table");
Assert.assertTrue(result.isValid());
result = runner.setProperty(TdchExportHiveToTeradata.TERADATA_STAGING_TABLE, "");
Assert.assertFalse(result.isValid());
runner.removeProperty(TdchExportHiveToTeradata.TERADATA_STAGING_TABLE);
runner.assertValid();
}
use of com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.controllerservice.DummyTdchConnectionService in project kylo by Teradata.
the class TdchExportHiveToTeradataTest method testHiveTable.
@Test
public void testHiveTable() 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(null, runner.getProcessor().getPropertyDescriptor(TdchExportHiveToTeradata.HIVE_TABLE_NAME).getDefaultValue());
Assert.assertTrue(runner.getProcessor().getPropertyDescriptor(TdchExportHiveToTeradata.HIVE_TABLE_NAME).isRequired());
Assert.assertTrue(runner.getProcessor().getPropertyDescriptor(TdchExportHiveToTeradata.HIVE_TABLE_NAME).isExpressionLanguageSupported());
ValidationResult result = runner.setProperty(TdchExportHiveToTeradata.HIVE_TABLE, "source_hive_table");
Assert.assertTrue(result.isValid());
result = runner.setProperty(TdchExportHiveToTeradata.HIVE_TABLE, "");
Assert.assertFalse(result.isValid());
result = runner.setProperty(TdchExportHiveToTeradata.HIVE_TABLE, "hive_table");
Assert.assertTrue(result.isValid());
runner.assertValid();
runner.removeProperty(TdchExportHiveToTeradata.HIVE_TABLE);
runner.assertNotValid();
}
use of com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.controllerservice.DummyTdchConnectionService in project kylo by Teradata.
the class TdchExportHiveToTeradataTest method testHiveFieldSeparator.
@Test
public void testHiveFieldSeparator() 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(null, runner.getProcessor().getPropertyDescriptor(TdchExportHiveToTeradata.HIVE_FIELD_SEPARATOR_NAME).getDefaultValue());
Assert.assertFalse(runner.getProcessor().getPropertyDescriptor(TdchExportHiveToTeradata.HIVE_FIELD_SEPARATOR_NAME).isRequired());
Assert.assertTrue(runner.getProcessor().getPropertyDescriptor(TdchExportHiveToTeradata.HIVE_FIELD_SEPARATOR_NAME).isExpressionLanguageSupported());
ValidationResult result = runner.setProperty(TdchExportHiveToTeradata.HIVE_FIELD_SEPARATOR, "|");
Assert.assertTrue(result.isValid());
result = runner.setProperty(TdchExportHiveToTeradata.HIVE_FIELD_SEPARATOR, "");
Assert.assertFalse(result.isValid());
runner.removeProperty(TdchExportHiveToTeradata.HIVE_FIELD_SEPARATOR);
runner.assertValid();
}
Aggregations