-
Notifications
You must be signed in to change notification settings - Fork 543
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
Surefire 1593 #199
Surefire 1593 #199
Conversation
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.
Well done.
I left a comment
String uri = toClasspathElementUri( parent, classPathElement, dumpLogDirectory ); | ||
cp.append( uri ); | ||
if ( classPathElement.isDirectory() && !uri.endsWith( "/" ) ) | ||
if ( new File( classPathElement ).isDirectory() && !uri.endsWith( "/" ) ) |
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.
Files.isDirectory will be more consistent with the new use of Paths.
What do you think?
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.
@eolivelli
yes, and moreover we should change the method signature from this:
toClasspathElementUri( String parent, String classPathElement, File dumpLogDirectory )
to this:
toClasspathElementUri( Path parent, Path classPathElement, Path dumpLogDirectory )
Which requires calling dumpLogDir.toPath()
in ForkStarter
(Line 580) but pls do not go deeper changing File to Path in all project since it is not a matter of this PR.
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.
It would be nice to have Path parent
created once before the loop.
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.
In the scope of this change which is about using Paths it seemed to me strange to add a line which is using the legacy API.
Btw the result will be correct
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.
I am totally with you. Let's wait for @jglick until he makes all changes.
off-topic: We have one JUnit5 issue and some easy issues to fix. I guess we can release a new release candidate next week,
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.
we should change the method signature
No, I deliberately used String
parameters so as to make it possible to write unit tests. Path
s can (as far as I know) only be constructed using platform-specific methods, making the tests behave differently according to the machine running them.
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.
Files.isDirectory
will be more consistent with the new use ofPath
s.
I chose to make a more minimal change to solve the immediate regression, rather than rewriting the whole class to use NIO methods.
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.
Thst's correct. The Strings are already platform specific.
.isEqualTo( "file" ); | ||
|
||
assertThat( testDirUri.getRawPath() ) | ||
.isEqualTo( testDir.toURI().getRawPath() ); |
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 will likely fail when run on Windows using a project directory that is a UNC path rather than a drive letter: just as File.toURL
had numerous problems corrected only by File.toUri
, so File.toUri
has some problems corrected by Path.toUri
.
I would suggest dropping shouldRelativizeOnRealPlatform
and shouldMakeAbsoluteUriOnRealPlatform
. If you want unit tests, that is what I originally wrote. If you want something more realistic, demonstrating that the result is what was intended, shouldMakeRelativeUriOnRealPlatform
is better.
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.
ok, I will use Path.toUri
then, but I am wondering who wants to run Jenkins build on Surefire project that is located on shared network folder.
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.
I am wondering who wants to run Jenkins build on Surefire project that is located on shared network folder
\\vboxsvr\linux
perhaps?
@PrepareForTest( { JarManifestForkConfiguration.class, InPluginProcessDumpSingleton.class } ) | ||
public class JarManifestForkConfigurationTest | ||
{ | ||
private static final String BASE_DIR = System.getProperty( "user.dir" ); |
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 will pollute the CWD when mvn
is run using -f
rather than defaulting the basedir.
If you want a temporary directory, I would suggest using the TemporaryFolder
rule.
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.
These are files for testing purposes in target folder. Here we run the build mvn install
in the root and not in a child. Even if you run this particular test in IntelliJIDEA, the user.dir
is maven-surefire-common/pom.xml
, so I think it is fine for this test but we can create the temporal folders in TEMP if you like, this does not harm the goal of the test.
Since I cannot edit the description or title, a note to viewers: this is an amendment of #198. |
@jglick |
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.
👍 assuming it indeed still passes on Windows.
...est/java/org/apache/maven/plugin/surefire/booterclient/JarManifestForkConfigurationTest.java
Outdated
Show resolved
Hide resolved
…fest.util.Files).
@jglick |
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.
You are the maintainer, right? Go ahead.
@jglick |
No description provided.