#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:
Mark Paluch
2018-12-11 09:48:18 +01:00
parent 96400bfef2
commit 2360aa3612
7 changed files with 244 additions and 22 deletions

View File

@@ -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)));

View File

@@ -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)));