use of com.synopsys.integration.jira.common.server.service.JiraServerServiceFactory in project hub-alert by blackducksoftware.
the class JiraServerPropertiesTest method testServerServiceFactory.
@Test
public void testServerServiceFactory() {
try {
JiraServerProperties properties = new JiraServerProperties("http://localhost:2990", "password", "user", false, ProxyInfo.NO_PROXY_INFO);
JiraServerServiceFactory serviceFactory = properties.createJiraServicesServerFactory(LoggerFactory.getLogger(getClass()), new Gson());
assertNotNull(serviceFactory);
} catch (IssueTrackerException ex) {
ex.printStackTrace();
fail();
}
}
use of com.synopsys.integration.jira.common.server.service.JiraServerServiceFactory in project hub-alert by blackducksoftware.
the class JiraServerCustomFunctionAction method createActionResponse.
@Override
public ActionResponse<String> createActionResponse(FieldModel fieldModel, HttpServletContentWrapper ignoredServletContent) {
try {
JiraServerProperties jiraProperties = jiraServerPropertiesFactory.createJiraPropertiesWithJobId(UUID.fromString(fieldModel.getId()));
JiraServerServiceFactory jiraServicesFactory = jiraProperties.createJiraServicesServerFactory(logger, gson);
PluginManagerService jiraAppService = jiraServicesFactory.createPluginManagerService();
try {
jiraAppService.installMarketplaceServerApp(JiraConstants.JIRA_APP_KEY);
} catch (IntegrationRestException e) {
if (RestConstants.NOT_FOUND_404 == e.getHttpStatusCode()) {
return new ActionResponse<>(HttpStatus.NOT_FOUND, String.format("The marketplace listing of the '%s' app may not support your version of Jira. Please install the app manually or request a compatibility update. Error: %s", JiraConstants.JIRA_ALERT_APP_NAME, e.getMessage()));
}
return createBadRequestIntegrationException(e);
}
boolean jiraPluginInstalled = JiraPluginCheckUtils.checkIsAppInstalledAndRetryIfNecessary(jiraAppService);
if (!jiraPluginInstalled) {
return new ActionResponse<>(HttpStatus.NOT_FOUND, String.format("Unable to confirm Jira server successfully installed the '%s' plugin. Please verify the installation on you Jira server.", JiraConstants.JIRA_ALERT_APP_NAME));
}
return new ActionResponse<>(HttpStatus.OK, String.format("Successfully installed the '%s' plugin on Jira server.", JiraConstants.JIRA_ALERT_APP_NAME));
} catch (IntegrationException e) {
return createBadRequestIntegrationException(e);
} catch (InterruptedException e) {
logger.error("Thread was interrupted while validating Jira plugin installation.", e);
Thread.currentThread().interrupt();
return new ActionResponse<>(HttpStatus.INTERNAL_SERVER_ERROR, String.format("Thread was interrupted while validating Jira '%s' plugin installation: %s", JiraConstants.JIRA_ALERT_APP_NAME, e.getMessage()));
}
}
use of com.synopsys.integration.jira.common.server.service.JiraServerServiceFactory in project hub-alert by blackducksoftware.
the class JiraServerGlobalFieldModelTestAction method canUserGetIssues.
@Override
protected boolean canUserGetIssues(FieldUtility fieldUtility) throws IntegrationException {
JiraServerProperties jiraProperties = createJiraProperties(fieldUtility);
JiraServerServiceFactory jiraServerServiceFactory = jiraProperties.createJiraServicesServerFactory(logger, gson);
IssueSearchService issueSearchService = jiraServerServiceFactory.createIssueSearchService();
IssueSearchResponseModel issueSearchResponseModel = issueSearchService.queryForIssuePage("", 0, 1);
return issueSearchResponseModel.getIssues().size() > 0;
}
use of com.synopsys.integration.jira.common.server.service.JiraServerServiceFactory in project hub-alert by blackducksoftware.
the class JiraServerProperties method createJiraServicesServerFactory.
public JiraServerServiceFactory createJiraServicesServerFactory(Logger logger, Gson gson) throws IssueTrackerException {
JiraServerRestConfig jiraServerConfig = createJiraServerConfig();
Slf4jIntLogger intLogger = new Slf4jIntLogger(logger);
JiraHttpClient jiraHttpClient = jiraServerConfig.createJiraHttpClient(intLogger);
return new JiraServerServiceFactory(intLogger, jiraHttpClient, gson);
}
Aggregations