#94 - Extend IssueTracker.closeIteration(…) to resolve release tickets.
closeIteration() now resolves release tickets within its release version to simplify post-release tasks.
This commit is contained in:
@@ -147,8 +147,8 @@ public class GitHubIssueTrackerIntegrationTests extends AbstractIntegrationTests
|
||||
|
||||
github.createReleaseVersion(BUILD_HOPPER_RC1);
|
||||
|
||||
verify(postRequestedFor(urlPathMatching(MILESTONES_URI))
|
||||
.withRequestBody(equalToJson("{\"title\":\"1.8 RC1 (Hopper)\", \"description\":\"Hopper RC1\"}")));
|
||||
verify(postRequestedFor(urlPathMatching(MILESTONES_URI)).withRequestBody(
|
||||
equalToJson("{\"title\":\"1.8 RC1 (Hopper)\", \"description\":\"Hopper RC1\",\"open\":false}")));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -231,6 +231,27 @@ public class GitHubIssueTrackerIntegrationTests extends AbstractIntegrationTests
|
||||
.withRequestBody(equalToJson("{\"assignees\":[\"mp911de\"]}")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #94
|
||||
*/
|
||||
@Test
|
||||
public void closeIterationShouldResolveReleaseTicket() {
|
||||
|
||||
mockGetMilestonesWith("milestones.json");
|
||||
mockGetIssuesWith("issues.json");
|
||||
|
||||
mockService.stubFor(patch(urlPathMatching(RELEASE_TICKET_URI)).//
|
||||
willReturn(json("issue.json")));
|
||||
|
||||
mockService.stubFor(patch(urlPathMatching(MILESTONES_URI + "/45")).//
|
||||
willReturn(aResponse().withStatus(200)));
|
||||
|
||||
github.closeIteration(BUILD_HOPPER_RC1);
|
||||
|
||||
verify(patchRequestedFor(urlPathMatching(RELEASE_TICKET_URI))
|
||||
.withRequestBody(equalToJson("{\"state\":\"closed\",\"assignees\":[\"mp911de\"]}")));
|
||||
}
|
||||
|
||||
private void mockGetIssueWith(String fromClassPath, int issueId) {
|
||||
mockService.stubFor(get(urlPathMatching(ISSUES_URI + "/" + issueId)).//
|
||||
willReturn(json(fromClassPath)));
|
||||
|
||||
@@ -298,8 +298,8 @@ public class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
||||
|
||||
jira.assignTicketToMe(new Ticket("DATAREDIS-302", "", null));
|
||||
|
||||
verify(putRequestedFor(urlPathMatching("/rest/api/2/issue/DATAREDIS-302"))
|
||||
.withRequestBody(equalToJson("{\"update\":{\"assignee\":[ {\"set\":{\"name\":\"dummy\"}} ] }}")));
|
||||
verify(putRequestedFor(urlPathMatching("/rest/api/2/issue/DATAREDIS-302")).withRequestBody(equalToJson(
|
||||
"{\"update\":{\"assignee\":[ {\"set\":{\"name\":\"dummy\"}} ] }, \"transition\":{}, \"fields\":{}}")));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -321,6 +321,28 @@ public class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
||||
verify(0, postRequestedFor(urlPathMatching("/rest/api/2/issue/DATACASS-302")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #94
|
||||
*/
|
||||
@Test
|
||||
public void closeIterationShouldResolveReleaseTicket() {
|
||||
|
||||
ModuleIteration moduleIteration = ReleaseTrains.HOPPER.getModuleIteration(Iteration.RC1, "REST");
|
||||
|
||||
properties.setUsername("mp911de");
|
||||
|
||||
mockGetProjectVersionsWith("releaseVersions.json", moduleIteration.getProjectKey());
|
||||
mockSearchWith("releaseTickets.json");
|
||||
|
||||
mockService.stubFor(get(urlPathMatching("/rest/api/2/issue/DATAREST-782")).//
|
||||
willReturn(json("releaseTicket.json")));
|
||||
|
||||
jira.closeIteration(moduleIteration);
|
||||
|
||||
verify(postRequestedFor(urlPathMatching("/rest/api/2/issue/DATAREST-782")).withRequestBody(
|
||||
equalToJson("{\"update\":{},\"transition\":{\"id\":5},\"fields\":{\"resolution\":{\"name\":\"Complete\"}}}")));
|
||||
}
|
||||
|
||||
private void mockSearchWith(String fromClassPath) {
|
||||
mockService.stubFor(get(urlPathMatching(SEARCH_URI)).//
|
||||
willReturn(json(fromClassPath)));
|
||||
|
||||
Reference in New Issue
Block a user