@Test public void testSignalHandleOutsideExecution() throws Exception { InputStream inputStream = new ByteArrayInputStream("".getBytes()); InteractiveShellRunner runner = new InteractiveShellRunner(cmdExecuter, txHandler, databaseManager, logger, new ShellStatementParser(), inputStream, historyFile, userMessagesHandler, connectionConfig); runner.handle(new Signal(InteractiveShellRunner.INTERRUPT_SIGNAL)); 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.)|@"); }
@Override public void handle(final Signal signal) { if (currentlyExecuting.get()) { executer.reset(); } else { logger.printError( AnsiFormattedText.s().colorRed() .append("\nInterrupted (Note that Cypher queries must end with a ") .bold().append("semicolon. ").boldOff() .append("Type ") .bold().append(Exit.COMMAND_NAME).append(" ").boldOff() .append("to exit the shell.)") .formattedString()); resetPrompt(); } }
InteractiveShellRunner implements ShellRunner, SignalHandler { @Override public void handle(final Signal signal) { if (currentlyExecuting.get()) { executer.reset(); } else { logger.printError( AnsiFormattedText.s().colorRed() .append("\nInterrupted (Note that Cypher queries must end with a ") .bold().append("semicolon. ").boldOff() .append("Type ") .bold().append(Exit.COMMAND_NAME).append(" ").boldOff() .append("to exit the shell.)") .formattedString()); resetPrompt(); } } }
InteractiveShellRunner implements ShellRunner, SignalHandler { @Override public void handle(final Signal signal) { if (currentlyExecuting.get()) { executer.reset(); } else { logger.printError( AnsiFormattedText.s().colorRed() .append("\nInterrupted (Note that Cypher queries must end with a ") .bold().append("semicolon. ").boldOff() .append("Type ") .bold().append(Exit.COMMAND_NAME).append(" ").boldOff() .append("to exit the shell.)") .formattedString()); resetPrompt(); } } InteractiveShellRunner(@Nonnull StatementExecuter executer,
                                  @Nonnull TransactionHandler txHandler,
                                  @Nonnull DatabaseManager databaseManager,
                                  @Nonnull Logger logger,
                                  @Nonnull StatementParser statementParser,
                                  @Nonnull InputStream inputStream,
                                  @Nonnull File historyFile,
                                  @Nonnull UserMessagesHandler userMessagesHandler,
                                  @Nonnull ConnectionConfig connectionConfig); }
InteractiveShellRunner implements ShellRunner, SignalHandler { @Override public void handle(final Signal signal) { if (currentlyExecuting.get()) { executer.reset(); } else { logger.printError( AnsiFormattedText.s().colorRed() .append("\nInterrupted (Note that Cypher queries must end with a ") .bold().append("semicolon. ").boldOff() .append("Type ") .bold().append(Exit.COMMAND_NAME).append(" ").boldOff() .append("to exit the shell.)") .formattedString()); resetPrompt(); } } InteractiveShellRunner(@Nonnull StatementExecuter executer,
                                  @Nonnull TransactionHandler txHandler,
                                  @Nonnull DatabaseManager databaseManager,
                                  @Nonnull Logger logger,
                                  @Nonnull StatementParser statementParser,
                                  @Nonnull InputStream inputStream,
                                  @Nonnull File historyFile,
                                  @Nonnull UserMessagesHandler userMessagesHandler,
                                  @Nonnull ConnectionConfig connectionConfig); @Override int runUntilEnd(); @Nonnull @Override Historian getHistorian(); @Nonnull List<String> readUntilStatement(); @Override void handle(final Signal signal); }
InteractiveShellRunner implements ShellRunner, SignalHandler { @Override public void handle(final Signal signal) { if (currentlyExecuting.get()) { executer.reset(); } else { logger.printError( AnsiFormattedText.s().colorRed() .append("\nInterrupted (Note that Cypher queries must end with a ") .bold().append("semicolon. ").boldOff() .append("Type ") .bold().append(Exit.COMMAND_NAME).append(" ").boldOff() .append("to exit the shell.)") .formattedString()); resetPrompt(); } } InteractiveShellRunner(@Nonnull StatementExecuter executer,
                                  @Nonnull TransactionHandler txHandler,
                                  @Nonnull DatabaseManager databaseManager,
                                  @Nonnull Logger logger,
                                  @Nonnull StatementParser statementParser,
                                  @Nonnull InputStream inputStream,
                                  @Nonnull File historyFile,
                                  @Nonnull UserMessagesHandler userMessagesHandler,
                                  @Nonnull ConnectionConfig connectionConfig); @Override int runUntilEnd(); @Nonnull @Override Historian getHistorian(); @Nonnull List<String> readUntilStatement(); @Override void handle(final Signal signal);  }