Search in sources :

Example 1 with StandardTdchConnectionService

use of com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.controllerservice.StandardTdchConnectionService 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);
}
Also used : StandardTdchConnectionService(com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.controllerservice.StandardTdchConnectionService) StandardTdchConnectionService(com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.controllerservice.StandardTdchConnectionService) TdchConnectionService(com.thinkbiganalytics.kylo.nifi.teradata.tdch.api.TdchConnectionService) HashMap(java.util.HashMap) TestRunner(org.apache.nifi.util.TestRunner) Test(org.junit.Test)

Aggregations

TdchConnectionService (com.thinkbiganalytics.kylo.nifi.teradata.tdch.api.TdchConnectionService)1 StandardTdchConnectionService (com.thinkbiganalytics.kylo.nifi.teradata.tdch.core.controllerservice.StandardTdchConnectionService)1 HashMap (java.util.HashMap)1 TestRunner (org.apache.nifi.util.TestRunner)1 Test (org.junit.Test)1