Search in sources :

Example 11 with Status

use of com.atlassian.jira.rest.client.api.domain.Status in project jira-plugin by jenkinsci.

the class JiraTester method main.

public static void main(String[] args) throws Exception {
    final URI uri = new URL(JiraConfig.getUrl()).toURI();
    final ExtendedJiraRestClient jiraRestClient = new ExtendedAsynchronousJiraRestClientFactory().createWithBasicHttpAuthentication(uri, JiraConfig.getUsername(), JiraConfig.getPassword());
    final JiraRestService restService = new JiraRestService(uri, jiraRestClient, JiraConfig.getUsername(), JiraConfig.getPassword(), JiraSite.DEFAULT_TIMEOUT);
    final String projectKey = "TESTPROJECT";
    final String issueId = "TESTPROJECT-425";
    final Integer actionId = 21;
    final Issue issue = restService.getIssue(issueId);
    System.out.println("issue:" + issue);
    final List<Transition> availableActions = restService.getAvailableActions(issueId);
    for (Transition action : availableActions) {
        System.out.println("Action:" + action);
    }
    for (IssueType issueType : restService.getIssueTypes()) {
        System.out.println(" issue type: " + issueType);
    }
    // restService.addVersion("TESTPROJECT", "0.0.2");
    final List<Component> components = restService.getComponents(projectKey);
    for (Component component : components) {
        System.out.println("component: " + component);
    }
    // BasicComponent backendComponent = null;
    // final Iterable<BasicComponent> components1 = Lists.newArrayList(backendComponent);
    // restService.createIssue("TESTPROJECT", "This is a test issue created using Jira jenkins plugin. Please ignore it.", "TESTUSER", components1, "test issue from Jira jenkins plugin");
    final List<Issue> searchResults = restService.getIssuesFromJqlSearch("project = \"TESTPROJECT\"", 3);
    for (Issue searchResult : searchResults) {
        System.out.println("JQL search result: " + searchResult);
    }
    final List<String> projectsKeys = restService.getProjectsKeys();
    for (String projectsKey : projectsKeys) {
        System.out.println("project key: " + projectsKey);
    }
    final List<Status> statuses = restService.getStatuses();
    for (Status status : statuses) {
        System.out.println("status:" + status);
    }
    final User user = restService.getUser("TESTUSER");
    System.out.println("user: " + user);
    final List<ExtendedVersion> versions = restService.getVersions(projectKey);
    for (ExtendedVersion version : versions) {
        System.out.println("version: " + version);
    }
    for (int i = 0; i < 10; i++) {
        callUniq(restService);
    }
    for (int i = 0; i < 10; i++) {
        callDuplicate(restService);
    }
}
Also used : Status(com.atlassian.jira.rest.client.api.domain.Status) Issue(com.atlassian.jira.rest.client.api.domain.Issue) User(com.atlassian.jira.rest.client.api.domain.User) IssueType(com.atlassian.jira.rest.client.api.domain.IssueType) ExtendedJiraRestClient(hudson.plugins.jira.extension.ExtendedJiraRestClient) URI(java.net.URI) URL(java.net.URL) ExtendedAsynchronousJiraRestClientFactory(hudson.plugins.jira.JiraSite.ExtendedAsynchronousJiraRestClientFactory) Transition(com.atlassian.jira.rest.client.api.domain.Transition) ExtendedVersion(hudson.plugins.jira.extension.ExtendedVersion) JiraRestService(hudson.plugins.jira.JiraRestService) Component(com.atlassian.jira.rest.client.api.domain.Component)

Example 12 with Status

use of com.atlassian.jira.rest.client.api.domain.Status in project camel-spring-boot by apache.

the class Utils method transitionIssueDone.

public static Issue transitionIssueDone(Issue issue) {
    URI doneStatusUri = URI.create(TEST_JIRA_URL + "/rest/api/2/status/1");
    URI doneResolutionUri = URI.create(TEST_JIRA_URL + "/rest/api/2/resolution/1");
    StatusCategory sc = new StatusCategory(doneResolutionUri, "statusCategory", 1L, "SC-1", "GREEN");
    Status status = new Status(doneStatusUri, 1L, "Done", "Done", null, sc);
    Resolution resolution = new Resolution(doneResolutionUri, 5L, "Resolution", "Resolution");
    return transitionIssueDone(issue, status, resolution);
}
Also used : Status(com.atlassian.jira.rest.client.api.domain.Status) StatusCategory(com.atlassian.jira.rest.client.api.StatusCategory) URI(java.net.URI) Resolution(com.atlassian.jira.rest.client.api.domain.Resolution)

Aggregations

Status (com.atlassian.jira.rest.client.api.domain.Status)12 Issue (com.atlassian.jira.rest.client.api.domain.Issue)8 Test (org.junit.Test)5 WithoutJenkins (org.jvnet.hudson.test.WithoutJenkins)4 IssueType (com.atlassian.jira.rest.client.api.domain.IssueType)3 URI (java.net.URI)3 StatusCategory (com.atlassian.jira.rest.client.api.StatusCategory)2 Resolution (com.atlassian.jira.rest.client.api.domain.Resolution)2 Transition (com.atlassian.jira.rest.client.api.domain.Transition)2 IOException (java.io.IOException)2 IssueRestClient (com.atlassian.jira.rest.client.api.IssueRestClient)1 JiraRestClient (com.atlassian.jira.rest.client.api.JiraRestClient)1 JiraRestClientFactory (com.atlassian.jira.rest.client.api.JiraRestClientFactory)1 Attachment (com.atlassian.jira.rest.client.api.domain.Attachment)1 Component (com.atlassian.jira.rest.client.api.domain.Component)1 IssueField (com.atlassian.jira.rest.client.api.domain.IssueField)1 Subtask (com.atlassian.jira.rest.client.api.domain.Subtask)1 User (com.atlassian.jira.rest.client.api.domain.User)1 TransitionInput (com.atlassian.jira.rest.client.api.domain.input.TransitionInput)1 Config (com.bbva.arq.devops.ae.mirrorgate.collectors.jira.config.Config)1