public static final class NbModuleSuite.Configuration extends Object
NbModuleSuite
. Chain the method invocations
(each method returns new instance of NbModuleSuite.Configuration
)
and call NbModuleSuite.Configuration.suite()
at the end to generate the final
JUnit test class.Modifier and Type | Method and Description |
---|---|
NbModuleSuite.Configuration |
addStartupArgument(String... arguments)
Appends one or more command line arguments which will be used to
start the application.
|
NbModuleSuite.Configuration |
addTest(Class<? extends junit.framework.Test> test)
Add new
Test to run. |
NbModuleSuite.Configuration |
addTest(Class<? extends junit.framework.TestCase> test,
String... testNames)
Adds new test class to run, together with a list of its methods
that shall be executed.
|
NbModuleSuite.Configuration |
addTest(String... testNames)
Adds new test name, or array of names into the configuration.
|
NbModuleSuite.Configuration |
clusters(String regExp)
Regular expression to match clusters that shall be enabled.
|
NbModuleSuite.Configuration |
enableClasspathModules(boolean enable)
By default all modules on classpath are enabled (so you can link
with modules that you compile against), this method allows you to
disable this feature, which is useful if the test is known to not
link against any of classpath classes.
|
NbModuleSuite.Configuration |
enableModules(String regExp)
By default only modules on classpath of the test are enabled,
the rest are just autoloads.
|
NbModuleSuite.Configuration |
enableModules(String clusterRegExp,
String moduleRegExp)
By default only modules on classpath of the test are enabled,
the rest are just autoloads.
|
NbModuleSuite.Configuration |
failOnException(Level level)
Fails if there is an exception reported to
Logger with appropriate
level or higher during the test run execution. |
NbModuleSuite.Configuration |
failOnMessage(Level level)
Fails if there is a message sent to
Logger with appropriate
level or higher during the test run execution. |
NbModuleSuite.Configuration |
gui(boolean gui)
Should the system run with GUI or without? The default behaviour
does not prevent any module to show UI.
|
NbModuleSuite.Configuration |
hideExtraModules(boolean hide)
Allows to limit what modules get enabled in the system.
|
NbModuleSuite.Configuration |
honorAutoloadEager(boolean honor)
By default the
NbModuleSuite.Configuration.enableModules(java.lang.String) method
converts all autoloads into regular modules and enables them. |
NbModuleSuite.Configuration |
parentClassLoader(ClassLoader parentCL)
Sets the parent ClassLoader on which the NB platform should start.
|
NbModuleSuite.Configuration |
reuseUserDir(boolean reuse)
Enables or disables userdir reuse.
|
junit.framework.Test |
suite()
Creates a test suite from this configuration.
|
public NbModuleSuite.Configuration clusters(String regExp)
".*"
. To enable
ide and java clusters, it is handy to pass in "ide|java"
.
There is no need to request presence of platform
cluster,
as that is available all the time by default.
Since version 1.55 this method can be called multiple times.
regExp
- regular expression to match cluster namespublic NbModuleSuite.Configuration enableModules(String regExp)
".*"
. Since 1.55 this method
is cummulative.regExp
- regular expression to match code name base of modulespublic NbModuleSuite.Configuration enableModules(String clusterRegExp, String moduleRegExp)
".*"
as list of
modules. This method is cumulative.clusterRegExp
- regular expression to match clustersmoduleRegExp
- regular expression to match code name base of modulespublic NbModuleSuite.Configuration addStartupArgument(String... arguments)
test.run.args
property (e.g.
in the module's project.properties
file).arguments
- command line arguments to append; each value
specified here will be passed a separate argument when starting
the application under test.public NbModuleSuite.Configuration addTest(String... testNames)
testXYZ
methods present in the test class
(the one passed into NbModuleSuite.createConfiguration(java.lang.Class)
method). However if there is a need to execute just some of them,
one can use this method to explicitly enumerate them by subsequent
calls to addTest
method.testNames
- list names to add to the test executionpublic NbModuleSuite.Configuration addTest(Class<? extends junit.framework.TestCase> test, String... testNames)
testXYZ
methods present in the test class.test
- the class to also execute in this suitetestNames
- list names to add to the test executionpublic NbModuleSuite.Configuration addTest(Class<? extends junit.framework.Test> test)
Test
to run. The implementation must
have no parameter constructor. TastCase can be also passed as an argument
of this method than it's delegated to
NbModuleSuite.Configuration.addTest(java.lang.Class, java.lang.String[])
test
- Test implementation to addpublic NbModuleSuite.Configuration enableClasspathModules(boolean enable)
enable
- pass false to ignore modules on classpathpublic NbModuleSuite.Configuration honorAutoloadEager(boolean honor)
NbModuleSuite.Configuration.enableModules(java.lang.String)
method
converts all autoloads into regular modules and enables them. This
is maybe useful in certain situations, but does not really mimic the
real behaviour of the system when it is executed. Those who need
to as closely as possible simulate the real run, can use
honorAutoloadEager(true)
.honor
- true in case autoloads shall remain autoloads and eager modules eagerpublic NbModuleSuite.Configuration hideExtraModules(boolean hide)
NbModuleSuite
was to enable
as much of modules as possible. This was believed to
resemble the real situation in the running application the best.
However it turned out there
are situations when too much modules can break the system
and it is necessary to prevent loading some of them.
This method can achieve that.
The primary usage is for Ant based harness. It usually
contains full installation of various clusters and the application
picks just certain modules from that configuration.
hideExtraModules(true)
allows exclusion of these
modules as well.
The usefulness of this method in Maven based environment
is not that big. Usually the nbm plugin makes only necessary
JARs available. In combination with enableClasspathModules(false)
, it may give you a subset of
the Platform loaded in a test. In a
Maven-based app declaring a dependency on the whole
org.netbeans.cluster:platform use the following suite expression:
NbModuleSuite.createConfiguration(ApplicationTest.class). gui(true). hideExtraModules(true). enableModules("(?!org.netbeans.modules.autoupdate|org.netbeans.modules.core.kit|org.netbeans.modules.favorites).*"). enableClasspathModules(false). suite();
hide
- true if all enabled not explicitly requested modules should
be hiddenpublic NbModuleSuite.Configuration failOnMessage(Level level)
Logger
with appropriate
level or higher during the test run execution.level
- the minimal level of the messagepublic NbModuleSuite.Configuration failOnException(Level level)
Logger
with appropriate
level or higher during the test run execution.level
- the minimal level of the messagepublic NbModuleSuite.Configuration gui(boolean gui)
false
is
used, then the whole system is instructed with --nogui
option that it shall run as much as possible in invisible mode. As
a result, the main window is not shown after the start, for example.gui
- true or falsepublic NbModuleSuite.Configuration reuseUserDir(boolean reuse)
reuse
- true or falsepublic NbModuleSuite.Configuration parentClassLoader(ClassLoader parentCL)
parentCL
- the parent ClassLoaderpublic junit.framework.Test suite()
NbModuleSuite.create(org.netbeans.junit.NbModuleSuite.Configuration)
but more fluid.public static Test suite()
method