@Test public void executeNeedsToBeConnected() throws CommandException { thrown.expect(CommandException.class); thrown.expectMessage("Not connected to Neo4j"); boltStateHandler.runCypher("", Collections.emptyMap()); }
@Nonnull public Optional<BoltResult> runCypher(@Nonnull String cypher, @Nonnull Map<String, Object> queryParams) throws CommandException { if (!isConnected()) { throw new CommandException("Not connected to Neo4j"); } if (isTransactionOpen()) { return getBoltResult(cypher, queryParams); } else { try { return getBoltResult(cypher, queryParams); } catch (SessionExpiredException e) { reconnect(activeDatabaseNameAsSetByUser, activeDatabaseNameAsSetByUser); return getBoltResult(cypher, queryParams); } } }
BoltStateHandler implements TransactionHandler, Connector, DatabaseManager { @Nonnull public Optional<BoltResult> runCypher(@Nonnull String cypher, @Nonnull Map<String, Object> queryParams) throws CommandException { if (!isConnected()) { throw new CommandException("Not connected to Neo4j"); } if (isTransactionOpen()) { return getBoltResult(cypher, queryParams); } else { try { return getBoltResult(cypher, queryParams); } catch (SessionExpiredException e) { reconnect(activeDatabaseNameAsSetByUser, activeDatabaseNameAsSetByUser); return getBoltResult(cypher, queryParams); } } } }
BoltStateHandler implements TransactionHandler, Connector, DatabaseManager { @Nonnull public Optional<BoltResult> runCypher(@Nonnull String cypher, @Nonnull Map<String, Object> queryParams) throws CommandException { if (!isConnected()) { throw new CommandException("Not connected to Neo4j"); } if (isTransactionOpen()) { return getBoltResult(cypher, queryParams); } else { try { return getBoltResult(cypher, queryParams); } catch (SessionExpiredException e) { reconnect(activeDatabaseNameAsSetByUser, activeDatabaseNameAsSetByUser); return getBoltResult(cypher, queryParams); } } } BoltStateHandler(boolean isInteractive);   BoltStateHandler(TriFunction<String, AuthToken, Config, Driver> driverProvider,
                     boolean isInteractive); }
BoltStateHandler implements TransactionHandler, Connector, DatabaseManager { @Nonnull public Optional<BoltResult> runCypher(@Nonnull String cypher, @Nonnull Map<String, Object> queryParams) throws CommandException { if (!isConnected()) { throw new CommandException("Not connected to Neo4j"); } if (isTransactionOpen()) { return getBoltResult(cypher, queryParams); } else { try { return getBoltResult(cypher, queryParams); } catch (SessionExpiredException e) { reconnect(activeDatabaseNameAsSetByUser, activeDatabaseNameAsSetByUser); return getBoltResult(cypher, queryParams); } } } BoltStateHandler(boolean isInteractive);   BoltStateHandler(TriFunction<String, AuthToken, Config, Driver> driverProvider,
                     boolean isInteractive); @Override void setActiveDatabase(String databaseName); @Override String getActiveDatabaseAsSetByUser(); @Override String getActualDatabaseAsReportedByServer(); @Override void beginTransaction(); @Override void commitTransaction(); @Override void rollbackTransaction(); Neo4jException handleException( Neo4jException e ); @Override boolean isTransactionOpen(); @Override boolean isConnected(); @Override void connect( @Nonnull ConnectionConfig connectionConfig, ThrowingAction<CommandException> command); @Nonnull @Override String getServerVersion(); @Nonnull Optional<BoltResult> runCypher(@Nonnull String cypher,
                                          @Nonnull Map<String, Object> queryParams); void updateActualDbName(@Nonnull ResultSummary resultSummary); void changePassword( @Nonnull ConnectionConfig connectionConfig ); void reset(); void disconnect(); }
BoltStateHandler implements TransactionHandler, Connector, DatabaseManager { @Nonnull public Optional<BoltResult> runCypher(@Nonnull String cypher, @Nonnull Map<String, Object> queryParams) throws CommandException { if (!isConnected()) { throw new CommandException("Not connected to Neo4j"); } if (isTransactionOpen()) { return getBoltResult(cypher, queryParams); } else { try { return getBoltResult(cypher, queryParams); } catch (SessionExpiredException e) { reconnect(activeDatabaseNameAsSetByUser, activeDatabaseNameAsSetByUser); return getBoltResult(cypher, queryParams); } } } BoltStateHandler(boolean isInteractive);   BoltStateHandler(TriFunction<String, AuthToken, Config, Driver> driverProvider,
                     boolean isInteractive); @Override void setActiveDatabase(String databaseName); @Override String getActiveDatabaseAsSetByUser(); @Override String getActualDatabaseAsReportedByServer(); @Override void beginTransaction(); @Override void commitTransaction(); @Override void rollbackTransaction(); Neo4jException handleException( Neo4jException e ); @Override boolean isTransactionOpen(); @Override boolean isConnected(); @Override void connect( @Nonnull ConnectionConfig connectionConfig, ThrowingAction<CommandException> command); @Nonnull @Override String getServerVersion(); @Nonnull Optional<BoltResult> runCypher(@Nonnull String cypher,
                                          @Nonnull Map<String, Object> queryParams); void updateActualDbName(@Nonnull ResultSummary resultSummary); void changePassword( @Nonnull ConnectionConfig connectionConfig ); void reset(); void disconnect();  }