Skip to content
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

DB2Rest and tests should be agnostic of FileSystem used (Windows, Linux, etc.) #787

Closed
thadguidry opened this issue Nov 12, 2024 · 1 comment · Fixed by #788
Closed

DB2Rest and tests should be agnostic of FileSystem used (Windows, Linux, etc.) #787

thadguidry opened this issue Nov 12, 2024 · 1 comment · Fixed by #788
Assignees
Labels
bug Something isn't working tests anything to do with Tests (resources, data, config, etc.)
Milestone

Comments

@thadguidry
Copy link
Collaborator

Currently tests will fail on Windows systems (maybe others) because of path errors such as:

[ERROR]   PgJsonFileCreateControllerTest.createDirectorViaUpload:71 »
   InvalidPath Illegal char <:> at index 2: /F:/GitHubRepos/db2rest/api-rest/target/test-classes/testdata/director.json

This is because we're not agnostic enough for the filesystem through java.nio methods.
According to docs for java.nio.file.Path.of(), we should be agnostic of filesystems since we are providing a library, and instead use an existing Path instance as an anchor as explained:

The Path is obtained by invoking the getPath method of the default FileSystem.

Note that while this method is very convenient, using it will imply an assumed reference to the default FileSystem and limit the utility of the calling code. Hence it should not be used in library code intended for flexible reuse. A more flexible alternative is to use an existing Path instance as an anchor, such as:

Path dir = ...
Path path = dir.resolve("file");
@thadguidry thadguidry self-assigned this Nov 12, 2024
@thadguidry thadguidry added bug Something isn't working tests anything to do with Tests (resources, data, config, etc.) labels Nov 12, 2024
@thadguidry thadguidry added this to the Dec2024 milestone Nov 12, 2024
thadguidry added a commit to thadguidry/db2rest that referenced this issue Nov 12, 2024
@thadguidry
Copy link
Collaborator Author

Full log of current ERRORS on Windows building:

[ERROR]   MySQLJsonFileCreateControllerTest.createDirectorViaUpload:71 » InvalidPath Illegal char <:> at index 2: /F:/GitHubRepos/db2rest/api-rest/target/test-classes/testdata/director.json     
[ERROR]   MySQLJsonFileCreateControllerTest.createFilmsViaUpload:91 » InvalidPath Illegal char <:> at index 2: /F:/GitHubRepos/db2rest/api-rest/target/test-classes/testdata/BULK_CREATE_FILM_REQUEST.json
[ERROR]   MySQLJsonFileCreateControllerTest.uploadActorFileNonJsonArray:56 » InvalidPath Illegal char <:> at index 2: /F:/GitHubRepos/db2rest/api-rest/target/test-classes/testdata/CREATE_ACTOR_REQUEST.json
[ERROR]   MySQLJsonFileCreateControllerTest.uploadActorsFile:36 » InvalidPath Illegal char <:> at index 2: /F:/GitHubRepos/db2rest/api-rest/target/test-classes/testdata/actor.json
[ERROR]   OracleJsonFileCreateControllerTest.createDirectorViaUpload:71 » InvalidPath Illegal char <:> at index 2: /F:/GitHubRepos/db2rest/api-rest/target/test-classes/testdata/director.json    
[ERROR]   OracleJsonFileCreateControllerTest.createFilmsViaUpload:91 » InvalidPath Illegal char <:> at index 2: /F:/GitHubRepos/db2rest/api-rest/target/test-classes/testdata/BULK_CREATE_FILM_REQUEST.json
[ERROR]   OracleJsonFileCreateControllerTest.uploadActorFileNonJsonArray:56 » InvalidPath Illegal char <:> at index 2: /F:/GitHubRepos/db2rest/api-rest/target/test-classes/testdata/CREATE_ACTOR_REQUEST.json
[ERROR]   OracleJsonFileCreateControllerTest.uploadActorsFile:36 » InvalidPath Illegal char <:> at index 2: /F:/GitHubRepos/db2rest/api-rest/target/test-classes/testdata/actor.json
[ERROR]   PgJsonFileCreateControllerTest.createDirectorViaUpload:71 » InvalidPath Illegal char <:> at index 2: /F:/GitHubRepos/db2rest/api-rest/target/test-classes/testdata/director.json        
[ERROR]   PgJsonFileCreateControllerTest.createFilmsViaUpload:91 » InvalidPath Illegal char <:> at index 2: /F:/GitHubRepos/db2rest/api-rest/target/test-classes/testdata/BULK_CREATE_FILM_REQUEST.json
[ERROR]   PgJsonFileCreateControllerTest.uploadActorFileNonJsonArray:56 » InvalidPath Illegal char <:> at index 2: /F:/GitHubRepos/db2rest/api-rest/target/test-classes/testdata/CREATE_ACTOR_REQUEST.json
[ERROR]   PgJsonFileCreateControllerTest.uploadActorsFile:36 » InvalidPath Illegal char <:> at index 2: /F:/GitHubRepos/db2rest/api-rest/target/test-classes/testdata/actor.json
[INFO]
[ERROR] Tests run: 342, Failures: 6, Errors: 70, Skipped: 9

kdhrubo added a commit that referenced this issue Nov 12, 2024
Fixes #787 make JSON File tests agnostic of FileSystem used
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tests anything to do with Tests (resources, data, config, etc.)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant