Further improvements:

Added functionality to prepare a release:

- Update the Spring Data Commons version a project relies on to the one included in the train iteration.
- Switch to the correct Maven repository matching the current release iteration (milestone, release).
- Update the BOM pom.xml in Spring Build project.

Upgraded to XmlBeam 1.1.4 get the XML manipulation working properly. Fixed XmlBeam configuration to write XML headers to XML files. Fixed the AnnouncementOperations to render the appropriate version number for service releases. Added further Git commands to be able to reset the repositories in the workspace. Let the changelog render the full artifact version.

Ignored integration tests for now.
This commit is contained in:
Oliver Gierke
2014-04-16 14:35:12 +02:00
parent 5d553123c1
commit 45c86d2b42
24 changed files with 323 additions and 86 deletions

View File

@@ -46,7 +46,7 @@
<dependency>
<groupId>org.xmlbeam</groupId>
<artifactId>xmlprojector</artifactId>
<version>1.1.0</version>
<version>1.1.4</version>
</dependency>
<dependency>

View File

@@ -17,6 +17,7 @@ package org.springframework.data.release.announcement;
import org.springframework.data.release.cli.StaticResources;
import org.springframework.data.release.maven.Artifact;
import org.springframework.data.release.model.ArtifactVersion;
import org.springframework.data.release.model.Iteration;
import org.springframework.data.release.model.ModuleIteration;
import org.springframework.data.release.model.Project;
@@ -50,7 +51,12 @@ public class AnnouncementOperations {
builder.append("* ");
builder.append(project.getFullName()).append(" ");
builder.append(module.getVersion()).append(" ").append(module.getIteration().getName());
builder.append(ArtifactVersion.from(module).toShortString());
if (!iteration.isServiceIteration()) {
builder.append(" ").append(module.getIteration().getName());
}
builder.append(" - ");
Artifact artifact = new Artifact(module);
@@ -77,6 +83,6 @@ public class AnnouncementOperations {
public static void main(String[] args) {
AnnouncementOperations operations = new AnnouncementOperations();
System.out.println(operations.getProjectBulletpoints(ReleaseTrains.DIJKSTRA, Iteration.M1));
System.out.println(operations.getProjectBulletpoints(ReleaseTrains.CODD, Iteration.SR2));
}
}

View File

@@ -73,11 +73,17 @@ public class JiraCommands implements CommandMarker {
}
@CliCommand("changelog")
public String changelog(@CliOption(key = { "", "module" }, mandatory = true) String moduleName, @CliOption(
key = { "iteration" }, mandatory = true) String iterationName) {
public String changelog(@CliOption(key = { "", "train" }, mandatory = true) String trainName, //
@CliOption(key = { "iteration" }, mandatory = true) String iterationName, //
@CliOption(key = "module") String moduleName) {
Train dijkstra = ReleaseTrains.DIJKSTRA;
return connector.getChangelogFor(dijkstra, dijkstra.getModule(moduleName),
dijkstra.getIterations().getIterationByName(iterationName)).toString();
Train train = ReleaseTrains.getTrainByName(trainName);
Iteration iteration = train.getIteration(iterationName);
if (StringUtils.hasText(moduleName)) {
return connector.getChangelogFor(train.getModuleIteration(iteration, moduleName)).toString();
}
return "";
}
}

View File

@@ -22,6 +22,7 @@ import org.springframework.data.release.git.GitOperations;
import org.springframework.data.release.git.Tags;
import org.springframework.data.release.maven.MavenOperations;
import org.springframework.data.release.maven.Pom;
import org.springframework.data.release.misc.ReleaseOperations;
import org.springframework.data.release.model.ArtifactVersion;
import org.springframework.data.release.model.Iteration;
import org.springframework.data.release.model.Module;
@@ -42,6 +43,7 @@ public class ReleaseCommands implements CommandMarker {
private final MavenOperations maven;
private final GitOperations git;
private final ReleaseOperations misc;
@CliCommand("release predict")
public String predictTrainAndIteration() throws Exception {
@@ -86,7 +88,14 @@ public class ReleaseCommands implements CommandMarker {
maven.triggerDistributionBuild(train, iteration);
}
@CliCommand("release prepare")
/**
* Prepares the release of the given iteration of the given train.
*
* @param trainName the name of the release train (ignoring case).
* @param iterationName the name of the iteration.
* @throws Exception
*/
@CliCommand(value = "release prepare", help = "Prepares the release of the iteration of the given train.")
public void prepare(@CliOption(key = { "", "train" }, mandatory = true) String trainName, @CliOption(
key = "iteration", mandatory = true) String iterationName) throws Exception {
@@ -94,6 +103,7 @@ public class ReleaseCommands implements CommandMarker {
Iteration iteration = train.getIteration(iterationName);
git.prepare(train, iteration);
misc.prepareChangelogs(train, iteration);
for (Module module : train) {
maven.prepareProject(train, iteration, module.getProject());

View File

@@ -61,4 +61,18 @@ public class GiCommands implements CommandMarker {
return StringUtils.collectionToDelimitedString(git.getTags(project).asList(), "\n");
}
@CliCommand("git reset")
public void reset(@CliOption(key = { "", "train" }, mandatory = true) String trainName, @CliOption(key = "iteration",
mandatory = true) String iterationName) throws Exception {
git.reset(ReleaseTrains.getTrainByName(trainName));
}
@CliCommand("git prepare")
public void prepare(@CliOption(key = { "", "train" }, mandatory = true) String trainName, @CliOption(
key = "iteration", mandatory = true) String iterationName) throws Exception {
Train train = ReleaseTrains.getTrainByName(trainName);
git.prepare(train, train.getIteration(iterationName));
}
}

View File

@@ -36,6 +36,7 @@ import org.springframework.data.release.model.Project;
import org.springframework.data.release.model.Train;
import org.springframework.shell.support.logging.HandlerUtils;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
/**
@@ -57,6 +58,21 @@ public class GitOperations {
return new GitProject(project, server);
}
/**
* Resets the repositories for all modules of the given {@link Train}.
*
* @param train must not be {@literal null}.
* @throws Exception
*/
public void reset(Train train) throws Exception {
Assert.notNull(train, "Train must not be null!");
for (Module module : train) {
osCommandOperations.executeCommand("git reset --hard", module.getProject()).get();
}
}
/**
* Checks out all projects of the given {@link Train} at the tags for the given {@link Iteration}.
*
@@ -93,7 +109,7 @@ public class GitOperations {
Branch branch = Branch.from(module);
update(module.getProject());
update(module.getProject()).get();
String checkoutCommand = String.format("git checkout %s", branch);
osCommandOperations.executeCommand(checkoutCommand, module.getProject()).get();

View File

@@ -22,8 +22,8 @@ import lombok.AccessLevel;
import lombok.EqualsAndHashCode;
import lombok.RequiredArgsConstructor;
import org.springframework.data.release.model.Iteration;
import org.springframework.data.release.model.Module;
import org.springframework.data.release.model.ArtifactVersion;
import org.springframework.data.release.model.ModuleIteration;
import org.springframework.format.datetime.DateFormatter;
import org.springframework.shell.support.util.OsUtils;
@@ -34,8 +34,7 @@ import org.springframework.shell.support.util.OsUtils;
@EqualsAndHashCode
public class Changelog {
private final Module module;
private final Iteration iteration;
private final ModuleIteration module;
private final Tickets tickets;
/*
@@ -45,7 +44,9 @@ public class Changelog {
@Override
public String toString() {
String headline = String.format("Changes in version %s (%s)", module.getVersion(),
ArtifactVersion version = ArtifactVersion.from(module);
String headline = String.format("Changes in version %s (%s)", version,
new DateFormatter("YYYY-MM-dd").print(new Date(), Locale.US));
StringBuilder builder = new StringBuilder(headline).append(OsUtils.LINE_SEPARATOR);

View File

@@ -16,7 +16,7 @@
package org.springframework.data.release.jira;
import org.springframework.data.release.model.Iteration;
import org.springframework.data.release.model.Module;
import org.springframework.data.release.model.ModuleIteration;
import org.springframework.data.release.model.Train;
/**
@@ -39,5 +39,5 @@ public interface JiraConnector {
void closeIteration(Train train, Iteration iteration, Credentials credentials);
Changelog getChangelogFor(Train train, Module module, Iteration iteration);
Changelog getChangelogFor(ModuleIteration iteration);
}

View File

@@ -19,6 +19,7 @@ import lombok.Value;
import org.springframework.data.release.model.Iteration;
import org.springframework.data.release.model.Module;
import org.springframework.data.release.model.ModuleIteration;
import org.springframework.data.release.model.Train;
/**
@@ -31,6 +32,13 @@ class JiraVersion {
private final Train train;
private final Iteration iteration;
public JiraVersion(ModuleIteration moduleIteration) {
this.module = moduleIteration.getModule();
this.iteration = moduleIteration.getIteration();
this.train = moduleIteration.getTrain();
}
/*
* (non-Javadoc)
* @see java.lang.Object#toString()

View File

@@ -21,7 +21,7 @@ import java.util.List;
import lombok.Value;
import org.springframework.data.release.model.Iteration;
import org.springframework.data.release.model.Module;
import org.springframework.data.release.model.ModuleIteration;
import org.springframework.data.release.model.ReleaseTrains;
import org.springframework.data.release.model.Train;
import org.springframework.util.StringUtils;
@@ -44,18 +44,25 @@ class JqlQuery {
return new JqlQuery(String.format("%s ORDER BY %s", query, orderBy));
}
public static JqlQuery from(ModuleIteration iteration) {
JiraVersion version = new JiraVersion(iteration);
return new JqlQuery(String.format(PROJECT_VERSION_TEMPLATE, iteration.getProjectKey(), version));
}
public static JqlQuery from(Train train, Iteration iteration) {
List<String> parts = new ArrayList<>();
for (Module module : train) {
for (ModuleIteration module : train.getModuleIterations(iteration)) {
if (ReleaseTrains.BUILD.equals(module.getProject())) {
continue;
}
JiraVersion version = new JiraVersion(module, train, iteration);
parts.add(String.format(PROJECT_VERSION_TEMPLATE, module.getProject().getKey(), version));
JiraVersion version = new JiraVersion(module);
parts.add(String.format(PROJECT_VERSION_TEMPLATE, module.getProjectKey(), version));
}
return new JqlQuery(StringUtils.collectionToDelimitedString(parts, " OR "));

View File

@@ -28,8 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.release.model.Iteration;
import org.springframework.data.release.model.Module;
import org.springframework.data.release.model.ReleaseTrains;
import org.springframework.data.release.model.ModuleIteration;
import org.springframework.data.release.model.Train;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
@@ -153,10 +152,20 @@ class RestJiraConnector implements JiraConnector {
* @see org.springframework.data.release.jira.JiraConnector#getChangelogFor(org.springframework.data.release.model.Module, org.springframework.data.release.model.Iteration)
*/
@Override
public Changelog getChangelogFor(Train train, Module module, Iteration iteration) {
public Changelog getChangelogFor(ModuleIteration module) {
Tickets tickets = getTicketsFor(ReleaseTrains.DIJKSTRA, iteration, null);
Map<String, Object> parameters = new HashMap<>();
parameters.put("jql", JqlQuery.from(module));
parameters.put("fields", "summary,fixVersions");
parameters.put("startAt", 0);
return new Changelog(module, iteration, tickets);
JiraIssues issues = operations.getForObject(SEARCH_TEMPLATE, JiraIssues.class, parameters);
List<Ticket> tickets = new ArrayList<>();
for (JiraIssue issue : issues) {
tickets.add(new Ticket(issue.getKey(), issue.getFields().getSummary()));
}
return new Changelog(module, new Tickets(tickets, tickets.size()));
}
}

View File

@@ -15,6 +15,8 @@
*/
package org.springframework.data.release.maven;
import lombok.Getter;
import org.springframework.data.release.model.ArtifactVersion;
import org.springframework.data.release.model.ModuleIteration;
import org.springframework.data.release.model.ReleaseTrains;
@@ -31,7 +33,7 @@ public class Artifact {
private final ModuleIteration module;
private final Repository repository;
private final ArtifactVersion version;
private final @Getter ArtifactVersion version;
/**
* Creates a new {@link Artifact} for the given {@link ModuleIteration}.

View File

@@ -17,14 +17,11 @@ package org.springframework.data.release.maven;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.release.model.ArtifactVersion;
import org.xmlbeam.ProjectionFactory;
import org.xmlbeam.XBProjector;
import org.xmlbeam.XBProjector.Flags;
import org.xmlbeam.config.DefaultXMLFactoriesConfig;
import org.xmlbeam.config.DefaultXMLFactoriesConfig.NamespacePhilosophy;
import org.xmlbeam.types.DefaultTypeConverter;
import org.xmlbeam.types.TypeConverter;
/**
* @author Oliver Gierke
@@ -35,38 +32,12 @@ class MavenConfig {
@Bean
public ProjectionFactory projectionFactory() {
TypeConverter converter = new DefaultTypeConverter().setConversionForType(ArtifactVersion.class,
new ArtifactVersionConverter());
DefaultXMLFactoriesConfig config = new DefaultXMLFactoriesConfig();
config.setNamespacePhilosophy(NamespacePhilosophy.AGNOSTIC);
config.setOmitXMLDeclaration(false);
XBProjector projector = new XBProjector(config, Flags.TO_STRING_RENDERS_XML);
projector.config().setTypeConverter(converter);
return projector;
}
/**
* Custom converter to be able to use {@link ArtifactVersion} directly from within an XmlBeam projection.
*
* @author Oliver Gierke
*/
private static class ArtifactVersionConverter extends DefaultTypeConverter.Conversion<ArtifactVersion> {
private static final long serialVersionUID = 1L;
public ArtifactVersionConverter() {
super(null);
}
/*
* (non-Javadoc)
* @see org.xmlbeam.types.DefaultTypeConverter.Conversion#convert(java.lang.String)
*/
@Override
public ArtifactVersion convert(String data) {
return ArtifactVersion.parse(data);
}
}
}

View File

@@ -43,6 +43,7 @@ import org.xmlbeam.io.XBFileIO;
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class MavenOperations {
private static final String COMMONS_VERSION_PROPERTY = "springdata.commons";
private static final Logger LOGGER = HandlerUtils.getLogger(MavenOperations.class);
private static final String POM_XML = "pom.xml";
@@ -56,29 +57,38 @@ public class MavenOperations {
return projectionFactory.io().file(file).read(Pom.class);
}
public void prepareProject(Train train, Iteration iteration, Project project) throws IOException {
public void prepareProject(Train train, Iteration iteration, final Project project) throws Exception {
updateBomPom(train, iteration);
if (ReleaseTrains.BUILD.equals(project)) {
return;
}
ArtifactVersion commonsVersion = train.getModuleVersion(ReleaseTrains.COMMONS, iteration);
ArtifactVersion buildVersion = train.getModuleVersion(ReleaseTrains.BUILD, iteration);
Repository repository = new Repository(iteration);
final ArtifactVersion commonsVersion = train.getModuleVersion(ReleaseTrains.COMMONS, iteration);
final ArtifactVersion buildVersion = train.getModuleVersion(ReleaseTrains.BUILD, iteration);
final Repository repository = new Repository(iteration);
File file = workspace.getFile(POM_XML, project);
XBFileIO io = projectionFactory.io().file(file);
Pom pom = io.read(Pom.class);
if (!project.equals(ReleaseTrains.COMMONS)) {
pom.setProperty("spring.data.commons", commonsVersion);
}
execute(file, new PomCallback() {
pom.setParentVersion(buildVersion);
pom.setRepositoryId(repository.getSnapshotId(), repository.getId());
pom.setRepositoryUrl(repository.getId(), repository.getUrl());
@Override
public Pom doWith(Pom pom) {
io.write(pom);
if (!project.equals(ReleaseTrains.COMMONS)) {
System.out.println(pom.getProperty(COMMONS_VERSION_PROPERTY));
pom.setProperty(COMMONS_VERSION_PROPERTY, commonsVersion);
}
pom.setParentVersion(buildVersion);
pom.setRepositoryId("spring-libs-snapshot", "spring-libs-release");
pom.setRepositoryUrl(repository.getId(), repository.getUrl());
return pom;
}
});
}
/**
@@ -130,4 +140,39 @@ public class MavenOperations {
private boolean isMavenProject(Project project) {
return workspace.getFile(POM_XML, project).exists();
}
private void updateBomPom(final Train train, final Iteration iteration) throws Exception {
File bomPomFile = workspace.getFile("bom/pom.xml", ReleaseTrains.BUILD);
execute(bomPomFile, new PomCallback() {
@Override
public Pom doWith(Pom pom) {
for (ModuleIteration module : train.getModuleIterations(iteration, ReleaseTrains.BUILD)) {
Artifact artifact = new Artifact(module);
pom.setDependencyVersion(artifact.getArtifactId(), artifact.getVersion());
}
return pom;
}
});
}
private void execute(File file, PomCallback callback) throws Exception {
XBFileIO io = projectionFactory.io().file(file);
Pom pom = io.read(Pom.class);
pom = callback.doWith(pom);
io.write(pom);
}
private interface PomCallback {
public Pom doWith(Pom pom);
}
}

View File

@@ -34,21 +34,30 @@ public interface Pom {
@XBWrite("/project/version")
void setVersion(String version);
@XBRead("/project/repositories/repository[id=\"spring-libs-snapshot\"]")
Repository getSpringRepository();
@XBWrite("/project/parent/version")
void setParentVersion(ArtifactVersion version);
@XBRead("/project/properties/{0}")
String getProperty(String property);
@XBWrite("/project/properties/{0}")
void setProperty(String property, @XBValue ArtifactVersion value);
@XBWrite("/project/repositories/repository[id={0}]/id")
@XBWrite("/project/repositories/repository[id=''{0}'']/id")
void setRepositoryId(String oldId, @XBValue String newId);
@XBWrite("/project/repositories/repository[id={0}]/url")
@XBWrite("/project/repositories/repository[id=''{0}'']/url")
void setRepositoryUrl(String id, @XBValue String url);
/**
* Sets the version of the dependency with the given artifact identifier to the given {@link ArtifactVersion}.
*
* @param artifactId
* @param version
*/
@XBWrite("/project/dependencies/dependency[artifactId=''{0}'']/version")
Pom setDependencyVersion(String artifactId, @XBValue ArtifactVersion version);
public interface Repository {
@XBRead("child::id")

View File

@@ -0,0 +1,83 @@
/*
* Copyright 2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.release.misc;
import java.io.File;
import java.nio.charset.Charset;
import java.util.Scanner;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.release.io.Workspace;
import org.springframework.data.release.jira.Changelog;
import org.springframework.data.release.jira.JiraConnector;
import org.springframework.data.release.model.Iteration;
import org.springframework.data.release.model.ModuleIteration;
import org.springframework.data.release.model.ReleaseTrains;
import org.springframework.data.release.model.Train;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import com.google.common.io.Files;
/**
* @author Oliver Gierke
*/
@Component
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class ReleaseOperations {
private final JiraConnector jira;
private final Workspace workspace;
/**
* Creates {@link Changelog} instances for all modules of the given {@link Train} and {@link Iteration}.
*
* @param train must not be {@literal null}.
* @param iteration must not be {@literal null}.
* @throws Exception
*/
public void prepareChangelogs(Train train, Iteration iteration) throws Exception {
Assert.notNull(train, "Release train must not be null!");
Assert.notNull(iteration, "Iteration must not be null!");
for (ModuleIteration module : train.getModuleIterations(iteration, ReleaseTrains.BUILD)) {
Changelog changelog = jira.getChangelogFor(module);
File file = workspace.getFile("src/main/resources/changelog.txt", module.getProject());
StringBuilder builder = new StringBuilder();
try (Scanner scanner = new Scanner(file)) {
// Copy headline
builder.append(scanner.nextLine()).append("\n");
builder.append(scanner.nextLine()).append("\n");
// Add new changelog
builder.append(changelog.toString());
// Append existing
while (scanner.hasNextLine()) {
builder.append(scanner.nextLine()).append("\n");
}
}
Files.write(builder, file, Charset.forName("UTF-8"));
}
}
}

View File

@@ -98,7 +98,7 @@ public class ArtifactVersion implements Comparable<ArtifactVersion> {
}
/**
* Returns the release version for the current a
* Returns the release version for the current one.
*
* @return
*/
@@ -106,14 +106,29 @@ public class ArtifactVersion implements Comparable<ArtifactVersion> {
return new ArtifactVersion(version, RELEASE_SUFFIX);
}
/**
* Returns the snapshot version of the current one.
*
* @return
*/
public ArtifactVersion getSnapshotVersion() {
return new ArtifactVersion(version, SNAPSHOT_SUFFIX);
}
/**
* Returns whether the version is a release version.
*
* @return
*/
public boolean isReleaseVersion() {
return suffix.equals(RELEASE_SUFFIX);
}
/**
* Returns whether the version is a milestone version.
*
* @return
*/
public boolean isMilestoneVersion() {
return suffix.matches(MILESTONE_SUFFIX);
}
@@ -148,4 +163,13 @@ public class ArtifactVersion implements Comparable<ArtifactVersion> {
public String toString() {
return String.format("%s.%s", version.toMajorMinorBugfix(), suffix);
}
/**
* Returns the {@link String} of the plain version (read: x.y.z, ommitting trailing bugfix zeros).
*
* @return
*/
public String toShortString() {
return version.toString();
}
}

View File

@@ -43,6 +43,10 @@ public class Module {
: new Iteration(customFirstIteration, Iteration.RC1);
}
public boolean hasName(String name) {
return project.getName().equalsIgnoreCase(name);
}
public boolean hasCustomFirstIteration() {
return customFirstIteration != null;
}

View File

@@ -16,6 +16,7 @@
package org.springframework.data.release.model;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
@@ -25,9 +26,9 @@ import lombok.RequiredArgsConstructor;
@EqualsAndHashCode
public class ModuleIteration implements IterationVersion {
private final Module module;
private final @Getter Module module;
private final Iteration iteration;
private final Train train;
private final @Getter Train train;
public ProjectKey getProjectKey() {
return module.getProject().getKey();
@@ -46,6 +47,10 @@ public class ModuleIteration implements IterationVersion {
return module.getVersion();
}
/*
* (non-Javadoc)
* @see org.springframework.data.release.model.IterationVersion#getIteration()
*/
public Iteration getIteration() {
return module.hasCustomFirstIteration() ? module.getCustomFirstIteration() : this.iteration;
}

View File

@@ -92,6 +92,17 @@ public class Train implements Iterable<Module> {
return new Train(name, nextModules);
}
public ModuleIteration getModuleIteration(Iteration iteration, String moduleName) {
for (Module module : this) {
if (module.hasName(moduleName)) {
return new ModuleIteration(module, iteration, this);
}
}
return null;
}
public Iterable<ModuleIteration> getModuleIterations(Iteration iteration) {
return getModuleIterations(iteration, new Project[0]);
}

View File

@@ -18,6 +18,7 @@ package org.springframework.data.release.cli;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.release.AbstractIntegrationTests;
@@ -33,6 +34,7 @@ public class ReleaseCommandsIntegrationTests extends AbstractIntegrationTests {
@Autowired GitOperations git;
@Test
@Ignore
public void predictsReleasTrainCorrectly() throws Exception {
git.update(ReleaseTrains.DIJKSTRA);

View File

@@ -15,6 +15,7 @@
*/
package org.springframework.data.release.git;
import org.junit.Ignore;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.release.AbstractIntegrationTests;
@@ -29,11 +30,13 @@ public class GitOperationsIntegrationTests extends AbstractIntegrationTests {
@Autowired GitOperations gitOperations;
@Test
@Ignore
public void testname() throws Exception {
gitOperations.update(ReleaseTrains.CODD);
}
@Test
@Ignore
public void showTags() throws Exception {
Tags tags = gitOperations.getTags(ReleaseTrains.COMMONS);

View File

@@ -20,10 +20,12 @@ import static org.junit.Assert.*;
import org.junit.Test;
import org.springframework.data.release.model.Iteration;
import org.springframework.data.release.model.Module;
import org.springframework.data.release.model.ModuleIteration;
import org.springframework.data.release.model.ReleaseTrains;
/**
* Unit tests for {@link JiraVersion}.
*
* @author Oliver Gierke
*/
public class JiraVersionUnitTests {
@@ -44,17 +46,17 @@ public class JiraVersionUnitTests {
@Test
public void usesCustomModuleIterationStartVersion() {
Module commons = ReleaseTrains.DIJKSTRA.getModule("Elasticsearch");
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Iteration.M1, "Elasticsearch");
JiraVersion version = new JiraVersion(commons, ReleaseTrains.DIJKSTRA, Iteration.M1);
JiraVersion version = new JiraVersion(module);
assertThat(version.toString(), is("1.0 M2 (Dijkstra)"));
}
private void assertIterationVersion(Iteration iteration, String expected) {
Module commons = ReleaseTrains.DIJKSTRA.getModule("Commons");
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(iteration, "Commons");
JiraVersion version = new JiraVersion(commons, ReleaseTrains.DIJKSTRA, iteration);
JiraVersion version = new JiraVersion(module);
assertThat(version.toString(), is(expected));
}
}

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.release.maven;
package org.springframework.data.release.model;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;
@@ -22,13 +22,12 @@ import org.junit.Test;
import org.springframework.data.release.model.ArtifactVersion;
import org.springframework.data.release.model.Iteration;
import org.springframework.data.release.model.IterationVersion;
import org.springframework.data.release.model.SimpleIterationVersion;
import org.springframework.data.release.model.Version;
/**
* @author Oliver Gierke
*/
public class MavenVersionUnitTests {
public class ArtifactVersionUnitTests {
@Test(expected = IllegalArgumentException.class)
public void rejectsInvalidVersionSuffix() {