com.atlassian.jira.rest.client.api.JiraRestClient Java Examples

The following examples show how to use com.atlassian.jira.rest.client.api.JiraRestClient. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JiraGovernorClientFactory.java    From arquillian-governor with Apache License 2.0 5 votes vote down vote up
@Override
public JiraGovernorClient build(JiraGovernorConfiguration jiraGovernorConfiguration) throws Exception {
    Validate.notNull(jiraGovernorConfiguration, "Jira governor configuration has to be set.");
    this.jiraGovernorConfiguration = jiraGovernorConfiguration;

    final URI jiraServerUri = this.jiraGovernorConfiguration.getServerURI();
    final String username = this.jiraGovernorConfiguration.getUsername();
    final String password = this.jiraGovernorConfiguration.getPassword();

    final AsynchronousJiraRestClientFactory factory = new AsynchronousJiraRestClientFactory();

    final AuthenticationHandler authHandler;

    if (username == null || username.isEmpty()) {
        authHandler = new AnonymousAuthenticationHandler();

    } else {
        authHandler = new BasicHttpAuthenticationHandler(username, password);
    }

    final JiraRestClient restClient = factory.create(jiraServerUri, authHandler);

    final JiraGovernorClient client = new JiraGovernorClient();
    client.setConfiguration(this.jiraGovernorConfiguration);
    client.initializeRestClient(restClient);
    client.setGovernorStrategy(new JiraGovernorStrategy(jiraGovernorConfiguration));

    return client;
}
 
Example #2
Source File: JiraModule.java    From rocketchat-jira-trigger with MIT License 4 votes vote down vote up
@Provides
@Singleton
JiraRestClient provideJiraRestClient(JiraConfiguration jiraConfig, AuthenticationHandler authHandler) {
	AsynchronousJiraRestClientFactory factory = new AsynchronousJiraRestClientFactory();
	return factory.create(jiraConfig.getUri(), authHandler);
}
 
Example #3
Source File: JiraModule.java    From rocketchat-jira-trigger with MIT License 4 votes vote down vote up
@Provides
@Singleton
MetadataRestClient provideMetadataRestClient(JiraRestClient jiraClient) {
	return jiraClient.getMetadataClient();
}
 
Example #4
Source File: JiraModule.java    From rocketchat-jira-trigger with MIT License 4 votes vote down vote up
@Provides
@Singleton
IssueRestClient provideIssueRestClient(JiraRestClient jiraClient) {
	return jiraClient.getIssueClient();
}
 
Example #5
Source File: JiraGovernorClient.java    From arquillian-governor with Apache License 2.0 4 votes vote down vote up
void initializeRestClient(final JiraRestClient restClient) throws Exception {
    Validate.notNull(restClient, "Jira REST client must be specified.");
    this.restClient = restClient;

    jiraBuildNumber = this.restClient.getMetadataClient().getServerInfo().claim().getBuildNumber();
}
 
Example #6
Source File: ThirdEyeJiraClient.java    From incubator-pinot with Apache License 2.0 4 votes vote down vote up
private JiraRestClient createJiraRestClient(JiraConfiguration jiraAdminConfig) {
  return new AsynchronousJiraRestClientFactory().createWithBasicHttpAuthentication(
      URI.create(jiraAdminConfig.getJiraHost()),
      jiraAdminConfig.getJiraUser(),
      jiraAdminConfig.getJiraPassword());
}
 
Example #7
Source File: MyJiraClient.java    From tutorials with MIT License 4 votes vote down vote up
private JiraRestClient getJiraRestClient() {
    return new AsynchronousJiraRestClientFactory()
      .createWithBasicHttpAuthentication(getJiraUri(), this.username, this.password);
}