...
Please report issues in the PaxTinyBundles Jira project.
Create Bundles
To get full benefit of the fluent api, you should include
...
We found this quite useful when for example testing extender-bundles like PaxWeb or SpringDM.
As you see, resources are pulled from "current classpath" which means that you can easily construct stuff like you do in ordinary java apps and pull them together using a fluent api like the above.
It is also trivial to create thounsands of (different) bundles to test high load for example.
Create Bundles using bnd builder
The bnd builder allows to automatically generate the imports of a bundle. Since version 3.0.0 it also automatically processes declarative services annotations. So your bundles can easily consume and offer OSGi services without manually writing an Activator.
There is a small caveat though when using the bnd builder in pax exam you can easily get a ClassNotFoundException with the BuilderStrategy interface. To avoid this put the code that generates the bundle into a separate class and make the method static.
Code Block | ||||
---|---|---|---|---|
| ||||
bundle( ).add(DsService.class).build( withBnd() ) |
Code Block | ||||
---|---|---|---|---|
| ||||
@Component(immediate=true)
public class DsService
{
@Activate
public void activate() {
System.out.println("Activated");
}
} |
Create Fragments
Basically same as Bundles with just the "Bundle-Host" Header added in "set" section.