I have created an OSGi example project and want to improve the provisioning of the bundles needed for the integration test.
Right now the bundles are statically references by file name, utilizing CoreOptions.bundle("reference:file:" + <path>)
, the problem thereby is that the test will fail at some time in the future, when the name of the jars changes (due to version change for example).
Is there a better way to deploy the needed dependencies? Maybe with the use of a symbolic name, or group/artifact id?
@RunWith(PaxExam.class)
public class ServiceTestCase {
@Inject
private Service service;
@Configuration
public Option[] config() {
return CoreOptions.options(
/* needed for ds annotations */
CoreOptions.mavenBundle("org.apache.felix", "org.apache.felix.scr", "1.8.2"),
CoreOptions.bundle("reference:file:../service/target/service-0.0.1-SNAPSHOT.jar"),
CoreOptions.bundle("reference:file:../service.impl/target/service.impl-0.0.1-SNAPSHOT.jar"),
CoreOptions.junitBundles());
}
@Test
public void testInjections() {
Assert.assertNotNull(service);
}
}
shortened version of ServiceTestCase.java