Addressed PR feedback
* Fix tests still referring to -E * add comment about missing classes * rename writer constant
This commit is contained in:
parent
591fb8f028
commit
5bd7da5659
|
@ -89,35 +89,35 @@ public abstract class Terminal {
|
|||
|
||||
private static class ConsoleTerminal extends Terminal {
|
||||
|
||||
private static final Console console = System.console();
|
||||
private static final Console CONSOLE = System.console();
|
||||
|
||||
ConsoleTerminal() {
|
||||
super(System.lineSeparator());
|
||||
}
|
||||
|
||||
static boolean isSupported() {
|
||||
return console != null;
|
||||
return CONSOLE != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrintWriter getWriter() {
|
||||
return console.writer();
|
||||
return CONSOLE.writer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String readText(String prompt) {
|
||||
return console.readLine("%s", prompt);
|
||||
return CONSOLE.readLine("%s", prompt);
|
||||
}
|
||||
|
||||
@Override
|
||||
public char[] readSecret(String prompt) {
|
||||
return console.readPassword("%s", prompt);
|
||||
return CONSOLE.readPassword("%s", prompt);
|
||||
}
|
||||
}
|
||||
|
||||
private static class SystemTerminal extends Terminal {
|
||||
|
||||
private static final PrintWriter writer = newWriter();
|
||||
private static final PrintWriter WRITER = newWriter();
|
||||
|
||||
SystemTerminal() {
|
||||
super(System.lineSeparator());
|
||||
|
@ -130,7 +130,7 @@ public abstract class Terminal {
|
|||
|
||||
@Override
|
||||
public PrintWriter getWriter() {
|
||||
return writer;
|
||||
return WRITER;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -38,6 +38,8 @@ thirdPartyAudit.excludes = [
|
|||
// for example we do not need ivy, scripts arent allowed to download code
|
||||
'com.thoughtworks.xstream.XStream',
|
||||
'groovyjarjarasm.asm.util.Textifiable',
|
||||
// commons-cli is referenced by groovy, even though they supposedly
|
||||
// jarjar it. Since we don't use the cli, we don't need the dep.
|
||||
'org.apache.commons.cli.CommandLine',
|
||||
'org.apache.commons.cli.CommandLineParser',
|
||||
'org.apache.commons.cli.GnuParser',
|
||||
|
|
|
@ -133,7 +133,7 @@ public class BootstrapCliParserTests extends CommandTestCase {
|
|||
public void testConfig() throws Exception {
|
||||
registerProperties("es.foo", "es.spam");
|
||||
|
||||
execute("-Efoo=bar", "-Espam=eggs");
|
||||
execute("-Dfoo=bar", "-Dspam=eggs");
|
||||
assertSystemProperty("es.foo", "bar");
|
||||
assertSystemProperty("es.spam", "eggs");
|
||||
assertShouldRun(true);
|
||||
|
@ -141,11 +141,18 @@ public class BootstrapCliParserTests extends CommandTestCase {
|
|||
|
||||
public void testConfigMalformed() throws Exception {
|
||||
UserError e = expectThrows(UserError.class, () -> {
|
||||
execute("-Efoo");
|
||||
execute("-Dfoo");
|
||||
});
|
||||
assertTrue(e.getMessage(), e.getMessage().contains("Malformed elasticsearch setting"));
|
||||
}
|
||||
|
||||
public void testUnknownOption() throws Exception {
|
||||
OptionException e = expectThrows(OptionException.class, () -> {
|
||||
execute("--network.host");
|
||||
});
|
||||
assertTrue(e.getMessage(), e.getMessage().contains("network.host is not a recognized option"));
|
||||
}
|
||||
|
||||
private void registerProperties(String ... systemProperties) {
|
||||
propertiesToClear.addAll(Arrays.asList(systemProperties));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue