ExamAndTinybundles
ExamAndTinybundles
Using Pax Exam together with Tinybundles
This page introduces the use of Tinybundles inside Pax Exam.
All use cases are valid since Pax Exam 1.2.
What is Tinybundles
It is a small library that basically draws nice, domain specific, api arround raw JarInput/Output streams.
- Tinybundles allows you to create and modify OSGi bundles from within Java API.
- Tinybundles leverages tooling like BND, Pax URL and Pax Scanner.
- Tinybundles allows you to create and modify OSGi DeploymentPackages within Java API.
- And since Pax Exam 1.2 Tinybundles plays great with Pax Exam, too!
To learn more about Tinybundles itself, go here.
How does it fit into Pax Exam context
- Pax Exam lets you modify the test probe after it has been built (right before the tests gets installed) using Customizers like so
@Configuration public static Option[] configure() { return options( new Customizer() { @Override public InputStream customizeTestProbe( InputStream testProbe ) { return .. } } ); }
Actually, its pretty tedious to deal with InputStreams directly.
So, Tinybundles lets you transform this stream into a TinyBundle Object, provides api to deal with it and finally build the (changed/new) bundle:
new Customizer() { @Override public InputStream customizeTestProbe( InputStream testProbe ) throws IOException { // change test probe on the fly. // you can do everything: // - remove classes // - add stuff // - change manifest return modifyBundle( testProbe ) .set( Constants.BUNDLE_SYMBOLICNAME, "My-very-own-probe" ) .build(); } }
Use Cases
, multiple selections available,