mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-20 03:45:02 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
4dec3c36ee
@ -56,6 +56,11 @@ public class CliRepl {
|
|||||||
multiLine.setLength(0);
|
multiLine.setLength(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip empty commands
|
||||||
|
if (line.isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// special case to handle exit
|
// special case to handle exit
|
||||||
if (isExit(line)) {
|
if (isExit(line)) {
|
||||||
cliTerminal.line().em("Bye!").ln();
|
cliTerminal.line().em("Bye!").ln();
|
||||||
|
@ -38,6 +38,28 @@ public class CliReplTests extends ESTestCase {
|
|||||||
verifyNoMoreInteractions(mockCommand, mockSession);
|
verifyNoMoreInteractions(mockCommand, mockSession);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that empty commands are skipped. This includes commands that are
|
||||||
|
* just new lines.
|
||||||
|
*/
|
||||||
|
public void testEmptyNotSent() {
|
||||||
|
CliTerminal cliTerminal = new TestTerminal(
|
||||||
|
";",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
";",
|
||||||
|
"exit;"
|
||||||
|
);
|
||||||
|
|
||||||
|
CliSession mockSession = mock(CliSession.class);
|
||||||
|
CliCommand mockCommand = mock(CliCommand.class);
|
||||||
|
|
||||||
|
CliRepl cli = new CliRepl(cliTerminal, mockSession, mockCommand);
|
||||||
|
cli.execute();
|
||||||
|
|
||||||
|
verify(mockCommand, times(1)).handle(cliTerminal, mockSession, "logo");
|
||||||
|
verifyNoMoreInteractions(mockSession, mockCommand);
|
||||||
|
}
|
||||||
|
|
||||||
public void testFatalCliExceptionHandling() throws Exception {
|
public void testFatalCliExceptionHandling() throws Exception {
|
||||||
CliTerminal cliTerminal = new TestTerminal(
|
CliTerminal cliTerminal = new TestTerminal(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user