Fixed
This commit is contained in:
@@ -427,7 +427,7 @@ public class ReleaserProperties implements Serializable {
|
||||
}
|
||||
|
||||
public String getReleaseTrainDocsUrl() {
|
||||
return releaseTrainDocsUrl;
|
||||
return this.releaseTrainDocsUrl;
|
||||
}
|
||||
|
||||
public void setReleaseTrainDocsUrl(String releaseTrainDocsUrl) {
|
||||
@@ -435,7 +435,7 @@ public class ReleaserProperties implements Serializable {
|
||||
}
|
||||
|
||||
public String getReleaseTrainDocsBranch() {
|
||||
return releaseTrainDocsBranch;
|
||||
return this.releaseTrainDocsBranch;
|
||||
}
|
||||
|
||||
public void setReleaseTrainDocsBranch(String releaseTrainDocsBranch) {
|
||||
@@ -443,7 +443,7 @@ public class ReleaserProperties implements Serializable {
|
||||
}
|
||||
|
||||
public boolean isUpdateReleaseTrainDocs() {
|
||||
return updateReleaseTrainDocs;
|
||||
return this.updateReleaseTrainDocs;
|
||||
}
|
||||
|
||||
public void setUpdateReleaseTrainDocs(boolean updateReleaseTrainDocs) {
|
||||
@@ -646,7 +646,7 @@ public class ReleaserProperties implements Serializable {
|
||||
}
|
||||
|
||||
public String getDeployCommand() {
|
||||
return deployCommand;
|
||||
return this.deployCommand;
|
||||
}
|
||||
|
||||
public void setDeployCommand(String deployCommand) {
|
||||
|
||||
@@ -38,7 +38,7 @@ class ProjectDocumentationUpdater implements ReleaserPropertiesAware {
|
||||
* @return {@link File cloned temporary directory} - {@code null} if wrong version is used
|
||||
*/
|
||||
File updateDocsRepo(ProjectVersion currentProject, String springCloudReleaseBranch) {
|
||||
if (!properties.getGit().isUpdateDocumentationRepo()) {
|
||||
if (!this.properties.getGit().isUpdateDocumentationRepo()) {
|
||||
log.info("Will not update documentation repository, since the switch to do so "
|
||||
+ "is off. Set [releaser.git.update-documentation-repo] to [true] to change that");
|
||||
return null;
|
||||
|
||||
@@ -1,21 +1,20 @@
|
||||
package org.springframework.cloud.release.internal.git;
|
||||
|
||||
import com.jcabi.github.Coordinates;
|
||||
import com.jcabi.github.Github;
|
||||
import com.jcabi.github.Milestone;
|
||||
import com.jcabi.github.RtGithub;
|
||||
import com.jcabi.http.wire.RetryWire;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.jcabi.github.Coordinates;
|
||||
import com.jcabi.github.Github;
|
||||
import com.jcabi.github.Milestone;
|
||||
import com.jcabi.github.RtGithub;
|
||||
import com.jcabi.http.wire.RetryWire;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.springframework.cloud.release.internal.ReleaserProperties;
|
||||
import org.springframework.cloud.release.internal.pom.ProjectVersion;
|
||||
import org.springframework.util.Assert;
|
||||
@@ -30,7 +29,8 @@ class GithubMilestones {
|
||||
|
||||
private final Github github;
|
||||
private final ReleaserProperties properties;
|
||||
static final Map<ProjectVersion, String> CACHE = new ConcurrentHashMap<>();
|
||||
static final Map<ProjectVersion, String> MILESTONE_URL_CACHE = new ConcurrentHashMap<>();
|
||||
static final Map<ProjectVersion, Milestone.Smart> MILESTONE_CACHE = new ConcurrentHashMap<>();
|
||||
|
||||
GithubMilestones(ReleaserProperties properties) {
|
||||
this.github = new RtGithub(new RtGithub(
|
||||
@@ -49,8 +49,14 @@ class GithubMilestones {
|
||||
+ "either via the command line [--releaser.git.oauth-token=...] "
|
||||
+ "or put it as an env variable in [~/.bashrc] or "
|
||||
+ "[~/.zshrc] e.g. [export RELEASER_GIT_OAUTH_TOKEN=...]");
|
||||
Milestone.Smart foundMilestone = MILESTONE_CACHE.get(version);
|
||||
String tagVersion = version.version;
|
||||
Milestone.Smart foundMilestone = matchingMilestone(tagVersion, openMilestones(version));
|
||||
if (foundMilestone == null) {
|
||||
foundMilestone = matchingMilestone(tagVersion, openMilestones(version));
|
||||
if (foundMilestone != null) {
|
||||
MILESTONE_CACHE.put(version, foundMilestone);
|
||||
}
|
||||
}
|
||||
if (foundMilestone != null) {
|
||||
try {
|
||||
log.info("Found a matching milestone - closing it");
|
||||
@@ -94,7 +100,7 @@ class GithubMilestones {
|
||||
}
|
||||
|
||||
String milestoneUrl(ProjectVersion version) {
|
||||
String cachedUrl = CACHE.get(version);
|
||||
String cachedUrl = MILESTONE_URL_CACHE.get(version);
|
||||
if (StringUtils.hasText(cachedUrl)) {
|
||||
return cachedUrl;
|
||||
}
|
||||
@@ -118,7 +124,7 @@ class GithubMilestones {
|
||||
log.error("Exception occurred while trying to find milestone", e);
|
||||
}
|
||||
}
|
||||
CACHE.put(version, foundUrl);
|
||||
MILESTONE_URL_CACHE.put(version, foundUrl);
|
||||
return foundUrl;
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ public class GradleUpdater implements ReleaserPropertiesAware {
|
||||
|
||||
private boolean pathIgnored(File file) {
|
||||
String path = file.getPath();
|
||||
return assertSnapshots &&
|
||||
return this.assertSnapshots &&
|
||||
this.properties.getGradle().getIgnoredGradleRegex().stream().anyMatch(path::matches);
|
||||
}
|
||||
|
||||
|
||||
@@ -381,7 +381,7 @@ class PropertyStorer {
|
||||
void setPropertyVersionIfApplicable(Project project) {
|
||||
String propertyName = propertyName(project);
|
||||
if (setPropertyVersion(propertyName, project.version)) {
|
||||
log.info("Updating property [" + propertyName + "] to version [" + project.version + "]");
|
||||
this.log.info("Updating property [" + propertyName + "] to version [" + project.version + "]");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -237,6 +237,6 @@ class ProjectAndException {
|
||||
}
|
||||
|
||||
boolean hasException() {
|
||||
return ex != null;
|
||||
return this.ex != null;
|
||||
}
|
||||
}
|
||||
@@ -22,10 +22,10 @@ public class Project {
|
||||
public Boolean aggregator;
|
||||
|
||||
@Override public String toString() {
|
||||
return "Project{" + "id='" + id + '\'' + ", name='" + name + '\'' + ", repoUrl='"
|
||||
+ repoUrl + '\'' + ", siteUrl='" + siteUrl + '\'' + ", category='"
|
||||
+ category + '\'' + ", stackOverflowTags='" + stackOverflowTags + '\''
|
||||
+ ", projectReleases=" + projectReleases + ", stackOverflowTagList="
|
||||
+ stackOverflowTagList + ", aggregator=" + aggregator + '}';
|
||||
return "Project{" + "id='" + this.id + '\'' + ", name='" + this.name + '\'' + ", repoUrl='"
|
||||
+ this.repoUrl + '\'' + ", siteUrl='" + this.siteUrl + '\'' + ", category='"
|
||||
+ this.category + '\'' + ", stackOverflowTags='" + this.stackOverflowTags + '\''
|
||||
+ ", projectReleases=" + this.projectReleases + ", stackOverflowTagList="
|
||||
+ this.stackOverflowTagList + ", aggregator=" + this.aggregator + '}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,12 @@ public class Release {
|
||||
public boolean snapshot;
|
||||
|
||||
@Override public String toString() {
|
||||
return "Release{" + "releaseStatus='" + releaseStatus + '\'' + ", refDocUrl='"
|
||||
+ refDocUrl + '\'' + ", apiDocUrl='" + apiDocUrl + '\'' + ", groupId='"
|
||||
+ groupId + '\'' + ", artifactId='" + artifactId + '\'' + ", repository="
|
||||
+ repository + ", version='" + version + '\'' + ", current=" + current
|
||||
+ ", generalAvailability=" + generalAvailability + ", preRelease="
|
||||
+ preRelease + ", versionDisplayName='" + versionDisplayName + '\''
|
||||
+ ", snapshot=" + snapshot + '}';
|
||||
return "Release{" + "releaseStatus='" + this.releaseStatus + '\'' + ", refDocUrl='"
|
||||
+ this.refDocUrl + '\'' + ", apiDocUrl='" + this.apiDocUrl + '\'' + ", groupId='"
|
||||
+ this.groupId + '\'' + ", artifactId='" + this.artifactId + '\'' + ", repository="
|
||||
+ this.repository + ", version='" + this.version + '\'' + ", current=" + this.current
|
||||
+ ", generalAvailability=" + this.generalAvailability + ", preRelease="
|
||||
+ this.preRelease + ", versionDisplayName='" + this.versionDisplayName + '\''
|
||||
+ ", snapshot=" + this.snapshot + '}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@ public class ReleaseUpdate {
|
||||
public Repository repository;
|
||||
|
||||
@Override public String toString() {
|
||||
return "ReleaseUpdate{" + "groupId='" + groupId + '\'' + ", artifactId='"
|
||||
+ artifactId + '\'' + ", version='" + version + '\'' + ", releaseStatus='"
|
||||
+ releaseStatus + '\'' + ", refDocUrl='" + refDocUrl + '\''
|
||||
+ ", apiDocUrl='" + apiDocUrl + '\'' + ", repository=" + repository + '}';
|
||||
return "ReleaseUpdate{" + "groupId='" + this.groupId + '\'' + ", artifactId='"
|
||||
+ this.artifactId + '\'' + ", version='" + this.version + '\'' + ", releaseStatus='"
|
||||
+ this.releaseStatus + '\'' + ", refDocUrl='" + this.refDocUrl + '\''
|
||||
+ ", apiDocUrl='" + this.apiDocUrl + '\'' + ", repository=" + this.repository + '}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ public class Repository {
|
||||
public Boolean snapshotsEnabled;
|
||||
|
||||
@Override public String toString() {
|
||||
return "Repository{" + "id='" + id + '\'' + ", name='" + name + '\'' + ", url='"
|
||||
+ url + '\'' + ", snapshotsEnabled=" + snapshotsEnabled + '}';
|
||||
return "Repository{" + "id='" + this.id + '\'' + ", name='" + this.name + '\'' + ", url='"
|
||||
+ this.url + '\'' + ", snapshotsEnabled=" + this.snapshotsEnabled + '}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,13 @@ package org.springframework.cloud.release.internal.sagan;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.Collections;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.springframework.cloud.release.internal.ReleaserProperties;
|
||||
import org.springframework.cloud.release.internal.pom.ProjectVersion;
|
||||
|
||||
import edu.emory.mathcs.backport.java.util.Collections;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
@@ -26,7 +25,7 @@ public class SaganUpdater {
|
||||
}
|
||||
|
||||
public void updateSagan(String branch, ProjectVersion originalVersion, ProjectVersion version) {
|
||||
if (!releaserProperties.getSagan().isUpdateSagan()) {
|
||||
if (!this.releaserProperties.getSagan().isUpdateSagan()) {
|
||||
log.info("Will not update sagan, since the switch to do so "
|
||||
+ "is off. Set [releaser.sagan.update-sagan] to [true] to change that");
|
||||
return;
|
||||
|
||||
@@ -45,15 +45,15 @@ class Notes {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
return this.version;
|
||||
}
|
||||
|
||||
public String getClosedMilestoneUrl() {
|
||||
return closedMilestoneUrl;
|
||||
return this.closedMilestoneUrl;
|
||||
}
|
||||
|
||||
@Override public boolean equals(Object o) {
|
||||
@@ -62,16 +62,16 @@ class Notes {
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
Notes notes = (Notes) o;
|
||||
if (name != null ? !name.equals(notes.name) : notes.name != null)
|
||||
if (this.name != null ? !this.name.equals(notes.name) : notes.name != null)
|
||||
return false;
|
||||
return version != null ?
|
||||
version.equals(notes.version) :
|
||||
return this.version != null ?
|
||||
this.version.equals(notes.version) :
|
||||
notes.version == null;
|
||||
}
|
||||
|
||||
@Override public int hashCode() {
|
||||
int result = name != null ? name.hashCode() : 0;
|
||||
result = 31 * result + (version != null ? version.hashCode() : 0);
|
||||
int result = this.name != null ? this.name.hashCode() : 0;
|
||||
result = 31 * result + (this.version != null ? this.version.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ import java.nio.file.Files;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import com.github.jknack.handlebars.Template;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
@@ -29,8 +28,6 @@ class ReleaseNotesTemplateGenerator {
|
||||
private final Projects projects;
|
||||
private final NotesGenerator notesGenerator;
|
||||
|
||||
static final Map<String, File> CACHE = new ConcurrentHashMap<>();
|
||||
|
||||
ReleaseNotesTemplateGenerator(Template template, String releaseVersion,
|
||||
File blogOutput, Projects projects, ProjectGitHandler handler) {
|
||||
this.template = template;
|
||||
@@ -41,12 +38,6 @@ class ReleaseNotesTemplateGenerator {
|
||||
}
|
||||
|
||||
File releaseNotes() {
|
||||
File cached = CACHE.get(this.releaseVersion);
|
||||
if (cached != null && fileSize(cached) > 0) {
|
||||
log.info("Found an existing entry [{}] in the cache "
|
||||
+ "for version [{}] with size [{}]", cached, this.releaseVersion, fileSize(cached));
|
||||
return cached;
|
||||
}
|
||||
try {
|
||||
Map<String, Object> map = ImmutableMap.<String, Object>builder()
|
||||
.put("date", LocalDate.now().format(DateTimeFormatter.ISO_DATE))
|
||||
@@ -55,9 +46,7 @@ class ReleaseNotesTemplateGenerator {
|
||||
.build();
|
||||
String blog = this.template.apply(map);
|
||||
Files.write(this.blogOutput.toPath(), blog.getBytes());
|
||||
File output = this.blogOutput;
|
||||
CACHE.put(this.releaseVersion, output);
|
||||
return output;
|
||||
return this.blogOutput;
|
||||
}
|
||||
catch (IOException e) {
|
||||
log.warn("Exception occurred while trying to generate release notes", e);
|
||||
|
||||
@@ -72,7 +72,7 @@ public class TemplateGenerator implements ReleaserPropertiesAware {
|
||||
File blogOutput = file(this.blogOutput);
|
||||
String releaseVersion = parsedVersion(projects);
|
||||
Template template = template(BLOG_TEMPLATE);
|
||||
return new BlogTemplateGenerator(template, releaseVersion, blogOutput, projects, handler).blog();
|
||||
return new BlogTemplateGenerator(template, releaseVersion, blogOutput, projects, this.handler).blog();
|
||||
}
|
||||
|
||||
public File tweet(Projects projects) {
|
||||
|
||||
@@ -41,7 +41,7 @@ public class ProjectDocumentationUpdaterTests {
|
||||
TestUtils.prepareLocalRepo();
|
||||
FileSystemUtils.copyRecursively(file("/projects"), this.tmpFolder);
|
||||
this.properties.getGit().setDocumentationUrl(file("/projects/spring-cloud-static/").toURI().toString());
|
||||
this.handler = new ProjectGitHandler(properties);
|
||||
this.handler = new ProjectGitHandler(this.properties);
|
||||
this.clonedDocProject = this.handler.cloneDocumentationProject();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public class ReleaseTrainContentsUpdaterTests {
|
||||
};
|
||||
TemplateGenerator templateGenerator = new TemplateGenerator(this.properties, this.projectGitHandler);
|
||||
ReleaseTrainContentsUpdater updater = new ReleaseTrainContentsUpdater(this.properties,
|
||||
this.projectGitHandler, templateGenerator);
|
||||
this.projectGitHandler, this.templateGenerator);
|
||||
File springCloudRepo;
|
||||
File wikiRepo;
|
||||
@Rule public TemporaryFolder tmp = new TemporaryFolder();
|
||||
|
||||
@@ -63,7 +63,7 @@ public class SpringCloudGhPagesParserTests {
|
||||
.parseProjectPage(this.wrongHtml);
|
||||
|
||||
BDDAssertions.then(contents).isNull();
|
||||
BDDAssertions.then(capture.toString())
|
||||
BDDAssertions.then(this.capture.toString())
|
||||
.contains("The page is missing the components table markers");
|
||||
}
|
||||
}
|
||||
@@ -272,7 +272,7 @@ public class GitRepoTests {
|
||||
|
||||
@Test
|
||||
public void should_not_revert_changes_when_commit_message_is_not_related_to_updating_snapshots() throws Exception {
|
||||
File project = new GitRepo(tmpFolder)
|
||||
File project = new GitRepo(this.tmpFolder)
|
||||
.cloneProject(new URIish(this.springCloudReleaseProject.toURI().toURL()));
|
||||
|
||||
BDDAssertions.thenThrownBy(
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
package org.springframework.cloud.release.internal.git;
|
||||
|
||||
import com.jcabi.github.Milestone;
|
||||
import com.jcabi.github.Repo;
|
||||
import com.jcabi.github.mock.MkGithub;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
|
||||
import javax.json.Json;
|
||||
|
||||
import com.jcabi.github.Milestone;
|
||||
import com.jcabi.github.Repo;
|
||||
import com.jcabi.github.mock.MkGithub;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
|
||||
import org.springframework.boot.test.rule.OutputCapture;
|
||||
import org.springframework.cloud.release.internal.ReleaserProperties;
|
||||
import org.springframework.cloud.release.internal.pom.ProjectVersion;
|
||||
@@ -40,7 +41,7 @@ public class GithubMilestonesTests {
|
||||
public void should_close_milestone_if_there_is_one() throws IOException {
|
||||
GithubMilestones milestones = new GithubMilestones(this.github, withToken()) {
|
||||
@Override String org() {
|
||||
return repo.coordinates().user();
|
||||
return GithubMilestonesTests.this.repo.coordinates().user();
|
||||
}
|
||||
|
||||
@Override String milestoneTitle(Milestone.Smart milestone)
|
||||
@@ -48,7 +49,7 @@ public class GithubMilestonesTests {
|
||||
return "0.2.0.BUILD-SNAPSHOT";
|
||||
}
|
||||
};
|
||||
repo.milestones().create("0.2.0.BUILD-SNAPSHOT");
|
||||
this.repo.milestones().create("0.2.0.BUILD-SNAPSHOT");
|
||||
|
||||
milestones.closeMilestone(nonGaSleuthProject());
|
||||
|
||||
@@ -59,7 +60,7 @@ public class GithubMilestonesTests {
|
||||
public void should_close_milestone_when_the_milestone_contains_numeric_version_only_and_version_is_ga() throws IOException {
|
||||
GithubMilestones milestones = new GithubMilestones(this.github, withToken()) {
|
||||
@Override String org() {
|
||||
return repo.coordinates().user();
|
||||
return GithubMilestonesTests.this.repo.coordinates().user();
|
||||
}
|
||||
|
||||
@Override String milestoneTitle(Milestone.Smart milestone)
|
||||
@@ -67,7 +68,7 @@ public class GithubMilestonesTests {
|
||||
return "0.2.0";
|
||||
}
|
||||
};
|
||||
repo.milestones().create("0.2.0");
|
||||
this.repo.milestones().create("0.2.0");
|
||||
|
||||
milestones.closeMilestone(gaSleuthProject());
|
||||
|
||||
@@ -82,7 +83,7 @@ public class GithubMilestonesTests {
|
||||
public void should_not_close_milestone_when_the_milestone_contains_numeric_version_only() throws IOException {
|
||||
GithubMilestones milestones = new GithubMilestones(this.github, withToken()) {
|
||||
@Override String org() {
|
||||
return repo.coordinates().user();
|
||||
return GithubMilestonesTests.this.repo.coordinates().user();
|
||||
}
|
||||
|
||||
@Override String milestoneTitle(Milestone.Smart milestone)
|
||||
@@ -90,7 +91,7 @@ public class GithubMilestonesTests {
|
||||
return "0.2.0";
|
||||
}
|
||||
};
|
||||
repo.milestones().create("0.2.0");
|
||||
this.repo.milestones().create("0.2.0");
|
||||
|
||||
milestones.closeMilestone(nonGaSleuthProject());
|
||||
|
||||
@@ -101,7 +102,7 @@ public class GithubMilestonesTests {
|
||||
public void should_fetch_url_of_a_closed_matching_milestone() throws IOException {
|
||||
GithubMilestones milestones = new GithubMilestones(this.github, withToken()) {
|
||||
@Override String org() {
|
||||
return repo.coordinates().user();
|
||||
return GithubMilestonesTests.this.repo.coordinates().user();
|
||||
}
|
||||
|
||||
@Override String milestoneTitle(Milestone.Smart milestone)
|
||||
@@ -114,7 +115,7 @@ public class GithubMilestonesTests {
|
||||
return new URL("https://api.github.com/repos/spring-cloud/spring-cloud-sleuth/milestones/33");
|
||||
}
|
||||
};
|
||||
repo.milestones().create("0.2.0.RELEASE");
|
||||
this.repo.milestones().create("0.2.0.RELEASE");
|
||||
|
||||
String url = milestones.milestoneUrl(gaSleuthProject());
|
||||
|
||||
@@ -124,7 +125,7 @@ public class GithubMilestonesTests {
|
||||
@Test
|
||||
public void should_fetch_url_of_a_closed_matching_milestone_from_cache() throws IOException {
|
||||
GithubMilestones milestones = new GithubMilestones(this.github, withToken());
|
||||
GithubMilestones.CACHE.put(gaSleuthProject(), "https://github.com/spring-cloud/spring-cloud-sleuth/milestone/33?closed=1");
|
||||
GithubMilestones.MILESTONE_URL_CACHE.put(gaSleuthProject(), "https://github.com/spring-cloud/spring-cloud-sleuth/milestone/33?closed=1");
|
||||
|
||||
String url = milestones.milestoneUrl(gaSleuthProject());
|
||||
|
||||
@@ -135,7 +136,7 @@ public class GithubMilestonesTests {
|
||||
public void should_return_null_if_no_matching_milestone_was_found() throws IOException {
|
||||
GithubMilestones milestones = new GithubMilestones(this.github, withToken()) {
|
||||
@Override String org() {
|
||||
return repo.coordinates().user();
|
||||
return GithubMilestonesTests.this.repo.coordinates().user();
|
||||
}
|
||||
|
||||
@Override String milestoneTitle(Milestone.Smart milestone)
|
||||
@@ -158,7 +159,7 @@ public class GithubMilestonesTests {
|
||||
public void should_return_null_if_no_matching_milestone_was_found_within_threshold() throws IOException {
|
||||
GithubMilestones milestones = new GithubMilestones(this.github, withThreshold()) {
|
||||
@Override String org() {
|
||||
return repo.coordinates().user();
|
||||
return GithubMilestonesTests.this.repo.coordinates().user();
|
||||
}
|
||||
|
||||
@Override String milestoneTitle(Milestone.Smart milestone)
|
||||
@@ -166,7 +167,7 @@ public class GithubMilestonesTests {
|
||||
return "0.2.0";
|
||||
}
|
||||
};
|
||||
repo.milestones().create("0.2.0");
|
||||
this.repo.milestones().create("0.2.0");
|
||||
|
||||
milestones.closeMilestone(gaSleuthProject());
|
||||
|
||||
@@ -181,7 +182,7 @@ public class GithubMilestonesTests {
|
||||
public void should_throw_exception_when_there_is_no_matching_milestone() throws IOException {
|
||||
GithubMilestones milestones = new GithubMilestones(this.github, withToken()) {
|
||||
@Override String org() {
|
||||
return repo.coordinates().user();
|
||||
return GithubMilestonesTests.this.repo.coordinates().user();
|
||||
}
|
||||
|
||||
@Override String milestoneTitle(Milestone.Smart milestone)
|
||||
@@ -189,7 +190,7 @@ public class GithubMilestonesTests {
|
||||
return "0.1.0.BUILD-SNAPSHOT";
|
||||
}
|
||||
};
|
||||
repo.milestones().create("v0.2.0.BUILD-SNAPSHOT");
|
||||
this.repo.milestones().create("v0.2.0.BUILD-SNAPSHOT");
|
||||
|
||||
milestones.closeMilestone(nonGaSleuthProject());
|
||||
then(this.capture.toString()).contains("No matching milestone was found");
|
||||
@@ -199,7 +200,7 @@ public class GithubMilestonesTests {
|
||||
public void should_print_that_no_milestones_were_found_when_io_problems_occurred() throws IOException {
|
||||
GithubMilestones milestones = new GithubMilestones(this.github, withToken()) {
|
||||
@Override String org() {
|
||||
return repo.coordinates().user();
|
||||
return GithubMilestonesTests.this.repo.coordinates().user();
|
||||
}
|
||||
|
||||
@Override String milestoneTitle(Milestone.Smart milestone)
|
||||
@@ -207,7 +208,7 @@ public class GithubMilestonesTests {
|
||||
throw new IOException("foo");
|
||||
}
|
||||
};
|
||||
repo.milestones().create("v0.2.0.BUILD-SNAPSHOT");
|
||||
this.repo.milestones().create("v0.2.0.BUILD-SNAPSHOT");
|
||||
|
||||
milestones.closeMilestone(nonGaSleuthProject());
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import org.slf4j.Logger;
|
||||
import org.springframework.cloud.release.internal.pom.LoggerToMavenLog;
|
||||
|
||||
import static org.mockito.BDDMockito.then;
|
||||
|
||||
@@ -39,7 +38,7 @@ public class LoggerToMavenLogTests {
|
||||
}
|
||||
|
||||
@Test public void debug2() throws Exception {
|
||||
this.loggerToMavenLog.debug(exception);
|
||||
this.loggerToMavenLog.debug(this.exception);
|
||||
|
||||
then(this.logger).should().debug("Exception occurred", this.exception);
|
||||
}
|
||||
@@ -63,7 +62,7 @@ public class LoggerToMavenLogTests {
|
||||
}
|
||||
|
||||
@Test public void info2() throws Exception {
|
||||
this.loggerToMavenLog.info(exception);
|
||||
this.loggerToMavenLog.info(this.exception);
|
||||
|
||||
then(this.logger).should().info("Exception occurred", this.exception);
|
||||
}
|
||||
@@ -87,7 +86,7 @@ public class LoggerToMavenLogTests {
|
||||
}
|
||||
|
||||
@Test public void warn2() throws Exception {
|
||||
this.loggerToMavenLog.warn(exception);
|
||||
this.loggerToMavenLog.warn(this.exception);
|
||||
|
||||
then(this.logger).should().warn("Exception occurred", this.exception);
|
||||
}
|
||||
@@ -111,7 +110,7 @@ public class LoggerToMavenLogTests {
|
||||
}
|
||||
|
||||
@Test public void error2() throws Exception {
|
||||
this.loggerToMavenLog.error(exception);
|
||||
this.loggerToMavenLog.error(this.exception);
|
||||
|
||||
then(this.logger).should().error("Exception occurred", this.exception);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class ProjectsTests {
|
||||
projectVersions.add(new ProjectVersion("spring-cloud-starter-build", "1.0.0"));
|
||||
Projects projects = new Projects(projectVersions);
|
||||
|
||||
then(projects.forFile(springCloudReleasePom).version).isEqualTo("1.0.0");
|
||||
then(projects.forFile(this.springCloudReleasePom).version).isEqualTo("1.0.0");
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -148,7 +148,7 @@ public class ProjectsTests {
|
||||
projectVersions.add(new ProjectVersion("foo", "1.0.0"));
|
||||
Projects projects = new Projects(projectVersions);
|
||||
|
||||
thenThrownBy(() -> projects.forFile(springCloudReleasePom))
|
||||
thenThrownBy(() -> projects.forFile(this.springCloudReleasePom))
|
||||
.isInstanceOf(IllegalStateException.class)
|
||||
.hasMessageContaining("Project with name [spring-cloud-starter-build] is not present");
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class VersionChangeAssert extends
|
||||
|
||||
VersionChangeAssert newParentVersionIsEqualTo(String groupId, String artifactId, String newVersion) {
|
||||
boolean matches = false;
|
||||
for (VersionChange change : actual.changes) {
|
||||
for (VersionChange change : this.actual.changes) {
|
||||
if (newVersion.equals(change.getNewVersion())
|
||||
&& groupId.equals(change.getGroupId())
|
||||
&& artifactId.equals(change.getArtifactId())) {
|
||||
|
||||
@@ -47,20 +47,20 @@ public class PostReleaseActionsTests {
|
||||
ProjectGitHandler projectGitHandler = new ProjectGitHandler(this.properties) {
|
||||
@Override
|
||||
public File cloneTestSamplesProject() {
|
||||
cloned = super.cloneTestSamplesProject();
|
||||
return cloned;
|
||||
PostReleaseActionsTests.this.cloned = super.cloneTestSamplesProject();
|
||||
return PostReleaseActionsTests.this.cloned;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File cloneReleaseTrainDocumentationProject() {
|
||||
cloned = super.cloneTestSamplesProject();
|
||||
return cloned;
|
||||
PostReleaseActionsTests.this.cloned = super.cloneTestSamplesProject();
|
||||
return PostReleaseActionsTests.this.cloned;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File cloneAndGuessBranch(String url, String... versions) {
|
||||
File file = super.cloneAndGuessBranch(url, versions);
|
||||
clonedTestProjects.add(url, file);
|
||||
PostReleaseActionsTests.this.clonedTestProjects.add(url, file);
|
||||
return file;
|
||||
}
|
||||
};
|
||||
@@ -78,24 +78,24 @@ public class PostReleaseActionsTests {
|
||||
public void should_do_nothing_when_is_not_meta_release_and_update_test_is_called() {
|
||||
this.properties.getMetaRelease().setEnabled(false);
|
||||
PostReleaseActions actions = new PostReleaseActions(this.projectGitHandler,
|
||||
this.updater, gradleUpdater, this.builder, this.properties);
|
||||
this.updater, this.gradleUpdater, this.builder, this.properties);
|
||||
|
||||
actions.runUpdatedTests(currentGa());
|
||||
|
||||
BDDAssertions.then(cloned).isNull();
|
||||
BDDMockito.then(gradleUpdater).shouldHaveZeroInteractions();
|
||||
BDDAssertions.then(this.cloned).isNull();
|
||||
BDDMockito.then(this.gradleUpdater).shouldHaveZeroInteractions();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_do_nothing_when_the_switch_for_sample_check_is_off_and_update_test_is_called() {
|
||||
this.properties.getGit().setRunUpdatedSamples(false);
|
||||
PostReleaseActions actions = new PostReleaseActions(this.projectGitHandler,
|
||||
this.updater, gradleUpdater, this.builder, this.properties);
|
||||
this.updater, this.gradleUpdater, this.builder, this.properties);
|
||||
|
||||
actions.runUpdatedTests(currentGa());
|
||||
|
||||
BDDAssertions.then(cloned).isNull();
|
||||
BDDMockito.then(gradleUpdater).shouldHaveZeroInteractions();
|
||||
BDDAssertions.then(this.cloned).isNull();
|
||||
BDDMockito.then(this.gradleUpdater).shouldHaveZeroInteractions();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -104,20 +104,20 @@ public class PostReleaseActionsTests {
|
||||
this.properties.getGit().setTestSamplesProjectUrl(tmpFile("spring-cloud-core-tests/").getAbsolutePath() + "/");
|
||||
this.properties.getMaven().setBuildCommand("touch build.log");
|
||||
PostReleaseActions actions = new PostReleaseActions(this.projectGitHandler,
|
||||
this.updater, gradleUpdater, this.builder, this.properties);
|
||||
this.updater, this.gradleUpdater, this.builder, this.properties);
|
||||
|
||||
actions.runUpdatedTests(currentGa());
|
||||
|
||||
Model rootPom = this.testPomReader.readPom(new File(cloned, "pom.xml"));
|
||||
Model rootPom = this.testPomReader.readPom(new File(this.cloned, "pom.xml"));
|
||||
BDDAssertions.then(rootPom.getVersion()).isEqualTo("Finchley.SR1");
|
||||
BDDAssertions.then(rootPom.getParent().getVersion()).isEqualTo("2.0.4.RELEASE");
|
||||
BDDAssertions.then(sleuthParentPomVersion()).isEqualTo("2.0.4.RELEASE");
|
||||
BDDAssertions.then(new File(cloned, "build.log")).exists();
|
||||
BDDAssertions.then(new File(this.cloned, "build.log")).exists();
|
||||
thenGradleUpdaterWasCalled();
|
||||
}
|
||||
|
||||
private void thenGradleUpdaterWasCalled() {
|
||||
BDDMockito.then(gradleUpdater).should().updateProjectFromBom(BDDMockito.any(File.class),
|
||||
BDDMockito.then(this.gradleUpdater).should().updateProjectFromBom(BDDMockito.any(File.class),
|
||||
BDDMockito.any(Projects.class), BDDMockito.any(ProjectVersion.class), BDDMockito.eq(false));
|
||||
}
|
||||
|
||||
@@ -125,22 +125,22 @@ public class PostReleaseActionsTests {
|
||||
public void should_do_nothing_when_is_not_meta_release_and_release_train_docs_generation_is_called() {
|
||||
this.properties.getMetaRelease().setEnabled(false);
|
||||
PostReleaseActions actions = new PostReleaseActions(this.projectGitHandler,
|
||||
this.updater, gradleUpdater, this.builder, this.properties);
|
||||
this.updater, this.gradleUpdater, this.builder, this.properties);
|
||||
|
||||
actions.generateReleaseTrainDocumentation(currentGa());
|
||||
|
||||
BDDAssertions.then(cloned).isNull();
|
||||
BDDAssertions.then(this.cloned).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_do_nothing_when_the_switch_for_sample_check_is_off_and_release_train_docs_generation_is_called() {
|
||||
this.properties.getGit().setUpdateReleaseTrainDocs(false);
|
||||
PostReleaseActions actions = new PostReleaseActions(this.projectGitHandler,
|
||||
this.updater, gradleUpdater, this.builder, this.properties);
|
||||
this.updater, this.gradleUpdater, this.builder, this.properties);
|
||||
|
||||
actions.generateReleaseTrainDocumentation(currentGa());
|
||||
|
||||
BDDAssertions.then(cloned).isNull();
|
||||
BDDAssertions.then(this.cloned).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -149,15 +149,15 @@ public class PostReleaseActionsTests {
|
||||
this.properties.getGit().setReleaseTrainDocsUrl(tmpFile("spring-cloud-core-tests/").getAbsolutePath() + "/");
|
||||
this.properties.getMaven().setGenerateReleaseTrainDocsCommand("touch generate.log");
|
||||
PostReleaseActions actions = new PostReleaseActions(this.projectGitHandler,
|
||||
this.updater, gradleUpdater, this.builder, this.properties);
|
||||
this.updater, this.gradleUpdater, this.builder, this.properties);
|
||||
|
||||
actions.generateReleaseTrainDocumentation(currentGa());
|
||||
|
||||
Model rootPom = this.testPomReader.readPom(new File(cloned, "pom.xml"));
|
||||
Model rootPom = this.testPomReader.readPom(new File(this.cloned, "pom.xml"));
|
||||
BDDAssertions.then(rootPom.getVersion()).isEqualTo("Finchley.SR1");
|
||||
BDDAssertions.then(rootPom.getParent().getVersion()).isEqualTo("2.0.4.RELEASE");
|
||||
BDDAssertions.then(sleuthParentPomVersion()).isEqualTo("2.0.4.RELEASE");
|
||||
BDDAssertions.then(new File(cloned, "generate.log")).exists();
|
||||
BDDAssertions.then(new File(this.cloned, "generate.log")).exists();
|
||||
thenGradleUpdaterWasCalled();
|
||||
}
|
||||
|
||||
@@ -165,24 +165,24 @@ public class PostReleaseActionsTests {
|
||||
public void should_do_nothing_when_is_not_meta_release_and_test_samples_update_is_called() {
|
||||
this.properties.getMetaRelease().setEnabled(false);
|
||||
PostReleaseActions actions = new PostReleaseActions(this.projectGitHandler,
|
||||
this.updater, gradleUpdater, this.builder, this.properties);
|
||||
this.updater, this.gradleUpdater, this.builder, this.properties);
|
||||
|
||||
actions.updateAllTestSamples(currentGa());
|
||||
|
||||
BDDAssertions.then(cloned).isNull();
|
||||
BDDMockito.then(gradleUpdater).shouldHaveZeroInteractions();
|
||||
BDDAssertions.then(this.cloned).isNull();
|
||||
BDDMockito.then(this.gradleUpdater).shouldHaveZeroInteractions();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void should_do_nothing_when_the_switch_for_test_samples_update_check_is_off_and_test_samples_update_is_called() {
|
||||
this.properties.getGit().setUpdateReleaseTrainDocs(false);
|
||||
PostReleaseActions actions = new PostReleaseActions(this.projectGitHandler,
|
||||
this.updater, gradleUpdater, this.builder, this.properties);
|
||||
this.updater, this.gradleUpdater, this.builder, this.properties);
|
||||
|
||||
actions.updateAllTestSamples(currentGa());
|
||||
|
||||
BDDAssertions.then(cloned).isNull();
|
||||
BDDMockito.then(gradleUpdater).shouldHaveZeroInteractions();
|
||||
BDDAssertions.then(this.cloned).isNull();
|
||||
BDDMockito.then(this.gradleUpdater).shouldHaveZeroInteractions();
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -193,11 +193,11 @@ public class PostReleaseActionsTests {
|
||||
Collections.singletonList(tmpFile("spring-cloud-core-tests/")
|
||||
.getAbsolutePath() + "/"));
|
||||
PostReleaseActions actions = new PostReleaseActions(this.projectGitHandler,
|
||||
this.updater, gradleUpdater, this.builder, this.properties);
|
||||
this.updater, this.gradleUpdater, this.builder, this.properties);
|
||||
|
||||
actions.updateAllTestSamples(currentGa());
|
||||
|
||||
Map.Entry<String, List<File>> entry = clonedTestProjects.entrySet()
|
||||
Map.Entry<String, List<File>> entry = this.clonedTestProjects.entrySet()
|
||||
.stream()
|
||||
.filter(s -> s.getKey().contains("spring-cloud-core-tests"))
|
||||
.findFirst().orElseThrow(() -> new IllegalStateException("Not found"));
|
||||
@@ -214,7 +214,7 @@ public class PostReleaseActionsTests {
|
||||
}
|
||||
|
||||
private String sleuthParentPomVersion() {
|
||||
return this.testPomReader.readPom(new File(cloned, "sleuth/pom.xml"))
|
||||
return this.testPomReader.readPom(new File(this.cloned, "sleuth/pom.xml"))
|
||||
.getParent().getVersion();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public class RestTemplateSaganClientTests {
|
||||
public void setup() {
|
||||
ReleaserProperties properties = new ReleaserProperties();
|
||||
properties.getGit().setOauthToken("foo");
|
||||
properties.getSagan().setBaseUrl("http://localhost:" + saganPort);
|
||||
properties.getSagan().setBaseUrl("http://localhost:" + this.saganPort);
|
||||
this.client = saganClient(properties);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
package org.springframework.cloud.release.internal.template;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import com.github.jknack.handlebars.Template;
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.Test;
|
||||
import org.mockito.BDDMockito;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
public class ReleaseNotesTemplateGeneratorTests {
|
||||
|
||||
@Test
|
||||
public void should_grab_notes_from_cache_if_present() {
|
||||
Template template = BDDMockito.mock(Template.class);
|
||||
ReleaseNotesTemplateGenerator generator =
|
||||
new ReleaseNotesTemplateGenerator(template, "Foo.RELEASE", null, null, null);
|
||||
ReleaseNotesTemplateGenerator.CACHE.put("Foo.RELEASE", new File("pom.xml"));
|
||||
|
||||
BDDAssertions.then(generator.releaseNotes()).isNotNull();
|
||||
|
||||
BDDMockito.then(template).shouldHaveZeroInteractions();
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ public class TemplateGeneratorTests {
|
||||
this.props.getPom().setBranch("vDalston.RELEASE");
|
||||
|
||||
File generatedMail = new TemplateGenerator(this.props, new File("target/foo/bar/baz/template.txt"),
|
||||
handler).email(new Projects());
|
||||
this.handler).email(new Projects());
|
||||
|
||||
then(generatedMail).hasContent(expectedEmail());
|
||||
}
|
||||
|
||||
@@ -50,10 +50,10 @@ class Task {
|
||||
if (interactive) {
|
||||
boolean skipStep = stepSkipper.skipStep();
|
||||
if (!skipStep) {
|
||||
consumer.accept(args);
|
||||
this.consumer.accept(args);
|
||||
}
|
||||
} else {
|
||||
consumer.accept(args);
|
||||
this.consumer.accept(args);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("\n\n\nBUILD FAILED!!!\n\nException occurred for task <" +
|
||||
@@ -63,6 +63,6 @@ class Task {
|
||||
}
|
||||
|
||||
private void printLog(boolean interactive) {
|
||||
log.info("\n\n\n=== {} ===\n\n{} {}\n\n", header, description, interactive ? MSG : "");
|
||||
log.info("\n\n\n=== {} ===\n\n{} {}\n\n", this.header, this.description, interactive ? MSG : "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package org.springframework.cloud.release.internal.spring;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
@@ -28,6 +25,7 @@ import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import org.mockito.BDDMockito;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import org.springframework.boot.test.rule.OutputCapture;
|
||||
import org.springframework.cloud.release.internal.Releaser;
|
||||
import org.springframework.cloud.release.internal.ReleaserProperties;
|
||||
@@ -49,11 +47,13 @@ import org.springframework.cloud.release.internal.sagan.Project;
|
||||
import org.springframework.cloud.release.internal.sagan.Release;
|
||||
import org.springframework.cloud.release.internal.sagan.SaganClient;
|
||||
import org.springframework.cloud.release.internal.sagan.SaganUpdater;
|
||||
import org.springframework.cloud.release.internal.template.ReleaseNotesTemplateGeneratorCacheClearer;
|
||||
import org.springframework.cloud.release.internal.template.TemplateGenerator;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.util.FileSystemUtils;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
@@ -86,7 +86,6 @@ public class AcceptanceTests {
|
||||
BDDMockito.given(this.saganClient.getProject(anyString()))
|
||||
.willReturn(newProject());
|
||||
Task.stepSkipper = () -> false;
|
||||
ReleaseNotesTemplateGeneratorCacheClearer.clear();
|
||||
}
|
||||
|
||||
@After
|
||||
@@ -138,7 +137,7 @@ public class AcceptanceTests {
|
||||
this.releaserProperties.getGit().setFetchVersionsFromGit(false);
|
||||
this.releaserProperties.getFixedVersions().put("spring-cloud-release", "Finchley.RELEASE");
|
||||
this.releaserProperties.getFixedVersions().put("spring-cloud-consul", "2.3.4.RELEASE");
|
||||
File temporaryDestination = tmp.newFolder();
|
||||
File temporaryDestination = this.tmp.newFolder();
|
||||
this.releaserProperties.getGit().setCloneDestinationDir(temporaryDestination.getAbsolutePath());
|
||||
|
||||
releaser.release();
|
||||
@@ -265,7 +264,7 @@ public class AcceptanceTests {
|
||||
}
|
||||
|
||||
private void thenSaganWasCalled() {
|
||||
BDDMockito.then(saganUpdater).should(BDDMockito.atLeastOnce())
|
||||
BDDMockito.then(this.saganUpdater).should(BDDMockito.atLeastOnce())
|
||||
.updateSagan(BDDMockito.anyString(),
|
||||
BDDMockito.any(ProjectVersion.class), BDDMockito
|
||||
.any(ProjectVersion.class));
|
||||
@@ -277,7 +276,7 @@ public class AcceptanceTests {
|
||||
.forEach(project -> {
|
||||
then(Arrays.asList("spring-cloud-starter-build",
|
||||
"spring-cloud-consul")).contains(pom(project).getArtifactId());
|
||||
then(capture.toString()).contains("executed_build", "executed_deploy", "executed_docs");
|
||||
then(this.capture.toString()).contains("executed_build", "executed_deploy", "executed_docs");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -290,7 +289,7 @@ public class AcceptanceTests {
|
||||
this.releaserProperties.getMetaRelease().getProjectsToSkip().add("spring-cloud-release");
|
||||
this.releaserProperties.getMetaRelease().getProjectsToSkip().add("spring-cloud-consul");
|
||||
this.releaserProperties.getGit().setUpdateReleaseTrainWiki(false);
|
||||
File temporaryDestination = tmp.newFolder();
|
||||
File temporaryDestination = this.tmp.newFolder();
|
||||
this.releaserProperties.getGit().setCloneDestinationDir(temporaryDestination.getAbsolutePath());
|
||||
|
||||
releaser.release(new OptionsBuilder().metaRelease(true).options());
|
||||
@@ -317,7 +316,7 @@ public class AcceptanceTests {
|
||||
.stream().filter(file -> file.getName().equals("spring-cloud-consul"))
|
||||
.forEach(project -> {
|
||||
then(pom(project).getArtifactId()).isEqualTo("spring-cloud-consul");
|
||||
then(capture.toString()).contains("executed_build", "executed_deploy", "executed_docs");
|
||||
then(this.capture.toString()).contains("executed_build", "executed_deploy", "executed_docs");
|
||||
});
|
||||
thenSaganWasCalled();
|
||||
thenDocumentationWasUpdated();
|
||||
@@ -344,7 +343,7 @@ public class AcceptanceTests {
|
||||
.forEach(project -> {
|
||||
then(Collections.singletonList("spring-cloud-consul"))
|
||||
.contains(pom(project).getArtifactId());
|
||||
then(capture.toString()).contains("executed_build", "executed_deploy",
|
||||
then(this.capture.toString()).contains("executed_build", "executed_deploy",
|
||||
"executed_docs");
|
||||
});
|
||||
thenSaganWasCalled();
|
||||
@@ -353,13 +352,13 @@ public class AcceptanceTests {
|
||||
}
|
||||
|
||||
private void thenDocumentationWasUpdated() {
|
||||
BDDMockito.then(documentationUpdater).should()
|
||||
BDDMockito.then(this.documentationUpdater).should()
|
||||
.updateDocsRepo(BDDMockito.any(ProjectVersion.class), BDDMockito
|
||||
.anyString());
|
||||
}
|
||||
|
||||
private void thenWikiPageWasUpdated() {
|
||||
BDDMockito.then(documentationUpdater).should()
|
||||
BDDMockito.then(this.documentationUpdater).should()
|
||||
.updateReleaseTrainWiki(BDDMockito.any(Projects.class));
|
||||
}
|
||||
|
||||
@@ -582,7 +581,7 @@ public class AcceptanceTests {
|
||||
options.interactive = false;
|
||||
super.postReleaseOptions(options, defaultArgs);
|
||||
}
|
||||
}, updater);
|
||||
}, this.updater);
|
||||
}
|
||||
|
||||
private SpringReleaser metaReleaserWithFullDeployment(ReleaserProperties properties) throws Exception {
|
||||
@@ -596,7 +595,7 @@ public class AcceptanceTests {
|
||||
options.interactive = false;
|
||||
super.postReleaseOptions(options, defaultArgs);
|
||||
}
|
||||
}, updater);
|
||||
}, this.updater);
|
||||
}
|
||||
|
||||
private SpringReleaser releaserWithSnapshotScRelease(File projectFile, String projectName,
|
||||
@@ -617,7 +616,7 @@ public class AcceptanceTests {
|
||||
options.interactive = true;
|
||||
super.postReleaseOptions(options, defaultArgs);
|
||||
}
|
||||
}, updater);
|
||||
}, this.updater);
|
||||
}
|
||||
|
||||
private Releaser defaultReleaser(String expectedVersion, String projectName,
|
||||
@@ -628,19 +627,19 @@ public class AcceptanceTests {
|
||||
expectedVersion, projectName);
|
||||
TemplateGenerator templateGenerator = new TemplateGenerator(properties, handler);
|
||||
GradleUpdater gradleUpdater = new GradleUpdater(properties);
|
||||
SaganUpdater saganUpdater = new SaganUpdater(this.saganClient, releaserProperties);
|
||||
SaganUpdater saganUpdater = new SaganUpdater(this.saganClient, this.releaserProperties);
|
||||
DocumentationUpdater documentationUpdater = new TestDocumentationUpdater(properties,
|
||||
new TestDocumentationUpdater.TestProjectDocumentationUpdater(properties, handler, "Brixton.SR1"),
|
||||
new TestDocumentationUpdater.TestReleaseContentsUpdater(properties, handler, templateGenerator)) {
|
||||
@Override public File updateDocsRepo(ProjectVersion currentProject,
|
||||
String springCloudReleaseBranch) {
|
||||
File file = super.updateDocsRepo(currentProject, springCloudReleaseBranch);
|
||||
documentationFolder = file;
|
||||
AcceptanceTests.this.documentationFolder = file;
|
||||
return file;
|
||||
}
|
||||
};
|
||||
Releaser releaser = new Releaser(pomUpdater, projectBuilder, handler,
|
||||
templateGenerator, gradleUpdater, saganUpdater, documentationUpdater, postReleaseActions);
|
||||
templateGenerator, gradleUpdater, saganUpdater, documentationUpdater, this.postReleaseActions);
|
||||
this.gitHandler = handler;
|
||||
return releaser;
|
||||
}
|
||||
@@ -651,26 +650,26 @@ public class AcceptanceTests {
|
||||
NonAssertingTestProjectGitHandler handler = new NonAssertingTestProjectGitHandler(properties);
|
||||
TemplateGenerator templateGenerator = Mockito.spy(new TemplateGenerator(properties, handler));
|
||||
GradleUpdater gradleUpdater = new GradleUpdater(properties);
|
||||
SaganUpdater saganUpdater = Mockito.spy(new SaganUpdater(this.saganClient, releaserProperties));
|
||||
SaganUpdater saganUpdater = Mockito.spy(new SaganUpdater(this.saganClient, this.releaserProperties));
|
||||
DocumentationUpdater documentationUpdater = Mockito.spy(new TestDocumentationUpdater(properties,
|
||||
new TestDocumentationUpdater.TestProjectDocumentationUpdater(properties, handler, "Brixton.SR1"),
|
||||
new TestDocumentationUpdater.TestReleaseContentsUpdater(properties, handler, templateGenerator) {
|
||||
@Override
|
||||
public File updateProjectRepo(Projects projects) {
|
||||
File file = super.updateProjectRepo(projects);
|
||||
cloudProjectFolder = file;
|
||||
AcceptanceTests.this.cloudProjectFolder = file;
|
||||
return file;
|
||||
}
|
||||
}) {
|
||||
@Override public File updateDocsRepo(ProjectVersion currentProject,
|
||||
String springCloudReleaseBranch) {
|
||||
File file = super.updateDocsRepo(currentProject, springCloudReleaseBranch);
|
||||
documentationFolder = file;
|
||||
AcceptanceTests.this.documentationFolder = file;
|
||||
return file;
|
||||
}
|
||||
});
|
||||
Releaser releaser = Mockito.spy(new Releaser(pomUpdater, projectBuilder, handler,
|
||||
templateGenerator, gradleUpdater, saganUpdater, documentationUpdater, postReleaseActions));
|
||||
templateGenerator, gradleUpdater, saganUpdater, documentationUpdater, this.postReleaseActions));
|
||||
this.nonAssertingGitHandler = handler;
|
||||
this.templateGenerator = templateGenerator;
|
||||
this.saganUpdater = saganUpdater;
|
||||
|
||||
@@ -29,11 +29,11 @@ public class OptionsProcessorTests {
|
||||
FirstConsumer first = new FirstConsumer();
|
||||
SecondConsumer second = new SecondConsumer();
|
||||
ThirdConsumer third = new ThirdConsumer();
|
||||
Task firstTask = task("first", "1", "", "", first);
|
||||
Task firstTask = task("first", "1", "", "", this.first);
|
||||
List<Task> tasks = Arrays.asList(new Task[] {
|
||||
firstTask,
|
||||
task("second", "2", "", "", second),
|
||||
task("third", "3", "", "", third)
|
||||
this.firstTask,
|
||||
task("second", "2", "", "", this.second),
|
||||
task("third", "3", "", "", this.third)
|
||||
});
|
||||
|
||||
OptionsProcessor optionsProcessor;
|
||||
@@ -214,7 +214,7 @@ public class OptionsProcessorTests {
|
||||
public void should_execute_full_release() throws Exception {
|
||||
this.optionsProcessor = new OptionsProcessor(this.releaser, new ReleaserProperties(), this.tasks) {
|
||||
@Override Task releaseTask() {
|
||||
return firstTask;
|
||||
return OptionsProcessorTests.this.firstTask;
|
||||
}
|
||||
|
||||
@Override String chosenOption() {
|
||||
@@ -234,7 +234,7 @@ public class OptionsProcessorTests {
|
||||
public void should_execute_full_verbose_release() throws Exception {
|
||||
this.optionsProcessor = new OptionsProcessor(this.releaser, new ReleaserProperties(), this.tasks) {
|
||||
@Override Task releaseVerboseTask() {
|
||||
return firstTask;
|
||||
return OptionsProcessorTests.this.firstTask;
|
||||
}
|
||||
|
||||
@Override String chosenOption() {
|
||||
|
||||
@@ -62,7 +62,7 @@ public class SpringReleaserTests {
|
||||
if (this.counter == 0) {
|
||||
log.info("First run");
|
||||
this.counter = this.counter + 1;
|
||||
return releaserUpdater;
|
||||
return SpringReleaserTests.this.releaserUpdater;
|
||||
}
|
||||
log.info("Second run");
|
||||
return new File("does/not/exist");
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
package org.springframework.cloud.release.internal.template;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
public class ReleaseNotesTemplateGeneratorCacheClearer {
|
||||
|
||||
public static void clear() {
|
||||
ReleaseNotesTemplateGenerator.CACHE.clear();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user