#49 - Upgraded to Spring Boot 2.0 snapshots.
This commit is contained in:
@@ -8,14 +8,13 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>1.3.2.RELEASE</version>
|
||||
<version>2.0.0.BUILD-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<java.version>1.8</java.version>
|
||||
<jar.mainclass>org.springframework.data.release.Application</jar.mainclass>
|
||||
<spring-plugin.version>1.3.0.BUILD-SNAPSHOT</spring-plugin.version>
|
||||
<spring.version>4.3.0.RELEASE</spring.version>
|
||||
<spring-plugin.version>2.0.0.BUILD-SNAPSHOT</spring-plugin.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -21,6 +21,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.data.release.deployment.DeploymentInformation;
|
||||
@@ -29,7 +30,6 @@ import org.springframework.data.release.model.Phase;
|
||||
import org.springframework.data.release.model.Project;
|
||||
import org.springframework.data.release.model.TrainIteration;
|
||||
import org.springframework.plugin.core.PluginRegistry;
|
||||
import org.springframework.plugin.core.PluginRegistry.Supplier;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@CliComponent
|
||||
@SuppressWarnings("deprecation")
|
||||
@RequiredArgsConstructor
|
||||
class GitCommands extends TimedCommand {
|
||||
|
||||
@@ -134,7 +135,6 @@ class GitCommands extends TimedCommand {
|
||||
* @throws Exception
|
||||
*/
|
||||
@CliCommand("git issuebranches")
|
||||
@SuppressWarnings("deprecation")
|
||||
public Table issuebranches(@CliOption(key = { "" }, mandatory = true) String projectName,
|
||||
@CliOption(key = "resolved", unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") Boolean resolved)
|
||||
throws Exception {
|
||||
|
||||
@@ -294,7 +294,8 @@ public class GitOperations {
|
||||
|
||||
Assert.notNull(project, "Project must not be null!");
|
||||
|
||||
IssueTracker tracker = issueTracker.getPluginFor(project);
|
||||
IssueTracker tracker = issueTracker.getRequiredPluginFor(project,
|
||||
() -> String.format("No issue tracker found for project %!", project));
|
||||
|
||||
return doWithGit(project, git -> {
|
||||
|
||||
@@ -410,7 +411,8 @@ public class GitOperations {
|
||||
Assert.hasText(summary, "Summary must not be null or empty!");
|
||||
|
||||
Project project = module.getProject();
|
||||
IssueTracker tracker = issueTracker.getPluginFor(project);
|
||||
IssueTracker tracker = issueTracker.getRequiredPluginFor(project,
|
||||
() -> String.format("No issue tracker found for project %s!", project));
|
||||
Ticket ticket = tracker.getReleaseTicketFor(module);
|
||||
|
||||
Commit commit = new Commit(ticket, summary, details);
|
||||
@@ -665,7 +667,10 @@ public class GitOperations {
|
||||
private String calculateTrigger(ModuleIteration module, String summary) {
|
||||
|
||||
Project project = module.getProject();
|
||||
Ticket releaseTicket = issueTracker.getPluginFor(project).getReleaseTicketFor(module);
|
||||
Ticket releaseTicket = issueTracker
|
||||
.getRequiredPluginFor(project, () -> String.format("No issue tracker found for project %!", project))//
|
||||
.getReleaseTicketFor(module);
|
||||
|
||||
return String.format("%s - %s", releaseTicket.getId(), summary);
|
||||
}
|
||||
|
||||
|
||||
@@ -119,6 +119,8 @@ class IssueTrackerCommands extends TimedCommand {
|
||||
}
|
||||
|
||||
private IssueTracker getTrackerFor(ModuleIteration moduleIteration) {
|
||||
return tracker.getPluginFor(moduleIteration.getProject());
|
||||
|
||||
return tracker.getRequiredPluginFor(moduleIteration.getProject(),
|
||||
() -> String.format("No issue tracker found for module %!", moduleIteration));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
@@ -78,7 +77,6 @@ class GitHub implements IssueTracker {
|
||||
* @param logger
|
||||
* @param properties
|
||||
*/
|
||||
@Autowired
|
||||
public GitHub(@Qualifier("tracker") RestOperations operations, Logger logger, GitHubProperties properties) {
|
||||
|
||||
this.operations = operations;
|
||||
|
||||
@@ -25,7 +25,6 @@ import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
@@ -33,7 +32,6 @@ import org.springframework.core.ParameterizedTypeReference;
|
||||
import org.springframework.data.release.issues.Changelog;
|
||||
import org.springframework.data.release.issues.Ticket;
|
||||
import org.springframework.data.release.issues.Tickets;
|
||||
import org.springframework.data.release.issues.jira.JiraIssue.Component;
|
||||
import org.springframework.data.release.issues.jira.JiraIssue.Fields;
|
||||
import org.springframework.data.release.issues.jira.JiraIssue.Resolution;
|
||||
import org.springframework.data.release.issues.jira.JiraIssue.Status;
|
||||
@@ -46,6 +44,7 @@ import org.springframework.data.release.utils.Logger;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.web.client.RestOperations;
|
||||
import org.springframework.web.util.UriTemplate;
|
||||
@@ -54,7 +53,7 @@ import org.springframework.web.util.UriTemplate;
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
@org.springframework.stereotype.Component
|
||||
@Component
|
||||
class Jira implements JiraConnector {
|
||||
|
||||
private static final String BASE_URI = "{jiraBaseUrl}/rest/api/2";
|
||||
@@ -77,7 +76,6 @@ class Jira implements JiraConnector {
|
||||
* @param logger
|
||||
* @param jiraProperties
|
||||
*/
|
||||
@Autowired
|
||||
public Jira(@Qualifier("tracker") RestOperations operations, Logger logger, JiraProperties jiraProperties) {
|
||||
|
||||
this.operations = operations;
|
||||
@@ -177,8 +175,8 @@ class Jira implements JiraConnector {
|
||||
|
||||
JiraIssues issues = execute(trainIteration.toString(), query, headers, jiraIssues -> {
|
||||
jiraIssues.stream().//
|
||||
filter(jiraIssue -> !jiraIssue.wasBackportedFrom(trainIteration.getTrain())). //
|
||||
forEach(jiraIssue -> tickets.add(toTicket(jiraIssue)));
|
||||
filter(jiraIssue -> !jiraIssue.wasBackportedFrom(trainIteration.getTrain())). //
|
||||
forEach(jiraIssue -> tickets.add(toTicket(jiraIssue)));
|
||||
});
|
||||
|
||||
return new Tickets(tickets, issues.getTotal());
|
||||
@@ -199,8 +197,8 @@ class Jira implements JiraConnector {
|
||||
|
||||
JiraIssues issues = execute(moduleIteration.toString(), query, headers, jiraIssues -> {
|
||||
jiraIssues.stream().//
|
||||
filter(jiraIssue -> !jiraIssue.wasBackportedFrom(moduleIteration.getTrain())). //
|
||||
forEach(jiraIssue -> tickets.add(toTicket(jiraIssue)));
|
||||
filter(jiraIssue -> !jiraIssue.wasBackportedFrom(moduleIteration.getTrain())). //
|
||||
forEach(jiraIssue -> tickets.add(toTicket(jiraIssue)));
|
||||
});
|
||||
|
||||
return new Tickets(tickets, issues.getTotal());
|
||||
@@ -246,9 +244,9 @@ class Jira implements JiraConnector {
|
||||
List<JiraReleaseVersion> versionsForModuleIteration = new ArrayList<>();
|
||||
getReleaseVersions(moduleIteration.toString(), moduleIteration.getProjectKey(), httpHeaders, releaseVersions -> {
|
||||
releaseVersions.stream(). //
|
||||
filter(jiraReleaseVersion -> jiraReleaseVersion.hasSameNameAs(jiraVersion)). //
|
||||
findFirst(). //
|
||||
ifPresent(jiraReleaseVersion -> versionsForModuleIteration.add(jiraReleaseVersion));
|
||||
filter(jiraReleaseVersion -> jiraReleaseVersion.hasSameNameAs(jiraVersion)). //
|
||||
findFirst(). //
|
||||
ifPresent(jiraReleaseVersion -> versionsForModuleIteration.add(jiraReleaseVersion));
|
||||
});
|
||||
|
||||
return versionsForModuleIteration.stream().findFirst();
|
||||
@@ -440,8 +438,8 @@ class Jira implements JiraConnector {
|
||||
Fields fields = jiraIssue.getFields();
|
||||
|
||||
Optional<JiraComponent> component = jiraComponents.findComponent(INFRASTRUCTURE_COMPONENT_NAME);
|
||||
component.ifPresent(
|
||||
jiraComponent -> fields.setComponents(Collections.singletonList(Component.of(jiraComponent.getName()))));
|
||||
component.ifPresent(jiraComponent -> fields.setComponents(Collections
|
||||
.singletonList(org.springframework.data.release.issues.jira.JiraIssue.Component.of(jiraComponent.getName()))));
|
||||
|
||||
return jiraIssue;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,10 @@ public class ReleaseOperations {
|
||||
|
||||
for (ModuleIteration module : iteration) {
|
||||
|
||||
final Changelog changelog = trackers.getPluginFor(module.getProject()).getChangelogFor(module);
|
||||
Changelog changelog = trackers
|
||||
.getRequiredPluginFor(module.getProject(),
|
||||
() -> String.format("No issue tracker found for project %!", module.getProject()))//
|
||||
.getChangelogFor(module);
|
||||
|
||||
for (String location : CHANGELOG_LOCATIONS) {
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ public class Version implements Comparable<Version> {
|
||||
*/
|
||||
private Version(int... parts) {
|
||||
|
||||
Assert.notNull(parts);
|
||||
Assert.isTrue(parts.length > 0 && parts.length < 5);
|
||||
Assert.notNull(parts, "Parts must not be null!");
|
||||
Assert.isTrue(parts.length > 0 && parts.length < 5, "We need at least 1 at most 4 parts!");
|
||||
|
||||
this.major = parts[0];
|
||||
this.minor = parts.length > 1 ? parts[1] : 0;
|
||||
@@ -51,7 +51,7 @@ public class Version implements Comparable<Version> {
|
||||
*/
|
||||
public static Version parse(String version) {
|
||||
|
||||
Assert.hasText(version);
|
||||
Assert.hasText(version, "Version must not be null or empty!");
|
||||
|
||||
String[] parts = version.trim().split("\\.");
|
||||
int[] intParts = new int[parts.length];
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
package org.springframework.data.release;
|
||||
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.SpringApplicationConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@@ -25,5 +25,5 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
*/
|
||||
@ActiveProfiles({ "local", "test" })
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringApplicationConfiguration(classes = Application.class)
|
||||
@SpringBootTest(classes = Application.class)
|
||||
public abstract class AbstractIntegrationTests {}
|
||||
|
||||
Reference in New Issue
Block a user