use of com.synopsys.integration.alert.api.channel.issue.search.IssueCategoryRetriever in project hub-alert by blackducksoftware.
the class JiraServerSummaryFieldLengthTestIT method createJiraServerMessageSender.
private static IssueTrackerMessageSender<String> createJiraServerMessageSender() throws AlertException {
TestProperties testProperties = new TestProperties();
Gson gson = new GsonBuilder().create();
IssueCategoryRetriever issueCategoryRetriever = new IssueCategoryRetriever();
JiraServerMessageSenderFactory jiraServerMessageSenderFactory = new JiraServerMessageSenderFactory(gson, ChannelKeys.JIRA_SERVER, createJiraServerPropertiesFactory(testProperties), new IssueTrackerCallbackInfoCreator(), issueCategoryRetriever);
JiraServerJobDetailsModel jiraServerJobDetails = createJiraServerJobDetails(testProperties);
return jiraServerMessageSenderFactory.createMessageSender(jiraServerJobDetails);
}
use of com.synopsys.integration.alert.api.channel.issue.search.IssueCategoryRetriever in project hub-alert by blackducksoftware.
the class JiraServerExternalConnectionTest method sendJiraServerMessageTest.
// This test is @Disabled since it requires a running Jira Server instance. In order to run this test, you must deploy a Jira Server and
// add the Jira Server environment values into test.properties
@Test
@Disabled
public void sendJiraServerMessageTest() throws AlertException {
Gson gson = new Gson();
JiraMessageFormatter jiraMessageFormatter = new JiraMessageFormatter();
JiraServerChannelKey jiraServerChannelKey = new JiraServerChannelKey();
JiraServerGlobalConfigAccessor jiraServerGlobalConfigAccessor = Mockito.mock(JiraServerGlobalConfigAccessor.class);
Mockito.when(jiraServerGlobalConfigAccessor.getConfigurationByName(Mockito.anyString())).thenReturn(Optional.of(createJiraServerConfigModel()));
ProxyManager proxyManager = Mockito.mock(ProxyManager.class);
Mockito.when(proxyManager.createProxyInfoForHost(Mockito.anyString())).thenReturn(null);
JobAccessor jobAccessor = Mockito.mock(JobAccessor.class);
Mockito.when(jobAccessor.getJobById(Mockito.any())).thenReturn(Optional.of(createDistributionJobModel()));
JiraServerPropertiesFactory jiraServerPropertiesFactory = new JiraServerPropertiesFactory(proxyManager, jiraServerGlobalConfigAccessor, jobAccessor);
IssueTrackerCallbackInfoCreator issueTrackerCallbackInfoCreator = new IssueTrackerCallbackInfoCreator();
IssueCategoryRetriever issueCategoryRetriever = new IssueCategoryRetriever();
JiraServerMessageSenderFactory jiraServerMessageSenderFactory = new JiraServerMessageSenderFactory(gson, jiraServerChannelKey, jiraServerPropertiesFactory, issueTrackerCallbackInfoCreator, issueCategoryRetriever);
ProjectMessageToIssueModelTransformer modelTransformer = new ProjectMessageToIssueModelTransformer();
JiraServerProcessorFactory jiraServerProcessorFactory = new JiraServerProcessorFactory(gson, jiraMessageFormatter, jiraServerPropertiesFactory, jiraServerMessageSenderFactory, modelTransformer, issueCategoryRetriever);
IssueTrackerProcessor<String> processor = jiraServerProcessorFactory.createProcessor(createDistributionDetails());
IssueTrackerResponse<String> response = processor.processMessages(createMessage(), "jobName");
assertEquals("Success", response.getStatusMessage());
}
use of com.synopsys.integration.alert.api.channel.issue.search.IssueCategoryRetriever in project hub-alert by blackducksoftware.
the class AzureBoardsComponentIssueFinderTest method findExistingIssuesByProjectIssueModelForUnknownVersionTest.
@Test
public void findExistingIssuesByProjectIssueModelForUnknownVersionTest() throws AlertException {
Gson gson = new Gson();
String organizationName = "orgName";
AzureBoardsIssueTrackerQueryManager queryManager = Mockito.mock(AzureBoardsIssueTrackerQueryManager.class);
IssueCategoryRetriever issueCategoryRetriever = new IssueCategoryRetriever();
AzureBoardsExistingIssueDetailsCreator issueDetailsCreator = new AzureBoardsExistingIssueDetailsCreator(organizationName, issueCategoryRetriever, azureBoardsIssueStatusResolver);
AzureBoardsWorkItemFinder workItemFinder = new AzureBoardsWorkItemFinder(queryManager, "test proj");
AzureBoardsComponentIssueFinder componentIssueFinder = new AzureBoardsComponentIssueFinder(gson, workItemFinder, issueDetailsCreator);
IssueComponentUnknownVersionDetails componentUnknownVersionDetails = new IssueComponentUnknownVersionDetails(ItemOperation.ADD, createRiskModels());
IssuePolicyDetails testPolicy = new IssuePolicyDetails("Test Policy", ItemOperation.ADD, ComponentConcernSeverity.UNSPECIFIED_UNKNOWN);
ProjectIssueModel projectIssueModel = ProjectIssueModel.componentUnknownVersion(PROVIDER_DETAILS, PROJECT_ITEM, PROJECT_VERSION_ITEM, ISSUE_BOM_COMPONENT_DETAILS, componentUnknownVersionDetails);
WorkItemResponseModel workItemResponseModel = createWorkItemResponseModel(workItemReopenState);
Mockito.when(queryManager.executeQueryAndRetrieveWorkItems(Mockito.any())).thenReturn(List.of(workItemResponseModel));
List<ExistingIssueDetails<Integer>> existingIssueDetailsList = componentIssueFinder.findExistingIssuesByProjectIssueModel(projectIssueModel);
assertEquals(1, existingIssueDetailsList.size());
ExistingIssueDetails<Integer> existingIssueDetails = existingIssueDetailsList.get(0);
assertEquals(IssueStatus.RESOLVABLE, existingIssueDetails.getIssueStatus());
assertEquals(IssueCategory.BOM, existingIssueDetails.getIssueCategory());
}
use of com.synopsys.integration.alert.api.channel.issue.search.IssueCategoryRetriever in project hub-alert by blackducksoftware.
the class JiraCloudIssueCreatorTest method createTestJiraCloudIssueCreator.
private TestJiraCloudIssueCreator createTestJiraCloudIssueCreator(String projectNameOrKey, JiraCloudJobDetailsModel jiraCloudJobDetailsModel) throws IntegrationException {
ProjectService projectService = Mockito.mock(ProjectService.class);
Mockito.when(projectService.getProjectsByName(Mockito.anyString())).thenReturn(new PageOfProjectsResponseModel(List.of(new ProjectComponent("self", "id", "key", projectNameOrKey, null, null, null, null))));
JiraCustomFieldResolver jiraCustomFieldResolver = new JiraCustomFieldResolver(() -> List.of());
JiraIssueCreationRequestCreator jiraIssueCreationRequestCreator = new JiraIssueCreationRequestCreator(jiraCustomFieldResolver);
IssueCategoryRetriever issueCategoryRetriever = new IssueCategoryRetriever();
return new TestJiraCloudIssueCreator(jiraCloudJobDetailsModel, projectService, jiraIssueCreationRequestCreator, issueCategoryRetriever);
}
use of com.synopsys.integration.alert.api.channel.issue.search.IssueCategoryRetriever in project hub-alert by blackducksoftware.
the class JiraCloudSummaryFieldLengthTestIT method createJiraCloudMessageSender.
private static IssueTrackerMessageSender<String> createJiraCloudMessageSender() throws AlertException {
TestProperties testProperties = new TestProperties();
Gson gson = new GsonBuilder().create();
IssueCategoryRetriever issueCategoryRetriever = new IssueCategoryRetriever();
JiraCloudMessageSenderFactory jiraCloudMessageSenderFactory = new JiraCloudMessageSenderFactory(gson, ChannelKeys.JIRA_CLOUD, createJiraCloudPropertiesFactory(testProperties), new IssueTrackerCallbackInfoCreator(), issueCategoryRetriever);
JiraCloudJobDetailsModel jiraCloudJobDetails = createJiraCloudJobDetails(testProperties);
return jiraCloudMessageSenderFactory.createMessageSender(jiraCloudJobDetails);
}
Aggregations