use of com.synopsys.integration.jira.common.cloud.model.IssueCreationRequestModel in project hub-alert by blackducksoftware.
the class JiraCloudIssueCreator method createIssueCreationRequest.
@Override
protected IssueCreationRequestModel createIssueCreationRequest(IssueCreationModel alertIssueCreationModel, MessageReplacementValues replacementValues) throws AlertException {
ProjectComponent jiraProject = retrieveProjectComponent();
String issueSummary = distributionDetails.getIssueSummary();
String title = alertIssueCreationModel.getTitle();
if (StringUtils.isNotEmpty(issueSummary)) {
MessageValueReplacementResolver messageValueReplacementResolver = new MessageValueReplacementResolver(replacementValues);
title = messageValueReplacementResolver.createReplacedFieldValue(issueSummary);
}
IssueRequestModelFieldsMapBuilder fieldsBuilder = jiraIssueCreationRequestCreator.createIssueRequestModel(title, alertIssueCreationModel.getDescription(), jiraProject.getId(), distributionDetails.getIssueType(), replacementValues, distributionDetails.getCustomFields());
return new IssueCreationRequestModel(distributionDetails.getIssueCreatorEmail(), distributionDetails.getIssueType(), distributionDetails.getProjectNameOrKey(), fieldsBuilder, List.of());
}
use of com.synopsys.integration.jira.common.cloud.model.IssueCreationRequestModel in project hub-alert by blackducksoftware.
the class JiraCloudIssueCreatorTest method verifySummaryReplacingValues.
@Test
public void verifySummaryReplacingValues() throws IntegrationException {
String projectNameOrKey = "FakeProject";
JiraCloudJobDetailsModel jiraCloudJobDetailsModel = new JiraCloudJobDetailsModel(UUID.randomUUID(), false, "my@email.com", projectNameOrKey, "Task", null, null, List.of(), "testSummary {{providerName}}");
TestJiraCloudIssueCreator jiraCloudIssueCreator = createTestJiraCloudIssueCreator(projectNameOrKey, jiraCloudJobDetailsModel);
IssueCreationModel issueCreationModel = createIssueCreationModel();
String testProviderName = "providerName";
MessageReplacementValues messageReplacementValues = new MessageReplacementValues.Builder(testProviderName, "projectName").projectVersionName("projectVersionName").componentName("componentName").componentVersionName("componentVersionName").severity("severity").policyCategory("UNCATEGORIZED").build();
IssueCreationRequestModel issueCreationRequest = jiraCloudIssueCreator.createIssueCreationRequest(issueCreationModel, messageReplacementValues);
String summaryText = getSummary(issueCreationRequest);
assertEquals("testSummary " + testProviderName, summaryText);
}
use of com.synopsys.integration.jira.common.cloud.model.IssueCreationRequestModel in project hub-alert by blackducksoftware.
the class JiraCloudIssueCreatorTest method verifyIssueSummaryReplacement.
@Test
public void verifyIssueSummaryReplacement() throws IntegrationException {
String testSummary = "testSummary";
String projectNameOrKey = "FakeProject";
JiraCloudJobDetailsModel jiraCloudJobDetailsModel = new JiraCloudJobDetailsModel(UUID.randomUUID(), false, "my@email.com", projectNameOrKey, "Task", null, null, List.of(), testSummary);
TestJiraCloudIssueCreator jiraCloudIssueCreator = createTestJiraCloudIssueCreator(projectNameOrKey, jiraCloudJobDetailsModel);
IssueCreationModel issueCreationModel = createIssueCreationModel();
MessageReplacementValues messageReplacementValues = new MessageReplacementValues.Builder("providerName", "projectName").projectVersionName("projectVersionName").componentName("componentName").componentVersionName("componentVersionName").severity("severity").policyCategory("UNCATEGORIZED").build();
IssueCreationRequestModel issueCreationRequest = jiraCloudIssueCreator.createIssueCreationRequest(issueCreationModel, messageReplacementValues);
String summaryText = getSummary(issueCreationRequest);
assertEquals(testSummary, summaryText);
}
Aggregations