JBoss OSGi comes with a number of examples that demonstrate supported functionality and show best practices. All examples are part of the binary distribution and tightly integrated in our Maven Build Process .
The examples can be either run against an embedded OSGi framework or against the AS7 Runtime. Here is how you build and run the against the embedded framework.
[tdiesler@tddell example]$ mvn test ------------------------------------------------------- T E S T S ------------------------------------------------------- Running org.jboss.test.osgi.example.webapp.WebAppInterceptorTestCase Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 14.417 sec ... Tests run: 23, Failures: 0, Errors: 0, Skipped: 0 [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 37.507s [INFO] Finished at: Wed Mar 07 09:15:50 CET 2012 [INFO] Final Memory: 13M/154M [INFO] ------------------------------------------------------------------------
To run the examples against AS7, you need to provide the target container that the runtime should connect to. This can be done with the target.container system property.
mvn -Dtarget.container=jboss710 test