@Test public void getServiceConfigs() { RDSConfig rdsConfig = new RDSConfig(); rdsConfig.setType(HIVE_DAS); rdsConfig.setConnectionURL(String.format("jdbc:%s: rdsConfig.setConnectionUserName(USER_NAME); rdsConfig.setConnectionPassword(PASSWORD); TemplatePreparationObject tpo = new Builder().withRdsConfigs(Set.of(rdsConfig)).build(); List<ApiClusterTemplateConfig> result = underTest.getServiceConfigs(null, tpo); Map<String, String> paramToVariable = result.stream().collect(Collectors.toMap(ApiClusterTemplateConfig::getName, ApiClusterTemplateConfig::getValue)); assertThat(paramToVariable).containsOnly( new SimpleEntry<>("data_analytics_studio_database_host", HOST), new SimpleEntry<>("data_analytics_studio_database_port", PORT), new SimpleEntry<>("data_analytics_studio_database_name", DB_NAME), new SimpleEntry<>("data_analytics_studio_database_username", USER_NAME), new SimpleEntry<>("data_analytics_studio_database_password", PASSWORD)); }
@Override public List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject source) { RdsView dasView = getRdsView(source); return List.of( config("data_analytics_studio_database_host", dasView.getHost()), config("data_analytics_studio_database_port", dasView.getPort()), config("data_analytics_studio_database_name", dasView.getDatabaseName()), config("data_analytics_studio_database_username", dasView.getConnectionUserName()), config("data_analytics_studio_database_password", dasView.getConnectionPassword()) ); }
DasConfigProvider extends AbstractRdsRoleConfigProvider { @Override public List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject source) { RdsView dasView = getRdsView(source); return List.of( config("data_analytics_studio_database_host", dasView.getHost()), config("data_analytics_studio_database_port", dasView.getPort()), config("data_analytics_studio_database_name", dasView.getDatabaseName()), config("data_analytics_studio_database_username", dasView.getConnectionUserName()), config("data_analytics_studio_database_password", dasView.getConnectionPassword()) ); } }
DasConfigProvider extends AbstractRdsRoleConfigProvider { @Override public List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject source) { RdsView dasView = getRdsView(source); return List.of( config("data_analytics_studio_database_host", dasView.getHost()), config("data_analytics_studio_database_port", dasView.getPort()), config("data_analytics_studio_database_name", dasView.getDatabaseName()), config("data_analytics_studio_database_username", dasView.getConnectionUserName()), config("data_analytics_studio_database_password", dasView.getConnectionPassword()) ); }  }
DasConfigProvider extends AbstractRdsRoleConfigProvider { @Override public List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject source) { RdsView dasView = getRdsView(source); return List.of( config("data_analytics_studio_database_host", dasView.getHost()), config("data_analytics_studio_database_port", dasView.getPort()), config("data_analytics_studio_database_name", dasView.getDatabaseName()), config("data_analytics_studio_database_username", dasView.getConnectionUserName()), config("data_analytics_studio_database_password", dasView.getConnectionPassword()) ); }  @Override List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject source); @Override String getServiceType(); @Override List<String> getRoleTypes(); }
DasConfigProvider extends AbstractRdsRoleConfigProvider { @Override public List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject source) { RdsView dasView = getRdsView(source); return List.of( config("data_analytics_studio_database_host", dasView.getHost()), config("data_analytics_studio_database_port", dasView.getPort()), config("data_analytics_studio_database_name", dasView.getDatabaseName()), config("data_analytics_studio_database_username", dasView.getConnectionUserName()), config("data_analytics_studio_database_password", dasView.getConnectionPassword()) ); }  @Override List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject source); @Override String getServiceType(); @Override List<String> getRoleTypes();  }