#113 - Deployment promotion is now skipped for public artifacts.
As we publish public artifacts (i.e. GA and service releases) directly to Maven Central, there's no need for the promotion step and it currently produces error output (fortunately not breaking the build). With this commit in place, this is now changed to simply skip that step and print informative output.
This commit is contained in:
@@ -32,7 +32,7 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
public class TrainIterationConverter implements Converter<TrainIteration> {
|
||||
|
||||
/*
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.shell.core.Converter#supports(java.lang.Class, java.lang.String)
|
||||
*/
|
||||
@@ -41,7 +41,7 @@ public class TrainIterationConverter implements Converter<TrainIteration> {
|
||||
return TrainIteration.class.equals(type);
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.shell.core.Converter#convertFromText(java.lang.String, java.lang.Class, java.lang.String)
|
||||
*/
|
||||
@@ -55,12 +55,11 @@ public class TrainIterationConverter implements Converter<TrainIteration> {
|
||||
}
|
||||
|
||||
Train train = ReleaseTrains.getTrainByName(parts[0].trim());
|
||||
Iteration iteration = train.getIteration(parts[1].trim());
|
||||
|
||||
return new TrainIteration(train, iteration);
|
||||
return train.getIteration(parts[1].trim());
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.shell.core.Converter#getAllPossibleValues(java.util.List, java.lang.Class, java.lang.String, java.lang.String, org.springframework.shell.core.MethodTarget)
|
||||
*/
|
||||
@@ -71,7 +70,10 @@ public class TrainIterationConverter implements Converter<TrainIteration> {
|
||||
for (Train train : ReleaseTrains.TRAINS) {
|
||||
|
||||
for (Iteration iteration : train.getIterations()) {
|
||||
completions.add(new Completion(new TrainIteration(train, iteration).toString()));
|
||||
|
||||
TrainIteration trainIteration = train.getIteration(iteration.getName());
|
||||
|
||||
completions.add(new Completion(trainIteration.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,12 +17,13 @@ package org.springframework.data.release.deployment;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import org.springframework.data.release.utils.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Deployment functionality.
|
||||
*
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@Component
|
||||
@@ -30,6 +31,7 @@ import org.springframework.util.Assert;
|
||||
public class DeploymentOperations {
|
||||
|
||||
private final ArtifactoryClient client;
|
||||
private final Logger logger;
|
||||
|
||||
public void verifyAuthentication() {
|
||||
client.verify();
|
||||
@@ -37,13 +39,19 @@ public class DeploymentOperations {
|
||||
|
||||
/**
|
||||
* Promotes the artifacts identified by the given {@link DeploymentInformation}.
|
||||
*
|
||||
*
|
||||
* @param information must not be {@literal null}.
|
||||
*/
|
||||
public void promote(DeploymentInformation information) {
|
||||
|
||||
Assert.notNull(information, "DeploymentInformation must not be null!");
|
||||
|
||||
if (information.getModule().getIteration().isPublic()) {
|
||||
logger.log(information.getModule(),
|
||||
"Skipping build promotion as it's a public version and was deployed to Maven Central directly,");
|
||||
return;
|
||||
}
|
||||
|
||||
client.promote(information);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import org.springframework.data.release.CliComponent;
|
||||
import org.springframework.data.release.TimedCommand;
|
||||
import org.springframework.data.release.model.ModuleIteration;
|
||||
import org.springframework.data.release.model.Project;
|
||||
import org.springframework.data.release.model.Projects;
|
||||
import org.springframework.data.release.model.TrainIteration;
|
||||
import org.springframework.data.release.utils.ExecutionUtils;
|
||||
import org.springframework.plugin.core.PluginRegistry;
|
||||
@@ -131,7 +132,9 @@ class IssueTrackerCommands extends TimedCommand {
|
||||
|
||||
if (StringUtils.hasText(moduleName)) {
|
||||
|
||||
ModuleIteration module = iteration.getModule(moduleName);
|
||||
Project project = Projects.requiredByName(moduleName);
|
||||
|
||||
ModuleIteration module = iteration.getModule(project);
|
||||
return getTrackerFor(module).getChangelogFor(module).toString();
|
||||
}
|
||||
|
||||
|
||||
@@ -109,4 +109,13 @@ public class Iteration {
|
||||
public int getBugfixValue() {
|
||||
return name.startsWith("SR") ? Integer.parseInt(name.substring(2)) : 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.release.model;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -22,7 +23,7 @@ import lombok.RequiredArgsConstructor;
|
||||
/**
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@RequiredArgsConstructor(access = AccessLevel.PACKAGE)
|
||||
@EqualsAndHashCode
|
||||
public class ModuleIteration implements IterationVersion {
|
||||
|
||||
@@ -44,7 +45,7 @@ public class ModuleIteration implements IterationVersion {
|
||||
return module.getProject();
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.release.model.IterationVersion#getVersion()
|
||||
*/
|
||||
@@ -60,10 +61,11 @@ public class ModuleIteration implements IterationVersion {
|
||||
public Iteration getIteration() {
|
||||
|
||||
return trainIteration.getIteration().isInitialIteration() && this.module.hasCustomFirstIteration()
|
||||
? module.getCustomFirstIteration() : this.trainIteration.getIteration();
|
||||
? module.getCustomFirstIteration()
|
||||
: this.trainIteration.getIteration();
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.data.release.model.IterationVersion#isBranchVersion()
|
||||
*/
|
||||
@@ -75,7 +77,7 @@ public class ModuleIteration implements IterationVersion {
|
||||
/**
|
||||
* Returns the {@link String} representation of the logical version of the {@link ModuleIteration}. This will
|
||||
* abbreviate trailing zeros and not include the release train name.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getShortVersionString() {
|
||||
@@ -112,7 +114,7 @@ public class ModuleIteration implements IterationVersion {
|
||||
/**
|
||||
* Returns the {@link String} representation of the logical version of the {@link ModuleIteration}. This will use the
|
||||
* technical version string and append the train iteration.
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getFullVersionString() {
|
||||
|
||||
@@ -73,14 +73,6 @@ public class Train implements Streamable<Module> {
|
||||
anyMatch(module -> module.getProject().equals(project));
|
||||
}
|
||||
|
||||
public Module getModule(String name) {
|
||||
|
||||
return modules.stream().//
|
||||
filter(module -> module.getProject().getName().equals(name)).//
|
||||
findFirst().//
|
||||
orElseThrow(() -> new IllegalArgumentException(String.format("No Module found with name %s!", name)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link Module} for the given {@link Project} in the current release {@link Train}.
|
||||
*
|
||||
@@ -121,14 +113,21 @@ public class Train implements Streamable<Module> {
|
||||
return new Train(name, collect);
|
||||
}
|
||||
|
||||
public ModuleIteration getModuleIteration(Iteration iteration, String moduleName) {
|
||||
/**
|
||||
* Returns the {@link ModuleIteration} for the given {@link Project} and {@link Iteration}.
|
||||
*
|
||||
* @param project must not be {@literal null}.
|
||||
* @param iteration must not be {@literal null}.
|
||||
* @return will never be {@literal null}.
|
||||
*/
|
||||
public ModuleIteration getModuleIteration(Project project, Iteration iteration) {
|
||||
|
||||
return modules.stream().//
|
||||
filter(module -> module.hasName(moduleName)).//
|
||||
findFirst().//
|
||||
map(module -> new ModuleIteration(module, new TrainIteration(this, iteration))).//
|
||||
orElseThrow(
|
||||
() -> new IllegalArgumentException(String.format("No module found with module name %s!", moduleName)));
|
||||
Assert.notNull(project, "Project must not be null!");
|
||||
Assert.notNull(iteration, "Iteration must not be null!");
|
||||
|
||||
Module module = getModule(project);
|
||||
|
||||
return new ModuleIteration(module, getIteration(iteration));
|
||||
}
|
||||
|
||||
public Iterable<ModuleIteration> getModuleIterations(Iteration iteration) {
|
||||
@@ -145,8 +144,8 @@ public class Train implements Streamable<Module> {
|
||||
collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public Iteration getIteration(String name) {
|
||||
return iterations.getIterationByName(name);
|
||||
public TrainIteration getIteration(String name) {
|
||||
return new TrainIteration(this, iterations.getIterationByName(name));
|
||||
}
|
||||
|
||||
public ArtifactVersion getModuleVersion(Project project, Iteration iteration) {
|
||||
@@ -176,6 +175,21 @@ public class Train implements Streamable<Module> {
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the {@link TrainIteration} for the given {@link Iteration} contained in this train.
|
||||
*
|
||||
* @param iteration must not be {@literal null}.
|
||||
* @return
|
||||
* @throws IllegalArgumentException in case the given {@link Iteration} is not available in this {@link Train}.
|
||||
*/
|
||||
private TrainIteration getIteration(Iteration iteration) {
|
||||
|
||||
Assert.isTrue(iterations.contains(iteration),
|
||||
String.format("Iteration %s is not a valid one for the configured iterations %s!", iteration, iterations));
|
||||
|
||||
return new TrainIteration(this, iteration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Value object to represent a set of {@link Iteration}s.
|
||||
*
|
||||
@@ -223,6 +237,10 @@ public class Train implements Streamable<Module> {
|
||||
String.format("Could not find previous iteration for %s!", iteration)));
|
||||
}
|
||||
|
||||
boolean contains(Iteration iteration) {
|
||||
return iterations.contains(iteration);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Iterable#iterator()
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.release.model;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Value;
|
||||
|
||||
import java.util.Iterator;
|
||||
@@ -26,12 +27,13 @@ import org.springframework.data.release.Streamable;
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@Value
|
||||
@RequiredArgsConstructor
|
||||
public class TrainIteration implements Streamable<ModuleIteration> {
|
||||
|
||||
private final Train train;
|
||||
private final Iteration iteration;
|
||||
|
||||
/*
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see java.lang.Iterable#iterator()
|
||||
*/
|
||||
@@ -44,12 +46,8 @@ public class TrainIteration implements Streamable<ModuleIteration> {
|
||||
return train.getModuleVersion(project, iteration);
|
||||
}
|
||||
|
||||
public ModuleIteration getModule(String name) {
|
||||
return train.getModuleIteration(iteration, name);
|
||||
}
|
||||
|
||||
public ModuleIteration getModule(Project project) {
|
||||
return train.getModuleIteration(iteration, project.getName());
|
||||
return train.getModuleIteration(project, iteration);
|
||||
}
|
||||
|
||||
public List<ModuleIteration> getModulesExcept(Project... exclusions) {
|
||||
@@ -63,7 +61,7 @@ public class TrainIteration implements Streamable<ModuleIteration> {
|
||||
public ModuleIteration getPreviousIteration(ModuleIteration module) {
|
||||
|
||||
Iteration previousIteration = train.getIterations().getPreviousIteration(iteration);
|
||||
return train.getModuleIteration(previousIteration, module.getProject().getName());
|
||||
return train.getModuleIteration(module.getProject(), previousIteration);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014 the original author or authors.
|
||||
* Copyright 2014-2019 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.
|
||||
@@ -22,6 +22,7 @@ import org.junit.Test;
|
||||
import org.springframework.data.release.build.MavenArtifact;
|
||||
import org.springframework.data.release.model.ArtifactVersion;
|
||||
import org.springframework.data.release.model.Iteration;
|
||||
import org.springframework.data.release.model.Projects;
|
||||
import org.springframework.data.release.model.ReleaseTrains;
|
||||
|
||||
/**
|
||||
@@ -32,7 +33,7 @@ public class ArtifactUnitTests {
|
||||
@Test
|
||||
public void testname() {
|
||||
|
||||
MavenArtifact artifact = new MavenArtifact(ReleaseTrains.DIJKSTRA.getModuleIteration(Iteration.M1, "JPA"));
|
||||
MavenArtifact artifact = new MavenArtifact(ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.JPA, Iteration.M1));
|
||||
|
||||
assertThat(artifact.getArtifactId(), is("spring-data-jpa"));
|
||||
assertThat(artifact.getVersion(), is(ArtifactVersion.of("1.6.0.M1")));
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.springframework.data.release.git.GitOperations;
|
||||
import org.springframework.data.release.model.Iteration;
|
||||
import org.springframework.data.release.model.ModuleIteration;
|
||||
import org.springframework.data.release.model.Phase;
|
||||
import org.springframework.data.release.model.Projects;
|
||||
import org.springframework.data.release.model.ReleaseTrains;
|
||||
import org.springframework.data.release.model.Train;
|
||||
|
||||
@@ -42,7 +43,7 @@ public class DeploymentOperationsIntegrationTests extends AbstractIntegrationTes
|
||||
public void testname() {
|
||||
|
||||
Train train = ReleaseTrains.HOPPER;
|
||||
ModuleIteration buildModule = train.getModuleIteration(Iteration.M1, "build");
|
||||
ModuleIteration buildModule = train.getModuleIteration(Projects.BUILD, Iteration.M1);
|
||||
|
||||
git.update(train);
|
||||
build.prepareVersion(buildModule, Phase.PREPARE);
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright 2019 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.deployment;
|
||||
|
||||
import static org.mockito.Matchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.release.model.Iteration;
|
||||
import org.springframework.data.release.model.ModuleIteration;
|
||||
import org.springframework.data.release.model.Projects;
|
||||
import org.springframework.data.release.model.ReleaseTrains;
|
||||
import org.springframework.data.release.utils.Logger;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link DeploymentOperations}.
|
||||
*
|
||||
* @author Oliver Drotbohm
|
||||
*/
|
||||
public class DeploymentOperationsUnitTests {
|
||||
|
||||
@Test // #113
|
||||
public void skipsPromotionForPublicArtifacts() {
|
||||
|
||||
Logger logger = mock(Logger.class);
|
||||
ArtifactoryClient client = mock(ArtifactoryClient.class);
|
||||
DeploymentOperations operations = new DeploymentOperations(client, logger);
|
||||
|
||||
ModuleIteration module = ReleaseTrains.MOORE.getModuleIteration(Projects.COMMONS, Iteration.GA);
|
||||
|
||||
DefaultDeploymentInformation information = new DefaultDeploymentInformation(module, new DeploymentProperties());
|
||||
|
||||
operations.promote(information);
|
||||
|
||||
verify(logger).log(eq(module), any());
|
||||
verifyZeroInteractions(client);
|
||||
}
|
||||
}
|
||||
@@ -21,12 +21,13 @@ import static org.junit.Assert.*;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.release.model.Module;
|
||||
import org.springframework.data.release.model.Project;
|
||||
import org.springframework.data.release.model.Projects;
|
||||
import org.springframework.data.release.model.ReleaseTrains;
|
||||
import org.springframework.data.release.model.Train;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link GitProject}.
|
||||
*
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
public class GitProjectUnitTests {
|
||||
@@ -36,7 +37,7 @@ public class GitProjectUnitTests {
|
||||
|
||||
Train codd = ReleaseTrains.CODD;
|
||||
GitServer server = new GitServer();
|
||||
Module module = codd.getModule("Commons");
|
||||
Module module = codd.getModule(Projects.COMMONS);
|
||||
Project project = module.getProject();
|
||||
|
||||
GitProject gitProject = new GitProject(project, server);
|
||||
|
||||
@@ -55,8 +55,8 @@ public class GitHubIssueTrackerIntegrationTests extends AbstractIntegrationTests
|
||||
public static final String ISSUES_URI = "/repos/spring-projects/spring-data-build/issues";
|
||||
public static final String RELEASE_TICKET_URI = "/repos/spring-projects/spring-data-build/issues/233";
|
||||
public static final String MILESTONES_URI = "/repos/spring-projects/spring-data-build/milestones";
|
||||
public static final ModuleIteration BUILD_HOPPER_RC1 = ReleaseTrains.HOPPER.getModuleIteration(Iteration.RC1,
|
||||
"Build");
|
||||
public static final ModuleIteration BUILD_HOPPER_RC1 = ReleaseTrains.HOPPER.getModuleIteration(Projects.BUILD,
|
||||
Iteration.RC1);
|
||||
|
||||
@Rule public WireMockRule mockService = new WireMockRule(
|
||||
wireMockConfig().port(8888).fileSource(new ClasspathFileSource("integration/github")));
|
||||
@@ -189,7 +189,7 @@ public class GitHubIssueTrackerIntegrationTests extends AbstractIntegrationTests
|
||||
expectedException.expect(IllegalStateException.class);
|
||||
expectedException.expectMessage("No milestone for Spring Data Build found containing 1.8 RC1!");
|
||||
|
||||
ModuleIteration moduleIteration = ReleaseTrains.HOPPER.getModuleIteration(Iteration.RC1, "Build");
|
||||
ModuleIteration moduleIteration = ReleaseTrains.HOPPER.getModuleIteration(Projects.BUILD, Iteration.RC1);
|
||||
|
||||
mockGetIssuesWith("emptyIssues.json");
|
||||
mockGetMilestonesWith("emptyMilestones.json");
|
||||
|
||||
@@ -19,9 +19,9 @@ import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.release.issues.github.GithubMilestone;
|
||||
import org.springframework.data.release.model.Iteration;
|
||||
import org.springframework.data.release.model.ModuleIteration;
|
||||
import org.springframework.data.release.model.Projects;
|
||||
import org.springframework.data.release.model.ReleaseTrains;
|
||||
|
||||
/**
|
||||
@@ -47,7 +47,7 @@ public class GithubMilestoneUnitTests {
|
||||
@Test
|
||||
public void usesCustomModuleIterationStartVersion() {
|
||||
|
||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Iteration.M1, "Elasticsearch");
|
||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.ELASTICSEARCH, Iteration.M1);
|
||||
|
||||
GithubMilestone version = new GithubMilestone(module);
|
||||
assertThat(version.toString(), is("1.0 M1 (Dijkstra)"));
|
||||
@@ -56,7 +56,7 @@ public class GithubMilestoneUnitTests {
|
||||
@Test
|
||||
public void doesNotUseCustomIterationOnNonFirstiterations() {
|
||||
|
||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Iteration.RC1, "Elasticsearch");
|
||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.ELASTICSEARCH, Iteration.RC1);
|
||||
|
||||
GithubMilestone version = new GithubMilestone(module);
|
||||
assertThat(version.toString(), is("1.0 RC1 (Dijkstra)"));
|
||||
@@ -65,7 +65,7 @@ public class GithubMilestoneUnitTests {
|
||||
@Test
|
||||
public void rendersDescriptionCorrectly() {
|
||||
|
||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Iteration.M1, "Elasticsearch");
|
||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.ELASTICSEARCH, Iteration.M1);
|
||||
|
||||
GithubMilestone version = new GithubMilestone(module);
|
||||
assertThat(version.getDescription(), is("Dijkstra M2"));
|
||||
@@ -73,7 +73,7 @@ public class GithubMilestoneUnitTests {
|
||||
|
||||
private void assertIterationVersion(Iteration iteration, String expected) {
|
||||
|
||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(iteration, "Commons");
|
||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.COMMONS, iteration);
|
||||
|
||||
GithubMilestone version = new GithubMilestone(module);
|
||||
assertThat(version.toString(), is(expected));
|
||||
|
||||
@@ -60,7 +60,7 @@ public class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
||||
static final String SEARCH_URI = "/rest/api/2/search";
|
||||
static final String PROJECT_VERSION_URI = "/rest/api/2/project/%s/version";
|
||||
static final String PROJECT_COMPONENTS_URI = "/rest/api/2/project/%s/components";
|
||||
static final ModuleIteration REST_HOPPER_RC1 = ReleaseTrains.HOPPER.getModuleIteration(Iteration.RC1, "REST");
|
||||
static final ModuleIteration REST_HOPPER_RC1 = ReleaseTrains.HOPPER.getModuleIteration(Projects.REST, Iteration.RC1);
|
||||
|
||||
@Rule public WireMockRule mockService = new WireMockRule(
|
||||
wireMockConfig().port(8888).fileSource(new ClasspathFileSource("integration/jira")));
|
||||
@@ -177,7 +177,7 @@ public class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
||||
@Test
|
||||
public void createReleaseVersionShouldFindExistingReleaseVersion() throws Exception {
|
||||
|
||||
ModuleIteration moduleIteration = ReleaseTrains.HOPPER.getModuleIteration(Iteration.RC1, "REST");
|
||||
ModuleIteration moduleIteration = ReleaseTrains.HOPPER.getModuleIteration(Projects.REST, Iteration.RC1);
|
||||
|
||||
mockGetProjectVersionsWith("releaseVersions.json", moduleIteration.getProjectKey());
|
||||
|
||||
@@ -192,7 +192,7 @@ public class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
||||
@Test
|
||||
public void archiveReleaseVersionShouldArchiveReleaseVersion() throws Exception {
|
||||
|
||||
ModuleIteration moduleIteration = ReleaseTrains.HOPPER.getModuleIteration(Iteration.RC1, "REST");
|
||||
ModuleIteration moduleIteration = ReleaseTrains.HOPPER.getModuleIteration(Projects.REST, Iteration.RC1);
|
||||
|
||||
mockGetProjectVersionsWith("releaseVersions.json", moduleIteration.getProjectKey());
|
||||
mockService.stubFor(put(urlPathMatching(UPDATE_VERSION_URI)).//
|
||||
@@ -211,7 +211,7 @@ public class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
||||
@Test
|
||||
public void createReleaseTicketShouldCreateReleaseTicket() throws Exception {
|
||||
|
||||
ModuleIteration moduleIteration = ReleaseTrains.HOPPER.getModuleIteration(Iteration.RC1, "REST");
|
||||
ModuleIteration moduleIteration = ReleaseTrains.HOPPER.getModuleIteration(Projects.REST, Iteration.RC1);
|
||||
|
||||
mockGetProjectVersionsWith("releaseVersions.json", moduleIteration.getProjectKey());
|
||||
mockGetProjectComponentsWith("projectComponents.json", moduleIteration.getProjectKey());
|
||||
@@ -233,7 +233,7 @@ public class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
||||
@Test
|
||||
public void createReleaseTicketShouldCreateReleaseTicketWithoutComponent() throws Exception {
|
||||
|
||||
ModuleIteration moduleIteration = ReleaseTrains.HOPPER.getModuleIteration(Iteration.RC1, "REST");
|
||||
ModuleIteration moduleIteration = ReleaseTrains.HOPPER.getModuleIteration(Projects.REST, Iteration.RC1);
|
||||
|
||||
mockGetProjectVersionsWith("releaseVersions.json", moduleIteration.getProjectKey());
|
||||
mockGetProjectComponentsWith("emptyProjectComponents.json", moduleIteration.getProjectKey());
|
||||
@@ -257,7 +257,7 @@ public class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
||||
expectedException.expect(IllegalStateException.class);
|
||||
expectedException.expectMessage("Did not find a release version for Spring Data REST 2.5 RC1");
|
||||
|
||||
ModuleIteration moduleIteration = ReleaseTrains.HOPPER.getModuleIteration(Iteration.RC1, "REST");
|
||||
ModuleIteration moduleIteration = ReleaseTrains.HOPPER.getModuleIteration(Projects.REST, Iteration.RC1);
|
||||
|
||||
mockSearchWith("emptyTickets.json");
|
||||
mockGetProjectVersionsWith("emptyReleaseVersions.json", moduleIteration.getProjectKey());
|
||||
@@ -273,7 +273,7 @@ public class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
||||
@Test
|
||||
public void createReleaseTicketShouldFindExistingTicket() throws Exception {
|
||||
|
||||
ModuleIteration moduleIteration = ReleaseTrains.HOPPER.getModuleIteration(Iteration.RC1, "REST");
|
||||
ModuleIteration moduleIteration = ReleaseTrains.HOPPER.getModuleIteration(Projects.REST, Iteration.RC1);
|
||||
|
||||
mockGetProjectVersionsWith("releaseVersions.json", moduleIteration.getProjectKey());
|
||||
mockGetProjectComponentsWith("projectComponents.json", moduleIteration.getProjectKey());
|
||||
@@ -327,7 +327,7 @@ public class JiraConnectorIntegrationTests extends AbstractIntegrationTests {
|
||||
@Test
|
||||
public void closeIterationShouldResolveReleaseTicket() {
|
||||
|
||||
ModuleIteration moduleIteration = ReleaseTrains.HOPPER.getModuleIteration(Iteration.RC1, "REST");
|
||||
ModuleIteration moduleIteration = ReleaseTrains.HOPPER.getModuleIteration(Projects.REST, Iteration.RC1);
|
||||
|
||||
properties.setUsername("mp911de");
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@ import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.release.issues.jira.JiraVersion;
|
||||
import org.springframework.data.release.model.Iteration;
|
||||
import org.springframework.data.release.model.ModuleIteration;
|
||||
import org.springframework.data.release.model.Projects;
|
||||
import org.springframework.data.release.model.ReleaseTrains;
|
||||
|
||||
/**
|
||||
@@ -47,7 +47,7 @@ public class JiraVersionUnitTests {
|
||||
@Test
|
||||
public void usesCustomModuleIterationStartVersion() {
|
||||
|
||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Iteration.M1, "Elasticsearch");
|
||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.ELASTICSEARCH, Iteration.M1);
|
||||
|
||||
JiraVersion version = new JiraVersion(module);
|
||||
assertThat(version.toString(), is("1.0 M1 (Dijkstra)"));
|
||||
@@ -56,7 +56,7 @@ public class JiraVersionUnitTests {
|
||||
@Test
|
||||
public void doesNotUseCustomIterationOnNonFirstiterations() {
|
||||
|
||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Iteration.RC1, "Elasticsearch");
|
||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.ELASTICSEARCH, Iteration.RC1);
|
||||
|
||||
JiraVersion version = new JiraVersion(module);
|
||||
assertThat(version.toString(), is("1.0 RC1 (Dijkstra)"));
|
||||
@@ -65,7 +65,7 @@ public class JiraVersionUnitTests {
|
||||
@Test
|
||||
public void rendersDescriptionCorrectly() {
|
||||
|
||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Iteration.M1, "Elasticsearch");
|
||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.ELASTICSEARCH, Iteration.M1);
|
||||
|
||||
JiraVersion version = new JiraVersion(module);
|
||||
assertThat(version.getDescription(), is("Dijkstra M2"));
|
||||
@@ -73,7 +73,7 @@ public class JiraVersionUnitTests {
|
||||
|
||||
private void assertIterationVersion(Iteration iteration, String expected) {
|
||||
|
||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(iteration, "Commons");
|
||||
ModuleIteration module = ReleaseTrains.DIJKSTRA.getModuleIteration(Projects.COMMONS, iteration);
|
||||
|
||||
JiraVersion version = new JiraVersion(module);
|
||||
assertThat(version.toString(), is(expected));
|
||||
|
||||
@@ -26,11 +26,12 @@ import org.junit.Test;
|
||||
import org.springframework.data.release.issues.Ticket;
|
||||
import org.springframework.data.release.issues.Tickets;
|
||||
import org.springframework.data.release.model.Iteration;
|
||||
import org.springframework.data.release.model.Projects;
|
||||
import org.springframework.data.release.model.ReleaseTrains;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link Tickets}.
|
||||
*
|
||||
*
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class TicketsUnitTests {
|
||||
@@ -41,7 +42,7 @@ public class TicketsUnitTests {
|
||||
Ticket ticket = new Ticket("1234", "Release 1.10 GA (Hopper)", JiraTicketStatus.of(false, "", ""));
|
||||
Tickets tickets = new Tickets(Collections.singletonList(ticket));
|
||||
|
||||
boolean result = tickets.hasReleaseTicket(ReleaseTrains.HOPPER.getModuleIteration(Iteration.GA, "JPA"));
|
||||
boolean result = tickets.hasReleaseTicket(ReleaseTrains.HOPPER.getModuleIteration(Projects.JPA, Iteration.GA));
|
||||
assertThat(result, is(true));
|
||||
}
|
||||
|
||||
@@ -51,7 +52,7 @@ public class TicketsUnitTests {
|
||||
Ticket ticket = new Ticket("1234", "Release 1.10 GA", JiraTicketStatus.of(false, "", ""));
|
||||
Tickets tickets = new Tickets(Collections.singletonList(ticket));
|
||||
|
||||
boolean result = tickets.hasReleaseTicket(ReleaseTrains.HOPPER.getModuleIteration(Iteration.GA, "JPA"));
|
||||
boolean result = tickets.hasReleaseTicket(ReleaseTrains.HOPPER.getModuleIteration(Projects.JPA, Iteration.GA));
|
||||
assertThat(result, is(false));
|
||||
}
|
||||
|
||||
@@ -61,7 +62,8 @@ public class TicketsUnitTests {
|
||||
Ticket ticket = new Ticket("1234", "Release 1.10 GA (Hopper)", JiraTicketStatus.of(false, "", ""));
|
||||
Tickets tickets = new Tickets(Collections.singletonList(ticket));
|
||||
|
||||
Ticket releaseTicket = tickets.getReleaseTicket(ReleaseTrains.HOPPER.getModuleIteration(Iteration.GA, "JPA"));
|
||||
Ticket releaseTicket = tickets
|
||||
.getReleaseTicket(ReleaseTrains.HOPPER.getModuleIteration(Projects.JPA, Iteration.GA));
|
||||
assertThat(releaseTicket, is(ticket));
|
||||
}
|
||||
|
||||
@@ -71,7 +73,7 @@ public class TicketsUnitTests {
|
||||
Ticket ticket = new Ticket("1234", "Release 1.10 GA", JiraTicketStatus.of(false, "", ""));
|
||||
Tickets tickets = new Tickets(Collections.singletonList(ticket));
|
||||
|
||||
tickets.getReleaseTicket(ReleaseTrains.HOPPER.getModuleIteration(Iteration.GA, "JPA"));
|
||||
tickets.getReleaseTicket(ReleaseTrains.HOPPER.getModuleIteration(Projects.JPA, Iteration.GA));
|
||||
fail("Missing IllegalStateException");
|
||||
}
|
||||
|
||||
@@ -81,7 +83,8 @@ public class TicketsUnitTests {
|
||||
Ticket ticket = new Ticket("1234", "Release 1.10 GA (Hopper)", JiraTicketStatus.of(true, "", ""));
|
||||
Tickets tickets = new Tickets(Collections.singletonList(ticket));
|
||||
|
||||
Ticket releaseTicket = tickets.getReleaseTicket(ReleaseTrains.HOPPER.getModuleIteration(Iteration.GA, "JPA"));
|
||||
Ticket releaseTicket = tickets
|
||||
.getReleaseTicket(ReleaseTrains.HOPPER.getModuleIteration(Projects.JPA, Iteration.GA));
|
||||
assertThat(releaseTicket, is(ticket));
|
||||
}
|
||||
|
||||
@@ -92,7 +95,7 @@ public class TicketsUnitTests {
|
||||
Tickets tickets = new Tickets(Collections.singletonList(ticket));
|
||||
|
||||
Tickets result = tickets
|
||||
.getReleaseTickets(ReleaseTrains.HOPPER.getModuleIteration(Iteration.GA, "JPA").getTrainIteration());
|
||||
.getReleaseTickets(ReleaseTrains.HOPPER.getModuleIteration(Projects.JPA, Iteration.GA).getTrainIteration());
|
||||
assertThat(result.getTickets().contains(ticket), is(true));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user