void registerArquillianServiceWithOSGi(BundleManagerService bundleManager) {
ModuleClassLoader classLoader = ((ModuleClassLoader) ArquillianService.class.getClassLoader());
Module module = classLoader.getModule();
if (bundleManager.getBundle(module.getIdentifier()) == null) {
OSGiMetaDataBuilder builder = OSGiMetaDataBuilder.createBuilder("arquillian-service");
builder.addExportPackages("org.jboss.arquillian.container.test.api", "org.jboss.arquillian.junit");
builder.addExportPackages("org.jboss.arquillian.osgi", "org.jboss.arquillian.test.api");
builder.addExportPackages("org.jboss.shrinkwrap.api", "org.jboss.shrinkwrap.api.asset", "org.jboss.shrinkwrap.api.spec");
builder.addExportPackages("org.junit", "org.junit.runner");
try {
log.infof("Register arquillian service with OSGi layer");
bundleManager.registerModule(serviceTarget, module, builder.getOSGiMetaData());
} catch (BundleException ex) {
log.errorf(ex, "Cannot register arquillian service with OSGi layer");
}
}
}