return new ObjectName("test:name=" + identity.getSymbolicName() + ",version=" + identity.getVersion());
}
@Deployment(name = RESOURCE_A, managed = false, testable = false)
public static Archive<?> getResourceA() {
final ArchiveBuilder archive = new ArchiveBuilder(RESOURCE_A);
archive.addClasses(RuntimeType.TOMCAT, AnnotatedContextListener.class, WebAppContextListener.class);
archive.addClasses(RuntimeType.KARAF, BundleActivatorBridge.class);
archive.addClasses(ModuleActivatorA.class, ModuleStateA.class);
archive.setManifest(new Asset() {
@Override
public InputStream openStream() {
if (ArchiveBuilder.getTargetContainer() == RuntimeType.KARAF) {
OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance();
builder.addBundleManifestVersion(2);
builder.addBundleSymbolicName(RESOURCE_A);
builder.addBundleActivator(BundleActivatorBridge.class);
builder.addManifestHeader(Constants.MODULE_ACTIVATOR, ModuleActivatorA.class.getName());
builder.addImportPackages(Runtime.class, Resource.class, ServiceLocator.class, MBeanServer.class);
return builder.openStream();
} else {
ManifestBuilder builder = new ManifestBuilder();
builder.addIdentityCapability(RESOURCE_A, Version.emptyVersion);
builder.addManifestHeader(Constants.MODULE_ACTIVATOR, ModuleActivatorA.class.getName());
builder.addManifestHeader("Dependencies", "org.jboss.gravia");
return builder.openStream();
}
}
});
return archive.getArchive();
}