Search in sources :

Example 21 with FieldValueModel

use of com.synopsys.integration.alert.common.rest.model.FieldValueModel in project hub-alert by blackducksoftware.

the class SettingsGlobalConfigurationFieldModelValidatorTest method missingProxyPassword.

@Test
public void missingProxyPassword() {
    Map<String, FieldValueModel> keyToValues = createProxyKeyToValues();
    FieldValueModel username = new FieldValueModel(List.of("username"), true);
    keyToValues.put(ProxyManager.KEY_PROXY_USERNAME, username);
    GlobalConfigurationValidatorAsserter validatorAsserter = createValidatorAsserter(keyToValues);
    validatorAsserter.assertMissingValue(ProxyManager.KEY_PROXY_PWD);
}
Also used : GlobalConfigurationValidatorAsserter(com.synopsys.integration.alert.test.common.channel.GlobalConfigurationValidatorAsserter) FieldValueModel(com.synopsys.integration.alert.common.rest.model.FieldValueModel) Test(org.junit.jupiter.api.Test)

Example 22 with FieldValueModel

use of com.synopsys.integration.alert.common.rest.model.FieldValueModel in project hub-alert by blackducksoftware.

the class AuthenticationConfigurationValidatorTest method missingLdapFields.

@Test
public void missingLdapFields() {
    Map<String, FieldValueModel> keyToValues = Map.of(AuthenticationDescriptor.KEY_LDAP_ENABLED, new FieldValueModel(List.of("true"), true));
    GlobalConfigurationValidatorAsserter validatorAsserter = createValidatorAsserter(keyToValues);
    validatorAsserter.assertCustom(alertFieldStatuses -> assertEquals(3, alertFieldStatuses.size(), alertFieldStatuses.toString()));
}
Also used : GlobalConfigurationValidatorAsserter(com.synopsys.integration.alert.test.common.channel.GlobalConfigurationValidatorAsserter) FieldValueModel(com.synopsys.integration.alert.common.rest.model.FieldValueModel) Test(org.junit.jupiter.api.Test)

Example 23 with FieldValueModel

use of com.synopsys.integration.alert.common.rest.model.FieldValueModel in project hub-alert by blackducksoftware.

the class AuthenticationConfigurationValidatorTest method hasSamlMetadataFile.

@Test
public void hasSamlMetadataFile() {
    Map<String, FieldValueModel> keyToValues = createValidSamlValues();
    keyToValues.remove(AuthenticationDescriptor.KEY_SAML_METADATA_URL);
    keyToValues.remove(AuthenticationDescriptor.KEY_SAML_ENTITY_BASE_URL);
    FilePersistenceUtil filePersistenceUtil = Mockito.mock(FilePersistenceUtil.class);
    Mockito.when(filePersistenceUtil.uploadFileExists(Mockito.anyString())).thenReturn(true);
    AuthenticationConfigurationFieldModelValidator authenticationConfigurationValidator = new AuthenticationConfigurationFieldModelValidator(filePersistenceUtil);
    Set<AlertFieldStatus> alertFieldStatuses = authenticationConfigurationValidator.validate(new FieldModel(new AuthenticationDescriptorKey().getUniversalKey(), ConfigContextEnum.GLOBAL.name(), keyToValues));
    assertEquals(1, alertFieldStatuses.size());
}
Also used : FilePersistenceUtil(com.synopsys.integration.alert.common.persistence.util.FilePersistenceUtil) AlertFieldStatus(com.synopsys.integration.alert.common.descriptor.config.field.errors.AlertFieldStatus) FieldModel(com.synopsys.integration.alert.common.rest.model.FieldModel) AuthenticationDescriptorKey(com.synopsys.integration.alert.component.authentication.descriptor.AuthenticationDescriptorKey) FieldValueModel(com.synopsys.integration.alert.common.rest.model.FieldValueModel) Test(org.junit.jupiter.api.Test)

Example 24 with FieldValueModel

use of com.synopsys.integration.alert.common.rest.model.FieldValueModel in project hub-alert by blackducksoftware.

the class AuthenticationConfigurationValidatorTest method verifyInvalidLdapAndSamlEnabled.

@Test
public void verifyInvalidLdapAndSamlEnabled() {
    Map<String, FieldValueModel> keyToValues = Map.of(AuthenticationDescriptor.KEY_LDAP_ENABLED, new FieldValueModel(List.of("true"), true), AuthenticationDescriptor.KEY_SAML_ENABLED, new FieldValueModel(List.of("true"), true));
    GlobalConfigurationValidatorAsserter validatorAsserter = createValidatorAsserter(keyToValues);
    validatorAsserter.assertCustom(alertFieldStatuses -> assertTrue(alertFieldStatuses.size() >= 2, alertFieldStatuses.toString()));
}
Also used : GlobalConfigurationValidatorAsserter(com.synopsys.integration.alert.test.common.channel.GlobalConfigurationValidatorAsserter) FieldValueModel(com.synopsys.integration.alert.common.rest.model.FieldValueModel) Test(org.junit.jupiter.api.Test)

Example 25 with FieldValueModel

use of com.synopsys.integration.alert.common.rest.model.FieldValueModel in project hub-alert by blackducksoftware.

the class SchedulingConfigurationValidatorTest method createValidConfig.

private Map<String, FieldValueModel> createValidConfig() {
    Map<String, FieldValueModel> keyToValues = new HashMap<>();
    FieldValueModel processingHour = new FieldValueModel(List.of("1"), true);
    FieldValueModel purgeFrequency = new FieldValueModel(List.of("3"), true);
    keyToValues.put(SchedulingDescriptor.KEY_DAILY_PROCESSOR_HOUR_OF_DAY, processingHour);
    keyToValues.put(SchedulingDescriptor.KEY_PURGE_DATA_FREQUENCY_DAYS, purgeFrequency);
    return keyToValues;
}
Also used : HashMap(java.util.HashMap) FieldValueModel(com.synopsys.integration.alert.common.rest.model.FieldValueModel)

Aggregations

FieldValueModel (com.synopsys.integration.alert.common.rest.model.FieldValueModel)58 HashMap (java.util.HashMap)27 FieldModel (com.synopsys.integration.alert.common.rest.model.FieldModel)24 Test (org.junit.jupiter.api.Test)18 ConfigurationFieldModel (com.synopsys.integration.alert.common.persistence.model.ConfigurationFieldModel)12 AlertFieldStatus (com.synopsys.integration.alert.common.descriptor.config.field.errors.AlertFieldStatus)6 GlobalConfigurationValidatorAsserter (com.synopsys.integration.alert.test.common.channel.GlobalConfigurationValidatorAsserter)6 JobFieldModel (com.synopsys.integration.alert.common.rest.model.JobFieldModel)5 JobProviderProjectFieldModel (com.synopsys.integration.alert.common.rest.model.JobProviderProjectFieldModel)4 ConfigurationManager (com.synopsys.integration.alert.performance.utility.ConfigurationManager)4 IntegrationPerformanceTestRunner (com.synopsys.integration.alert.performance.utility.IntegrationPerformanceTestRunner)4 Disabled (org.junit.jupiter.api.Disabled)4 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)4 ConfigContextEnum (com.synopsys.integration.alert.common.enumeration.ConfigContextEnum)3 DescriptorAccessor (com.synopsys.integration.alert.common.persistence.accessor.DescriptorAccessor)3 ConfigurationModel (com.synopsys.integration.alert.common.persistence.model.ConfigurationModel)3 EncryptionUtility (com.synopsys.integration.alert.common.security.EncryptionUtility)3 AlertRequestUtility (com.synopsys.integration.alert.performance.utility.AlertRequestUtility)3 BlackDuckProviderService (com.synopsys.integration.alert.performance.utility.BlackDuckProviderService)3 List (java.util.List)3