use of com.synopsys.integration.alert.api.channel.issue.model.IssueTrackerModelHolder 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.IssueTrackerModelHolder 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.IssueTrackerModelHolder 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.IssueTrackerModelHolder in project hub-alert by blackducksoftware.
the class IssueTrackerTransitionTestAction method transitionTestIssueOrReturnFailureResult.
public Optional<MessageResult> transitionTestIssueOrReturnFailureResult(IssueOperation operation, ExistingIssueDetails<T> existingIssueDetails, ProjectIssueModel testProjectIssueModel) {
String postTransitionComment = String.format("Successfully tested the %s operation", operation.name());
IssueTransitionModel<T> resolveRequest = new IssueTransitionModel<>(existingIssueDetails, operation, List.of(postTransitionComment), testProjectIssueModel);
IssueTrackerModelHolder<T> resolveRequestModelHolder = new IssueTrackerModelHolder<>(List.of(), List.of(resolveRequest), List.of());
List<IssueTrackerIssueResponseModel<T>> transitionedIssues;
try {
transitionedIssues = messageSender.sendMessages(resolveRequestModelHolder);
} catch (IssueMissingTransitionException e) {
MessageResult issueMissingResult = handleIssueMessingTransitionException(e);
return Optional.of(issueMissingResult);
} catch (AlertException e) {
MessageResult alertExceptionResult = handleAlertException(e, operation);
return Optional.of(alertExceptionResult);
}
int transitionedIssuesSize = transitionedIssues.size();
if (transitionedIssuesSize != 1) {
String errorMessage = String.format("Expected [1] issue to be transitioned, but there were actually [%d]", transitionedIssuesSize);
return Optional.of(new MessageResult(errorMessage, fieldStatusCreator.createWithoutField(errorMessage)));
}
return Optional.empty();
}
use of com.synopsys.integration.alert.api.channel.issue.model.IssueTrackerModelHolder in project hub-alert by blackducksoftware.
the class JiraCloudSummaryFieldLengthTestIT method summaryLength254SucceedsTest.
@Test
public void summaryLength254SucceedsTest() {
IssueCreationModel issueCreationModel = createIssueCreationModel(254);
IssueTrackerModelHolder<String> messages = new IssueTrackerModelHolder<>(List.of(issueCreationModel), List.of(), List.of());
try {
jiraCloudMessageSender.sendMessages(messages);
} catch (AlertException e) {
fail("Failed to send a message with a 254 character summary", e);
}
}
Aggregations