Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #153 from henriknyman/1.2-fix-database-name-case-s…
Browse files Browse the repository at this point in the history
…ensitivity

Fix case sensitivity of system database name
  • Loading branch information
henriknyman authored May 31, 2019
2 parents 90cf424 + 130072a commit 64a3990
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 64a3990

Please sign in to comment.