-
-
Notifications
You must be signed in to change notification settings - Fork 87
Accept local Url + tests #763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| private String parseLocalUrl(final String url) { | ||
| return databaseDirectory + url.replaceFirst("file://", ""); | ||
| if(url.startsWith(LOCAL_PREFIX + "//")) { | ||
| return url.replaceFirst(LOCAL_PREFIX + "//", "/"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This forces the path tp be absolute, because it prefix the path with /. Is this wanted or a bug?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The paths are supposed to be absolute. The intention is to not rely on the current work-directory. Any not-absolute path would always be relative to the CWD. The URL without the LOCAL_PREFIX is still supported and allows to connect to a db relative to the database directory.
|
|
||
| @Test | ||
| public void testDropCreateWithLocalUrl() throws IOException { | ||
| String localUrl = "local:/" + absoluteDBPath + "/" + DB_NAME; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you prefixing with local:/ because the absolute path already starts with /?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, exactly.
|
The build-error is: Is it possible that the test uses a JDK version not supported by Gremlin? I cannot see any cause in my small coding additions that might be responsible for this kind of error. |
|
Merged, thanks @gfinger ! |
What does this PR do?
A local URL like :
local:<absolutePathToDB>/DBcan be used within the Console to connect to a local DB, to create and drop it.Motivation
It should be possible to use the Console not relying on the current work-directory. It might also be advantageous not to depend on a global setting like when using the
-Darcadedb.server.databaseDirectoryparameter at startup of the console.Related issues
Introduction of the
-Darcadedb.server.databaseDirectoryparameter for the Console.Additional Notes
The commit also contains Unit Tests for the local connect, as well as a test whether the local URL can also be used with the
CREATE DBand theDROP DBcommands.I used JDK 19 for compiling and testing, but the code is compatible with Java 8.
Checklist
mvn clean packagecommand