Commit f5c8a887 authored by Andy Wilkinson's avatar Andy Wilkinson

Isolate CLI integration tests from any settings decryption failures

parent 4d4cc076
...@@ -21,7 +21,9 @@ import java.io.File; ...@@ -21,7 +21,9 @@ import java.io.File;
import java.io.FileFilter; import java.io.FileFilter;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringReader; import java.io.StringReader;
import java.io.StringWriter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
...@@ -99,16 +101,31 @@ public final class CommandLineInvoker { ...@@ -99,16 +101,31 @@ public final class CommandLineInvoker {
} }
public String getErrorOutput() { public String getErrorOutput() {
return this.err.toString(); return postProcessLines(getLines(this.err));
} }
public String getStandardOutput() { public String getStandardOutput() {
return this.out.toString(); return postProcessLines(getStandardOutputLines());
} }
public List<String> getStandardOutputLines() { public List<String> getStandardOutputLines() {
BufferedReader reader = new BufferedReader(new StringReader( return getLines(this.out);
this.out.toString())); }
private String postProcessLines(List<String> lines) {
StringWriter out = new StringWriter();
PrintWriter printOut = new PrintWriter(out);
for (String line : lines) {
if (!line.startsWith("Maven settings decryption failed")) {
printOut.println(line);
}
}
return out.toString();
}
private List<String> getLines(StringBuffer buffer) {
BufferedReader reader = new BufferedReader(
new StringReader(buffer.toString()));
String line; String line;
List<String> lines = new ArrayList<String>(); List<String> lines = new ArrayList<String>();
try { try {
...@@ -117,7 +134,7 @@ public final class CommandLineInvoker { ...@@ -117,7 +134,7 @@ public final class CommandLineInvoker {
} }
} }
catch (IOException ex) { catch (IOException ex) {
throw new RuntimeException("Failed to read standard output"); throw new RuntimeException("Failed to read output");
} }
return lines; return lines;
} }
......
...@@ -77,7 +77,7 @@ public class SettingsXmlRepositorySystemSessionAutoConfiguration implements ...@@ -77,7 +77,7 @@ public class SettingsXmlRepositorySystemSessionAutoConfiguration implements
Settings settings = loadSettings(); Settings settings = loadSettings();
SettingsDecryptionResult decryptionResult = decryptSettings(settings); SettingsDecryptionResult decryptionResult = decryptSettings(settings);
if (!decryptionResult.getProblems().isEmpty()) { if (!decryptionResult.getProblems().isEmpty()) {
Log.error("Settings decryption failed: " + decryptionResult.getProblems()); Log.error("Maven settings decryption failed. Some Maven repositories may be inaccessible");
// Continue - the encrypted credentials may not be used // Continue - the encrypted credentials may not be used
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment