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

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

Merged
merged 1 commit into from
Jul 6, 2017

Conversation

famod
Copy link
Contributor

@famod famod commented Jul 5, 2017

  • 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
Contributor

Thanks for your contribution!

removed JDK7 stuff

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

Copy link
Contributor

@bartoszmajsak bartoszmajsak left a comment

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
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
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
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
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
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
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
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
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
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
Copy link
Contributor Author

famod commented Jul 5, 2017

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
Copy link
Contributor Author

famod commented Jul 6, 2017

@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
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.

None yet

2 participants