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

Tests in openidm-launcher module does not work on Windows #168

Closed
pavelhoral opened this issue Feb 2, 2024 · 3 comments
Closed

Tests in openidm-launcher module does not work on Windows #168

pavelhoral opened this issue Feb 2, 2024 · 3 comments

Comments

@pavelhoral
Copy link
Member

pavelhoral commented Feb 2, 2024

Module openidm-launcher uses glob matcher from plexus-utils library. This library is no longer maintained and is sensitive to path separator characters (\ vs /). Fortunately the base configuration does not need to use path separator so the question is if we really need that feature. Nevertheless the unit test ConfigurationUtilTest does not work when File.separator == "\\" (that also means Wren:IDM would not run on Windows if someone tries to use path separator in glob pattern inside launcher.json includes/excludes).

Also with our Java 11+ support we can switch glob matching to native PathMatcher and possible drop the dependency (if it is used only for this purpose).

FAILED: org.forgerock.commons.launcher.ConfigurationUtilTest.testGetZipFileListing
java.lang.AssertionError: Find all jar files expected:<2> but was:<1>
	at org.junit.Assert.fail(Assert.java:93)
	at org.junit.Assert.failNotEquals(Assert.java:647)
	at org.junit.Assert.assertEquals(Assert.java:128)
	at org.junit.Assert.assertEquals(Assert.java:472)
	at org.forgerock.commons.launcher.ConfigurationUtilTest.testGetZipFileListing(ConfigurationUtilTest.java:69)
@pavelhoral
Copy link
Member Author

I think this issue can be generalized to "Windows build does not work". There are more modules that fail.

@pavelhoral
Copy link
Member Author

pavelhoral commented Feb 3, 2024

JRE's PathMatcher does not handle directory wildcards ** the same as Plexus Utils' MatchPattern does:

var plexusMatch = MatchPattern.fromString("**\\hello\\**\\*.jar").matchPath("hello\\foo.jar", false); // => true
var javaMatch = FileSystems.getDefault().getPathMatcher("glob:**/hello/**/*.jar").matches(Path.of("hello\\foo.jar")); // => false

JRE must match ** to at least one directory whereas Plexus Utils can match zero or more. So if we want to keep the old behavior we might need to write our own matcher :(.

Btw. Spring's AntPathMatcher behaves in the same way as the Plexus matcher.

pavelhoral added a commit to orchitech/wrenidm that referenced this issue Feb 3, 2024
pavelhoral added a commit to orchitech/wrenidm that referenced this issue Feb 4, 2024
pavelhoral added a commit to orchitech/wrenidm that referenced this issue Feb 5, 2024
pavelhoral added a commit to orchitech/wrenidm that referenced this issue Feb 5, 2024
pavelhoral added a commit to orchitech/wrenidm that referenced this issue Feb 5, 2024
pavelhoral added a commit to orchitech/wrenidm that referenced this issue Feb 5, 2024
pavelhoral added a commit to orchitech/wrenidm that referenced this issue Feb 6, 2024
pavelhoral added a commit to orchitech/wrenidm that referenced this issue Feb 6, 2024
pavelhoral added a commit to orchitech/wrenidm that referenced this issue Feb 6, 2024
@pavelhoral
Copy link
Member Author

This has been solved by the linked PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant