diff --git a/cypher-shell/src/integration-test/java/org/neo4j/shell/commands/CypherShellMultiDatabaseIntegrationTest.java b/cypher-shell/src/integration-test/java/org/neo4j/shell/commands/CypherShellMultiDatabaseIntegrationTest.java index 47e28cd0..a4986c6b 100644 --- a/cypher-shell/src/integration-test/java/org/neo4j/shell/commands/CypherShellMultiDatabaseIntegrationTest.java +++ b/cypher-shell/src/integration-test/java/org/neo4j/shell/commands/CypherShellMultiDatabaseIntegrationTest.java @@ -60,6 +60,14 @@ public void switchingToSystemDatabaseWorks() throws CommandException { assertOnSystemDB(); } + @Test + public void switchingToSystemDatabaseIsNotCaseSensitive() throws CommandException { + useCommand.execute("SyStEm"); + + assertThat(linePrinter.output(), is("")); + assertOnSystemDB(); + } + @Test public void switchingToSystemDatabaseAndBackToNeo4jWorks() throws CommandException { useCommand.execute(SYSTEM_DB_NAME); @@ -100,7 +108,7 @@ public void switchingDatabaseAfterRollbackTransactionWorks() throws CommandExcep @Test public void switchingToNonExistingDatabaseShouldGiveErrorResponseFromServer() throws CommandException { thrown.expect(ClientException.class); - thrown.expectMessage("The database requested does not exist."); + thrown.expectMessage("Database does not exist"); useCommand.execute("this_database_name_does_not_exist_in_test_container"); } diff --git a/cypher-shell/src/main/java/org/neo4j/shell/state/BoltStateHandler.java b/cypher-shell/src/main/java/org/neo4j/shell/state/BoltStateHandler.java index 5ed81344..b733c0c1 100644 --- a/cypher-shell/src/main/java/org/neo4j/shell/state/BoltStateHandler.java +++ b/cypher-shell/src/main/java/org/neo4j/shell/state/BoltStateHandler.java @@ -162,7 +162,7 @@ private void reconnect(boolean keepBookmark) { }; session = driver.session(sessionArgs.andThen(sessionOptionalArgs)); - String query = activeDatabaseNameAsSetByUser.equals(SYSTEM_DB_NAME) ? "SHOW DATABASES" : "RETURN 1"; + String query = activeDatabaseNameAsSetByUser.compareToIgnoreCase(SYSTEM_DB_NAME) == 0 ? "SHOW DATABASES" : "RETURN 1"; resetActualDbName(); // Set this to null first in case run throws an exception StatementResult run = session.run(query);