@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> oozieServer = roleConfigs.get("oozie-OOZIE_SERVER-BASE"); assertEquals(5, oozieServer.size()); assertEquals("oozie_database_host", oozieServer.get(0).getName()); assertEquals("testhost", oozieServer.get(0).getValue()); assertEquals("oozie_database_name", oozieServer.get(1).getName()); assertEquals("ooziedb", oozieServer.get(1).getValue()); assertEquals("oozie_database_type", oozieServer.get(2).getName()); assertEquals("postgresql", oozieServer.get(2).getValue()); assertEquals("oozie_database_user", oozieServer.get(3).getName()); assertEquals("testuser", oozieServer.get(3).getValue()); assertEquals("oozie_database_password", oozieServer.get(4).getName()); assertEquals("testpassword", oozieServer.get(4).getValue()); }
@Override protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { switch (roleType) { case OozieRoles.OOZIE_SERVER: RdsView oozieRdsView = getRdsView(source); return List.of( config(OOZIE_DATABASE_HOST, oozieRdsView.getHost()), config(OOZIE_DATABASE_NAME, oozieRdsView.getDatabaseName()), config(OOZIE_DATABASE_TYPE, oozieRdsView.getSubprotocol()), config(OOZIE_DATABASE_USER, oozieRdsView.getConnectionUserName()), config(OOZIE_DATABASE_PASSWORD, oozieRdsView.getConnectionPassword()) ); default: return List.of(); } }
OozieRoleConfigProvider extends AbstractRdsRoleConfigProvider { @Override protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { switch (roleType) { case OozieRoles.OOZIE_SERVER: RdsView oozieRdsView = getRdsView(source); return List.of( config(OOZIE_DATABASE_HOST, oozieRdsView.getHost()), config(OOZIE_DATABASE_NAME, oozieRdsView.getDatabaseName()), config(OOZIE_DATABASE_TYPE, oozieRdsView.getSubprotocol()), config(OOZIE_DATABASE_USER, oozieRdsView.getConnectionUserName()), config(OOZIE_DATABASE_PASSWORD, oozieRdsView.getConnectionPassword()) ); default: return List.of(); } } }
OozieRoleConfigProvider extends AbstractRdsRoleConfigProvider { @Override protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { switch (roleType) { case OozieRoles.OOZIE_SERVER: RdsView oozieRdsView = getRdsView(source); return List.of( config(OOZIE_DATABASE_HOST, oozieRdsView.getHost()), config(OOZIE_DATABASE_NAME, oozieRdsView.getDatabaseName()), config(OOZIE_DATABASE_TYPE, oozieRdsView.getSubprotocol()), config(OOZIE_DATABASE_USER, oozieRdsView.getConnectionUserName()), config(OOZIE_DATABASE_PASSWORD, oozieRdsView.getConnectionPassword()) ); default: return List.of(); } }  }
OozieRoleConfigProvider extends AbstractRdsRoleConfigProvider { @Override protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { switch (roleType) { case OozieRoles.OOZIE_SERVER: RdsView oozieRdsView = getRdsView(source); return List.of( config(OOZIE_DATABASE_HOST, oozieRdsView.getHost()), config(OOZIE_DATABASE_NAME, oozieRdsView.getDatabaseName()), config(OOZIE_DATABASE_TYPE, oozieRdsView.getSubprotocol()), config(OOZIE_DATABASE_USER, oozieRdsView.getConnectionUserName()), config(OOZIE_DATABASE_PASSWORD, oozieRdsView.getConnectionPassword()) ); default: return List.of(); } }  @Override String getServiceType(); @Override List<String> getRoleTypes(); }
OozieRoleConfigProvider extends AbstractRdsRoleConfigProvider { @Override protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { switch (roleType) { case OozieRoles.OOZIE_SERVER: RdsView oozieRdsView = getRdsView(source); return List.of( config(OOZIE_DATABASE_HOST, oozieRdsView.getHost()), config(OOZIE_DATABASE_NAME, oozieRdsView.getDatabaseName()), config(OOZIE_DATABASE_TYPE, oozieRdsView.getSubprotocol()), config(OOZIE_DATABASE_USER, oozieRdsView.getConnectionUserName()), config(OOZIE_DATABASE_PASSWORD, oozieRdsView.getConnectionPassword()) ); default: return List.of(); } }  @Override String getServiceType(); @Override List<String> getRoleTypes();  }