Search in sources :

Example 26 with GlobalConfigurationValidatorAsserter

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

the class BlackDuckGlobalConfigurationFieldModelValidatorTest method givesTimeoutWarning.

@Test
public void givesTimeoutWarning() {
    BlackDuckGlobalConfigurationFieldModelValidator blackDuckGlobalConfigurationValidator = new BlackDuckGlobalConfigurationFieldModelValidator(createDefaultConfigurationAccessor());
    GlobalConfigurationValidatorAsserter globalConfigurationValidatorAsserter = new GlobalConfigurationValidatorAsserter(new BlackDuckProviderKey().getUniversalKey(), blackDuckGlobalConfigurationValidator, createDefaultKeyToValues());
    globalConfigurationValidatorAsserter.assertInvalidValue(BlackDuckDescriptor.KEY_BLACKDUCK_TIMEOUT, "500", (fieldStatus) -> assertEquals(FieldStatusSeverity.WARNING, fieldStatus.getSeverity()));
}
Also used : BlackDuckProviderKey(com.synopsys.integration.alert.descriptor.api.BlackDuckProviderKey) GlobalConfigurationValidatorAsserter(com.synopsys.integration.alert.test.common.channel.GlobalConfigurationValidatorAsserter) Test(org.junit.jupiter.api.Test)

Example 27 with GlobalConfigurationValidatorAsserter

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

the class SettingsGlobalConfigurationFieldModelValidatorTest method saltTooShort.

@Test
public void saltTooShort() {
    GlobalConfigurationValidatorAsserter validatorAsserter = createValidatorAsserter();
    validatorAsserter.assertInvalidValue(SettingsDescriptor.KEY_ENCRYPTION_GLOBAL_SALT, "short");
}
Also used : GlobalConfigurationValidatorAsserter(com.synopsys.integration.alert.test.common.channel.GlobalConfigurationValidatorAsserter) Test(org.junit.jupiter.api.Test)

Example 28 with GlobalConfigurationValidatorAsserter

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

the class SettingsGlobalConfigurationFieldModelValidatorTest method validHostAndPort.

@Test
public void validHostAndPort() {
    Map<String, FieldValueModel> keyToValues = createProxyKeyToValues();
    GlobalConfigurationValidatorAsserter validatorAsserter = createValidatorAsserter(keyToValues);
    validatorAsserter.assertValid();
}
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 29 with GlobalConfigurationValidatorAsserter

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

the class AuthenticationConfigurationValidatorTest method missingSamlFields.

@Test
public void missingSamlFields() {
    Map<String, FieldValueModel> keyToValues = Map.of(AuthenticationDescriptor.KEY_SAML_ENABLED, new FieldValueModel(List.of("true"), true));
    GlobalConfigurationValidatorAsserter validatorAsserter = createValidatorAsserter(keyToValues);
    validatorAsserter.assertCustom(alertFieldStatuses -> assertEquals(5, 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 30 with GlobalConfigurationValidatorAsserter

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

the class AuthenticationConfigurationValidatorTest method verifyValidConfiguration.

/*
     * LDAP Enabled: Not allowed with SAML Enabled
     * LDAP Server: required with LDAP Enabled
     * LDAP Manager Dn: required with LDAP Enabled
     * LDAP Manager Password: required with LDAP Enabled
     *
     * LDAP authentication type: has option
     * LDAP referral: has option
     */
/*
     * SAML Enabled: Not allowed with LDAP Enabled
     * SAML force auth: required with SAML Enabled
     * SAML Entity ID: required with SAML Enabled
     * SAML Entity base url: required with SAML Enabled, required without SAML metadata file
     * SAML Metadata url: required without SAML metadata file
     * SAML metadata file: required without SAML metadata url
     */
@Test
public void verifyValidConfiguration() {
    GlobalConfigurationValidatorAsserter validatorAsserter = createValidatorAsserter(Map.of());
    validatorAsserter.assertValid();
}
Also used : GlobalConfigurationValidatorAsserter(com.synopsys.integration.alert.test.common.channel.GlobalConfigurationValidatorAsserter) Test(org.junit.jupiter.api.Test)

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