use of com.synopsys.integration.jira.common.cloud.service.ProjectService in project hub-alert by blackducksoftware.
the class JiraCloudProcessorFactory method createProcessor.
@Override
public IssueTrackerProcessor<String> createProcessor(JiraCloudJobDetailsModel distributionDetails) throws AlertException {
JiraCloudProperties jiraProperties = createJiraCloudProperties();
JiraCloudServiceFactory jiraCloudServiceFactory = jiraProperties.createJiraServicesCloudFactory(logger, gson);
if (!jiraProperties.isPluginCheckDisabled()) {
checkIfAlertPluginIsInstalled(jiraCloudServiceFactory.createPluginManagerService());
}
// Jira Cloud Services
IssueService issueService = jiraCloudServiceFactory.createIssueService();
IssueSearchService issueSearchService = jiraCloudServiceFactory.createIssueSearchService();
IssuePropertyService issuePropertyService = jiraCloudServiceFactory.createIssuePropertyService();
// Common Helpers
JiraIssueAlertPropertiesManager issuePropertiesManager = new JiraIssueAlertPropertiesManager(gson, issuePropertyService);
// Extractor Requirement
JiraIssueStatusCreator jiraIssueStatusCreator = new JiraIssueStatusCreator(distributionDetails.getResolveTransition(), distributionDetails.getReopenTransition());
JiraSearcherFactory jiraSearcherFactory = new JiraSearcherFactory(issuePropertiesManager, jiraIssueStatusCreator, issueService::getTransitions, issueCategoryRetriever, modelTransformer);
JiraCloudQueryExecutor jiraCloudQueryExecutor = new JiraCloudQueryExecutor(issueSearchService);
IssueTrackerSearcher<String> jiraSearcher = jiraSearcherFactory.createJiraSearcher(distributionDetails.getProjectNameOrKey(), jiraCloudQueryExecutor);
IssueTrackerModelExtractor<String> extractor = new IssueTrackerModelExtractor<>(jiraMessageFormatter, jiraSearcher);
ProjectService projectService = jiraCloudServiceFactory.createProjectService();
FieldService fieldService = jiraCloudServiceFactory.createFieldService();
JiraCustomFieldResolver customFieldResolver = new JiraCustomFieldResolver(fieldService::getUserVisibleFields);
JiraIssueCreationRequestCreator issueCreationRequestCreator = new JiraIssueCreationRequestCreator(customFieldResolver);
JiraErrorMessageUtility jiraErrorMessageUtility = new JiraErrorMessageUtility(gson, customFieldResolver);
IssueTrackerMessageSender<String> messageSender = messageSenderFactory.createMessageSender(issueService, distributionDetails, projectService, issueCreationRequestCreator, issuePropertiesManager, jiraErrorMessageUtility);
return new IssueTrackerProcessor<>(extractor, messageSender);
}
use of com.synopsys.integration.jira.common.cloud.service.ProjectService 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.jira.common.cloud.service.ProjectService in project hub-alert by blackducksoftware.
the class JiraCloudMessageSenderFactory method createMessageSender.
@Override
public IssueTrackerMessageSender<String> createMessageSender(JiraCloudJobDetailsModel distributionDetails) throws AlertException {
JiraCloudProperties jiraCloudProperties = jiraCloudPropertiesFactory.createJiraProperties();
JiraCloudServiceFactory jiraCloudServiceFactory = jiraCloudProperties.createJiraServicesCloudFactory(logger, gson);
// Jira Services
IssueService issueService = jiraCloudServiceFactory.createIssueService();
IssuePropertyService issuePropertyService = jiraCloudServiceFactory.createIssuePropertyService();
// Common Helpers
JiraIssueAlertPropertiesManager issuePropertiesManager = new JiraIssueAlertPropertiesManager(gson, issuePropertyService);
ProjectService projectService = jiraCloudServiceFactory.createProjectService();
FieldService fieldService = jiraCloudServiceFactory.createFieldService();
JiraCustomFieldResolver customFieldResolver = new JiraCustomFieldResolver(fieldService::getUserVisibleFields);
JiraIssueCreationRequestCreator issueCreationRequestCreator = new JiraIssueCreationRequestCreator(customFieldResolver);
JiraErrorMessageUtility jiraErrorMessageUtility = new JiraErrorMessageUtility(gson, customFieldResolver);
return createMessageSender(issueService, distributionDetails, projectService, issueCreationRequestCreator, issuePropertiesManager, jiraErrorMessageUtility);
}
Aggregations