This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 159570 - Overly general Project argument to TestSession
Summary: Overly general Project argument to TestSession
Status: NEW
Alias: None
Product: utilities
Classification: Unclassified
Component: Test Runner (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Theofanis Oikonomou
URL:
Keywords: API
Depends on:
Blocks: 158018 158019 187004
  Show dependency tree
 
Reported: 2009-03-04 00:10 UTC by Jesse Glick
Modified: 2011-11-14 18:10 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2009-03-04 00:10:57 UTC
org.netbeans.modules.gsf.testrunner.api.TestSession requires a non-null Project object. But this Project never seems to
be used. If there is no purpose to it, it should be removed.
Comment 1 Erno Mononen 2009-03-10 17:34:20 UTC
It's passed to Report and gets used at least by the Ruby test runner, though the project might not need to be passed to
it through TestSession. Need to look at this again with more time. 
Comment 2 Andrey Yamkovoy 2009-03-19 07:36:26 UTC
Now Project is used to get the FileLocator implementation from the project's lookup. I am planning to create the
FileLocator based on the project classpath in case there is nothing found in the lookup. Also it's in plans to add some
default actions to the nodes such as "Go to source", "Run Test", "Debug Test" which will use the FileLocator to get the
FileObject's for the test files.
So, now it's used a little but will be used more in the nearest future. Closing as INVALID.
Comment 3 Jesse Glick 2009-03-19 14:25:08 UTC
Please consider requesting an argument more specific than Project that reflects what you will actually need - a
FileLocator, etc. (Rather than defaulting the FileLocator based on project CP, have a factory method to create a
standard locator from a ClassPathProvider or whatever it is you use.)

I would like to be able to use this API from the Hudson integration module to display test results run on the remote
server that may not correspond to any local Project whatsoever. While I could create a fake Project object whose sole
purpose is to have a Lookup with some required interfaces in it, assuming I can even find what is required, this seems
stupid.
Comment 4 Erno Mononen 2009-03-19 14:53:37 UTC
I checked the usages in the Ruby test runner, and it seems that from its point of view the Project argument is not 
necessarily needed in TestSession. I need a Project instance in various places in the test node implementations, but I 
could easily have the project instance passed to my nodes by my TestRunnerNodeFactory implementation. (The Project 
arguments in the TestRunnerNodeFactory methods are also not neeeded by the Ruby client).
Comment 5 Jesse Glick 2011-04-29 08:14:13 UTC
Workaround: pass

new Project() {
    public @Override FileObject getProjectDirectory() {
        return FileUtil.createMemoryFileSystem().getRoot();
    }
    public @Override Lookup getLookup() {
        return Lookup.EMPTY;
    }
}