Search in sources :

Example 1 with Resolution

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

the class TransitionIssueProducerTest method contextConfiguration.

@Bean
CamelContextConfiguration contextConfiguration() {
    return new CamelContextConfiguration() {

        @Override
        public void beforeApplicationStart(CamelContext context) {
            // get chance to mock camelContext/Registry
            jiraRestClientFactory = mock(JiraRestClientFactory.class);
            jiraClient = mock(JiraRestClient.class);
            issueRestClient = mock(IssueRestClient.class);
            lenient().when(jiraRestClientFactory.createWithBasicHttpAuthentication(any(), any(), any())).thenReturn(jiraClient);
            lenient().when(jiraClient.getIssueClient()).thenReturn(issueRestClient);
            issue = createIssue(1);
            when(issueRestClient.getIssue(any())).then(inv -> Promises.promise(issue));
            when(issueRestClient.transition(any(Issue.class), any(TransitionInput.class))).then(inv -> {
                URI doneStatusUri = URI.create(TEST_JIRA_URL + "/rest/api/2/status/1");
                URI doneResolutionUri = URI.create(TEST_JIRA_URL + "/rest/api/2/resolution/1");
                Status status = new Status(doneStatusUri, 1L, "Done", "Done", null, null);
                Resolution resolution = new Resolution(doneResolutionUri, 1L, "Resolution", "Resolution");
                issue = transitionIssueDone(issue, status, resolution);
                return null;
            });
            camelContext.getRegistry().bind(JIRA_REST_CLIENT_FACTORY, jiraRestClientFactory);
        }

        @Override
        public void afterApplicationStart(CamelContext camelContext) {
        // do nothing here
        }
    };
}
Also used : CamelContext(org.apache.camel.CamelContext) Status(com.atlassian.jira.rest.client.api.domain.Status) CamelContextConfiguration(org.apache.camel.spring.boot.CamelContextConfiguration) TransitionInput(com.atlassian.jira.rest.client.api.domain.input.TransitionInput) Issue(com.atlassian.jira.rest.client.api.domain.Issue) Utils.createIssue(org.apache.camel.component.jira.springboot.test.Utils.createIssue) JiraRestClientFactory(com.atlassian.jira.rest.client.api.JiraRestClientFactory) JiraRestClient(com.atlassian.jira.rest.client.api.JiraRestClient) IssueRestClient(com.atlassian.jira.rest.client.api.IssueRestClient) URI(java.net.URI) Resolution(com.atlassian.jira.rest.client.api.domain.Resolution) Bean(org.springframework.context.annotation.Bean)

Example 2 with Resolution

use of com.atlassian.jira.rest.client.api.domain.Resolution in project camel-quarkus by apache.

the class JiraTest method workflowTransition.

@Test
public void workflowTransition() {
    // Create issue
    String issueKey = createIssue();
    try {
        Issue originalIssue = getClient().getIssueClient().getIssue(issueKey).claim();
        assertNotNull(originalIssue);
        Resolution originalResolution = originalIssue.getResolution();
        assertNull(originalResolution);
        String transitionId = System.getenv("JIRA_TRANSITION_ID");
        if (transitionId == null) {
            // The default for the Jira docker server
            transitionId = "31";
        }
        // Transition issue
        RestAssured.given().contentType(ContentType.TEXT).pathParam("key", issueKey).body(transitionId).when().post("/jira/issue/{key}/transition").then().statusCode(200);
        // Verify issue workflow transition
        await().atMost(10, TimeUnit.SECONDS).pollDelay(1, TimeUnit.SECONDS).until(() -> {
            Issue issue = getClient().getIssueClient().getIssue(issueKey).claim();
            assertNotNull(issue);
            Resolution resolution = issue.getResolution();
            return resolution != null;
        });
    } finally {
        deleteIssue(issueKey);
    }
}
Also used : Issue(com.atlassian.jira.rest.client.api.domain.Issue) Resolution(com.atlassian.jira.rest.client.api.domain.Resolution) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 3 with Resolution

use of com.atlassian.jira.rest.client.api.domain.Resolution 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

Resolution (com.atlassian.jira.rest.client.api.domain.Resolution)3 Issue (com.atlassian.jira.rest.client.api.domain.Issue)2 Status (com.atlassian.jira.rest.client.api.domain.Status)2 URI (java.net.URI)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 StatusCategory (com.atlassian.jira.rest.client.api.StatusCategory)1 TransitionInput (com.atlassian.jira.rest.client.api.domain.input.TransitionInput)1 QuarkusTest (io.quarkus.test.junit.QuarkusTest)1 CamelContext (org.apache.camel.CamelContext)1 Utils.createIssue (org.apache.camel.component.jira.springboot.test.Utils.createIssue)1 CamelContextConfiguration (org.apache.camel.spring.boot.CamelContextConfiguration)1 Test (org.junit.jupiter.api.Test)1 Bean (org.springframework.context.annotation.Bean)1