[jboss-as7-dev] Subsystem testing harness
Kabir Khan
kabir.khan at jboss.com
Mon Jul 18 13:05:58 EDT 2011
There is now a testing harness for testing subsystem parsing, that the operations work, that the model gets updated and services get installed in the service container as expected.
If your subsystem is not totally self contained, the harness provided makes it easy to
* Install services your subsystem depends on manually
* Add socket bindings, paths and system properties used by your subsystem
* Add parsers and other subsystem extensions required by your subsystem
It lives in https://github.com/jbossas/jboss-as/tree/master/subsystem-test and contains some examples/tests of the harness itself in https://github.com/jbossas/jboss-as/tree/master/subsystem-test/src/test.
To see it used in the wild, take a look at https://github.com/jbossas/jboss-as/blob/master/jmx/src/test/java/org/jboss/as/jmx/JMXSubsystemTestCase.java. As you can see here it
* checks that the model exists:
https://github.com/jbossas/jboss-as/blob/master/jmx/src/test/java/org/jboss/as/jmx/JMXSubsystemTestCase.java#L180
* actually bootstraps the controller and uses the services installed by the JMX service (the jmx connector in this case):
https://github.com/jbossas/jboss-as/blob/master/jmx/src/test/java/org/jboss/as/jmx/JMXSubsystemTestCase.java#L186
The JMX subsystem is trivial, but when writing this test I found a few minor bugs. So if you are a subsystem maintainer, I'd highly recommend using this to test your subsystem properly in isolation.
This is based on the stuff that was in the subsystem maven artifact, which now in turn will be based on jboss-as-subsystem-test instead. So, if you find some problems with it try to add to the API rather than changing it, or check with me.
More information about the jboss-as7-dev
mailing list