Isolate CLI integration tests from any settings decryption failures
This commit is contained in:
parent
4d4cc076c6
commit
f5c8a8879a
|
|
@ -21,7 +21,9 @@ import java.io.File;
|
|||
import java.io.FileFilter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
|
@ -99,16 +101,31 @@ public final class CommandLineInvoker {
|
|||
}
|
||||
|
||||
public String getErrorOutput() {
|
||||
return this.err.toString();
|
||||
return postProcessLines(getLines(this.err));
|
||||
}
|
||||
|
||||
public String getStandardOutput() {
|
||||
return this.out.toString();
|
||||
return postProcessLines(getStandardOutputLines());
|
||||
}
|
||||
|
||||
public List<String> getStandardOutputLines() {
|
||||
BufferedReader reader = new BufferedReader(new StringReader(
|
||||
this.out.toString()));
|
||||
return getLines(this.out);
|
||||
}
|
||||
|
||||
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;
|
||||
List<String> lines = new ArrayList<String>();
|
||||
try {
|
||||
|
|
@ -117,7 +134,7 @@ public final class CommandLineInvoker {
|
|||
}
|
||||
}
|
||||
catch (IOException ex) {
|
||||
throw new RuntimeException("Failed to read standard output");
|
||||
throw new RuntimeException("Failed to read output");
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public class SettingsXmlRepositorySystemSessionAutoConfiguration implements
|
|||
Settings settings = loadSettings();
|
||||
SettingsDecryptionResult decryptionResult = decryptSettings(settings);
|
||||
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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue