@Test public void testGetHdfsServiceConfigsWithoutS3Guard() { doNothing().when(s3GuardConfigProvider).getServiceConfigs(any(TemplatePreparationObject.class), any(StringBuilder.class)); TemplatePreparationObject preparationObject = getTemplatePreparationObject(false, false, false); String inputJson = getBlueprintText("input/clouderamanager.bp"); CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson); List<ApiClusterTemplateConfig> serviceConfigs = underTest.getServiceConfigs(cmTemplateProcessor, preparationObject); assertEquals(0, serviceConfigs.size()); }
@Override public List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject templatePreparationObject) { StringBuilder hdfsCoreSiteSafetyValveValue = new StringBuilder(); s3GuardConfigProvider.getServiceConfigs(templatePreparationObject, hdfsCoreSiteSafetyValveValue); List<ApiClusterTemplateConfig> list = new ArrayList<>(); if (StringUtils.isNotEmpty(hdfsCoreSiteSafetyValveValue.toString())) { list.add(config(CORE_SITE_SAFETY_VALVE, hdfsCoreSiteSafetyValveValue.toString())); } if (templatePreparationObject.getProductDetailsView() != null && templatePreparationObject.getProductDetailsView().getCm() != null && templatePreparationObject.getProductDetailsView().getCm().getVersion() != null) { String cmVersion = templatePreparationObject.getProductDetailsView().getCm().getVersion(); if (templatePreparationObject.getStackType() == StackType.DATALAKE && isVersionNewerOrEqualThanLimited(cmVersion, CLOUDERAMANAGER_VERSION_7_2_0)) { list.add(config("dfs_replication", "1")); list.add(config("service_health_suppression_hdfs_verify_ec_with_topology", "true")); } } return Collections.unmodifiableList(list); }
HdfsConfigProvider implements CmTemplateComponentConfigProvider { @Override public List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject templatePreparationObject) { StringBuilder hdfsCoreSiteSafetyValveValue = new StringBuilder(); s3GuardConfigProvider.getServiceConfigs(templatePreparationObject, hdfsCoreSiteSafetyValveValue); List<ApiClusterTemplateConfig> list = new ArrayList<>(); if (StringUtils.isNotEmpty(hdfsCoreSiteSafetyValveValue.toString())) { list.add(config(CORE_SITE_SAFETY_VALVE, hdfsCoreSiteSafetyValveValue.toString())); } if (templatePreparationObject.getProductDetailsView() != null && templatePreparationObject.getProductDetailsView().getCm() != null && templatePreparationObject.getProductDetailsView().getCm().getVersion() != null) { String cmVersion = templatePreparationObject.getProductDetailsView().getCm().getVersion(); if (templatePreparationObject.getStackType() == StackType.DATALAKE && isVersionNewerOrEqualThanLimited(cmVersion, CLOUDERAMANAGER_VERSION_7_2_0)) { list.add(config("dfs_replication", "1")); list.add(config("service_health_suppression_hdfs_verify_ec_with_topology", "true")); } } return Collections.unmodifiableList(list); } }
HdfsConfigProvider implements CmTemplateComponentConfigProvider { @Override public List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject templatePreparationObject) { StringBuilder hdfsCoreSiteSafetyValveValue = new StringBuilder(); s3GuardConfigProvider.getServiceConfigs(templatePreparationObject, hdfsCoreSiteSafetyValveValue); List<ApiClusterTemplateConfig> list = new ArrayList<>(); if (StringUtils.isNotEmpty(hdfsCoreSiteSafetyValveValue.toString())) { list.add(config(CORE_SITE_SAFETY_VALVE, hdfsCoreSiteSafetyValveValue.toString())); } if (templatePreparationObject.getProductDetailsView() != null && templatePreparationObject.getProductDetailsView().getCm() != null && templatePreparationObject.getProductDetailsView().getCm().getVersion() != null) { String cmVersion = templatePreparationObject.getProductDetailsView().getCm().getVersion(); if (templatePreparationObject.getStackType() == StackType.DATALAKE && isVersionNewerOrEqualThanLimited(cmVersion, CLOUDERAMANAGER_VERSION_7_2_0)) { list.add(config("dfs_replication", "1")); list.add(config("service_health_suppression_hdfs_verify_ec_with_topology", "true")); } } return Collections.unmodifiableList(list); }  }
HdfsConfigProvider implements CmTemplateComponentConfigProvider { @Override public List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject templatePreparationObject) { StringBuilder hdfsCoreSiteSafetyValveValue = new StringBuilder(); s3GuardConfigProvider.getServiceConfigs(templatePreparationObject, hdfsCoreSiteSafetyValveValue); List<ApiClusterTemplateConfig> list = new ArrayList<>(); if (StringUtils.isNotEmpty(hdfsCoreSiteSafetyValveValue.toString())) { list.add(config(CORE_SITE_SAFETY_VALVE, hdfsCoreSiteSafetyValveValue.toString())); } if (templatePreparationObject.getProductDetailsView() != null && templatePreparationObject.getProductDetailsView().getCm() != null && templatePreparationObject.getProductDetailsView().getCm().getVersion() != null) { String cmVersion = templatePreparationObject.getProductDetailsView().getCm().getVersion(); if (templatePreparationObject.getStackType() == StackType.DATALAKE && isVersionNewerOrEqualThanLimited(cmVersion, CLOUDERAMANAGER_VERSION_7_2_0)) { list.add(config("dfs_replication", "1")); list.add(config("service_health_suppression_hdfs_verify_ec_with_topology", "true")); } } return Collections.unmodifiableList(list); }  @Override List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject templatePreparationObject); @Override String getServiceType(); @Override List<String> getRoleTypes(); @Override boolean isConfigurationNeeded(CmTemplateProcessor cmTemplateProcessor, TemplatePreparationObject source); }
HdfsConfigProvider implements CmTemplateComponentConfigProvider { @Override public List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject templatePreparationObject) { StringBuilder hdfsCoreSiteSafetyValveValue = new StringBuilder(); s3GuardConfigProvider.getServiceConfigs(templatePreparationObject, hdfsCoreSiteSafetyValveValue); List<ApiClusterTemplateConfig> list = new ArrayList<>(); if (StringUtils.isNotEmpty(hdfsCoreSiteSafetyValveValue.toString())) { list.add(config(CORE_SITE_SAFETY_VALVE, hdfsCoreSiteSafetyValveValue.toString())); } if (templatePreparationObject.getProductDetailsView() != null && templatePreparationObject.getProductDetailsView().getCm() != null && templatePreparationObject.getProductDetailsView().getCm().getVersion() != null) { String cmVersion = templatePreparationObject.getProductDetailsView().getCm().getVersion(); if (templatePreparationObject.getStackType() == StackType.DATALAKE && isVersionNewerOrEqualThanLimited(cmVersion, CLOUDERAMANAGER_VERSION_7_2_0)) { list.add(config("dfs_replication", "1")); list.add(config("service_health_suppression_hdfs_verify_ec_with_topology", "true")); } } return Collections.unmodifiableList(list); }  @Override List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject templatePreparationObject); @Override String getServiceType(); @Override List<String> getRoleTypes(); @Override boolean isConfigurationNeeded(CmTemplateProcessor cmTemplateProcessor, TemplatePreparationObject source);  }