@Test public void testGetRoleConfigsWithSingleRolesPerHostGroup() { TemplatePreparationObject preparationObject = getTemplatePreparationObject(); String inputJson = getBlueprintText("input/clouderamanager-db-config.bp"); CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson); Map<String, List<ApiClusterTemplateConfig>> roleConfigs = underTest.getRoleConfigs(cmTemplateProcessor, preparationObject); List<ApiClusterTemplateConfig> profilerAdmin = roleConfigs.get("profiler_manager-PROFILER_ADMIN_AGENT-BASE"); assertEquals(5, profilerAdmin.size()); assertEquals("profiler_admin_database_host", profilerAdmin.get(0).getName()); assertEquals("10.1.1.1", profilerAdmin.get(0).getValue()); assertEquals("profiler_admin_database_name", profilerAdmin.get(1).getName()); assertEquals("profiler_agent", profilerAdmin.get(1).getValue()); assertEquals("profiler_admin_database_type", profilerAdmin.get(2).getName()); assertEquals("POSTGRES", profilerAdmin.get(2).getValue()); assertEquals("profiler_admin_database_user", profilerAdmin.get(3).getName()); assertEquals("heyitsme", profilerAdmin.get(3).getValue()); assertEquals("profiler_admin_database_password", profilerAdmin.get(4).getName()); assertEquals("iamsoosecure", profilerAdmin.get(4).getValue()); }
@Override protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { switch (roleType) { case ProfilerManagerRoles.PROFILER_ADMIN_AGENT: RdsView profilerManagerRdsView = getRdsView(source); return List.of(config("profiler_admin_database_host", profilerManagerRdsView.getHost()), config("profiler_admin_database_name", profilerManagerRdsView.getDatabaseName()), config("profiler_admin_database_type", ConfigUtils.getDbTypePostgres(profilerManagerRdsView, ProfilerManagerRoles.PROFILER_MANAGER)), config("profiler_admin_database_user", profilerManagerRdsView.getConnectionUserName()), config("profiler_admin_database_password", profilerManagerRdsView.getConnectionPassword())); default: return List.of(); } }
ProfilerAdminRoleConfigProvider extends AbstractRdsRoleConfigProvider { @Override protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { switch (roleType) { case ProfilerManagerRoles.PROFILER_ADMIN_AGENT: RdsView profilerManagerRdsView = getRdsView(source); return List.of(config("profiler_admin_database_host", profilerManagerRdsView.getHost()), config("profiler_admin_database_name", profilerManagerRdsView.getDatabaseName()), config("profiler_admin_database_type", ConfigUtils.getDbTypePostgres(profilerManagerRdsView, ProfilerManagerRoles.PROFILER_MANAGER)), config("profiler_admin_database_user", profilerManagerRdsView.getConnectionUserName()), config("profiler_admin_database_password", profilerManagerRdsView.getConnectionPassword())); default: return List.of(); } } }
ProfilerAdminRoleConfigProvider extends AbstractRdsRoleConfigProvider { @Override protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { switch (roleType) { case ProfilerManagerRoles.PROFILER_ADMIN_AGENT: RdsView profilerManagerRdsView = getRdsView(source); return List.of(config("profiler_admin_database_host", profilerManagerRdsView.getHost()), config("profiler_admin_database_name", profilerManagerRdsView.getDatabaseName()), config("profiler_admin_database_type", ConfigUtils.getDbTypePostgres(profilerManagerRdsView, ProfilerManagerRoles.PROFILER_MANAGER)), config("profiler_admin_database_user", profilerManagerRdsView.getConnectionUserName()), config("profiler_admin_database_password", profilerManagerRdsView.getConnectionPassword())); default: return List.of(); } }  }
ProfilerAdminRoleConfigProvider extends AbstractRdsRoleConfigProvider { @Override protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { switch (roleType) { case ProfilerManagerRoles.PROFILER_ADMIN_AGENT: RdsView profilerManagerRdsView = getRdsView(source); return List.of(config("profiler_admin_database_host", profilerManagerRdsView.getHost()), config("profiler_admin_database_name", profilerManagerRdsView.getDatabaseName()), config("profiler_admin_database_type", ConfigUtils.getDbTypePostgres(profilerManagerRdsView, ProfilerManagerRoles.PROFILER_MANAGER)), config("profiler_admin_database_user", profilerManagerRdsView.getConnectionUserName()), config("profiler_admin_database_password", profilerManagerRdsView.getConnectionPassword())); default: return List.of(); } }  @Override String getServiceType(); @Override List<String> getRoleTypes(); }
ProfilerAdminRoleConfigProvider extends AbstractRdsRoleConfigProvider { @Override protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { switch (roleType) { case ProfilerManagerRoles.PROFILER_ADMIN_AGENT: RdsView profilerManagerRdsView = getRdsView(source); return List.of(config("profiler_admin_database_host", profilerManagerRdsView.getHost()), config("profiler_admin_database_name", profilerManagerRdsView.getDatabaseName()), config("profiler_admin_database_type", ConfigUtils.getDbTypePostgres(profilerManagerRdsView, ProfilerManagerRoles.PROFILER_MANAGER)), config("profiler_admin_database_user", profilerManagerRdsView.getConnectionUserName()), config("profiler_admin_database_password", profilerManagerRdsView.getConnectionPassword())); default: return List.of(); } }  @Override String getServiceType(); @Override List<String> getRoleTypes();  }