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 128339

Summary: NbModuleSuite - solution to all test configuration problems
Product: platform Reporter: Jaroslav Tulach <jtulach>
Component: NB JUnitAssignee: apireviews <apireviews>
Status: RESOLVED FIXED    
Severity: blocker CC: jskrivanek
Priority: P2 Keywords: API_REVIEW_FAST
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: hg export, read from the end, is there a better way to export patches?
Today's diff, I'd like to extend it with new parameter to specify regexp for additional modules to turn on

Description Jaroslav Tulach 2008-02-25 17:32:30 UTC
Hi,
I need to write a test that will startup the IDE with just platform, run some measurement, then enable more modules, 
run some more measurements, and so on, so on, until it tests the full IDE. Then it is supposed to print the 
measurements.

For that I decided to write an infrastructure that allows to invoke tests inside of NetBeans, with modules properly 
loaded by the module system. Please look at the proposed API, review, please hurry up, I'd like to use this year's 
unique opportunity and integrate on Feb 29. 

The API should be minimalistic, yet useful. However definitely they shall be extended with additional configuration 
parameters, configuration properties, etc. But that can imho be done later, this patch just outlines the basic idea.
Comment 1 Jaroslav Tulach 2008-02-25 17:34:38 UTC
Created attachment 57212 [details]
hg export, read from the end, is there a better way to export patches?
Comment 2 Jesse Glick 2008-02-25 19:18:22 UTC
Next time please provide a single patch as it is disconcerting to review a series. You can look up the common base
revision and use hg diff -r -r to do this.


Can't ProxyClassLoader use ProxyClassLoader.class in place of MainImpl.class? To reduce dependencies among classes I mean.


It is permissible for ClassLoader.getSystemClassLoader().getParent() to be null, though it will not be in the Sun JRE.
You can pass null as a parent loader. "null" means bootstrap loader. (Normally the parent of app loader will be ext
loader, whose parent will be null.) So just remove Assert.assertNotNull("Parent", parent).


BTW it is helpful to

import static junit.framework.Assert.*;


List<String> args = new ArrayList<String>();
args.add("--nosplash");
m.invoke(null, (Object)args.toArray(new String[0]));

could be simplified to

m.invoke(null, "--nosplash");


Direct (nonreflective) call to Lookup.getDefault().lookup(ClassLoader.class) looks suspicious to me. What is this
supposed to do? AFAIK it would be the same as just calling ThisClass.class.getClassLoader(), since the version of Lookup
you are calling is that loadable from NbModuleSuite, not from the tested NB instance. Maybe
Thread.currentThread().getContextClassLoader() would do the job just as well? I would like to see a test that verifies
that the testLoader can "see" not just the unit test, junit.jar, and platform*/lib/*.jar, but also real modules.


s/JunitLoader/JUnitLoader/g


isUnit could be simplified with a regular expression.


typo 'insanse'


'Unparseable' -> 'Unparsable'


'not every feature is available and every behaviour stays the same' -> 'not every feature is available and not every
behavior remains the same'


Why the change in year of CollectData?
Comment 3 Jaroslav Tulach 2008-02-26 07:18:04 UTC
Thanks for comments. I applied these:

changeset:   68121:09ec08d3df47
user:        Jaroslav Tulach <jtulach@netbeans.org>
date:        Tue Feb 26 08:06:15 2008 +0100
summary:     jglick: Can't ProxyClassLoader use ProxyClassLoader.class in place of MainImpl.class? To reduce 
dependencies among classes I mean.

changeset:   68122:d312ca0978c0
user:        Jaroslav Tulach <jtulach@netbeans.org>
date:        Tue Feb 26 08:07:46 2008 +0100
summary:     jglick: It is permissible for ClassLoader.getSystemClassLoader().getParent() to be null, though it will 
not be in the Sun JRE.

changeset:   68123:8e210c8d274f
user:        Jaroslav Tulach <jtulach@netbeans.org>
date:        Tue Feb 26 08:11:40 2008 +0100
summary:     Direct reference to Lookup is strange, why it even works?

changeset:   68124:9170f0dc3ecb
user:        Jaroslav Tulach <jtulach@netbeans.org>
date:        Tue Feb 26 08:12:20 2008 +0100
summary:     jglick: s/JunitLoader/JUnitLoader/g

changeset:   68125:0101cd8142aa
user:        Jaroslav Tulach <jtulach@netbeans.org>
date:        Tue Feb 26 08:12:48 2008 +0100
summary:     Remove imports

changeset:   68126:4964d1b0c3ce
user:        Jaroslav Tulach <jtulach@netbeans.org>
date:        Tue Feb 26 08:13:28 2008 +0100
summary:     jglick: 'Unparseable' -> 'Unparsable'

changeset:   68127:e011e6baa197
tag:         tip
user:        Jaroslav Tulach <jtulach@netbeans.org>
date:        Tue Feb 26 08:14:29 2008 +0100
summary:     jglick: Grammar changes


CollectData is modified, because I found out that I entered wrong year. I've added it during 6.1 work - e.g. in 2007.
Comment 4 Jaroslav Tulach 2008-02-29 09:33:51 UTC
Created attachment 57514 [details]
Today's diff, I'd like to extend it with new parameter to specify regexp for additional modules to turn on
Comment 5 Jiri Skrivanek 2008-02-29 13:07:53 UTC
I looked at it and haven't found any problem with it.
Comment 6 Jaroslav Tulach 2008-02-29 13:49:38 UTC
http://hg.netbeans.org/main/rev/58dc2103af57