Search in sources :

Example 6 with GlobalConfigurationValidatorAsserter

use of com.synopsys.integration.alert.test.common.channel.GlobalConfigurationValidatorAsserter 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 7 with GlobalConfigurationValidatorAsserter

use of com.synopsys.integration.alert.test.common.channel.GlobalConfigurationValidatorAsserter 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 8 with GlobalConfigurationValidatorAsserter

use of com.synopsys.integration.alert.test.common.channel.GlobalConfigurationValidatorAsserter 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 9 with GlobalConfigurationValidatorAsserter

use of com.synopsys.integration.alert.test.common.channel.GlobalConfigurationValidatorAsserter in project hub-alert by blackducksoftware.

the class AuthenticationConfigurationValidatorTest method verifyValidSamlConfiguration.

@Test
public void verifyValidSamlConfiguration() {
    GlobalConfigurationValidatorAsserter validatorAsserter = createValidatorAsserter(createValidSamlValues());
    validatorAsserter.assertValid();
}
Also used : GlobalConfigurationValidatorAsserter(com.synopsys.integration.alert.test.common.channel.GlobalConfigurationValidatorAsserter) Test(org.junit.jupiter.api.Test)

Example 10 with GlobalConfigurationValidatorAsserter

use of com.synopsys.integration.alert.test.common.channel.GlobalConfigurationValidatorAsserter in project hub-alert by blackducksoftware.

the class AuthenticationConfigurationValidatorTest method createValidatorAsserter.

private GlobalConfigurationValidatorAsserter createValidatorAsserter(Map<String, FieldValueModel> keyToValues) {
    AlertProperties mockAlertProperties = new MockAlertProperties();
    FilePersistenceUtil filePersistenceUtil = new FilePersistenceUtil(mockAlertProperties, new Gson());
    return new GlobalConfigurationValidatorAsserter(new AuthenticationDescriptorKey().getUniversalKey(), new AuthenticationConfigurationFieldModelValidator(filePersistenceUtil), keyToValues);
}
Also used : FilePersistenceUtil(com.synopsys.integration.alert.common.persistence.util.FilePersistenceUtil) MockAlertProperties(com.synopsys.integration.alert.test.common.MockAlertProperties) Gson(com.google.gson.Gson) AlertProperties(com.synopsys.integration.alert.common.AlertProperties) MockAlertProperties(com.synopsys.integration.alert.test.common.MockAlertProperties) GlobalConfigurationValidatorAsserter(com.synopsys.integration.alert.test.common.channel.GlobalConfigurationValidatorAsserter) AuthenticationDescriptorKey(com.synopsys.integration.alert.component.authentication.descriptor.AuthenticationDescriptorKey)

Aggregations

GlobalConfigurationValidatorAsserter (com.synopsys.integration.alert.test.common.channel.GlobalConfigurationValidatorAsserter)32 Test (org.junit.jupiter.api.Test)31 FieldValueModel (com.synopsys.integration.alert.common.rest.model.FieldValueModel)6 BlackDuckProviderKey (com.synopsys.integration.alert.descriptor.api.BlackDuckProviderKey)4 EmailChannelKey (com.synopsys.integration.alert.descriptor.api.EmailChannelKey)2 Gson (com.google.gson.Gson)1 AlertProperties (com.synopsys.integration.alert.common.AlertProperties)1 FilePersistenceUtil (com.synopsys.integration.alert.common.persistence.util.FilePersistenceUtil)1 AuthenticationDescriptorKey (com.synopsys.integration.alert.component.authentication.descriptor.AuthenticationDescriptorKey)1 MockAlertProperties (com.synopsys.integration.alert.test.common.MockAlertProperties)1