Search in sources :

Example 11 with ShellStatementParser

use of org.neo4j.shell.parser.ShellStatementParser in project neo4j by neo4j.

the class InteractiveShellRunnerTest method multilineEndsOnSemicolonOnNewLine.

@Test
public void multilineEndsOnSemicolonOnNewLine() 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(cmdExecuter).execute("CREATE (n:Person) RETURN n\n;");
}
Also used : ShellStatementParser(org.neo4j.shell.parser.ShellStatementParser) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) Test(org.junit.Test)

Example 12 with ShellStatementParser

use of org.neo4j.shell.parser.ShellStatementParser in project neo4j by neo4j.

the class NonInteractiveShellRunnerTest method setup.

@Before
public void setup() throws CommandException {
    statementParser = new ShellStatementParser();
    badLineError = new ClientException("Found a bad line");
    doThrow(badLineError).when(cmdExecuter).execute(contains("bad"));
    doReturn(System.out).when(logger).getOutputStream();
}
Also used : ShellStatementParser(org.neo4j.shell.parser.ShellStatementParser) ClientException(org.neo4j.driver.exceptions.ClientException) Before(org.junit.Before)

Aggregations

ShellStatementParser (org.neo4j.shell.parser.ShellStatementParser)12 ByteArrayInputStream (java.io.ByteArrayInputStream)10 InputStream (java.io.InputStream)10 Test (org.junit.Test)9 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)7 Before (org.junit.Before)2 ClientException (org.neo4j.driver.exceptions.ClientException)2 AnsiLogger (org.neo4j.shell.log.AnsiLogger)2 Logger (org.neo4j.shell.log.Logger)2 BoltStateHandler (org.neo4j.shell.state.BoltStateHandler)2 Signal (sun.misc.Signal)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 PrintStream (java.io.PrintStream)1 ConnectionConfig (org.neo4j.shell.ConnectionConfig)1 DatabaseManager (org.neo4j.shell.DatabaseManager)1 OfflineTestShell (org.neo4j.shell.OfflineTestShell)1 StatementExecuter (org.neo4j.shell.StatementExecuter)1 TransactionHandler (org.neo4j.shell.TransactionHandler)1 UserMessagesHandler (org.neo4j.shell.UserMessagesHandler)1 CommandHelper (org.neo4j.shell.commands.CommandHelper)1