@Test public void buildApiConfigList() { RDSConfig rdsConfig = new RDSConfig(); rdsConfig.setConnectionURL("jdbc:postgresql: rdsConfig.setConnectionUserName("testUser"); rdsConfig.setConnectionPassword("testPassword"); List<ApiConfig> configList = setupService.buildApiConfigList("testPrefix", rdsConfig).getItems(); assertThat(configList).hasSize(5); apiConfigAssertion(configList.get(0), "testPrefix_database_type", "postgresql"); apiConfigAssertion(configList.get(1), "testPrefix_database_host", "somehost.com:5432"); apiConfigAssertion(configList.get(2), "testPrefix_database_name", "dbName"); apiConfigAssertion(configList.get(3), "testPrefix_database_user", "testUser"); apiConfigAssertion(configList.get(4), "testPrefix_database_password", "testPassword"); }
@VisibleForTesting ApiConfigList buildApiConfigList(String prefix, RDSConfig rdsConfig) { String connectionUrl = rdsConfig.getConnectionURL(); DatabaseCommon.JdbcConnectionUrlFields connectionUrlFields = databaseCommon.parseJdbcConnectionUrl(connectionUrl); String type = connectionUrlFields.getVendorDriverId(); String hostAndPort = connectionUrlFields.getHostAndPort(); String databaseName = connectionUrlFields.getDatabase().get(); ApiConfigList result = new ApiConfigList(); result.addItemsItem(makeApiConfig(getDatabaseApiConfigName(prefix, DatabaseProperties.TYPE_PROPERTY), type)); result.addItemsItem(makeApiConfig(getDatabaseApiConfigName(prefix, DatabaseProperties.HOST_PROPERTY), hostAndPort)); result.addItemsItem(makeApiConfig(getDatabaseApiConfigName(prefix, DatabaseProperties.NAME_PROPERTY), databaseName)); result.addItemsItem(makeApiConfig(getDatabaseApiConfigName(prefix, DatabaseProperties.USER_PROPERTY), rdsConfig.getConnectionUserName())); result.addItemsItem(makeApiConfig(getDatabaseApiConfigName(prefix, DatabaseProperties.PASSWORD_PROPERTY), rdsConfig.getConnectionPassword())); return result; }
ClouderaManagerMgmtSetupService { @VisibleForTesting ApiConfigList buildApiConfigList(String prefix, RDSConfig rdsConfig) { String connectionUrl = rdsConfig.getConnectionURL(); DatabaseCommon.JdbcConnectionUrlFields connectionUrlFields = databaseCommon.parseJdbcConnectionUrl(connectionUrl); String type = connectionUrlFields.getVendorDriverId(); String hostAndPort = connectionUrlFields.getHostAndPort(); String databaseName = connectionUrlFields.getDatabase().get(); ApiConfigList result = new ApiConfigList(); result.addItemsItem(makeApiConfig(getDatabaseApiConfigName(prefix, DatabaseProperties.TYPE_PROPERTY), type)); result.addItemsItem(makeApiConfig(getDatabaseApiConfigName(prefix, DatabaseProperties.HOST_PROPERTY), hostAndPort)); result.addItemsItem(makeApiConfig(getDatabaseApiConfigName(prefix, DatabaseProperties.NAME_PROPERTY), databaseName)); result.addItemsItem(makeApiConfig(getDatabaseApiConfigName(prefix, DatabaseProperties.USER_PROPERTY), rdsConfig.getConnectionUserName())); result.addItemsItem(makeApiConfig(getDatabaseApiConfigName(prefix, DatabaseProperties.PASSWORD_PROPERTY), rdsConfig.getConnectionPassword())); return result; } }
ClouderaManagerMgmtSetupService { @VisibleForTesting ApiConfigList buildApiConfigList(String prefix, RDSConfig rdsConfig) { String connectionUrl = rdsConfig.getConnectionURL(); DatabaseCommon.JdbcConnectionUrlFields connectionUrlFields = databaseCommon.parseJdbcConnectionUrl(connectionUrl); String type = connectionUrlFields.getVendorDriverId(); String hostAndPort = connectionUrlFields.getHostAndPort(); String databaseName = connectionUrlFields.getDatabase().get(); ApiConfigList result = new ApiConfigList(); result.addItemsItem(makeApiConfig(getDatabaseApiConfigName(prefix, DatabaseProperties.TYPE_PROPERTY), type)); result.addItemsItem(makeApiConfig(getDatabaseApiConfigName(prefix, DatabaseProperties.HOST_PROPERTY), hostAndPort)); result.addItemsItem(makeApiConfig(getDatabaseApiConfigName(prefix, DatabaseProperties.NAME_PROPERTY), databaseName)); result.addItemsItem(makeApiConfig(getDatabaseApiConfigName(prefix, DatabaseProperties.USER_PROPERTY), rdsConfig.getConnectionUserName())); result.addItemsItem(makeApiConfig(getDatabaseApiConfigName(prefix, DatabaseProperties.PASSWORD_PROPERTY), rdsConfig.getConnectionPassword())); return result; }  }
ClouderaManagerMgmtSetupService { @VisibleForTesting ApiConfigList buildApiConfigList(String prefix, RDSConfig rdsConfig) { String connectionUrl = rdsConfig.getConnectionURL(); DatabaseCommon.JdbcConnectionUrlFields connectionUrlFields = databaseCommon.parseJdbcConnectionUrl(connectionUrl); String type = connectionUrlFields.getVendorDriverId(); String hostAndPort = connectionUrlFields.getHostAndPort(); String databaseName = connectionUrlFields.getDatabase().get(); ApiConfigList result = new ApiConfigList(); result.addItemsItem(makeApiConfig(getDatabaseApiConfigName(prefix, DatabaseProperties.TYPE_PROPERTY), type)); result.addItemsItem(makeApiConfig(getDatabaseApiConfigName(prefix, DatabaseProperties.HOST_PROPERTY), hostAndPort)); result.addItemsItem(makeApiConfig(getDatabaseApiConfigName(prefix, DatabaseProperties.NAME_PROPERTY), databaseName)); result.addItemsItem(makeApiConfig(getDatabaseApiConfigName(prefix, DatabaseProperties.USER_PROPERTY), rdsConfig.getConnectionUserName())); result.addItemsItem(makeApiConfig(getDatabaseApiConfigName(prefix, DatabaseProperties.PASSWORD_PROPERTY), rdsConfig.getConnectionPassword())); return result; }  void setupMgmtServices(Stack stack, ApiClient apiClient, ApiHostRef cmHostRef,
            Set<RDSConfig> rdsConfigs, Telemetry telemetry, String sdxContextName, String sdxStackCrn,
            ProxyConfig proxyConfig); }
ClouderaManagerMgmtSetupService { @VisibleForTesting ApiConfigList buildApiConfigList(String prefix, RDSConfig rdsConfig) { String connectionUrl = rdsConfig.getConnectionURL(); DatabaseCommon.JdbcConnectionUrlFields connectionUrlFields = databaseCommon.parseJdbcConnectionUrl(connectionUrl); String type = connectionUrlFields.getVendorDriverId(); String hostAndPort = connectionUrlFields.getHostAndPort(); String databaseName = connectionUrlFields.getDatabase().get(); ApiConfigList result = new ApiConfigList(); result.addItemsItem(makeApiConfig(getDatabaseApiConfigName(prefix, DatabaseProperties.TYPE_PROPERTY), type)); result.addItemsItem(makeApiConfig(getDatabaseApiConfigName(prefix, DatabaseProperties.HOST_PROPERTY), hostAndPort)); result.addItemsItem(makeApiConfig(getDatabaseApiConfigName(prefix, DatabaseProperties.NAME_PROPERTY), databaseName)); result.addItemsItem(makeApiConfig(getDatabaseApiConfigName(prefix, DatabaseProperties.USER_PROPERTY), rdsConfig.getConnectionUserName())); result.addItemsItem(makeApiConfig(getDatabaseApiConfigName(prefix, DatabaseProperties.PASSWORD_PROPERTY), rdsConfig.getConnectionPassword())); return result; }  void setupMgmtServices(Stack stack, ApiClient apiClient, ApiHostRef cmHostRef,
            Set<RDSConfig> rdsConfigs, Telemetry telemetry, String sdxContextName, String sdxStackCrn,
            ProxyConfig proxyConfig);  }