use of com.synopsys.integration.alert.api.channel.issue.model.IssueCreationModel in project hub-alert by blackducksoftware.
the class JiraServerSummaryFieldLengthTestIT method summaryLength254SucceedsTest.
@Test
public void summaryLength254SucceedsTest() {
IssueCreationModel issueCreationModel = createIssueCreationModel(254);
IssueTrackerModelHolder<String> messages = new IssueTrackerModelHolder<>(List.of(issueCreationModel), List.of(), List.of());
try {
jiraServerMessageSender.sendMessages(messages);
} catch (AlertException e) {
fail("Failed to send a message with a 254 character summary", e);
}
}
use of com.synopsys.integration.alert.api.channel.issue.model.IssueCreationModel in project hub-alert by blackducksoftware.
the class IssueTrackerModelExtractor method extractSimpleMessageIssueModels.
public final IssueTrackerModelHolder<T> extractSimpleMessageIssueModels(List<SimpleMessage> simpleMessages, String jobName) {
List<IssueCreationModel> simpleMessageIssueCreationModels = new ArrayList<>(simpleMessages.size());
for (SimpleMessage simpleMessage : simpleMessages) {
IssueCreationModel simpleMessageIssueCreationModel = issueTrackerSimpleMessageConverter.convertToIssueCreationModel(simpleMessage, jobName);
simpleMessageIssueCreationModels.add(simpleMessageIssueCreationModel);
}
return new IssueTrackerModelHolder<>(simpleMessageIssueCreationModels, List.of(), List.of());
}
use of com.synopsys.integration.alert.api.channel.issue.model.IssueCreationModel in project hub-alert by blackducksoftware.
the class IssueTrackerModelExtractor method convertSearchResult.
private IssueTrackerModelHolder<T> convertSearchResult(ActionableIssueSearchResult<T> searchResult, String jobName) {
Optional<ExistingIssueDetails<T>> existingIssueDetails = searchResult.getExistingIssueDetails();
ProjectIssueModel projectIssueModel = searchResult.getProjectIssueModel();
if (existingIssueDetails.isPresent()) {
return convertExistingIssue(existingIssueDetails.get(), projectIssueModel, searchResult.getRequiredOperation());
} else {
IssueCreationModel issueCreationModel = projectIssueModelConverter.toIssueCreationModel(projectIssueModel, jobName);
return new IssueTrackerModelHolder<>(List.of(issueCreationModel), List.of(), List.of());
}
}
use of com.synopsys.integration.alert.api.channel.issue.model.IssueCreationModel in project hub-alert by blackducksoftware.
the class IssueTrackerIssueCreatorTest method createIssueTrackerIssueWithSourceTest.
@Test
public void createIssueTrackerIssueWithSourceTest() throws AlertException {
TestIssueCreator issueCreator = new TestIssueCreator(commenter, callbackInfoCreator);
ProjectIssueModel projectIssueModel = Mockito.mock(ProjectIssueModel.class);
IssueCreationModel issueCreationModel = IssueCreationModel.project("Test title", null, List.of("example comment"), projectIssueModel);
IssueTrackerIssueResponseModel<String> responseModel = issueCreator.createIssueTrackerIssue(issueCreationModel);
assertEquals(issueCreationModel.getTitle(), responseModel.getIssueTitle());
}
use of com.synopsys.integration.alert.api.channel.issue.model.IssueCreationModel in project hub-alert by blackducksoftware.
the class IssueTrackerIssueCreatorTest method createIssueTrackerIssueTest.
@Test
public void createIssueTrackerIssueTest() throws AlertException {
TestIssueCreator issueCreator = new TestIssueCreator(commenter, callbackInfoCreator);
IssueCreationModel issueCreationModel = IssueCreationModel.simple("Test title", null, List.of("comment 1", "comment 2"), null);
IssueTrackerIssueResponseModel<String> responseModel = issueCreator.createIssueTrackerIssue(issueCreationModel);
assertEquals(issueCreationModel.getTitle(), responseModel.getIssueTitle());
}
Aggregations