Search in sources :

Example 1 with EmailChannelKey

use of com.synopsys.integration.alert.descriptor.api.EmailChannelKey in project hub-alert by blackducksoftware.

the class EmailGlobalConfigurationFieldModelValidatorTest method verifyValidConfig.

/*
     * Email host: Required
     * Email from: Required
     *
     * Email user: Required if email auth is true
     * Email password: Required if email auth is true
     */
@Test
public void verifyValidConfig() {
    GlobalConfigurationValidatorAsserter globalConfigurationValidatorAsserter = new GlobalConfigurationValidatorAsserter(new EmailChannelKey().getUniversalKey(), new EmailGlobalConfigurationFieldModelValidator(), createDefaultKeyToValues());
    globalConfigurationValidatorAsserter.assertValid();
}
Also used : EmailChannelKey(com.synopsys.integration.alert.descriptor.api.EmailChannelKey) GlobalConfigurationValidatorAsserter(com.synopsys.integration.alert.test.common.channel.GlobalConfigurationValidatorAsserter) Test(org.junit.jupiter.api.Test)

Example 2 with EmailChannelKey

use of com.synopsys.integration.alert.descriptor.api.EmailChannelKey in project hub-alert by blackducksoftware.

the class StaticJobAccessorTestIT method verifyEmailSavesTest.

@Test
public void verifyEmailSavesTest() {
    EmailJobDetailsModel emailJobDetailsModel = new EmailJobDetailsModel(UUID.randomUUID(), "subjectLine", false, false, "attachmentFileType", List.of());
    DistributionJobRequestModel jobRequestModel = createJobRequestModel(emailJobDetailsModel, new EmailChannelKey());
    createAndAssertJob(jobRequestModel);
}
Also used : EmailChannelKey(com.synopsys.integration.alert.descriptor.api.EmailChannelKey) EmailJobDetailsModel(com.synopsys.integration.alert.common.persistence.model.job.details.EmailJobDetailsModel) DistributionJobRequestModel(com.synopsys.integration.alert.common.persistence.model.job.DistributionJobRequestModel) AlertIntegrationTest(com.synopsys.integration.alert.util.AlertIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 3 with EmailChannelKey

use of com.synopsys.integration.alert.descriptor.api.EmailChannelKey in project hub-alert by blackducksoftware.

the class EmailGlobalConfigurationFieldModelValidatorTest method verifyMissingAuthPassword.

@Test
public void verifyMissingAuthPassword() {
    Map<String, FieldValueModel> defaultKeyToValues = createDefaultKeyToValues();
    FieldValueModel authFieldValueModel = new FieldValueModel(List.of("true"), true);
    FieldValueModel usernameFieldValueModel = new FieldValueModel(List.of("username"), true);
    defaultKeyToValues.put(EmailPropertyKeys.JAVAMAIL_AUTH_KEY.getPropertyKey(), authFieldValueModel);
    defaultKeyToValues.put(EmailPropertyKeys.JAVAMAIL_USER_KEY.getPropertyKey(), usernameFieldValueModel);
    GlobalConfigurationValidatorAsserter globalConfigurationValidatorAsserter = new GlobalConfigurationValidatorAsserter(new EmailChannelKey().getUniversalKey(), new EmailGlobalConfigurationFieldModelValidator(), defaultKeyToValues);
    globalConfigurationValidatorAsserter.assertMissingValue(EmailPropertyKeys.JAVAMAIL_PASSWORD_KEY.getPropertyKey());
}
Also used : EmailChannelKey(com.synopsys.integration.alert.descriptor.api.EmailChannelKey) 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 4 with EmailChannelKey

use of com.synopsys.integration.alert.descriptor.api.EmailChannelKey in project hub-alert by blackducksoftware.

the class EmailGlobalConfigurationFieldModelValidatorTest method verifyMissingAuth.

@Test
public void verifyMissingAuth() {
    Map<String, FieldValueModel> defaultKeyToValues = createDefaultKeyToValues();
    FieldValueModel authFieldValueModel = new FieldValueModel(List.of("true"), true);
    defaultKeyToValues.put(EmailPropertyKeys.JAVAMAIL_AUTH_KEY.getPropertyKey(), authFieldValueModel);
    FieldModel fieldModel = new FieldModel(new EmailChannelKey().getUniversalKey(), ConfigContextEnum.GLOBAL.name(), defaultKeyToValues);
    EmailGlobalConfigurationFieldModelValidator emailGlobalConfigurationValidator = new EmailGlobalConfigurationFieldModelValidator();
    Set<AlertFieldStatus> alertFieldStatuses = emailGlobalConfigurationValidator.validate(fieldModel);
    assertEquals(2, alertFieldStatuses.size());
}
Also used : EmailChannelKey(com.synopsys.integration.alert.descriptor.api.EmailChannelKey) AlertFieldStatus(com.synopsys.integration.alert.common.descriptor.config.field.errors.AlertFieldStatus) FieldModel(com.synopsys.integration.alert.common.rest.model.FieldModel) FieldValueModel(com.synopsys.integration.alert.common.rest.model.FieldValueModel) Test(org.junit.jupiter.api.Test)

Aggregations

EmailChannelKey (com.synopsys.integration.alert.descriptor.api.EmailChannelKey)4 Test (org.junit.jupiter.api.Test)4 FieldValueModel (com.synopsys.integration.alert.common.rest.model.FieldValueModel)2 GlobalConfigurationValidatorAsserter (com.synopsys.integration.alert.test.common.channel.GlobalConfigurationValidatorAsserter)2 AlertFieldStatus (com.synopsys.integration.alert.common.descriptor.config.field.errors.AlertFieldStatus)1 DistributionJobRequestModel (com.synopsys.integration.alert.common.persistence.model.job.DistributionJobRequestModel)1 EmailJobDetailsModel (com.synopsys.integration.alert.common.persistence.model.job.details.EmailJobDetailsModel)1 FieldModel (com.synopsys.integration.alert.common.rest.model.FieldModel)1 AlertIntegrationTest (com.synopsys.integration.alert.util.AlertIntegrationTest)1