Raymond Feng wrote:
I have prototyped a maven plugin that can run junit test cases with the
Equinox OSGi runtime. It works as follows:
1) Generate a bundle for the current project with the target/classes
2) Generate a bundle fragment that attaches to the bundle from step 1
3) Find all the maven dependencies and use them as the set of initial
bundles (the plain jars are converted into a bundle on the fly too)
4) Bootstrap the Equinox runtime
5) Find all test cases and run them with the JUNIT runner
6) Report the results of the test case
To configure a maven project, use the following XML in the pom.xml (See
an example at [2]):
<plugin>
<groupId>org.apache.tuscany.sca</groupId>
<artifactId>tuscany-maven-osgi-junit</artifactId>
<version>2.0-SNAPSHOT</version>
<executions>
<execution>
<id>osgi-test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
<configuration></configuration>
</executions>
</plugin>
The ideal approach is to plug in the same logic into the existing
maven-surefire-plugin. But it doesn't seem that the surefire plugin has
such plug points.
Please let me know if you have better ideas.
Thanks,
Raymond
[1]
https://svn.apache.org/repos/asf/tuscany/java/sca/tools/maven/maven-osgi-junit
[2]
https://svn.apache.org/repos/asf/tuscany/java/sca/samples/calculator-osgi/pom.xml
+1. This would be quite useful in 2.0.
--
Thanks, Dan Becker