@Test public void isConfigurationNeededWhenNotPresentedHdfsNotAndStorageConfiguredMustReturnTrue() { CmTemplateProcessor mockTemplateProcessor = mock(CmTemplateProcessor.class); TemplatePreparationObject templatePreparationObject = mock(TemplatePreparationObject.class); BaseFileSystemConfigurationsView fileSystemConfiguration = mock(BaseFileSystemConfigurationsView.class); List<StorageLocationView> storageLocationViews = new ArrayList<>(); StorageLocation storageLocation = new StorageLocation(); storageLocation.setConfigFile("core_defaultfs1"); storageLocation.setProperty("core_defaultfs1"); storageLocation.setValue("s3a: storageLocationViews.add(new StorageLocationView(storageLocation)); when(fileSystemConfiguration.getLocations()).thenReturn(storageLocationViews); Optional<BaseFileSystemConfigurationsView> fileSystemConfigurationView = Optional.of(fileSystemConfiguration); when(mockTemplateProcessor.isRoleTypePresentInService(HDFS, List.of(NAMENODE))).thenReturn(false); when(templatePreparationObject.getFileSystemConfigurationView()).thenReturn(fileSystemConfigurationView); Assert.assertFalse(underTest.isConfigurationNeeded(mockTemplateProcessor, templatePreparationObject)); }
@Override public boolean isConfigurationNeeded(CmTemplateProcessor cmTemplateProcessor, TemplatePreparationObject source) { return !cmTemplateProcessor.isRoleTypePresentInService(HDFS, Lists.newArrayList(NAMENODE)) && source.getFileSystemConfigurationView().isPresent() && ConfigUtils.getStorageLocationForServiceProperty(source, CORE_DEFAULTFS).isPresent(); }
CoreConfigProvider extends AbstractRoleConfigProvider { @Override public boolean isConfigurationNeeded(CmTemplateProcessor cmTemplateProcessor, TemplatePreparationObject source) { return !cmTemplateProcessor.isRoleTypePresentInService(HDFS, Lists.newArrayList(NAMENODE)) && source.getFileSystemConfigurationView().isPresent() && ConfigUtils.getStorageLocationForServiceProperty(source, CORE_DEFAULTFS).isPresent(); } }
CoreConfigProvider extends AbstractRoleConfigProvider { @Override public boolean isConfigurationNeeded(CmTemplateProcessor cmTemplateProcessor, TemplatePreparationObject source) { return !cmTemplateProcessor.isRoleTypePresentInService(HDFS, Lists.newArrayList(NAMENODE)) && source.getFileSystemConfigurationView().isPresent() && ConfigUtils.getStorageLocationForServiceProperty(source, CORE_DEFAULTFS).isPresent(); }  }
CoreConfigProvider extends AbstractRoleConfigProvider { @Override public boolean isConfigurationNeeded(CmTemplateProcessor cmTemplateProcessor, TemplatePreparationObject source) { return !cmTemplateProcessor.isRoleTypePresentInService(HDFS, Lists.newArrayList(NAMENODE)) && source.getFileSystemConfigurationView().isPresent() && ConfigUtils.getStorageLocationForServiceProperty(source, CORE_DEFAULTFS).isPresent(); }  @Override List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject source); @Override Map<String, ApiClusterTemplateService> getAdditionalServices(CmTemplateProcessor cmTemplateProcessor, TemplatePreparationObject source); @Override String getServiceType(); @Override List<String> getRoleTypes(); @Override boolean isConfigurationNeeded(CmTemplateProcessor cmTemplateProcessor, TemplatePreparationObject source); }
CoreConfigProvider extends AbstractRoleConfigProvider { @Override public boolean isConfigurationNeeded(CmTemplateProcessor cmTemplateProcessor, TemplatePreparationObject source) { return !cmTemplateProcessor.isRoleTypePresentInService(HDFS, Lists.newArrayList(NAMENODE)) && source.getFileSystemConfigurationView().isPresent() && ConfigUtils.getStorageLocationForServiceProperty(source, CORE_DEFAULTFS).isPresent(); }  @Override List<ApiClusterTemplateConfig> getServiceConfigs(CmTemplateProcessor templateProcessor, TemplatePreparationObject source); @Override Map<String, ApiClusterTemplateService> getAdditionalServices(CmTemplateProcessor cmTemplateProcessor, TemplatePreparationObject source); @Override String getServiceType(); @Override List<String> getRoleTypes(); @Override boolean isConfigurationNeeded(CmTemplateProcessor cmTemplateProcessor, TemplatePreparationObject source); static final String CORE_DEFAULTFS; }