use of com.synopsys.integration.alert.api.channel.issue.model.ProjectIssueModel in project hub-alert by blackducksoftware.
the class ProjectIssueModelConverterTest method basicIssueTransitionModelTest.
private IssueTransitionModel<String> basicIssueTransitionModelTest(ItemOperation operation) {
ProjectIssueModel projectIssueModel = ProjectIssueModel.bom(PROVIDER_DETAILS, PROJECT_ITEM, PROJECT_VERSION_ITEM, ISSUE_BOM_COMPONENT_DETAILS);
MockIssueTrackerMessageFormatter formatter = MockIssueTrackerMessageFormatter.withIntegerMaxValueLength();
ProjectIssueModelConverter converter = new ProjectIssueModelConverter(formatter);
IssueTransitionModel<String> issueTransitionModel = converter.toIssueTransitionModel(EXISTING_ISSUE_DETAILS, projectIssueModel, operation);
assertEquals(EXISTING_ISSUE_DETAILS, issueTransitionModel.getExistingIssueDetails());
assertEquals(projectIssueModel, issueTransitionModel.getSource());
return issueTransitionModel;
}
use of com.synopsys.integration.alert.api.channel.issue.model.ProjectIssueModel in project hub-alert by blackducksoftware.
the class ProjectIssueModelConverterTest method toIssueCreationModelPolicyTest.
@Test
public void toIssueCreationModelPolicyTest() {
IssuePolicyDetails testPolicy = new IssuePolicyDetails("Test Policy", ItemOperation.ADD, ComponentConcernSeverity.UNSPECIFIED_UNKNOWN);
ProjectIssueModel projectIssueModel = ProjectIssueModel.policy(PROVIDER_DETAILS, PROJECT_ITEM, PROJECT_VERSION_ITEM, ISSUE_BOM_COMPONENT_DETAILS, testPolicy);
IssueCreationModel issueCreationModel = basicIssueCreationModelTest(projectIssueModel);
assertTrue(issueCreationModel.getTitle().contains(testPolicy.getName()), "Expected policy name to be present in the title");
assertTrue(issueCreationModel.getDescription().contains(testPolicy.getName()), "Expected policy name to be present in the description");
}
use of com.synopsys.integration.alert.api.channel.issue.model.ProjectIssueModel in project hub-alert by blackducksoftware.
the class ProjectIssueModelConverterTest method toIssueCreationModelBomTest.
@Test
public void toIssueCreationModelBomTest() {
ProjectIssueModel projectIssueModel = ProjectIssueModel.bom(PROVIDER_DETAILS, PROJECT_ITEM, PROJECT_VERSION_ITEM, ISSUE_BOM_COMPONENT_DETAILS);
basicIssueCreationModelTest(projectIssueModel);
}
use of com.synopsys.integration.alert.api.channel.issue.model.ProjectIssueModel in project hub-alert by blackducksoftware.
the class JiraIssueSearchResultCreator method createResultFromProjectIssue.
public ProjectIssueSearchResult<String> createResultFromProjectIssue(JiraSearcherResponseModel issue, ProviderDetails providerDetails, LinkableItem project) throws AlertException {
JiraIssueSearchProperties issueProperties = issuePropertiesManager.retrieveIssueProperties(issue.getIssueKey());
String nullableSubComponentName = issueProperties.getSubComponentName();
String nullableSubComponentValue = issueProperties.getSubComponentValue();
LinkableItem componentVersion = null;
if (StringUtils.isNotBlank(nullableSubComponentName) && StringUtils.isNotBlank(nullableSubComponentValue)) {
componentVersion = new LinkableItem(nullableSubComponentName, nullableSubComponentValue);
}
LinkableItem projectVersion = new LinkableItem(issueProperties.getSubTopicName(), issueProperties.getSubTopicValue());
IssueBomComponentDetails bomComponentDetails = IssueBomComponentDetails.fromSearchResults(new LinkableItem(issueProperties.getComponentName(), issueProperties.getComponentValue()), componentVersion);
ProjectIssueModel projectIssueModel = ProjectIssueModel.bom(providerDetails, project, projectVersion, bomComponentDetails);
return createIssueResult(issue, projectIssueModel);
}
use of com.synopsys.integration.alert.api.channel.issue.model.ProjectIssueModel in project hub-alert by blackducksoftware.
the class IssueCategoryRetrieverTest method retrieveIssueCategoryFromProjectIssueModel_VulnerabilityTest.
@Test
public void retrieveIssueCategoryFromProjectIssueModel_VulnerabilityTest() {
IssueVulnerabilityDetails issueVulnerabilityDetails = Mockito.mock(IssueVulnerabilityDetails.class);
ProjectIssueModel projectIssueModel = Mockito.mock(ProjectIssueModel.class);
Mockito.when(projectIssueModel.getPolicyDetails()).thenReturn(Optional.empty());
Mockito.when(projectIssueModel.getVulnerabilityDetails()).thenReturn(Optional.of(issueVulnerabilityDetails));
IssueCategoryRetriever issueCategoryRetriever = new IssueCategoryRetriever();
IssueCategory issueCategory = issueCategoryRetriever.retrieveIssueCategoryFromProjectIssueModel(projectIssueModel);
assertEquals(IssueCategory.VULNERABILITY, issueCategory);
}
Aggregations