use of com.synopsys.integration.alert.common.persistence.accessor.SystemMessageAccessor in project hub-alert by blackducksoftware.
the class ProviderConfigMissingValidatorTest method testValidConfigurations.
@Test
public void testValidConfigurations() {
SystemMessageAccessor systemMessageAccessor = Mockito.mock(SystemMessageAccessor.class);
ConfigurationModelConfigurationAccessor configurationModelConfigurationAccessor = Mockito.mock(ConfigurationModelConfigurationAccessor.class);
List<Provider> providers = List.of(Mockito.mock(Provider.class));
ConfigurationModel model = Mockito.mock(ConfigurationModel.class);
Mockito.when(model.getCopyOfFieldList()).thenReturn(List.of(Mockito.mock(ConfigurationFieldModel.class)));
Mockito.when(configurationModelConfigurationAccessor.getConfigurationsByDescriptorKeyAndContext(Mockito.any(), Mockito.any())).thenReturn(List.of(model));
ProviderConfigMissingValidator validator = new ProviderConfigMissingValidator(systemMessageAccessor, providers, configurationModelConfigurationAccessor);
validator.validate();
Mockito.verify(systemMessageAccessor, Mockito.never()).addSystemMessage(Mockito.anyString(), Mockito.any(SystemMessageSeverity.class), Mockito.anyString());
}
use of com.synopsys.integration.alert.common.persistence.accessor.SystemMessageAccessor in project hub-alert by blackducksoftware.
the class ProviderConfigMissingValidatorTest method testEmptyConfigurationsList.
@Test
public void testEmptyConfigurationsList() {
SystemMessageAccessor systemMessageAccessor = Mockito.mock(SystemMessageAccessor.class);
ConfigurationModelConfigurationAccessor configurationModelConfigurationAccessor = Mockito.mock(ConfigurationModelConfigurationAccessor.class);
List<Provider> providers = List.of(Mockito.mock(Provider.class));
Mockito.when(configurationModelConfigurationAccessor.getConfigurationsByDescriptorKeyAndContext(Mockito.any(ProviderKey.class), Mockito.any(ConfigContextEnum.class))).thenReturn(List.of());
ProviderConfigMissingValidator validator = new ProviderConfigMissingValidator(systemMessageAccessor, providers, configurationModelConfigurationAccessor);
validator.validate();
Mockito.verify(systemMessageAccessor).addSystemMessage(Mockito.anyString(), Mockito.any(SystemMessageSeverity.class), Mockito.anyString());
}
use of com.synopsys.integration.alert.common.persistence.accessor.SystemMessageAccessor in project hub-alert by blackducksoftware.
the class SystemValidatorTest method testValidate.
@Test
public void testValidate() {
BlackDuckProperties blackDuckProperties = Mockito.mock(BlackDuckProperties.class);
Mockito.when(blackDuckProperties.getBlackDuckUrl()).thenReturn(Optional.of("Black Duck URL"));
Mockito.when(blackDuckProperties.getApiToken()).thenReturn("Black Duck API Token");
Mockito.when(blackDuckProperties.getBlackDuckTimeout()).thenReturn(BlackDuckProperties.DEFAULT_TIMEOUT);
SettingsSystemValidator settingsSystemValidator = Mockito.mock(SettingsSystemValidator.class);
ConfigurationModelConfigurationAccessor configurationModelConfigurationAccessor = Mockito.mock(ConfigurationModelConfigurationAccessor.class);
UserSystemValidator userSystemValidator = Mockito.mock(UserSystemValidator.class);
SystemMessageAccessor systemMessageAccessor = Mockito.mock(SystemMessageAccessor.class);
SystemMessageInitializer systemValidator = new SystemMessageInitializer(List.of(), settingsSystemValidator, configurationModelConfigurationAccessor, userSystemValidator, systemMessageAccessor);
systemValidator.validate();
}
use of com.synopsys.integration.alert.common.persistence.accessor.SystemMessageAccessor in project hub-alert by blackducksoftware.
the class ProviderConfigMissingValidatorTest method testMissingProviders.
@Test
public void testMissingProviders() {
SystemMessageAccessor systemMessageAccessor = Mockito.mock(SystemMessageAccessor.class);
ConfigurationModelConfigurationAccessor configurationModelConfigurationAccessor = Mockito.mock(ConfigurationModelConfigurationAccessor.class);
List<Provider> providers = List.of();
ProviderConfigMissingValidator validator = new ProviderConfigMissingValidator(systemMessageAccessor, providers, configurationModelConfigurationAccessor);
validator.validate();
Mockito.verify(systemMessageAccessor, Mockito.never()).addSystemMessage(Mockito.anyString(), Mockito.any(SystemMessageSeverity.class), Mockito.any(SystemMessageType.class));
}
use of com.synopsys.integration.alert.common.persistence.accessor.SystemMessageAccessor in project hub-alert by blackducksoftware.
the class ProviderConfigMissingValidatorTest method testEmptyConfigurations.
@Test
public void testEmptyConfigurations() {
SystemMessageAccessor systemMessageAccessor = Mockito.mock(SystemMessageAccessor.class);
ConfigurationModelConfigurationAccessor configurationModelConfigurationAccessor = Mockito.mock(ConfigurationModelConfigurationAccessor.class);
List<Provider> providers = List.of(Mockito.mock(Provider.class));
ConfigurationModel model = Mockito.mock(ConfigurationModel.class);
Mockito.when(model.getCopyOfFieldList()).thenReturn(List.of());
Mockito.when(configurationModelConfigurationAccessor.getConfigurationsByDescriptorKeyAndContext(Mockito.any(ProviderKey.class), Mockito.any(ConfigContextEnum.class))).thenReturn(List.of(model));
ProviderConfigMissingValidator validator = new ProviderConfigMissingValidator(systemMessageAccessor, providers, configurationModelConfigurationAccessor);
validator.validate();
Mockito.verify(systemMessageAccessor).addSystemMessage(Mockito.anyString(), Mockito.any(SystemMessageSeverity.class), Mockito.anyString());
}
Aggregations