With Pax Exam 2.x, you can write tests which launch an OSGi container,
automatically install a test probe bundle, inject container dependencies
into the test and invoke test methods within the container.
Now why should the container be limited to an OSGi framework and the
probe be limited to a bundle?
The same approach works for Java EE: the container is an (embedded) Java
EE server, the probe is a WAR built on the fly, and the injection method
is CDI.
There is a growing number of Java EE servers which are built on OSGi
and/or offer an OSGi subsystem for deploying bundles in addition to
traditional WARs.
Thus, an in-container testing framework should support both modes, OSGi
and Java EE, to let you test hybrid applications.
As it happens, I created the jeeunit project [1] in 2010 for testing my
Java EE 6 projects - long before I started working with Pax Exam.
The more I work with these two projects, the more I feel they are really
two sides of the same coin.
jeeunit supports GlassFish 3.1, JBoss AS 7 and Resin 4. Recently, its
scope has broadened to cover other containers and injection methods in
the guise of Tomcat 6 and 7 and Spring. There is no OSGi support.
Pax Exam on the other hand supports practically all OSGi frameworks, but
no Java EE or servlet containers.
Now I'm proposing to merge jeeunit into Pax Exam to provide adequate
testing capabilities for containers that support hybrid OSGi plus Java
EE applications and to offer a unified testing approach for users who
switch between OSGi, Java EE and Spring.
Working with a pure OSGi or a pure Java EE container, the resulting Pax
Exam 3.0 would be equivalent to either Pax Exam 2.x or jeeunit, but on a
hybrid container, Pax Exam 3.x would let you deploy and test WARs and
bundles at the same time.
This should be doable by introducing a bunch of new options like war(),
mavenWar() and a number of new pax-exam-container-foo modules.
As a proof of concept, I've started working on a GlassFish Container,
guided by Sahoo's usage of Pax Exam 2.1 for testing OSGi bundles and
WABs on GlassFish [2].
I'm looking forward to your comments on this idea.
[1] http://code.google.com/p/jeeunit/
[2]
http://www.java.net/forum/topic/glassfish/glassfish/using-glassfish-pax-exam
Best regards,
Harald
_______________________________________________
general mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/general