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
}
};
}
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);
}
}
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);
}
Aggregations