Table done; fixes gh-111

This commit is contained in:
Marcin Grzejszczak
2018-11-19 18:38:43 +01:00
parent 4ab19000ab
commit 03666265f8
29 changed files with 333 additions and 147 deletions

View File

@@ -346,7 +346,7 @@ class PropertyVersionChanger extends AbstractVersionChanger {
this.propertyStorer = propertyStorer;
}
@Override public void apply(final VersionChange versionChange) throws XMLStreamException {
@Override public void apply(final VersionChange versionChange) {
this.versions.projects
.stream()
.filter(project -> {

View File

@@ -2,7 +2,6 @@ package org.springframework.cloud.release.internal.post;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@@ -84,7 +83,7 @@ public class PostReleaseActions implements Closeable {
+ "is off. Set [releaser.git.update-all-test-samples] to [true] to change that");
return;
}
List<ProjectAndException> projectAndExceptions = this.properties.getGit()
List<ProjectUrlAndException> projectUrlAndExceptions = this.properties.getGit()
.getAllTestSampleUrls()
.entrySet()
.stream()
@@ -93,22 +92,21 @@ public class PostReleaseActions implements Closeable {
.flatMap(Collection::stream)
.collect(Collectors.toList());
log.info("Updated all samples!");
List<String> exceptionMessages = projectAndExceptions.stream()
.filter(ProjectAndException::hasException)
List<String> exceptionMessages = projectUrlAndExceptions.stream()
.filter(ProjectUrlAndException::hasException)
.map(e -> "Project [" + e.key + "] for url [" + e.url + "] "
+ "has exception [" + Arrays
.toString(NestedExceptionUtils.getMostSpecificCause(e.ex)
.getStackTrace()) + "]")
.collect(Collectors.toList());
if (!exceptionMessages.isEmpty()) {
log.warn("Exceptions were found while updating samples");
log.warn(String.join("\n", exceptionMessages));
throw new IllegalStateException("Exceptions were found while updating samples\n" + String.join("\n", exceptionMessages));
} else {
log.info("No exceptions were found while updating the samples");
}
}
private Future<List<ProjectAndException>> updateAllProjects(Projects projects, Map.Entry<String, List<String>> e) {
private Future<List<ProjectUrlAndException>> updateAllProjects(Projects projects, Map.Entry<String, List<String>> e) {
return SERVICE.submit(() -> {
String key = e.getKey();
List<String> value = e.getValue();
@@ -162,7 +160,7 @@ public class PostReleaseActions implements Closeable {
return new ProjectAndFuture(key, url, SERVICE.submit(runnable));
}
private ProjectAndException getResult(ProjectAndFuture projectAndFuture) {
private ProjectUrlAndException getResult(ProjectAndFuture projectAndFuture) {
Exception e = null;
try {
projectAndFuture.future.get(10, TimeUnit.MINUTES);
@@ -171,10 +169,10 @@ public class PostReleaseActions implements Closeable {
catch (Exception ex) {
e = ex;
}
return new ProjectAndException(projectAndFuture.key, projectAndFuture.url, e);
return new ProjectUrlAndException(projectAndFuture.key, projectAndFuture.url, e);
}
private List<ProjectAndException> getResult(Future<List<ProjectAndException>> future) {
private List<ProjectUrlAndException> getResult(Future<List<ProjectUrlAndException>> future) {
try {
return future.get(10, TimeUnit.MINUTES);
}
@@ -211,7 +209,7 @@ public class PostReleaseActions implements Closeable {
}
@Override
public void close() throws IOException {
public void close() {
SERVICE.shutdown();
}
}
@@ -229,12 +227,12 @@ class ProjectAndFuture {
}
}
class ProjectAndException {
class ProjectUrlAndException {
final String key;
final String url;
final Exception ex;
ProjectAndException(String key, String url, Exception ex) {
ProjectUrlAndException(String key, String url, Exception ex) {
this.key = key;
this.url = url;
this.ex = ex;

View File

@@ -66,8 +66,7 @@ class BlogTemplateGenerator {
return this.blogOutput;
}
catch (Exception e) {
log.warn("Exception occurred while trying to create a blog entry", e);
return null;
throw new IllegalStateException("Exception occurred while trying to create a blog entry", e);
}
}

View File

@@ -32,8 +32,7 @@ class EmailTemplateGenerator {
return this.emailOutput;
}
catch (Exception e) {
log.warn("Exception occurred while trying to generate an email template", e);
return null;
throw new IllegalStateException("Exception occurred while trying to generate an email template", e);
}
}
}

View File

@@ -52,6 +52,7 @@ class Notes {
return this.version;
}
@SuppressWarnings("unused")
public String getClosedMilestoneUrl() {
return this.closedMilestoneUrl;
}

View File

@@ -49,22 +49,7 @@ class ReleaseNotesTemplateGenerator {
return this.blogOutput;
}
catch (IOException e) {
log.warn("Exception occurred while trying to generate release notes", e);
return null;
}
}
private int fileSize(File cached) {
try {
int length = Files.readAllBytes(cached.toPath()).length;
if (length == 0) {
log.warn("Cached file has no contents!");
}
return length;
}
catch (IOException e) {
log.warn("Exception [" + e + "] occurred while trying to retrieve file length - will assume it's empty");
return 0;
throw new IllegalStateException("Exception occurred while trying to generate release notes", e);
}
}
}

View File

@@ -31,8 +31,7 @@ class TwitterTemplateGenerator {
return this.output;
}
catch (Exception e) {
log.warn("Exception occurred while trying to generate a twitter template", e);
return null;
throw new IllegalStateException("Exception occurred while trying to generate a twitter template", e);
}
}
}