other bookmarks
BundleBuilding-Utils is a project that provides an API for building OSGi bundles (OSGi-compliant JAR files) with few lines of code. BundleBuilding-Utils is the first project in the OSGi space that provides such an API and is usable in both OSGi and non-osgi environments.The project can be in handy when testing bundles that process other bundles since it allows you to create many bundles with slight differences in order to test the behavior of your main bundle under different circumstances.
Take for example Dynamic-JPA, Dynamic-JPA processes the persistence.xml file contained in bundles and generates from it an Entity Manager Factory, to validate that it works with Toplink, OpenJPA, Hibernate and EclipseLink we create test bundles which contain persistence.xml that use each of the JPA implementations above, using traditional tools we will have to create 4 Maven projects (one for each of the mentioned JPA providers) + a bundle which contains the entities + a bundle which contains client code (6 bundles in sum). Creating a single project for each of them, generating JARs then installing them to the OSGi Environment is surely not an easy thing, and to make things worse, lets say that we want to test the behavior of Dynamic-JPA when the bundles which contain the persistence.xml file don’t import entity classes, don’t import JPA implementation classes or has the entities in the same bundle instead of importing it. Obviously, creating a Maven project for each test case is very inefficient? Observing different projects (including projects at DynamicJava.org), I noticed that such tests are ignored, I think that mostly due the time/resources consuming process of maintaining separate projects for each test case. But lets see how we can install two bundles, one which contains persistence.xml file and imports the needed entities, the other contains persistence.xml file but don’t import the entities using BundleBuilding-Utils.

Leave a reply