After the twitter post from Neil, I think about such a portal and here are my first ideas about such a information portal. I think first we need a small command line tool which implements a set of static and dynamic tests for OSGi bundles. Nice would be a set of plugins which integrate the tool into your build tool (e.g. maven, ant) or favorite IDE.
What kind of static tests should this bundle test tool support?
- Check if the to test JAR (bundle) have a valid MANIFEST e.g. to check via Peter Kriens BND lib.
- Check some MANIFEST pattern e.g. do the bundle import the exported packages, which is a OSGi best practice.
- Do the bundle describe e.g. via extra configuration where to get the runtime dependencies e.g. via maven pom.xml? Provide this dependencies (JARs) all of the imported packages.
- Use the bundle a framework for declarative services? E.g. do the bundle use DS, Blue Print, iPOJO, Pearbeary...
- Which OSGi services does the bundle use e.g. configuration service, logging service etc.
What kind of dynamic test should the test tool provided?
- Check if the bundle can be deployed in an OSGi container (equinox, felix,… therefore the pax runner can be used for implementation). The bundle should ship a reference set of runtime dependencies or provided a configuration file which describes where to get these dependencies e.g. via maven or ivy. The order in which the runtime dependencies will be started can be determined via a static test on each bundle (for implementation the BND lib can be used, or pax runner do this already?). In addition to the runtime dependencies it should be a possibility that a bundle can describe a set of system properties.
- Test that the exported packages can be used from a bundle. There for a test bundle can be generated which use the exported package resources of the bundle under test.
- Check that if a started OSGi bundle provides OSGi services.
- When a bundle use a framework for declarative services e.g. DS, verify that the decelerated services are up and running in the service registry.
- Check that a bundle restart works. Service is down and will be started again etc.
When we have such a tool to automatically verify the quality of an OSGi bundle and get a set of information about the bundle. A central information portal/repository would be very nice where you can submit your bundles and the checks will be run on your bundle and published. Where you can search for bundles and you get information where to download the bundle and a set of information of the quality of the bundle. I think such an information repository about OSGi bundles and there quality should be hosted under www.osgi.org.
Here some ideas how to submit a bundle into such an information repository/portal? I think the portal should provide a REST service and web form to submit bundles to check and to add to the repository. The runtime dependencies can submit as ZIP or as maven pom.xml or ivy configuration. For the REST service plugins for build tools and IDEs would be nice. E.g. a plugin for maven which will be bind to the deploy phase of maven, could automatically deploy the bundle to check also to the bundle information repository.
Is anyone interested to build the testing tool with me as an open source project? Or is there a cool tool out there which can do such tests? Please contact me or write a comment to the post?
- OSGi Compliance Levels - Neil Bartlett