#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 e066093976
commit e51c06c8e3
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)));

View File

@@ -0,0 +1,22 @@
{
"expand": "operations,editmeta,changelog,transitions,renderedFields",
"id": "67908",
"self": "https://jira.spring.io/rest/api/2/issue/67908",
"key": "DATAREST-782",
"fields": {
"summary": "Release 2.5 RC1 (Hopper)",
"resolution": {
"self": "https://jira.spring.io/rest/api/2/resolution/1",
"id": "1",
"description": "A fix for this issue is checked into the tree and tested.",
"name": "Fixed"
},
"status": {
"name": "In Progress",
"id": "6",
"statusCategory": {
"key": "indeterminate"
}
}
}
}