#147 - Add means to create a ticket for each project.
We now have a command to create a ticket per module iteration using the summary as argument. tracker create tickets <module iteration> -text "summary"
This commit is contained in:
@@ -95,11 +95,19 @@ public interface IssueTracker extends Plugin<Project> {
|
|||||||
*/
|
*/
|
||||||
void createReleaseTicket(ModuleIteration module);
|
void createReleaseTicket(ModuleIteration module);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a ticket for the given {@link ModuleIteration} and summary {@code text}.
|
||||||
|
*
|
||||||
|
* @param module must not be {@literal null}.
|
||||||
|
* @param text the text to use.
|
||||||
|
* @return the created ticket.
|
||||||
|
*/
|
||||||
|
Ticket createTicket(ModuleIteration module, String text);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assigns the ticket to the current user.
|
* Assigns the ticket to the current user.
|
||||||
*
|
*
|
||||||
* @param ticket must not be {@literal null}.
|
* @param ticket must not be {@literal null}.
|
||||||
* @param credentials must not be {@literal null}.
|
|
||||||
*/
|
*/
|
||||||
void assignTicketToMe(Ticket ticket);
|
void assignTicketToMe(Ticket ticket);
|
||||||
|
|
||||||
|
|||||||
@@ -126,6 +126,15 @@ class IssueTrackerCommands extends TimedCommand {
|
|||||||
return releaseTickets(iteration);
|
return releaseTickets(iteration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@CliCommand(value = "tracker create tickets")
|
||||||
|
public String createTickets(@CliOption(key = "", mandatory = true) TrainIteration iteration,
|
||||||
|
@CliOption(key = "text", mandatory = true) String text) {
|
||||||
|
|
||||||
|
return iteration.stream().//
|
||||||
|
map(module -> getTrackerFor(module).createTicket(module, text)).collect(Tickets.toTicketsCollector())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
|
||||||
@CliCommand("tracker changelog")
|
@CliCommand("tracker changelog")
|
||||||
public String changelog(@CliOption(key = "", mandatory = true) TrainIteration iteration, //
|
public String changelog(@CliOption(key = "", mandatory = true) TrainIteration iteration, //
|
||||||
@CliOption(key = "module") String moduleName) {
|
@CliOption(key = "module") String moduleName) {
|
||||||
|
|||||||
@@ -24,13 +24,15 @@ import org.springframework.util.Assert;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Value object to represent a {@link Ticket}.
|
* Value object to represent a {@link Ticket}.
|
||||||
*
|
*
|
||||||
* @author Oliver Gierke
|
* @author Oliver Gierke
|
||||||
|
* @author Mark Paluch
|
||||||
*/
|
*/
|
||||||
@Value
|
@Value
|
||||||
public class Ticket {
|
public class Ticket {
|
||||||
|
|
||||||
String id, summary;
|
String id, summary;
|
||||||
|
String url;
|
||||||
TicketStatus ticketStatus;
|
TicketStatus ticketStatus;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -39,7 +41,7 @@ public class Ticket {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("%14s - %s", id, summary);
|
return String.format("%14s - %s (%s)", id, summary, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isResolved() {
|
public boolean isResolved() {
|
||||||
@@ -48,7 +50,7 @@ public class Ticket {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the current {@link Ticket} is the release ticket for the given {@link ModuleIteration}.
|
* Returns whether the current {@link Ticket} is the release ticket for the given {@link ModuleIteration}.
|
||||||
*
|
*
|
||||||
* @param module must not be {@literal null}.
|
* @param module must not be {@literal null}.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -60,7 +62,7 @@ public class Ticket {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the current {@link Ticket} is a release ticket for the given {@link TrainIteration}.
|
* Returns whether the current {@link Ticket} is a release ticket for the given {@link TrainIteration}.
|
||||||
*
|
*
|
||||||
* @param train must not be {@literal null}.
|
* @param train must not be {@literal null}.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -246,24 +246,38 @@ class GitHub implements IssueTracker {
|
|||||||
|
|
||||||
Assert.notNull(moduleIteration, "ModuleIteration must not be null.");
|
Assert.notNull(moduleIteration, "ModuleIteration must not be null.");
|
||||||
|
|
||||||
HttpHeaders httpHeaders = newUserScopedHttpHeaders();
|
|
||||||
Tickets tickets = getTicketsFor(moduleIteration);
|
Tickets tickets = getTicketsFor(moduleIteration);
|
||||||
|
|
||||||
if (tickets.hasReleaseTicket(moduleIteration)) {
|
if (tickets.hasReleaseTicket(moduleIteration)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.log(moduleIteration, "Creating release ticket…");
|
||||||
|
|
||||||
|
doCreateTicket(moduleIteration, Tracker.releaseTicketSummary(moduleIteration));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Ticket createTicket(ModuleIteration moduleIteration, String text) {
|
||||||
|
|
||||||
|
logger.log(moduleIteration, "Creating ticket…");
|
||||||
|
|
||||||
|
return doCreateTicket(moduleIteration, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Ticket doCreateTicket(ModuleIteration moduleIteration, String text) {
|
||||||
|
HttpHeaders httpHeaders = newUserScopedHttpHeaders();
|
||||||
|
|
||||||
String repositoryName = GitProject.of(moduleIteration.getProject()).getRepositoryName();
|
String repositoryName = GitProject.of(moduleIteration.getProject()).getRepositoryName();
|
||||||
Milestone milestone = getMilestone(moduleIteration, repositoryName);
|
Milestone milestone = getMilestone(moduleIteration, repositoryName);
|
||||||
GitHubIssue gitHubIssue = GitHubIssue.of(Tracker.releaseTicketSummary(moduleIteration), milestone);
|
GitHubIssue gitHubIssue = GitHubIssue.of(text, milestone);
|
||||||
|
|
||||||
Map<String, Object> parameters = newUrlTemplateVariables();
|
Map<String, Object> parameters = newUrlTemplateVariables();
|
||||||
parameters.put("repoName", repositoryName);
|
parameters.put("repoName", repositoryName);
|
||||||
|
|
||||||
logger.log(moduleIteration, "Creating release ticket…");
|
GitHubIssue body = operations.exchange(ISSUES_URI_TEMPLATE, HttpMethod.POST,
|
||||||
|
new HttpEntity<Object>(gitHubIssue, httpHeaders), GitHubIssue.class, parameters).getBody();
|
||||||
|
|
||||||
operations.exchange(ISSUES_URI_TEMPLATE, HttpMethod.POST, new HttpEntity<Object>(gitHubIssue, httpHeaders),
|
return toTicket(body);
|
||||||
GitHubIssue.class, parameters).getBody();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Cacheable("tickets")
|
@Cacheable("tickets")
|
||||||
@@ -530,12 +544,12 @@ class GitHub implements IssueTracker {
|
|||||||
Optional<Milestone> milestone = findMilestone(moduleIteration, repositoryName);
|
Optional<Milestone> milestone = findMilestone(moduleIteration, repositoryName);
|
||||||
|
|
||||||
return milestone
|
return milestone
|
||||||
.orElseThrow(() -> new IllegalArgumentException(String.format("No milestone for %s found containing %s!", //
|
.orElseThrow(() -> new IllegalStateException(String.format("No milestone for %s found containing %s!", //
|
||||||
moduleIteration.getProject().getFullName(), //
|
moduleIteration.getProject().getFullName(), //
|
||||||
new GithubMilestone(moduleIteration))));
|
new GithubMilestone(moduleIteration))));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Ticket toTicket(GitHubIssue issue) {
|
private static Ticket toTicket(GitHubIssue issue) {
|
||||||
return new Ticket(issue.getId(), issue.getTitle(), new GithubTicketStatus(issue.getState()));
|
return new Ticket(issue.getId(), issue.getTitle(), issue.getHtmlUrl(), new GithubTicketStatus(issue.getState()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.springframework.data.release.issues.github;
|
package org.springframework.data.release.issues.github;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.Value;
|
import lombok.Value;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
@@ -25,31 +24,42 @@ import org.springframework.data.release.model.ModuleIteration;
|
|||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Oliver Gierke
|
* @author Oliver Gierke
|
||||||
* @author Mark Paluch
|
* @author Mark Paluch
|
||||||
*/
|
*/
|
||||||
@Value
|
@Value
|
||||||
@RequiredArgsConstructor
|
|
||||||
class GitHubIssue {
|
class GitHubIssue {
|
||||||
|
|
||||||
String number, title, state;
|
String number, title, state;
|
||||||
List<Object> assignees;
|
List<Object> assignees;
|
||||||
|
String htmlUrl;
|
||||||
Object milestone;
|
Object milestone;
|
||||||
|
|
||||||
|
public GitHubIssue(String number, String title, String state, List<Object> assignees,
|
||||||
|
@JsonProperty("html_url") String htmlUrl, Object milestone) {
|
||||||
|
this.number = number;
|
||||||
|
this.title = title;
|
||||||
|
this.state = state;
|
||||||
|
this.assignees = assignees;
|
||||||
|
this.htmlUrl = htmlUrl;
|
||||||
|
this.milestone = milestone;
|
||||||
|
}
|
||||||
|
|
||||||
public static GitHubIssue of(String title, Milestone milestone) {
|
public static GitHubIssue of(String title, Milestone milestone) {
|
||||||
return new GitHubIssue(null, title, null, null, milestone.number);
|
return new GitHubIssue(null, title, null, null, null, milestone.number);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GitHubIssue assignedTo(String username) {
|
public static GitHubIssue assignedTo(String username) {
|
||||||
|
|
||||||
Assert.hasText(username, "Username must not be null or empty!");
|
Assert.hasText(username, "Username must not be null or empty!");
|
||||||
return new GitHubIssue(null, null, null, Collections.singletonList(username), null);
|
return new GitHubIssue(null, null, null, Collections.singletonList(username), null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public GitHubIssue close() {
|
public GitHubIssue close() {
|
||||||
return new GitHubIssue(this.number, this.title, "closed", this.assignees, this.milestone);
|
return new GitHubIssue(this.number, this.title, "closed", this.assignees, null, this.milestone);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import org.springframework.data.release.issues.jira.JiraIssue.StatusCategory;
|
|||||||
import org.springframework.data.release.model.ModuleIteration;
|
import org.springframework.data.release.model.ModuleIteration;
|
||||||
import org.springframework.data.release.model.Project;
|
import org.springframework.data.release.model.Project;
|
||||||
import org.springframework.data.release.model.ProjectKey;
|
import org.springframework.data.release.model.ProjectKey;
|
||||||
|
import org.springframework.data.release.model.Projects;
|
||||||
import org.springframework.data.release.model.Tracker;
|
import org.springframework.data.release.model.Tracker;
|
||||||
import org.springframework.data.release.model.TrainIteration;
|
import org.springframework.data.release.model.TrainIteration;
|
||||||
import org.springframework.data.release.utils.Logger;
|
import org.springframework.data.release.utils.Logger;
|
||||||
@@ -230,7 +231,7 @@ class Jira implements JiraConnector {
|
|||||||
|
|
||||||
Optional<JiraReleaseVersion> versionsForModuleIteration = findJiraReleaseVersion(moduleIteration);
|
Optional<JiraReleaseVersion> versionsForModuleIteration = findJiraReleaseVersion(moduleIteration);
|
||||||
|
|
||||||
if (versionsForModuleIteration.isPresent()) {
|
if (versionsForModuleIteration.isPresent() || moduleIteration.getProject() == Projects.GEMFIRE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,28 +304,45 @@ class Jira implements JiraConnector {
|
|||||||
|
|
||||||
Assert.notNull(moduleIteration, "ModuleIteration must not be null.");
|
Assert.notNull(moduleIteration, "ModuleIteration must not be null.");
|
||||||
|
|
||||||
HttpHeaders httpHeaders = newUserScopedHttpHeaders();
|
|
||||||
|
|
||||||
Map<String, Object> parameters = newUrlTemplateVariables();
|
|
||||||
|
|
||||||
Tickets tickets = getTicketsFor(moduleIteration);
|
Tickets tickets = getTicketsFor(moduleIteration);
|
||||||
|
|
||||||
if (tickets.hasReleaseTicket(moduleIteration)) {
|
if (tickets.hasReleaseTicket(moduleIteration) || moduleIteration.getProject() == Projects.GEODE) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
findJiraReleaseVersion(moduleIteration).orElseThrow(
|
|
||||||
() -> new IllegalStateException(String.format("No release version for %s found containing %s!",
|
|
||||||
moduleIteration.getProject().getFullName(), new JiraVersion(moduleIteration))));
|
|
||||||
|
|
||||||
JiraComponents jiraComponents = getJiraComponents(moduleIteration.getProjectKey());
|
|
||||||
|
|
||||||
logger.log(moduleIteration, "Creating release ticket…");
|
logger.log(moduleIteration, "Creating release ticket…");
|
||||||
|
|
||||||
JiraIssue jiraIssue = prepareJiraIssueToCreate(moduleIteration, jiraComponents);
|
doCreateTicket(moduleIteration, Tracker.releaseTicketSummary(moduleIteration));
|
||||||
|
}
|
||||||
|
|
||||||
operations.exchange(CREATE_ISSUES_TEMPLATE, HttpMethod.POST, new HttpEntity<Object>(jiraIssue, httpHeaders),
|
@Override
|
||||||
CreatedJiraIssue.class, parameters).getBody();
|
public Ticket createTicket(ModuleIteration moduleIteration, String text) {
|
||||||
|
|
||||||
|
Assert.notNull(moduleIteration, "ModuleIteration must not be null.");
|
||||||
|
|
||||||
|
logger.log(moduleIteration, "Creating ticket…");
|
||||||
|
|
||||||
|
return doCreateTicket(moduleIteration, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Ticket doCreateTicket(ModuleIteration moduleIteration, String text) {
|
||||||
|
|
||||||
|
HttpHeaders httpHeaders = newUserScopedHttpHeaders();
|
||||||
|
Map<String, Object> parameters = newUrlTemplateVariables();
|
||||||
|
|
||||||
|
findJiraReleaseVersion(moduleIteration).orElseThrow(
|
||||||
|
() -> new IllegalStateException(String.format("No release version for %s found", moduleIteration)));
|
||||||
|
|
||||||
|
JiraComponents jiraComponents = getJiraComponents(moduleIteration.getProjectKey());
|
||||||
|
JiraIssue jiraIssue = prepareJiraIssueToCreate(text, moduleIteration, jiraComponents);
|
||||||
|
|
||||||
|
CreatedJiraIssue created = operations.exchange(CREATE_ISSUES_TEMPLATE, HttpMethod.POST,
|
||||||
|
new HttpEntity<Object>(jiraIssue, httpHeaders), CreatedJiraIssue.class, parameters).getBody();
|
||||||
|
|
||||||
|
JiraIssue createdIssue = getJiraIssue(created.getKey())
|
||||||
|
.orElseThrow(() -> new IllegalStateException(String.format("Cannot retrieve ticket %s", created.getKey())));
|
||||||
|
|
||||||
|
return toTicket(createdIssue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -357,7 +375,8 @@ class Jira implements JiraConnector {
|
|||||||
operations.exchange(ISSUE_TEMPLATE, HttpMethod.PUT, new HttpEntity<Object>(editMeta, httpHeaders), String.class,
|
operations.exchange(ISSUE_TEMPLATE, HttpMethod.PUT, new HttpEntity<Object>(editMeta, httpHeaders), String.class,
|
||||||
parameters).getBody();
|
parameters).getBody();
|
||||||
} catch (HttpClientErrorException e) {
|
} catch (HttpClientErrorException e) {
|
||||||
logger.warn("Ticket", "Self-assignment of %s failed with status ", ticket, e.getStatusCode());
|
logger.warn("Ticket", "Self-assignment of %s failed with status %s (%s)", ticket, e.getStatusCode(),
|
||||||
|
e.getResponseBodyAsString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -409,7 +428,8 @@ class Jira implements JiraConnector {
|
|||||||
operations.exchange(TRANSITION_TEMPLATE, HttpMethod.POST, new HttpEntity<Object>(editMeta, httpHeaders),
|
operations.exchange(TRANSITION_TEMPLATE, HttpMethod.POST, new HttpEntity<Object>(editMeta, httpHeaders),
|
||||||
String.class, parameters).getBody();
|
String.class, parameters).getBody();
|
||||||
} catch (HttpClientErrorException e) {
|
} catch (HttpClientErrorException e) {
|
||||||
logger.warn("Ticket", "Start progress of %s failed with status ", ticket, e.getStatusCode());
|
logger.warn("Ticket", "Start progress of %s failed with status %s (%s)", ticket, e.getStatusCode(),
|
||||||
|
e.getResponseBodyAsString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,7 +456,8 @@ class Jira implements JiraConnector {
|
|||||||
operations.exchange(TRANSITION_TEMPLATE, HttpMethod.POST, new HttpEntity<Object>(editMeta, httpHeaders),
|
operations.exchange(TRANSITION_TEMPLATE, HttpMethod.POST, new HttpEntity<Object>(editMeta, httpHeaders),
|
||||||
String.class, parameters).getBody();
|
String.class, parameters).getBody();
|
||||||
} catch (HttpClientErrorException e) {
|
} catch (HttpClientErrorException e) {
|
||||||
logger.warn("Ticket", "Resolution of %s failed with status ", ticket, e.getStatusCode());
|
logger.warn("Ticket", "Resolution of %s failed with status %s (%s)", ticket, e.getStatusCode(),
|
||||||
|
e.getResponseBodyAsString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -564,11 +585,11 @@ class Jira implements JiraConnector {
|
|||||||
return JiraComponents.of(components);
|
return JiraComponents.of(components);
|
||||||
}
|
}
|
||||||
|
|
||||||
private JiraIssue prepareJiraIssueToCreate(ModuleIteration moduleIteration, JiraComponents jiraComponents) {
|
private JiraIssue prepareJiraIssueToCreate(String text, ModuleIteration moduleIteration,
|
||||||
|
JiraComponents jiraComponents) {
|
||||||
|
|
||||||
JiraIssue jiraIssue = JiraIssue.createTask();
|
JiraIssue jiraIssue = JiraIssue.createTask();
|
||||||
jiraIssue.project(moduleIteration.getProjectKey()).summary(Tracker.releaseTicketSummary(moduleIteration))
|
jiraIssue.project(moduleIteration.getProjectKey()).summary(text).fixVersion(moduleIteration);
|
||||||
.fixVersion(moduleIteration);
|
|
||||||
|
|
||||||
Fields fields = jiraIssue.getFields();
|
Fields fields = jiraIssue.getFields();
|
||||||
|
|
||||||
@@ -684,7 +705,8 @@ class Jira implements JiraConnector {
|
|||||||
jiraTicketStatus = JiraTicketStatus.UNKNOWN;
|
jiraTicketStatus = JiraTicketStatus.UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Ticket(issue.getKey(), fields.getSummary(), jiraTicketStatus);
|
return new Ticket(issue.getKey(), fields.getSummary(),
|
||||||
|
String.format("%s/browse/%s", jiraProperties.getApiUrl(), issue.getKey()), jiraTicketStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -158,6 +158,6 @@ public class ModuleIteration implements IterationVersion, ProjectAware {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("%s %s", module.getProject().getFullName(), getShortVersionString());
|
return String.format("%s %s", module.getProject().getFullName(), getMediumVersionString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ class CommitUnitTests {
|
|||||||
@Test
|
@Test
|
||||||
void shouldRenderCommitMessage() {
|
void shouldRenderCommitMessage() {
|
||||||
|
|
||||||
assertThat(new Commit(new Ticket("1234", "Hello", Mockito.mock(TicketStatus.class)), "Summary", Optional.empty()))
|
assertThat(
|
||||||
|
new Commit(new Ticket("1234", "Hello", null, Mockito.mock(TicketStatus.class)), "Summary", Optional.empty()))
|
||||||
.hasToString("1234 - Summary.");
|
.hasToString("1234 - Summary.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,7 +42,8 @@ class CommitUnitTests {
|
|||||||
void shouldRenderCommitMessageWithDetail() {
|
void shouldRenderCommitMessageWithDetail() {
|
||||||
|
|
||||||
assertThat(
|
assertThat(
|
||||||
new Commit(new Ticket("1234", "Hello", Mockito.mock(TicketStatus.class)), "Summary", Optional.of("detail")))
|
new Commit(new Ticket("1234", "Hello", null, Mockito.mock(TicketStatus.class)), "Summary",
|
||||||
|
Optional.of("detail")))
|
||||||
.hasToString("1234 - Summary.\n" + "\n" + "detail");
|
.hasToString("1234 - Summary.\n" + "\n" + "detail");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -181,6 +181,8 @@ class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
|||||||
mockGetProjectComponentsWith("projectComponents.json", moduleIteration.getProjectKey());
|
mockGetProjectComponentsWith("projectComponents.json", moduleIteration.getProjectKey());
|
||||||
mockSearchWith("emptyTickets.json");
|
mockSearchWith("emptyTickets.json");
|
||||||
prepareCreateIssueAndReturn("issueCreated.json");
|
prepareCreateIssueAndReturn("issueCreated.json");
|
||||||
|
mockService.stubFor(get(urlPathMatching("/rest/api/2/issue/DATAREDIS-42")).//
|
||||||
|
willReturn(json("existingTicket.json")));
|
||||||
|
|
||||||
jira.createReleaseTicket(moduleIteration);
|
jira.createReleaseTicket(moduleIteration);
|
||||||
|
|
||||||
@@ -200,6 +202,8 @@ class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
|||||||
mockGetProjectComponentsWith("emptyProjectComponents.json", moduleIteration.getProjectKey());
|
mockGetProjectComponentsWith("emptyProjectComponents.json", moduleIteration.getProjectKey());
|
||||||
mockSearchWith("emptyTickets.json");
|
mockSearchWith("emptyTickets.json");
|
||||||
prepareCreateIssueAndReturn("issueCreated.json");
|
prepareCreateIssueAndReturn("issueCreated.json");
|
||||||
|
mockService.stubFor(get(urlPathMatching("/rest/api/2/issue/DATAREDIS-42")).//
|
||||||
|
willReturn(json("existingTicket.json")));
|
||||||
|
|
||||||
jira.createReleaseTicket(moduleIteration);
|
jira.createReleaseTicket(moduleIteration);
|
||||||
|
|
||||||
@@ -218,7 +222,7 @@ class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
|||||||
mockGetProjectVersionsWith("emptyReleaseVersions.json", moduleIteration.getProjectKey());
|
mockGetProjectVersionsWith("emptyReleaseVersions.json", moduleIteration.getProjectKey());
|
||||||
|
|
||||||
assertThatIllegalStateException().isThrownBy(() -> jira.createReleaseTicket(moduleIteration))
|
assertThatIllegalStateException().isThrownBy(() -> jira.createReleaseTicket(moduleIteration))
|
||||||
.withMessageContaining("No release version for Spring Data REST found containing 2.5 RC1 (Hopper)!");
|
.withMessageContaining("No release version for Spring Data REST 2.5 RC1 (Hopper) found");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test // #5
|
@Test // #5
|
||||||
@@ -247,7 +251,7 @@ class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
|||||||
mockService.stubFor(put(urlPathMatching("/rest/api/2/issue/DATAREDIS-302")).//
|
mockService.stubFor(put(urlPathMatching("/rest/api/2/issue/DATAREDIS-302")).//
|
||||||
willReturn(aResponse().withStatus(204)));
|
willReturn(aResponse().withStatus(204)));
|
||||||
|
|
||||||
jira.assignTicketToMe(new Ticket("DATAREDIS-302", "", null));
|
jira.assignTicketToMe(new Ticket("DATAREDIS-302", "", null, null));
|
||||||
|
|
||||||
verify(putRequestedFor(urlPathMatching("/rest/api/2/issue/DATAREDIS-302")).withRequestBody(equalToJson(
|
verify(putRequestedFor(urlPathMatching("/rest/api/2/issue/DATAREDIS-302")).withRequestBody(equalToJson(
|
||||||
"{\"update\":{\"assignee\":[ {\"set\":{\"name\":\"dummy\"}} ] }, \"transition\":{}, \"fields\":{}}")));
|
"{\"update\":{\"assignee\":[ {\"set\":{\"name\":\"dummy\"}} ] }, \"transition\":{}, \"fields\":{}}")));
|
||||||
@@ -267,7 +271,7 @@ class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
|||||||
mockService.stubFor(post(urlPathMatching("/rest/api/2/issue/DATACASS-302")).//
|
mockService.stubFor(post(urlPathMatching("/rest/api/2/issue/DATACASS-302")).//
|
||||||
willReturn(aResponse().withStatus(204)));
|
willReturn(aResponse().withStatus(204)));
|
||||||
|
|
||||||
jira.assignTicketToMe(new Ticket("DATACASS-302", "", null));
|
jira.assignTicketToMe(new Ticket("DATACASS-302", "", null, null));
|
||||||
|
|
||||||
verify(0, postRequestedFor(urlPathMatching("/rest/api/2/issue/DATACASS-302")));
|
verify(0, postRequestedFor(urlPathMatching("/rest/api/2/issue/DATACASS-302")));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class TicketsUnitTests {
|
|||||||
@Test
|
@Test
|
||||||
void hasReleaseTicketShouldReturnTrue() {
|
void hasReleaseTicketShouldReturnTrue() {
|
||||||
|
|
||||||
Ticket ticket = new Ticket("1234", "Release 1.10 GA (Hopper)", JiraTicketStatus.of(false, "", ""));
|
Ticket ticket = new Ticket("1234", "Release 1.10 GA (Hopper)", null, JiraTicketStatus.of(false, "", ""));
|
||||||
Tickets tickets = new Tickets(Collections.singletonList(ticket));
|
Tickets tickets = new Tickets(Collections.singletonList(ticket));
|
||||||
|
|
||||||
boolean result = tickets.hasReleaseTicket(ReleaseTrains.HOPPER.getModuleIteration(Projects.JPA, Iteration.GA));
|
boolean result = tickets.hasReleaseTicket(ReleaseTrains.HOPPER.getModuleIteration(Projects.JPA, Iteration.GA));
|
||||||
@@ -47,7 +47,7 @@ class TicketsUnitTests {
|
|||||||
@Test
|
@Test
|
||||||
void hasReleaseTickeForTicketWithoutTrainNameShouldReturnFalse() {
|
void hasReleaseTickeForTicketWithoutTrainNameShouldReturnFalse() {
|
||||||
|
|
||||||
Ticket ticket = new Ticket("1234", "Release 1.10 GA", JiraTicketStatus.of(false, "", ""));
|
Ticket ticket = new Ticket("1234", "Release 1.10 GA", null, JiraTicketStatus.of(false, "", ""));
|
||||||
Tickets tickets = new Tickets(Collections.singletonList(ticket));
|
Tickets tickets = new Tickets(Collections.singletonList(ticket));
|
||||||
|
|
||||||
boolean result = tickets.hasReleaseTicket(ReleaseTrains.HOPPER.getModuleIteration(Projects.JPA, Iteration.GA));
|
boolean result = tickets.hasReleaseTicket(ReleaseTrains.HOPPER.getModuleIteration(Projects.JPA, Iteration.GA));
|
||||||
@@ -57,7 +57,7 @@ class TicketsUnitTests {
|
|||||||
@Test
|
@Test
|
||||||
void getReleaseTicketReturnsReleaseTicket() {
|
void getReleaseTicketReturnsReleaseTicket() {
|
||||||
|
|
||||||
Ticket ticket = new Ticket("1234", "Release 1.10 GA (Hopper)", JiraTicketStatus.of(false, "", ""));
|
Ticket ticket = new Ticket("1234", "Release 1.10 GA (Hopper)", null, JiraTicketStatus.of(false, "", ""));
|
||||||
Tickets tickets = new Tickets(Collections.singletonList(ticket));
|
Tickets tickets = new Tickets(Collections.singletonList(ticket));
|
||||||
|
|
||||||
Ticket releaseTicket = tickets
|
Ticket releaseTicket = tickets
|
||||||
@@ -69,20 +69,23 @@ class TicketsUnitTests {
|
|||||||
void getReleaseTicketReturnsCalverReleaseTicket() {
|
void getReleaseTicketReturnsCalverReleaseTicket() {
|
||||||
|
|
||||||
Tickets tickets = new Tickets(
|
Tickets tickets = new Tickets(
|
||||||
Collections.singletonList(new Ticket("1234", "Release 2.4 GA (2020.0.0)", JiraTicketStatus.of(false, "", ""))));
|
Collections
|
||||||
|
.singletonList(new Ticket("1234", "Release 2.4 GA (2020.0.0)", null, JiraTicketStatus.of(false, "", ""))));
|
||||||
|
|
||||||
Ticket releaseTicket = tickets
|
Ticket releaseTicket = tickets
|
||||||
.getReleaseTicket(ReleaseTrains.OCKHAM.getModuleIteration(Projects.JPA, Iteration.GA));
|
.getReleaseTicket(ReleaseTrains.OCKHAM.getModuleIteration(Projects.JPA, Iteration.GA));
|
||||||
assertThat(releaseTicket).isNotNull();
|
assertThat(releaseTicket).isNotNull();
|
||||||
|
|
||||||
tickets = new Tickets(
|
tickets = new Tickets(
|
||||||
Collections.singletonList(new Ticket("1234", "Release 2.4 M1 (2020.0.0)", JiraTicketStatus.of(false, "", ""))));
|
Collections
|
||||||
|
.singletonList(new Ticket("1234", "Release 2.4 M1 (2020.0.0)", null, JiraTicketStatus.of(false, "", ""))));
|
||||||
|
|
||||||
releaseTicket = tickets.getReleaseTicket(ReleaseTrains.OCKHAM.getModuleIteration(Projects.JPA, Iteration.M1));
|
releaseTicket = tickets.getReleaseTicket(ReleaseTrains.OCKHAM.getModuleIteration(Projects.JPA, Iteration.M1));
|
||||||
assertThat(releaseTicket).isNotNull();
|
assertThat(releaseTicket).isNotNull();
|
||||||
|
|
||||||
tickets = new Tickets(
|
tickets = new Tickets(
|
||||||
Collections.singletonList(new Ticket("1234", "Release 2.4.1 (2020.0.1)", JiraTicketStatus.of(false, "", ""))));
|
Collections
|
||||||
|
.singletonList(new Ticket("1234", "Release 2.4.1 (2020.0.1)", null, JiraTicketStatus.of(false, "", ""))));
|
||||||
|
|
||||||
releaseTicket = tickets.getReleaseTicket(ReleaseTrains.OCKHAM.getModuleIteration(Projects.JPA, Iteration.SR1));
|
releaseTicket = tickets.getReleaseTicket(ReleaseTrains.OCKHAM.getModuleIteration(Projects.JPA, Iteration.SR1));
|
||||||
assertThat(releaseTicket).isNotNull();
|
assertThat(releaseTicket).isNotNull();
|
||||||
@@ -91,7 +94,7 @@ class TicketsUnitTests {
|
|||||||
@Test
|
@Test
|
||||||
void getReleaseTicketThrowsExceptionWithoutAReleaseTicket() {
|
void getReleaseTicketThrowsExceptionWithoutAReleaseTicket() {
|
||||||
|
|
||||||
Ticket ticket = new Ticket("1234", "Release 1.10 GA", JiraTicketStatus.of(false, "", ""));
|
Ticket ticket = new Ticket("1234", "Release 1.10 GA", null, JiraTicketStatus.of(false, "", ""));
|
||||||
Tickets tickets = new Tickets(Collections.singletonList(ticket));
|
Tickets tickets = new Tickets(Collections.singletonList(ticket));
|
||||||
|
|
||||||
assertThatIllegalArgumentException().isThrownBy(
|
assertThatIllegalArgumentException().isThrownBy(
|
||||||
@@ -101,7 +104,7 @@ class TicketsUnitTests {
|
|||||||
@Test
|
@Test
|
||||||
void getResolvedReleaseTicket() {
|
void getResolvedReleaseTicket() {
|
||||||
|
|
||||||
Ticket ticket = new Ticket("1234", "Release 1.10 GA (Hopper)", JiraTicketStatus.of(true, "", ""));
|
Ticket ticket = new Ticket("1234", "Release 1.10 GA (Hopper)", null, JiraTicketStatus.of(true, "", ""));
|
||||||
Tickets tickets = new Tickets(Collections.singletonList(ticket));
|
Tickets tickets = new Tickets(Collections.singletonList(ticket));
|
||||||
|
|
||||||
Ticket releaseTicket = tickets
|
Ticket releaseTicket = tickets
|
||||||
@@ -112,7 +115,7 @@ class TicketsUnitTests {
|
|||||||
@Test
|
@Test
|
||||||
void getReleaseTicketsReturnsReleaseTickets() {
|
void getReleaseTicketsReturnsReleaseTickets() {
|
||||||
|
|
||||||
Ticket ticket = new Ticket("1234", "Release 1.10 GA (Hopper)", JiraTicketStatus.of(false, "", ""));
|
Ticket ticket = new Ticket("1234", "Release 1.10 GA (Hopper)", null, JiraTicketStatus.of(false, "", ""));
|
||||||
Tickets tickets = new Tickets(Collections.singletonList(ticket));
|
Tickets tickets = new Tickets(Collections.singletonList(ticket));
|
||||||
|
|
||||||
Tickets result = tickets
|
Tickets result = tickets
|
||||||
|
|||||||
Reference in New Issue
Block a user