@Test void nonHA() { HostgroupView master = new HostgroupView("master", 0, InstanceGroupType.CORE, 1); HostgroupView worker = new HostgroupView("worker", 0, InstanceGroupType.CORE, 3); String inputJson = FileReaderUtils.readFileFromClasspathQuietly("input/clouderamanager.bp"); CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson); TemplatePreparationObject preparationObject = TemplatePreparationObject.Builder.builder() .withHostgroupViews(Set.of(master, worker)) .withBlueprintView(new BlueprintView(inputJson, "CDP", "1.0", cmTemplateProcessor)) .build(); Map<String, List<ApiClusterTemplateConfig>> roleConfigs = subject.getRoleConfigs(cmTemplateProcessor, preparationObject); assertEquals(List.of(), roleConfigs.get("hdfs-NAMENODE-BASE")); assertEquals(List.of(config("dfs_datanode_failed_volumes_tolerated", "0")), roleConfigs.get("hdfs-DATANODE-BASE")); }
@Override protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { switch (roleType) { case HdfsRoles.DATANODE: return List.of( config(FAILED_VOLUMES_TOLERATED, NUM_FAILED_VOLUMES_TOLERATED.toString()) ); case HdfsRoles.NAMENODE: if (isNamenodeHA(source)) { return List.of( config("autofailover_enabled", "true"), config("dfs_federation_namenode_nameservice", DEFAULT_NAME_SERVICE), config("dfs_namenode_quorum_journal_name", DEFAULT_NAME_SERVICE) ); } return List.of(); default: return List.of(); } }
HdfsRoleConfigProvider extends AbstractRoleConfigProvider { @Override protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { switch (roleType) { case HdfsRoles.DATANODE: return List.of( config(FAILED_VOLUMES_TOLERATED, NUM_FAILED_VOLUMES_TOLERATED.toString()) ); case HdfsRoles.NAMENODE: if (isNamenodeHA(source)) { return List.of( config("autofailover_enabled", "true"), config("dfs_federation_namenode_nameservice", DEFAULT_NAME_SERVICE), config("dfs_namenode_quorum_journal_name", DEFAULT_NAME_SERVICE) ); } return List.of(); default: return List.of(); } } }
HdfsRoleConfigProvider extends AbstractRoleConfigProvider { @Override protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { switch (roleType) { case HdfsRoles.DATANODE: return List.of( config(FAILED_VOLUMES_TOLERATED, NUM_FAILED_VOLUMES_TOLERATED.toString()) ); case HdfsRoles.NAMENODE: if (isNamenodeHA(source)) { return List.of( config("autofailover_enabled", "true"), config("dfs_federation_namenode_nameservice", DEFAULT_NAME_SERVICE), config("dfs_namenode_quorum_journal_name", DEFAULT_NAME_SERVICE) ); } return List.of(); default: return List.of(); } }  }
HdfsRoleConfigProvider extends AbstractRoleConfigProvider { @Override protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { switch (roleType) { case HdfsRoles.DATANODE: return List.of( config(FAILED_VOLUMES_TOLERATED, NUM_FAILED_VOLUMES_TOLERATED.toString()) ); case HdfsRoles.NAMENODE: if (isNamenodeHA(source)) { return List.of( config("autofailover_enabled", "true"), config("dfs_federation_namenode_nameservice", DEFAULT_NAME_SERVICE), config("dfs_namenode_quorum_journal_name", DEFAULT_NAME_SERVICE) ); } return List.of(); default: return List.of(); } }  @Override String getServiceType(); @Override List<String> getRoleTypes(); static boolean isNamenodeHA(TemplatePreparationObject source); static Set<String> nameNodeFQDNs(TemplatePreparationObject source); }
HdfsRoleConfigProvider extends AbstractRoleConfigProvider { @Override protected List<ApiClusterTemplateConfig> getRoleConfigs(String roleType, TemplatePreparationObject source) { switch (roleType) { case HdfsRoles.DATANODE: return List.of( config(FAILED_VOLUMES_TOLERATED, NUM_FAILED_VOLUMES_TOLERATED.toString()) ); case HdfsRoles.NAMENODE: if (isNamenodeHA(source)) { return List.of( config("autofailover_enabled", "true"), config("dfs_federation_namenode_nameservice", DEFAULT_NAME_SERVICE), config("dfs_namenode_quorum_journal_name", DEFAULT_NAME_SERVICE) ); } return List.of(); default: return List.of(); } }  @Override String getServiceType(); @Override List<String> getRoleTypes(); static boolean isNamenodeHA(TemplatePreparationObject source); static Set<String> nameNodeFQDNs(TemplatePreparationObject source); static final String DEFAULT_NAME_SERVICE; }