use of com.synopsys.integration.alert.api.channel.issue.send.IssueTrackerMessageSender in project hub-alert by blackducksoftware.
the class IssueTrackerFieldModelTestActionTest method testConfigNoReopen.
@Test
public void testConfigNoReopen() throws AlertException {
IssueTrackerMessageSender<String> messageSender = Mockito.mock(IssueTrackerMessageSender.class);
Mockito.when(messageSender.sendMessages(Mockito.any())).thenReturn(List.of(TEST_ISSUE_RESPONSE_MODEL));
IssueTrackerMessageSenderFactory<TestJobDetails, String> messageSenderFactory = distributionDetails -> messageSender;
TestIssueTrackerTestAction issueTrackerTestAction = new TestIssueTrackerTestAction(messageSenderFactory, true, false);
MessageResult messageResult = issueTrackerTestAction.testConfig(TEST_JOB_MODEL, "jobName", null, null);
assertFalse(messageResult.hasErrors(), EXPECTED_NO_ERRORS);
assertFalse(messageResult.hasWarnings(), EXPECTED_NO_WARNINGS);
}
use of com.synopsys.integration.alert.api.channel.issue.send.IssueTrackerMessageSender in project hub-alert by blackducksoftware.
the class JiraCloudMessageSenderFactory method createMessageSender.
public IssueTrackerMessageSender<String> createMessageSender(IssueService issueService, JiraCloudJobDetailsModel distributionDetails, ProjectService projectService, JiraIssueCreationRequestCreator issueCreationRequestCreator, JiraIssueAlertPropertiesManager issuePropertiesManager, JiraErrorMessageUtility jiraErrorMessageUtility) {
// Jira Services
IssueTrackerIssueResponseCreator issueResponseCreator = new IssueTrackerIssueResponseCreator(callbackInfoCreator);
// Message Sender Requirements
JiraCloudIssueCommenter issueCommenter = new JiraCloudIssueCommenter(issueResponseCreator, issueService, distributionDetails);
JiraCloudIssueTransitioner issueTransitioner = new JiraCloudIssueTransitioner(issueCommenter, issueResponseCreator, distributionDetails, issueService);
JiraCloudIssueCreator issueCreator = new JiraCloudIssueCreator(channelKey, issueCommenter, callbackInfoCreator, distributionDetails, issueService, projectService, issueCreationRequestCreator, issuePropertiesManager, jiraErrorMessageUtility, issueCategoryRetriever);
return new IssueTrackerMessageSender<>(issueCreator, issueTransitioner, issueCommenter);
}
use of com.synopsys.integration.alert.api.channel.issue.send.IssueTrackerMessageSender in project hub-alert by blackducksoftware.
the class JiraServerMessageSenderFactory method createMessageSender.
public IssueTrackerMessageSender<String> createMessageSender(IssueService issueService, JiraServerJobDetailsModel distributionDetails, ProjectService projectService, JiraIssueCreationRequestCreator issueCreationRequestCreator, JiraIssueAlertPropertiesManager issuePropertiesManager, JiraErrorMessageUtility jiraErrorMessageUtility) {
IssueTrackerIssueResponseCreator issueResponseCreator = new IssueTrackerIssueResponseCreator(callbackInfoCreator);
// Message Sender Requirements
JiraServerIssueCommenter commenter = new JiraServerIssueCommenter(issueResponseCreator, issueService, distributionDetails);
JiraServerIssueTransitioner transitioner = new JiraServerIssueTransitioner(commenter, issueResponseCreator, distributionDetails, issueService);
JiraServerIssueCreator creator = new JiraServerIssueCreator(channelKey, commenter, callbackInfoCreator, distributionDetails, issueService, projectService, issueCreationRequestCreator, issuePropertiesManager, jiraErrorMessageUtility, issueCategoryRetriever);
return new IssueTrackerMessageSender<>(creator, transitioner, commenter);
}
use of com.synopsys.integration.alert.api.channel.issue.send.IssueTrackerMessageSender in project hub-alert by blackducksoftware.
the class AzureBoardsMessageSenderFactory method createMessageSender.
public IssueTrackerMessageSender<Integer> createMessageSender(AzureWorkItemService workItemService, AzureWorkItemTypeStateService workItemTypeStateService, AzureWorkItemCommentService workItemCommentService, String organizationName, AzureBoardsJobDetailsModel distributionDetails) {
IssueTrackerIssueResponseCreator issueResponseCreator = new IssueTrackerIssueResponseCreator(callbackInfoCreator);
AzureBoardsWorkItemTypeStateRetriever workItemTypeStateRetriever = new AzureBoardsWorkItemTypeStateRetriever(gson, workItemService, workItemTypeStateService);
AzureBoardsAlertIssuePropertiesManager issuePropertiesManager = new AzureBoardsAlertIssuePropertiesManager();
// Message Sender Requirements
AzureBoardsIssueCommenter commenter = new AzureBoardsIssueCommenter(issueResponseCreator, organizationName, distributionDetails, workItemCommentService);
AzureBoardsIssueTransitioner transitioner = new AzureBoardsIssueTransitioner(commenter, issueResponseCreator, gson, organizationName, distributionDetails, workItemService, workItemTypeStateRetriever, exceptionMessageImprover);
AzureBoardsIssueCreator creator = new AzureBoardsIssueCreator(channelKey, commenter, callbackInfoCreator, gson, organizationName, distributionDetails, workItemService, issuePropertiesManager, exceptionMessageImprover, issueCategoryRetriever);
return new IssueTrackerMessageSender<>(creator, transitioner, commenter);
}
use of com.synopsys.integration.alert.api.channel.issue.send.IssueTrackerMessageSender in project hub-alert by blackducksoftware.
the class IssueTrackerFieldModelTestActionTest method testConfigResolveFailure.
@Test
public void testConfigResolveFailure() throws AlertException {
IssueTrackerMessageSender<String> messageSender = Mockito.mock(IssueTrackerMessageSender.class);
Mockito.when(messageSender.sendMessages(Mockito.any())).thenAnswer(invocation -> {
IssueTrackerModelHolder<String> argument = invocation.getArgument(0);
if (!argument.getIssueCreationModels().isEmpty()) {
return List.of(TEST_ISSUE_RESPONSE_MODEL);
}
return List.of();
});
IssueTrackerMessageSenderFactory<TestJobDetails, String> messageSenderFactory = distributionDetails -> messageSender;
TestIssueTrackerTestAction issueTrackerTestAction = new TestIssueTrackerTestAction(messageSenderFactory, true, false);
MessageResult messageResult = issueTrackerTestAction.testConfig(TEST_JOB_MODEL, "jobName", null, null);
assertTrue(messageResult.hasErrors(), EXPECTED_ERRORS);
}
Aggregations