Search in sources :

Example 11 with DistributionJobDetailsModel

use of com.synopsys.integration.alert.common.persistence.model.job.details.DistributionJobDetailsModel in project hub-alert by blackducksoftware.

the class IssueTrackerChannelTest method distributeMessagesTest.

@Test
public void distributeMessagesTest() throws AlertException {
    IssueTrackerModelExtractor<String> modelExtractor = new IssueTrackerModelExtractor<>(createFormatter(), null);
    IssueTrackerMessageSender<String> messageSender = createMessageSender();
    IssueTrackerProcessor<String> processor = new IssueTrackerProcessor<>(modelExtractor, messageSender);
    IssueTrackerProcessorFactory<DistributionJobDetailsModel, String> processorFactory = x -> processor;
    IssueTrackerResponsePostProcessor postProcessor = new IssueTrackerResponsePostProcessor() {

        @Override
        public <T extends Serializable> void postProcess(IssueTrackerResponse<T> response) {
        }
    };
    IssueTrackerChannel<DistributionJobDetailsModel, String> issueTrackerChannel = new IssueTrackerChannel<>(processorFactory, postProcessor) {
    };
    MessageResult testResult = issueTrackerChannel.distributeMessages(null, ProviderMessageHolder.empty(), null);
    IssueTrackerResponse<?> processorResponse = processor.processMessages(ProviderMessageHolder.empty(), "jobName");
    assertEquals(processorResponse.getStatusMessage(), testResult.getStatusMessage());
}
Also used : IssueTrackerIssueCommenter(com.synopsys.integration.alert.api.channel.issue.send.IssueTrackerIssueCommenter) MessageResult(com.synopsys.integration.alert.common.message.model.MessageResult) IssueTrackerMessageSender(com.synopsys.integration.alert.api.channel.issue.send.IssueTrackerMessageSender) ExistingIssueDetails(com.synopsys.integration.alert.api.channel.issue.search.ExistingIssueDetails) IssueOperation(com.synopsys.integration.alert.common.channel.issuetracker.enumeration.IssueOperation) IssueCreationModel(com.synopsys.integration.alert.api.channel.issue.model.IssueCreationModel) DistributionJobDetailsModel(com.synopsys.integration.alert.common.persistence.model.job.details.DistributionJobDetailsModel) IssueTrackerIssueTransitioner(com.synopsys.integration.alert.api.channel.issue.send.IssueTrackerIssueTransitioner) AlertException(com.synopsys.integration.alert.api.common.model.exception.AlertException) Serializable(java.io.Serializable) Test(org.junit.jupiter.api.Test) Nullable(org.jetbrains.annotations.Nullable) IssueTrackerMessageFormatter(com.synopsys.integration.alert.api.channel.issue.convert.IssueTrackerMessageFormatter) IssueTrackerIssueCreator(com.synopsys.integration.alert.api.channel.issue.send.IssueTrackerIssueCreator) Optional(java.util.Optional) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) IssueTrackerResponse(com.synopsys.integration.alert.api.channel.issue.model.IssueTrackerResponse) ProjectIssueModel(com.synopsys.integration.alert.api.channel.issue.model.ProjectIssueModel) ProviderMessageHolder(com.synopsys.integration.alert.processor.api.extract.model.ProviderMessageHolder) Serializable(java.io.Serializable) MessageResult(com.synopsys.integration.alert.common.message.model.MessageResult) DistributionJobDetailsModel(com.synopsys.integration.alert.common.persistence.model.job.details.DistributionJobDetailsModel) IssueTrackerResponse(com.synopsys.integration.alert.api.channel.issue.model.IssueTrackerResponse) Test(org.junit.jupiter.api.Test)

Aggregations

DistributionJobDetailsModel (com.synopsys.integration.alert.common.persistence.model.job.details.DistributionJobDetailsModel)11 ChannelKey (com.synopsys.integration.alert.descriptor.api.model.ChannelKey)6 UUID (java.util.UUID)6 AlertException (com.synopsys.integration.alert.api.common.model.exception.AlertException)5 Test (org.junit.jupiter.api.Test)5 Optional (java.util.Optional)4 JobDetailsAccessor (com.synopsys.integration.alert.common.persistence.accessor.JobDetailsAccessor)3 ProcessingAuditAccessor (com.synopsys.integration.alert.common.persistence.accessor.ProcessingAuditAccessor)3 DistributionEvent (com.synopsys.integration.alert.processor.api.distribute.DistributionEvent)3 Set (java.util.Set)3 Mockito (org.mockito.Mockito)3 MessageResult (com.synopsys.integration.alert.common.message.model.MessageResult)2 AzureBoardsJobDetailsEntity (com.synopsys.integration.alert.database.job.azure.boards.AzureBoardsJobDetailsEntity)2 JiraCloudJobDetailsEntity (com.synopsys.integration.alert.database.job.jira.cloud.JiraCloudJobDetailsEntity)2 MSTeamsJobDetailsEntity (com.synopsys.integration.alert.database.job.msteams.MSTeamsJobDetailsEntity)2 SlackJobDetailsEntity (com.synopsys.integration.alert.database.job.slack.SlackJobDetailsEntity)2 ProviderMessageHolder (com.synopsys.integration.alert.processor.api.extract.model.ProviderMessageHolder)2 List (java.util.List)2 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)2 AbstractChannelMessageConverter (com.synopsys.integration.alert.api.channel.convert.AbstractChannelMessageConverter)1