@Test public void testRequestsEmpty() throws Exception { JiraServerRequestDelegator service = new JiraServerRequestDelegator(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 Server instance."); } if (null == requests || requests.isEmpty()) { throw new IssueTrackerException("Requests missing. Require at least one request."); } JiraServerProperties jiraProperties = (JiraServerProperties) context.getIssueTrackerConfig(); JiraServerServiceFactory jiraServerServiceFactory = jiraProperties.createJiraServicesServerFactory(logger, gson); if (!jiraProperties.isPluginCheckDisabled()) { checkIfAlertPluginIsInstalled(jiraServerServiceFactory.createPluginManagerService()); } ProjectService projectService = jiraServerServiceFactory.createProjectService(); UserSearchService userSearchService = jiraServerServiceFactory.createUserSearchService(); IssueTypeService issueTypeService = jiraServerServiceFactory.createIssueTypeService(); IssueMetaDataService issueMetaDataService = jiraServerServiceFactory.createIssueMetadataService(); JiraServerIssueConfigValidator jiraIssueConfigValidator = new JiraServerIssueConfigValidator(projectService, userSearchService, issueTypeService, issueMetaDataService); IssueConfig validIssueConfig = jiraIssueConfigValidator.createValidIssueConfig(context); IssueService issueService = jiraServerServiceFactory.createIssueService(); IssuePropertyService issuePropertyService = jiraServerServiceFactory.createIssuePropertyService(); IssueSearchService issueSearchService = jiraServerServiceFactory.createIssueSearchService(); JiraContentValidator jiraContentValidator = new JiraContentValidator(); JiraServerTransitionHandler jiraTransitionHandler = new JiraServerTransitionHandler(issueService); JiraServerIssuePropertyHandler jiraIssuePropertyHandler = new JiraServerIssuePropertyHandler(issueSearchService, issuePropertyService); JiraServerIssueHandler jiraIssueHandler = new JiraServerIssueHandler(issueService, jiraProperties, gson, jiraTransitionHandler, jiraIssuePropertyHandler, jiraContentValidator); return jiraIssueHandler.createOrUpdateIssues(validIssueConfig, requests); }
JiraServerRequestDelegator { public IssueTrackerResponse sendRequests(List<IssueTrackerRequest> requests) throws IntegrationException { if (null == context) { throw new IssueTrackerException("Context missing. Cannot determine Jira Server instance."); } if (null == requests || requests.isEmpty()) { throw new IssueTrackerException("Requests missing. Require at least one request."); } JiraServerProperties jiraProperties = (JiraServerProperties) context.getIssueTrackerConfig(); JiraServerServiceFactory jiraServerServiceFactory = jiraProperties.createJiraServicesServerFactory(logger, gson); if (!jiraProperties.isPluginCheckDisabled()) { checkIfAlertPluginIsInstalled(jiraServerServiceFactory.createPluginManagerService()); } ProjectService projectService = jiraServerServiceFactory.createProjectService(); UserSearchService userSearchService = jiraServerServiceFactory.createUserSearchService(); IssueTypeService issueTypeService = jiraServerServiceFactory.createIssueTypeService(); IssueMetaDataService issueMetaDataService = jiraServerServiceFactory.createIssueMetadataService(); JiraServerIssueConfigValidator jiraIssueConfigValidator = new JiraServerIssueConfigValidator(projectService, userSearchService, issueTypeService, issueMetaDataService); IssueConfig validIssueConfig = jiraIssueConfigValidator.createValidIssueConfig(context); IssueService issueService = jiraServerServiceFactory.createIssueService(); IssuePropertyService issuePropertyService = jiraServerServiceFactory.createIssuePropertyService(); IssueSearchService issueSearchService = jiraServerServiceFactory.createIssueSearchService(); JiraContentValidator jiraContentValidator = new JiraContentValidator(); JiraServerTransitionHandler jiraTransitionHandler = new JiraServerTransitionHandler(issueService); JiraServerIssuePropertyHandler jiraIssuePropertyHandler = new JiraServerIssuePropertyHandler(issueSearchService, issuePropertyService); JiraServerIssueHandler jiraIssueHandler = new JiraServerIssueHandler(issueService, jiraProperties, gson, jiraTransitionHandler, jiraIssuePropertyHandler, jiraContentValidator); return jiraIssueHandler.createOrUpdateIssues(validIssueConfig, requests); } }
JiraServerRequestDelegator { public IssueTrackerResponse sendRequests(List<IssueTrackerRequest> requests) throws IntegrationException { if (null == context) { throw new IssueTrackerException("Context missing. Cannot determine Jira Server instance."); } if (null == requests || requests.isEmpty()) { throw new IssueTrackerException("Requests missing. Require at least one request."); } JiraServerProperties jiraProperties = (JiraServerProperties) context.getIssueTrackerConfig(); JiraServerServiceFactory jiraServerServiceFactory = jiraProperties.createJiraServicesServerFactory(logger, gson); if (!jiraProperties.isPluginCheckDisabled()) { checkIfAlertPluginIsInstalled(jiraServerServiceFactory.createPluginManagerService()); } ProjectService projectService = jiraServerServiceFactory.createProjectService(); UserSearchService userSearchService = jiraServerServiceFactory.createUserSearchService(); IssueTypeService issueTypeService = jiraServerServiceFactory.createIssueTypeService(); IssueMetaDataService issueMetaDataService = jiraServerServiceFactory.createIssueMetadataService(); JiraServerIssueConfigValidator jiraIssueConfigValidator = new JiraServerIssueConfigValidator(projectService, userSearchService, issueTypeService, issueMetaDataService); IssueConfig validIssueConfig = jiraIssueConfigValidator.createValidIssueConfig(context); IssueService issueService = jiraServerServiceFactory.createIssueService(); IssuePropertyService issuePropertyService = jiraServerServiceFactory.createIssuePropertyService(); IssueSearchService issueSearchService = jiraServerServiceFactory.createIssueSearchService(); JiraContentValidator jiraContentValidator = new JiraContentValidator(); JiraServerTransitionHandler jiraTransitionHandler = new JiraServerTransitionHandler(issueService); JiraServerIssuePropertyHandler jiraIssuePropertyHandler = new JiraServerIssuePropertyHandler(issueSearchService, issuePropertyService); JiraServerIssueHandler jiraIssueHandler = new JiraServerIssueHandler(issueService, jiraProperties, gson, jiraTransitionHandler, jiraIssuePropertyHandler, jiraContentValidator); return jiraIssueHandler.createOrUpdateIssues(validIssueConfig, requests); } JiraServerRequestDelegator(Gson gson, IssueTrackerContext context); }
JiraServerRequestDelegator { public IssueTrackerResponse sendRequests(List<IssueTrackerRequest> requests) throws IntegrationException { if (null == context) { throw new IssueTrackerException("Context missing. Cannot determine Jira Server instance."); } if (null == requests || requests.isEmpty()) { throw new IssueTrackerException("Requests missing. Require at least one request."); } JiraServerProperties jiraProperties = (JiraServerProperties) context.getIssueTrackerConfig(); JiraServerServiceFactory jiraServerServiceFactory = jiraProperties.createJiraServicesServerFactory(logger, gson); if (!jiraProperties.isPluginCheckDisabled()) { checkIfAlertPluginIsInstalled(jiraServerServiceFactory.createPluginManagerService()); } ProjectService projectService = jiraServerServiceFactory.createProjectService(); UserSearchService userSearchService = jiraServerServiceFactory.createUserSearchService(); IssueTypeService issueTypeService = jiraServerServiceFactory.createIssueTypeService(); IssueMetaDataService issueMetaDataService = jiraServerServiceFactory.createIssueMetadataService(); JiraServerIssueConfigValidator jiraIssueConfigValidator = new JiraServerIssueConfigValidator(projectService, userSearchService, issueTypeService, issueMetaDataService); IssueConfig validIssueConfig = jiraIssueConfigValidator.createValidIssueConfig(context); IssueService issueService = jiraServerServiceFactory.createIssueService(); IssuePropertyService issuePropertyService = jiraServerServiceFactory.createIssuePropertyService(); IssueSearchService issueSearchService = jiraServerServiceFactory.createIssueSearchService(); JiraContentValidator jiraContentValidator = new JiraContentValidator(); JiraServerTransitionHandler jiraTransitionHandler = new JiraServerTransitionHandler(issueService); JiraServerIssuePropertyHandler jiraIssuePropertyHandler = new JiraServerIssuePropertyHandler(issueSearchService, issuePropertyService); JiraServerIssueHandler jiraIssueHandler = new JiraServerIssueHandler(issueService, jiraProperties, gson, jiraTransitionHandler, jiraIssuePropertyHandler, jiraContentValidator); return jiraIssueHandler.createOrUpdateIssues(validIssueConfig, requests); } JiraServerRequestDelegator(Gson gson, IssueTrackerContext context); IssueTrackerResponse sendRequests(List<IssueTrackerRequest> requests); }
JiraServerRequestDelegator { public IssueTrackerResponse sendRequests(List<IssueTrackerRequest> requests) throws IntegrationException { if (null == context) { throw new IssueTrackerException("Context missing. Cannot determine Jira Server instance."); } if (null == requests || requests.isEmpty()) { throw new IssueTrackerException("Requests missing. Require at least one request."); } JiraServerProperties jiraProperties = (JiraServerProperties) context.getIssueTrackerConfig(); JiraServerServiceFactory jiraServerServiceFactory = jiraProperties.createJiraServicesServerFactory(logger, gson); if (!jiraProperties.isPluginCheckDisabled()) { checkIfAlertPluginIsInstalled(jiraServerServiceFactory.createPluginManagerService()); } ProjectService projectService = jiraServerServiceFactory.createProjectService(); UserSearchService userSearchService = jiraServerServiceFactory.createUserSearchService(); IssueTypeService issueTypeService = jiraServerServiceFactory.createIssueTypeService(); IssueMetaDataService issueMetaDataService = jiraServerServiceFactory.createIssueMetadataService(); JiraServerIssueConfigValidator jiraIssueConfigValidator = new JiraServerIssueConfigValidator(projectService, userSearchService, issueTypeService, issueMetaDataService); IssueConfig validIssueConfig = jiraIssueConfigValidator.createValidIssueConfig(context); IssueService issueService = jiraServerServiceFactory.createIssueService(); IssuePropertyService issuePropertyService = jiraServerServiceFactory.createIssuePropertyService(); IssueSearchService issueSearchService = jiraServerServiceFactory.createIssueSearchService(); JiraContentValidator jiraContentValidator = new JiraContentValidator(); JiraServerTransitionHandler jiraTransitionHandler = new JiraServerTransitionHandler(issueService); JiraServerIssuePropertyHandler jiraIssuePropertyHandler = new JiraServerIssuePropertyHandler(issueSearchService, issuePropertyService); JiraServerIssueHandler jiraIssueHandler = new JiraServerIssueHandler(issueService, jiraProperties, gson, jiraTransitionHandler, jiraIssuePropertyHandler, jiraContentValidator); return jiraIssueHandler.createOrUpdateIssues(validIssueConfig, requests); } JiraServerRequestDelegator(Gson gson, IssueTrackerContext context); IssueTrackerResponse sendRequests(List<IssueTrackerRequest> requests); static final String ERROR_MESSAGE_PLUGIN_CONFIG; }