|
Page Created :
FELIX :
BND Testing Harness
BND Testing Harness has been created by Richard S. Hall (Feb 12, 2009). Content:BND Testing HarnessThe latest versions of BND This document describes an example BND project used to test Felix' Framework and Logger subprojects. This document is not intended as a BND tutorial, since it is beyond my capabilities to describe how BND works. The goal is to document my hacked up example sufficiently so that other people can try it out for themselves. The original build files and configuration for this example are based on an example from Peter Kriens. BND also has an Eclipse plugin which makes it easy to run the test cases, but I have not experimented with that; this document works solely with the command line. With that in mind, let's get started. PrerequisitesThis document assumes you have Ant|http://ant.apache.org, Maven|http://maven.apache.org, and Subversion installed. If you don't, please do this first. Getting StartedThe first thing you need to do is check out the example with the following command: svn co http://svn.apache.org/repos/asf/felix/sandbox/rickhall/bnd-test
We will discuss the organization of each of these. {{cnf}The default Ant build file cnf/build.xml is sufficiently generic and I didn't need to modify it, although it could probably be further cleaned up. The cnf/build.bnd sets up a lot of properties for BND, most of which I didn't touch. The main thing I modified in here was changing the -runpath to use the 1.5.0 version of Felix' Framework and configured BND's Maven plugin to use "org.apache.felix" as its groupId. org.apache.felix.framework.testThis example is somewhat special since it tests the framework itself instead of a bundle, but even then it works basically the same as testing a bundle except that the framework is built separately. The project's build.xml file just includes the generic one from cnf, while the bnd.bnd file contains of the BND commands to create the resulting test bundle. We also use this file to specify the build path for the project and to indicate which classes are the test cases. The source for the project is contained in the src/ directory, but this is only source for the test cases. The recipes/ directory contains additional .bnd files, which describe other bundles that get created and embedded into the resulting project bundle. If you look at the Include-Resource line in bnd.bnd, you can see that it instructs BND to include JAR files with names corresponding to the .bnd files in the recipes/ directory. This is a cool feature, since it allows you to have a bunch of test code in the same project and generate any number of bundles from it, but these bundles don't actually exist in the file system or have to be managed. org.apache.felix.logThis example tests the Felix Log Service bundle and actually demonstrates how you can include your tests cases within your project. The project's build.xml file just includes the generic one from cnf, while the bnd.bnd file contains the BND commands to create the resulting log service bundle. As before, we also specify the build path and the test cases for the project. The source for the project is contained in the src/ directory, which contains both the source for the Log Service and the test cases. |
Unsubscribe or edit your notifications preferences
