DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
Using the OSGi TCK
The OSGi Alliance now provides access to Apache committers to its TCK binaries. This page describes how to use run Felix subprojects against the TCK.
OSGi TCK Overview
The TCK is delivered as two JAR files, one for the core TCK and one for the compendium TCK. Each JAR file is comprised of several other JAR files, which are the actual compliance tests. Typically, there is one JAR per specification, except for the OSGi framework.
The TCK uses BND as its testing harness, which in turn uses the OSGi R4.2 framework launching and embedding API to configure, launch, and install test bundles. Each test JAR file has an associated BND file which supplies the configuration BND needs to run the associated tests.
Modifying the BND files
Modifying the BND files is fairly straightforward, if not tedious. A typical BND file looks like this:
# bnd pack for project org.osgi.test.cases.startlevel
# Mon Aug 31 18:50:18 EDT 2009
build=.
-target = \
jar/org.osgi.test.cases.startlevel-4.2.0.jar;version=file,
-runpath = \
jar/org.eclipse.osgi-3.5.1.jar;version=file, \
jar/com.springsource.junit-3.8.2.jar;version=file;export="junit.framework;version=3.8"
-runbundles
-runproperties = \
report="true", \
osgi.compatibility.bootdelegation="false", \
osgi.resolverMode="strict"
The important parts are the following settings:
-targetspecifies the bundles containing the tests.-runpathspecifies the class path used to run the tests.-runbundlesspecifies the bundles to install for the tests.-runpropertiesspecifies configuration properties to pass into the framework.
The following two examples show how to edit these files for the Felix framework and other subprojects.
Testing the Felix framework
The Felix framework is tested against the core TCK. The first thing to do is extract the core TCK JAR file, which includes test suites for:
- Framework core (mandatory)
- Framework security (optional)
- Framework launching (mandatory)
- Framework launching security (optional)
- Package Admin (optional)
- Start Level (optional)
- URL Handlers (optional)
- Permission Admin (optional)
- Conditional Permission Admin (optional)
For each of the associated BND files, the -runpath needs to be edited to refer to the Felix framework; each one should look something like this after editing:
-runpath = \
/path/to/felix/framework/org.apache.felix.framework-2.0.2.jar;version=file, \
jar/com.springsource.junit-3.8.2.jar;version=file;export="junit.framework;version=3.8"
It is not necessary to change anything else in the BND and it is normal that the -runbundles setting is empty, since there are no additional bundles associated with testing the framework. After editing the BND files, run the tests using:
source runtests
This will run all test suites for all BND files. To run a specific test suite, do the following:
java -jar jar/bnd.jar runtests -title osgi.ct <bnd-file>
Since the Felix framework does not fully implement the security-related portions of the OSGi specification, it is normal for it to fail the security-related test suites.
The important parts are the following settings:
-targetspecifies the bundles containing the tests.-runpathspecifies the class path used to run the framework for the tests.-runbundlesspecifies the bundles being tested.-runpropertiesspecifies configuration properties to pass into the framework.
The following two examples show how to edit these files for the Felix framework and other subprojects.
Testing the Felix framework
The Felix framework is tested against the core TCK, which includes test suites for:
- Framework core (mandatory)
- Framework security (optional)
- Framework launching (mandatory)
- Framework launching security (optional)
- Package Admin (optional)
- Start Level (optional)
- URL Handlers (optional)
- Permission Admin (optional)
- Conditional Permission Admin (optional)
For each of the associated BND files, the -runpath needs to be edited to refer to the Felix framework; each one should look something like this after editing:
-runpath = \
/path/to/felix/framework/org.apache.felix.framework-2.0.2.jar;version=file, \
jar/com.springsource.junit-3.8.2.jar;version=file;export="junit.framework;version=3.8"
It is not necessary to change anything else in the BND and it is normal that the -runbundles setting is empty, since there are no additional bundles associated with testing the framework. After editing the BND files, run the tests using:
source runtests
This will run all test suites for all BND files. To run a specific test suite, do the following:
java -jar jar/bnd.jar runtests -title osgi.ct <bnd-file>
Where <bnd-file> specifies one or more BND files for the associates test suites to run.
Be Aware
Since the Felix framework does not fully implement the security-related portions of the OSGi specification, it is normal for it to fail the security-related test suites.
Reports for the tests suites are generated in the reports/ subdirectory and are named after the appropriate test suite.
Testing a Felix bundle
The core TCK tests the framework implementation and its related services. The compendium TCK tests the various non-framework-related specifications, which are implemented as bundles. For the most part, testing a bundle is similar to testing the framework.
Extract the compendium TCK JAR file to access the individual test suites. Since most compendium service specification test suites require security, it is necessary to use another framework implementation to run these tests, such as Equinox. Since the BND files already mention Equinox on their -runpath setting, it is not necessary to edit them to use it, although it is necessary to supply an Equinox JAR file and drop it into the jar/ subdirectory.
To test a bundle, the -runbundles setting must be modified to refer to the bundle or bundles being tested. For example, to test Felix' Event Admin implementation, edit the -runbundles setting in org.osgi.test.cases.event.bnd to look something like this:
-runbundles = \
/path/to/felix/eventadmin/org.apache.felix.eventadmin-1.0.0.jar;version=file, \
jar/org.osgi.impl.service.log-1.3.2.jar;version=file
It is not necessary to change anything else in the BND and it is normal that the -runbundles setting is empty, since there are no additional bundles associated with testing the framework. After editing the BND files, run the tests using:
source runtests
This will run all test suites for all BND files. To run a specific test suite, do the following:
java -jar jar/bnd.jar runtests -title osgi.ct <bnd-file>
Where <bnd-file> specifies one or more BND files for the associates test suites to run.
Be Aware
Since the Felix framework does not fully implement the security-related portions of the OSGi specification, it is normal for it to fail the security-related test suites.
Reports for the tests suites are generated in the reports/ subdirectory and are named after the appropriate test suite.