Search in sources :

Example 1 with ServerInfo

use of com.atlassian.jira.rest.client.api.domain.ServerInfo in project opennms by OpenNMS.

the class VerifyCommand method verifyConnection.

private JiraRestClient verifyConnection() {
    final String host = config.getHost();
    final String username = config.getUsername();
    final String password = config.getPassword();
    try {
        System.out.println();
        System.out.println("Try connecting to jira server " + host + " with username: '" + username + "' and password: '" + password + "'...");
        final JiraRestClient connection = JiraConnectionFactory.createConnection(host, username, password);
        final ServerInfo serverInfo = connection.getMetadataClient().getServerInfo().get();
        System.out.println("Successfully connected to jira instance at " + host);
        System.out.println("Server Info:" + serverInfo.toString());
        System.out.println("OK");
        return connection;
    } catch (PluginException | InterruptedException | ExecutionException e) {
        throw new RuntimeException("Could not connect to jira server", e);
    }
}
Also used : ServerInfo(com.atlassian.jira.rest.client.api.domain.ServerInfo) PluginException(org.opennms.api.integration.ticketing.PluginException) JiraRestClient(com.atlassian.jira.rest.client.api.JiraRestClient) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

JiraRestClient (com.atlassian.jira.rest.client.api.JiraRestClient)1 ServerInfo (com.atlassian.jira.rest.client.api.domain.ServerInfo)1 ExecutionException (java.util.concurrent.ExecutionException)1 PluginException (org.opennms.api.integration.ticketing.PluginException)1