Search in sources :

Example 1 with AsynchronousJiraRestClientFactory

use of com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory in project syndesis-qe by syndesisio.

the class JiraClientFactory method getJiraRestClient.

@Bean
public JiraRestClient getJiraRestClient() throws URISyntaxException {
    Account jiraAccount = AccountsDirectory.getInstance().get("Jira");
    String jiraUrl = jiraAccount.getProperty("jiraurl");
    return new AsynchronousJiraRestClientFactory().create(new URI(jiraUrl), new OAuthJiraAuthenticationHandler());
}
Also used : Account(io.syndesis.qe.account.Account) AsynchronousJiraRestClientFactory(com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory) URI(java.net.URI) Bean(org.springframework.context.annotation.Bean)

Example 2 with AsynchronousJiraRestClientFactory

use of com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory in project mirrorgate-jira-stories-collector by BBVA.

the class Config method getJiraRestClient.

@Bean
public synchronized JiraRestClient getJiraRestClient() {
    if (restClientInstance == null) {
        URI jiraServerUri = null;
        try {
            jiraServerUri = new URI(jiraUrl);
        } catch (URISyntaxException e) {
            e.printStackTrace();
        }
        restClientInstance = new AsynchronousJiraRestClientFactory().createWithBasicHttpAuthentication(jiraServerUri, jiraUserName, jiraPassword);
    }
    return restClientInstance;
}
Also used : AsynchronousJiraRestClientFactory(com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI) Bean(org.springframework.context.annotation.Bean)

Example 3 with AsynchronousJiraRestClientFactory

use of com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory in project syndesis-qe by syndesisio.

the class IssueHooksUtils method getJiraClient.

private static JiraRestClient getJiraClient(Scenario scenario) {
    String userName = "";
    String password = "";
    String instanceUrl = "";
    URI uri = null;
    Optional<Account> account = AccountsDirectory.getInstance().getAccount(Account.Name.JIRA_HOOK);
    if (account.isPresent()) {
        if (!account.get().getProperties().keySet().containsAll(Arrays.asList("username", "password", "instanceUrl"))) {
            logError(scenario, "Account with name \"Jira\" and properties \"username\", \"password\", \"instanceUrl\" is required in credentials.json file.");
            logError(scenario, "If you want to get known issues from Jira in logs in case of scenario fails, update your credentials.");
            return null;
        } else {
            userName = account.get().getProperty("username");
            password = account.get().getProperty("password");
            instanceUrl = account.get().getProperty("instanceUrl");
        }
    }
    JiraRestClientFactory factory = new AsynchronousJiraRestClientFactory();
    try {
        uri = new URI(instanceUrl);
    } catch (URISyntaxException e) {
        log.error("URL {} is a malformed URL", instanceUrl);
        e.printStackTrace();
    }
    return factory.createWithBasicHttpAuthentication(uri, userName, password);
}
Also used : Account(io.syndesis.qe.account.Account) AsynchronousJiraRestClientFactory(com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory) JiraRestClientFactory(com.atlassian.jira.rest.client.api.JiraRestClientFactory) AsynchronousJiraRestClientFactory(com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory) URISyntaxException(java.net.URISyntaxException) URI(java.net.URI)

Aggregations

AsynchronousJiraRestClientFactory (com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory)3 URI (java.net.URI)3 Account (io.syndesis.qe.account.Account)2 URISyntaxException (java.net.URISyntaxException)2 Bean (org.springframework.context.annotation.Bean)2 JiraRestClientFactory (com.atlassian.jira.rest.client.api.JiraRestClientFactory)1