public class DeploymentAgentTest {
@Deployment
@StartLevelAware(autostart = true)
public static Archive<?> deployment() {
final ArchiveBuilder archive = new ArchiveBuilder("deployment-agent-test");
archive.addClasses(RuntimeType.TOMCAT, AnnotatedContextListener.class);
archive.addPackage(CommandSupport.class.getPackage());
archive.setManifest(new Asset() {
@Override
public InputStream openStream() {
if (ArchiveBuilder.getTargetContainer() == RuntimeType.KARAF) {
OSGiManifestBuilder builder = OSGiManifestBuilder.newInstance();
builder.addBundleManifestVersion(2);
builder.addBundleSymbolicName(archive.getName());
builder.addBundleVersion("1.0.0");
builder.addManifestHeader(Constants.GRAVIA_ENABLED, Boolean.TRUE.toString());
builder.addImportPackages(RuntimeLocator.class, FabricService.class);
builder.addImportPackages(AbstractCommand.class, Action.class);
builder.addImportPackage("org.apache.felix.service.command;status=provisional");
builder.addImportPackages(ConfigurationAdmin.class, Logger.class);
return builder.openStream();
} else {
ManifestBuilder builder = new ManifestBuilder();
builder.addIdentityCapability(archive.getName(), "1.0.0");
builder.addManifestHeader("Dependencies", "io.fabric8.api,org.apache.karaf,org.jboss.gravia");
return builder.openStream();
}
}
});
return archive.getArchive();
}