### Question:
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);  }### Answer:
@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()); }
@Test public void testGetHdfsServiceConfigsWithS3FileSystemNoDynamoTable() { doNothing().when(s3GuardConfigProvider).getServiceConfigs(any(TemplatePreparationObject.class), any(StringBuilder.class)); TemplatePreparationObject preparationObject = getTemplatePreparationObject(true, false, false); String inputJson = getBlueprintText("input/clouderamanager.bp"); CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson); List<ApiClusterTemplateConfig> serviceConfigs = underTest.getServiceConfigs(cmTemplateProcessor, preparationObject); assertEquals(0, serviceConfigs.size()); }
@Test public void testGetHdsfServiceConfigsFor720() { doNothing().when(s3GuardConfigProvider).getServiceConfigs(any(TemplatePreparationObject.class), any(StringBuilder.class)); TemplatePreparationObject preparationObject = getTemplatePreparationObject(true, false, false); ClouderaManagerRepo cmRepo = new ClouderaManagerRepo(); cmRepo.setVersion("7.2.0"); preparationObject.getProductDetailsView().setCm(cmRepo); String inputJson = getBlueprintText("input/clouderamanager.bp"); CmTemplateProcessor cmTemplateProcessor = new CmTemplateProcessor(inputJson); List<ApiClusterTemplateConfig> serviceConfigs = underTest.getServiceConfigs(cmTemplateProcessor, preparationObject); assertEquals(2, serviceConfigs.size()); assertEquals("dfs_replication", serviceConfigs.get(0).getName()); assertEquals("service_health_suppression_hdfs_verify_ec_with_topology", serviceConfigs.get(1).getName()); }