This may be an obvious question, but nevertheless. In recently working with the AbstractConfigurableBundleCreatorTests, I have been a bit confused on the intent. A test bundle is generated with a manifest that imports required bundles from the bootstrapped OSGi context. This allows the exported packages of the imported bundles to be validated in the test class. Clear so far.
The question is, what if I have a bean in the project containing the integration test that injects an osgi:reference exported by one of the imported bundles? Is it possible to integration test this bean without breaking it out into a separate bundle? For example, take the following simple case where com.myorg.consumer.ExampleService is exported by an imported bundle:
<property name="exampleService" ref="exampleService" />
In the integration test (ServiceTest) in the same project I can do:
But I cannot:
ServiceReference serviceRef = bundleContext
ExampleService service =
It seems that the test bundle generation logic allows only one root.dir to apply include patterns to. The default uses /target/test-classes meaning all classes in /target/classes are ignored. If the applicationContext for the integration test includes any beans contained in the same project (in src/main/java) this fails with a ClassNotFoundException as these classes are not included in the test bundle.
ExampleConsumer consumer = (ExampleConsumer)
Is the assumption that a project will always have a multi-module build where all modules under test are generated prior to executing the integration test? This would make sense given the current base functionality, but I was curious if this was the intent.
Thanks for your help and please let me know if any clarification on the points above is required.