@Test public void shouldReturnNothingOnStrangeCommand() { Optional<CommandExecutable> exe = offlineTestShell.getCommandExecutable(" :aklxjde arg1 arg2 "); assertFalse(exe.isPresent()); }
@Nonnull protected Optional<CommandExecutable> getCommandExecutable(@Nonnull final String line) { Matcher m = cmdNamePattern.matcher(line); if (commandHelper == null || !m.matches()) { return Optional.empty(); } String name = m.group("name"); String args = m.group("args"); Command cmd = commandHelper.getCommand(name); if (cmd == null) { return Optional.empty(); } return Optional.of(() -> cmd.execute(stripTrailingSemicolons(args))); }
CypherShell implements StatementExecuter, Connector, TransactionHandler, DatabaseManager { @Nonnull protected Optional<CommandExecutable> getCommandExecutable(@Nonnull final String line) { Matcher m = cmdNamePattern.matcher(line); if (commandHelper == null || !m.matches()) { return Optional.empty(); } String name = m.group("name"); String args = m.group("args"); Command cmd = commandHelper.getCommand(name); if (cmd == null) { return Optional.empty(); } return Optional.of(() -> cmd.execute(stripTrailingSemicolons(args))); } }
CypherShell implements StatementExecuter, Connector, TransactionHandler, DatabaseManager { @Nonnull protected Optional<CommandExecutable> getCommandExecutable(@Nonnull final String line) { Matcher m = cmdNamePattern.matcher(line); if (commandHelper == null || !m.matches()) { return Optional.empty(); } String name = m.group("name"); String args = m.group("args"); Command cmd = commandHelper.getCommand(name); if (cmd == null) { return Optional.empty(); } return Optional.of(() -> cmd.execute(stripTrailingSemicolons(args))); } CypherShell(@Nonnull LinePrinter linePrinter,
                       @Nonnull PrettyConfig prettyConfig,
                       boolean isInteractive,
                       ParameterMap parameterMap); protected  CypherShell(@Nonnull LinePrinter linePrinter,
                          @Nonnull BoltStateHandler boltStateHandler,
                          @Nonnull PrettyPrinter prettyPrinter,
                          ParameterMap parameterMap); }
CypherShell implements StatementExecuter, Connector, TransactionHandler, DatabaseManager { @Nonnull protected Optional<CommandExecutable> getCommandExecutable(@Nonnull final String line) { Matcher m = cmdNamePattern.matcher(line); if (commandHelper == null || !m.matches()) { return Optional.empty(); } String name = m.group("name"); String args = m.group("args"); Command cmd = commandHelper.getCommand(name); if (cmd == null) { return Optional.empty(); } return Optional.of(() -> cmd.execute(stripTrailingSemicolons(args))); } CypherShell(@Nonnull LinePrinter linePrinter,
                       @Nonnull PrettyConfig prettyConfig,
                       boolean isInteractive,
                       ParameterMap parameterMap); protected  CypherShell(@Nonnull LinePrinter linePrinter,
                          @Nonnull BoltStateHandler boltStateHandler,
                          @Nonnull PrettyPrinter prettyPrinter,
                          ParameterMap parameterMap); @Override void execute(@Nonnull final String cmdString); @Override String lastNeo4jErrorCode(); @Override boolean isConnected(); @Override void connect( @Nonnull ConnectionConfig connectionConfig,
            ThrowingAction<CommandException> command); @Nonnull @Override String getServerVersion(); @Override void beginTransaction(); @Override void commitTransaction(); @Override void rollbackTransaction(); @Override boolean isTransactionOpen(); void setCommandHelper(@Nonnull CommandHelper commandHelper); @Override void reset(); @Override void setActiveDatabase(String databaseName); @Override String getActiveDatabaseAsSetByUser(); @Override String getActualDatabaseAsReportedByServer(); ParameterMap getParameterMap(); void changePassword(@Nonnull ConnectionConfig connectionConfig); void disconnect(); }
CypherShell implements StatementExecuter, Connector, TransactionHandler, DatabaseManager { @Nonnull protected Optional<CommandExecutable> getCommandExecutable(@Nonnull final String line) { Matcher m = cmdNamePattern.matcher(line); if (commandHelper == null || !m.matches()) { return Optional.empty(); } String name = m.group("name"); String args = m.group("args"); Command cmd = commandHelper.getCommand(name); if (cmd == null) { return Optional.empty(); } return Optional.of(() -> cmd.execute(stripTrailingSemicolons(args))); } CypherShell(@Nonnull LinePrinter linePrinter,
                       @Nonnull PrettyConfig prettyConfig,
                       boolean isInteractive,
                       ParameterMap parameterMap); protected  CypherShell(@Nonnull LinePrinter linePrinter,
                          @Nonnull BoltStateHandler boltStateHandler,
                          @Nonnull PrettyPrinter prettyPrinter,
                          ParameterMap parameterMap); @Override void execute(@Nonnull final String cmdString); @Override String lastNeo4jErrorCode(); @Override boolean isConnected(); @Override void connect( @Nonnull ConnectionConfig connectionConfig,
            ThrowingAction<CommandException> command); @Nonnull @Override String getServerVersion(); @Override void beginTransaction(); @Override void commitTransaction(); @Override void rollbackTransaction(); @Override boolean isTransactionOpen(); void setCommandHelper(@Nonnull CommandHelper commandHelper); @Override void reset(); @Override void setActiveDatabase(String databaseName); @Override String getActiveDatabaseAsSetByUser(); @Override String getActualDatabaseAsReportedByServer(); ParameterMap getParameterMap(); void changePassword(@Nonnull ConnectionConfig connectionConfig); void disconnect();  }