-
Notifications
You must be signed in to change notification settings - Fork 78
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
7903300: Add test library support to jtreg plugin #117
Conversation
👋 Welcome back gli! A progress list of the required criteria for merging this PR into |
Webrevs
|
testInfo.jtregLib = library; | ||
rootModel.addLibrary(library); | ||
} else if (testInfo.jtregLib != null) { | ||
rootModel.removeLibrary(testInfo.jtregLib); |
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'm not sure this is logically correct. While I can understand adding jtreg/testng library to the model as soon as a new test file requiring it is opened, removing the library seems more problematic. In principle we should remove the testng/junit library from the model only if there's no open test that's a jtreg test. Which doesn't seem to be what's happening in the code.
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.
The TestRootManager#addLibrary
will record the reference count in the field TestRootManager.moduleLibRefCount
. And the TestRootManager#removeLibrary
only actually removes the lib from the module when the count becomes 1.
Note that there is a workaround for the problem mentioned in this PR (not that I think it wouldn't be nice to fix). The IDE will typically suggest to add relevant test libraries when clicking on the light-bulb fix icon beside a TestNG/JUnit import. |
Yes, I fixed the problem locally by using this way. But I think it is good to let the plugin fix it automatically, so I write this patch. |
/** | ||
* Create (if not existing) and get the jtreg project library. | ||
*/ | ||
public static Library createJTRegLibrary(Project project, String oldDir, String newDir) { |
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.
Wouldn't it be better to split this into a function that creates the library, and one that updates it? I find it odd that the file listener is calling this with oldDir == newDir. Maybe just add option for oldDir to be null, so that we only drop the old root if one is given?
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 adjusted the api, added update
method and delegated the create
method to it. And I also fixed the possible NPE and avoided the duplicated lib entries.
Also, when updating the plugin, it is better to update the |
I bumped the version and revised the notes. I think the plugin should be released periodically (may be several months). But now it seems you want to release a new version one patch. I don't know the current release flow so I follow your command. |
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.
Looks good
@mcimadamore Thanks for the review. Still waiting for a formal reviewer to review it. |
@lgxbslgx This pull request has been inactive for more than 4 weeks and will be automatically closed if another 4 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration! |
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.
Endorsing @mcimadamore's review
@lgxbslgx This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 53 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@mcimadamore, @jonathan-gibbons) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
Thanks for the review. Could I get your help to sponsor this patch? /integrate |
/sponsor |
Going to push as commit a396e2f.
Your commit was automatically rebased without conflicts. |
Hi all,
Currently, when we open a jtreg test file which uses the JUnit or TestNG, the plugin can't identify the related classes of the JUnit or TestNG. So the statement such as
import org.junit.Test
is marked as red with error messageCannot resolve symbol 'junit'
.This patch adds the jtreg libraries directory to the lib path of the
Jetbrains IDEA
when opening the JUnit or TestNG test files so that theJetbrains IDEA
can identify the related classes.Thanks for taking the time to review.
Best Regards,
-- Guoxiong
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jtreg.git pull/117/head:pull/117
$ git checkout pull/117
Update a local copy of the PR:
$ git checkout pull/117
$ git pull https://git.openjdk.org/jtreg.git pull/117/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 117
View PR using the GUI difftool:
$ git pr show -t 117
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jtreg/pull/117.diff
Webrev
Link to Webrev Comment