use of org.neo4j.shell.parser.ShellStatementParser in project neo4j by neo4j.
the class InteractiveShellRunnerTest method testSignalHandleOutsideExecution.
@Test
public void testSignalHandleOutsideExecution() throws Exception {
// given
InputStream inputStream = new ByteArrayInputStream("".getBytes());
InteractiveShellRunner runner = new InteractiveShellRunner(cmdExecuter, txHandler, databaseManager, logger, new ShellStatementParser(), inputStream, historyFile, userMessagesHandler, connectionConfig);
// when
runner.handle(new Signal(InteractiveShellRunner.INTERRUPT_SIGNAL));
// then
verify(cmdExecuter).lastNeo4jErrorCode();
verifyNoMoreInteractions(cmdExecuter);
verify(logger).printError("@|RED \nInterrupted (Note that Cypher queries must end with a |@" + "@|RED,BOLD semicolon. |@" + "@|RED Type |@@|RED,BOLD :exit|@@|RED,BOLD |@" + "@|RED to exit the shell.)|@");
}
use of org.neo4j.shell.parser.ShellStatementParser in project neo4j by neo4j.
the class InteractiveShellRunnerTest method multilineRequiresNewLineOrSemicolonToEnd.
@Test
public void multilineRequiresNewLineOrSemicolonToEnd() throws Exception {
// given
String inputString = " \\ \nCREATE (n:Person) RETURN n\n";
InputStream inputStream = new ByteArrayInputStream(inputString.getBytes());
InteractiveShellRunner runner = new InteractiveShellRunner(cmdExecuter, txHandler, databaseManager, logger, new ShellStatementParser(), inputStream, historyFile, userMessagesHandler, connectionConfig);
// when
runner.runUntilEnd();
// then
verify(cmdExecuter).lastNeo4jErrorCode();
verifyNoMoreInteractions(cmdExecuter);
}
use of org.neo4j.shell.parser.ShellStatementParser in project neo4j by neo4j.
the class InteractiveShellRunnerTest method multilineEndsOnSemicolonOnSameLine.
@Test
public void multilineEndsOnSemicolonOnSameLine() throws Exception {
// given
String inputString = "\nCREATE (n:Person) RETURN n;\n";
InputStream inputStream = new ByteArrayInputStream(inputString.getBytes());
InteractiveShellRunner runner = new InteractiveShellRunner(cmdExecuter, txHandler, databaseManager, logger, new ShellStatementParser(), inputStream, historyFile, userMessagesHandler, connectionConfig);
// when
runner.runUntilEnd();
// then
verify(cmdExecuter).execute("CREATE (n:Person) RETURN n;");
}
use of org.neo4j.shell.parser.ShellStatementParser in project neo4j by neo4j.
the class InteractiveShellRunnerTest method printsWelcomeAndExitMessage.
@Test
public void printsWelcomeAndExitMessage() throws Exception {
// given
String inputString = "\nCREATE (n:Person) RETURN n\n;\n";
InputStream inputStream = new ByteArrayInputStream(inputString.getBytes());
InteractiveShellRunner runner = new InteractiveShellRunner(cmdExecuter, txHandler, databaseManager, logger, new ShellStatementParser(), inputStream, historyFile, userMessagesHandler, connectionConfig);
// when
runner.runUntilEnd();
// then
verify(logger).printIfVerbose("Welcome to cypher-shell!");
verify(logger).printIfVerbose("Exit message");
}
use of org.neo4j.shell.parser.ShellStatementParser in project neo4j by neo4j.
the class InteractiveShellRunnerTest method justNewLineThrowsNoMoreInput.
@Test
public void justNewLineThrowsNoMoreInput() throws Exception {
// then
thrown.expect(NoMoreInputException.class);
// given
String inputString = "\n";
InputStream inputStream = new ByteArrayInputStream(inputString.getBytes());
InteractiveShellRunner runner = new InteractiveShellRunner(cmdExecuter, txHandler, databaseManager, logger, new ShellStatementParser(), inputStream, historyFile, userMessagesHandler, connectionConfig);
// when
runner.readUntilStatement();
}
Aggregations