Skip to content

SHRINKWRAP-515 Fix name and JDK5 compliance of AddPackage*Test - #109

Merged
bartoszmajsak merged 1 commit into
shrinkwrap:masterfrom
famod:SHRINKWRAP-515
Jul 6, 2017
Merged

bartoszmajsak merged 1 commit into
shrinkwrap:masterfrom
famod:SHRINKWRAP-515

Conversation

@famod

@famod famod commented Jul 5, 2017

Copy link
Copy Markdown
Contributor
  • suffix must be TestCase to be picked up by surefire
  • removed JDK7 stuff
  • consolidated by introducing test base class
  • worked around file leak (?) on windows (just warn for now)

@bartoszmajsak

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

removed JDK7 stuff

Can you be more specific on what has been changed? Is it nio?

@bartoszmajsak bartoszmajsak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small suggestion to discuss.


protected Domain domain;

private File tempFile;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a very nice simplification, thanks for cleaning it up! I was wondering if we couldn't simply use TemporaryFolder rule from JUnit to have this auto-cleanup done on our behalf?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, basically we could. But with the current file leak on windows (which prevents deletion anyway) there would not be a warning like with my current approach.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate under which circumstances the leak occurs?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No special circumstances really. I traced it back to the .addPackage(...) call in the test method. Once I remove this call (which renders the test pretty useless, though) the .tearDown() method does delete the file just fine.
In the beginning I thought that the URLClassLoader needs to be closed explicitly but firstly this is a JDK7+ feature and secondly this does not change anything (tried it briefly with JDK5_HOME pointing to JDK8).

Actually I was going to file another bug ticket anyway. WDYT?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do so, but this makes me wonder what locks this file though. Do you have Linux to check if we are facing the same issue there?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tested this on CentOS7 (via VirtualBox) and the problem does not occur there!

It is interesting to see that the problem does occur on Linux when the project resides on a virtualbox shared folder (which is a Windows folder "physically") but there is no problem when the project resides entirely within the Linux VM.

public abstract class AddPackageTestBase {

/**
* Logger

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just using 3 lines for not that much value :) Let's kick it out :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Logger JavaDoc? Ok, will do. I just copied it from another class.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, but we can boy scout here - it's just a noise :)

@famod

famod commented Jul 5, 2017

Copy link
Copy Markdown
Contributor Author

Can you be more specific on what has been changed? Is it nio?

Yes, and I had to replace Collections.emptyEnumeration() in FilteringClassLoader.

- suffix must be TestCase to be picked up by surefire
- removed JDK7 stuff
- consolidated by introducing test base class
- worked around file leak (?) on windows (just warn for now)
@famod
famod force-pushed the SHRINKWRAP-515 branch from dce32e4 to 85edcee Compare July 6, 2017 08:36
@famod

famod commented Jul 6, 2017 •

Copy link
Copy Markdown
Contributor Author

@bartoszmajsak I removed the Logger JavaDoc. I suggest we take another stab at TemporaryFolder while working on https://issues.jboss.org/browse/SHRINKWRAP-517 (the file leak).
AFAICS this PR should be now mergable.

@bartoszmajsak

Copy link
Copy Markdown
Contributor

I suggest we take another stab at TemporaryFolder while working on https://issues.jboss.org/browse/SHRINKWRAP-517 (the file leak).

That makes perfect sense. Thanks for your contribution.

@bartoszmajsak
bartoszmajsak merged commit 36f8ce0 into shrinkwrap:master Jul 6, 2017
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

Successfully merging this pull request may close these issues.

2 participants