@Test public void testRequestsEmpty() throws Exception { JiraCloudRequestDelegator service = new JiraCloudRequestDelegator(gson, createContext()); List<IssueTrackerRequest> requests = new ArrayList<>(); try { service.sendRequests(requests); fail(); } catch (IssueTrackerException ex) { assertTrue(ex.getMessage().contains("Requests missing.")); } }
public IssueTrackerResponse sendRequests(List<IssueTrackerRequest> requests) throws IntegrationException { if (null == context) { throw new IssueTrackerException("Context missing. Cannot determine Jira Cloud instance."); } if (null == requests || requests.isEmpty()) { throw new IssueTrackerException("Requests missing. Requires at least one request."); } JiraCloudProperties jiraProperties = (JiraCloudProperties) context.getIssueTrackerConfig(); JiraCloudServiceFactory jiraCloudServiceFactory = jiraProperties.createJiraServicesCloudFactory(logger, gson); if (!jiraProperties.isPluginCheckDisabled()) { checkIfAlertPluginIsInstalled(jiraCloudServiceFactory.createPluginManagerService()); } ProjectService projectService = jiraCloudServiceFactory.createProjectService(); UserSearchService userSearchService = jiraCloudServiceFactory.createUserSearchService(); IssueTypeService issueTypeService = jiraCloudServiceFactory.createIssueTypeService(); IssueMetaDataService issueMetaDataService = jiraCloudServiceFactory.createIssueMetadataService(); JiraCloudIssueConfigValidator jiraIssueConfigValidator = new JiraCloudIssueConfigValidator(projectService, userSearchService, issueTypeService, issueMetaDataService); IssueConfig validIssueConfig = jiraIssueConfigValidator.createValidIssueConfig(context); IssueService issueService = jiraCloudServiceFactory.createIssueService(); IssuePropertyService issuePropertyService = jiraCloudServiceFactory.createIssuePropertyService(); IssueSearchService issueSearchService = jiraCloudServiceFactory.createIssueSearchService(); JiraContentValidator contentValidator = new JiraContentValidator(); JiraCloudTransitionHandler jiraTransitionHandler = new JiraCloudTransitionHandler(issueService); JiraCloudIssuePropertyHandler jiraIssuePropertyHandler = new JiraCloudIssuePropertyHandler(issueSearchService, issuePropertyService); JiraCloudIssueHandler jiraIssueHandler = new JiraCloudIssueHandler(issueService, jiraProperties, gson, jiraTransitionHandler, jiraIssuePropertyHandler, contentValidator); return jiraIssueHandler.createOrUpdateIssues(validIssueConfig, requests); }
JiraCloudRequestDelegator { public IssueTrackerResponse sendRequests(List<IssueTrackerRequest> requests) throws IntegrationException { if (null == context) { throw new IssueTrackerException("Context missing. Cannot determine Jira Cloud instance."); } if (null == requests || requests.isEmpty()) { throw new IssueTrackerException("Requests missing. Requires at least one request."); } JiraCloudProperties jiraProperties = (JiraCloudProperties) context.getIssueTrackerConfig(); JiraCloudServiceFactory jiraCloudServiceFactory = jiraProperties.createJiraServicesCloudFactory(logger, gson); if (!jiraProperties.isPluginCheckDisabled()) { checkIfAlertPluginIsInstalled(jiraCloudServiceFactory.createPluginManagerService()); } ProjectService projectService = jiraCloudServiceFactory.createProjectService(); UserSearchService userSearchService = jiraCloudServiceFactory.createUserSearchService(); IssueTypeService issueTypeService = jiraCloudServiceFactory.createIssueTypeService(); IssueMetaDataService issueMetaDataService = jiraCloudServiceFactory.createIssueMetadataService(); JiraCloudIssueConfigValidator jiraIssueConfigValidator = new JiraCloudIssueConfigValidator(projectService, userSearchService, issueTypeService, issueMetaDataService); IssueConfig validIssueConfig = jiraIssueConfigValidator.createValidIssueConfig(context); IssueService issueService = jiraCloudServiceFactory.createIssueService(); IssuePropertyService issuePropertyService = jiraCloudServiceFactory.createIssuePropertyService(); IssueSearchService issueSearchService = jiraCloudServiceFactory.createIssueSearchService(); JiraContentValidator contentValidator = new JiraContentValidator(); JiraCloudTransitionHandler jiraTransitionHandler = new JiraCloudTransitionHandler(issueService); JiraCloudIssuePropertyHandler jiraIssuePropertyHandler = new JiraCloudIssuePropertyHandler(issueSearchService, issuePropertyService); JiraCloudIssueHandler jiraIssueHandler = new JiraCloudIssueHandler(issueService, jiraProperties, gson, jiraTransitionHandler, jiraIssuePropertyHandler, contentValidator); return jiraIssueHandler.createOrUpdateIssues(validIssueConfig, requests); } }
JiraCloudRequestDelegator { public IssueTrackerResponse sendRequests(List<IssueTrackerRequest> requests) throws IntegrationException { if (null == context) { throw new IssueTrackerException("Context missing. Cannot determine Jira Cloud instance."); } if (null == requests || requests.isEmpty()) { throw new IssueTrackerException("Requests missing. Requires at least one request."); } JiraCloudProperties jiraProperties = (JiraCloudProperties) context.getIssueTrackerConfig(); JiraCloudServiceFactory jiraCloudServiceFactory = jiraProperties.createJiraServicesCloudFactory(logger, gson); if (!jiraProperties.isPluginCheckDisabled()) { checkIfAlertPluginIsInstalled(jiraCloudServiceFactory.createPluginManagerService()); } ProjectService projectService = jiraCloudServiceFactory.createProjectService(); UserSearchService userSearchService = jiraCloudServiceFactory.createUserSearchService(); IssueTypeService issueTypeService = jiraCloudServiceFactory.createIssueTypeService(); IssueMetaDataService issueMetaDataService = jiraCloudServiceFactory.createIssueMetadataService(); JiraCloudIssueConfigValidator jiraIssueConfigValidator = new JiraCloudIssueConfigValidator(projectService, userSearchService, issueTypeService, issueMetaDataService); IssueConfig validIssueConfig = jiraIssueConfigValidator.createValidIssueConfig(context); IssueService issueService = jiraCloudServiceFactory.createIssueService(); IssuePropertyService issuePropertyService = jiraCloudServiceFactory.createIssuePropertyService(); IssueSearchService issueSearchService = jiraCloudServiceFactory.createIssueSearchService(); JiraContentValidator contentValidator = new JiraContentValidator(); JiraCloudTransitionHandler jiraTransitionHandler = new JiraCloudTransitionHandler(issueService); JiraCloudIssuePropertyHandler jiraIssuePropertyHandler = new JiraCloudIssuePropertyHandler(issueSearchService, issuePropertyService); JiraCloudIssueHandler jiraIssueHandler = new JiraCloudIssueHandler(issueService, jiraProperties, gson, jiraTransitionHandler, jiraIssuePropertyHandler, contentValidator); return jiraIssueHandler.createOrUpdateIssues(validIssueConfig, requests); } JiraCloudRequestDelegator(Gson gson, IssueTrackerContext context); }
JiraCloudRequestDelegator { public IssueTrackerResponse sendRequests(List<IssueTrackerRequest> requests) throws IntegrationException { if (null == context) { throw new IssueTrackerException("Context missing. Cannot determine Jira Cloud instance."); } if (null == requests || requests.isEmpty()) { throw new IssueTrackerException("Requests missing. Requires at least one request."); } JiraCloudProperties jiraProperties = (JiraCloudProperties) context.getIssueTrackerConfig(); JiraCloudServiceFactory jiraCloudServiceFactory = jiraProperties.createJiraServicesCloudFactory(logger, gson); if (!jiraProperties.isPluginCheckDisabled()) { checkIfAlertPluginIsInstalled(jiraCloudServiceFactory.createPluginManagerService()); } ProjectService projectService = jiraCloudServiceFactory.createProjectService(); UserSearchService userSearchService = jiraCloudServiceFactory.createUserSearchService(); IssueTypeService issueTypeService = jiraCloudServiceFactory.createIssueTypeService(); IssueMetaDataService issueMetaDataService = jiraCloudServiceFactory.createIssueMetadataService(); JiraCloudIssueConfigValidator jiraIssueConfigValidator = new JiraCloudIssueConfigValidator(projectService, userSearchService, issueTypeService, issueMetaDataService); IssueConfig validIssueConfig = jiraIssueConfigValidator.createValidIssueConfig(context); IssueService issueService = jiraCloudServiceFactory.createIssueService(); IssuePropertyService issuePropertyService = jiraCloudServiceFactory.createIssuePropertyService(); IssueSearchService issueSearchService = jiraCloudServiceFactory.createIssueSearchService(); JiraContentValidator contentValidator = new JiraContentValidator(); JiraCloudTransitionHandler jiraTransitionHandler = new JiraCloudTransitionHandler(issueService); JiraCloudIssuePropertyHandler jiraIssuePropertyHandler = new JiraCloudIssuePropertyHandler(issueSearchService, issuePropertyService); JiraCloudIssueHandler jiraIssueHandler = new JiraCloudIssueHandler(issueService, jiraProperties, gson, jiraTransitionHandler, jiraIssuePropertyHandler, contentValidator); return jiraIssueHandler.createOrUpdateIssues(validIssueConfig, requests); } JiraCloudRequestDelegator(Gson gson, IssueTrackerContext context); IssueTrackerResponse sendRequests(List<IssueTrackerRequest> requests); }
JiraCloudRequestDelegator { public IssueTrackerResponse sendRequests(List<IssueTrackerRequest> requests) throws IntegrationException { if (null == context) { throw new IssueTrackerException("Context missing. Cannot determine Jira Cloud instance."); } if (null == requests || requests.isEmpty()) { throw new IssueTrackerException("Requests missing. Requires at least one request."); } JiraCloudProperties jiraProperties = (JiraCloudProperties) context.getIssueTrackerConfig(); JiraCloudServiceFactory jiraCloudServiceFactory = jiraProperties.createJiraServicesCloudFactory(logger, gson); if (!jiraProperties.isPluginCheckDisabled()) { checkIfAlertPluginIsInstalled(jiraCloudServiceFactory.createPluginManagerService()); } ProjectService projectService = jiraCloudServiceFactory.createProjectService(); UserSearchService userSearchService = jiraCloudServiceFactory.createUserSearchService(); IssueTypeService issueTypeService = jiraCloudServiceFactory.createIssueTypeService(); IssueMetaDataService issueMetaDataService = jiraCloudServiceFactory.createIssueMetadataService(); JiraCloudIssueConfigValidator jiraIssueConfigValidator = new JiraCloudIssueConfigValidator(projectService, userSearchService, issueTypeService, issueMetaDataService); IssueConfig validIssueConfig = jiraIssueConfigValidator.createValidIssueConfig(context); IssueService issueService = jiraCloudServiceFactory.createIssueService(); IssuePropertyService issuePropertyService = jiraCloudServiceFactory.createIssuePropertyService(); IssueSearchService issueSearchService = jiraCloudServiceFactory.createIssueSearchService(); JiraContentValidator contentValidator = new JiraContentValidator(); JiraCloudTransitionHandler jiraTransitionHandler = new JiraCloudTransitionHandler(issueService); JiraCloudIssuePropertyHandler jiraIssuePropertyHandler = new JiraCloudIssuePropertyHandler(issueSearchService, issuePropertyService); JiraCloudIssueHandler jiraIssueHandler = new JiraCloudIssueHandler(issueService, jiraProperties, gson, jiraTransitionHandler, jiraIssuePropertyHandler, contentValidator); return jiraIssueHandler.createOrUpdateIssues(validIssueConfig, requests); } JiraCloudRequestDelegator(Gson gson, IssueTrackerContext context); IssueTrackerResponse sendRequests(List<IssueTrackerRequest> requests);  }