Skip to content

Launching Framework

bnd edited this page Sep 14, 2010 · 12 revisions

The bnd Build aspect is capable of starting another VM to run a project (launching) and to run tests in it (testing). The testing is based on the launching. As always, these facilities must work in ant, Eclipse, and other tools. As the requirements are diverse and numerous, bnd uses an extension mechanisms to allow different needs to be handled by different bundles. It also includes a default launcher and tester that have the following features:

  • ee.minimum based. This means they run on minimal VMs.
  • Uses JUnit 3 to also support minimal VMs
  • Can launch without starting a framework. This is sometimes necessary to test launching and distributed code.
  • Tester runs outside the framework, thereby not disturbing test code with extraneous bundles

However, both the launcher and tester are completely replaceable.

This is implemented in master now. Project now has getProjectTester and getProjectLauncher. By default they return the handlers for biz.aQute.launcher and biz.aQute.junit. These can be used as examples. You can add your own jars on the -runpath (for the launcher) and -testpath (for the tester). If such a JAR has a manifest header specifying the Tester-Plugin or Launcher-Plugin then an instance of the given class is made. This instance should extend ProjectLauncher or ProjectTester. This instance can then setup the classpath, vm args, etc.

Simplest config is:

-runpath: org.apache.felix.main

The ProjectLauncher and ProjectTester base classes specify an API to control the launching. They can be used by Eclipse (e.g.) to get the VM args, classpath, etc. to obtain the settings needed in the Eclipse launcher architecture. However, the launcher and tester can work independently from this, the launcher implements a launch method and the tester implements a test method that will launch a new VM properly setup.

Clone this wiki locally