public class ConfigurationAdminTest {
@Deployment
@StartLevelAware(autostart = true)
public static Archive<?> deployment() {
final ArchiveBuilder archive = new ArchiveBuilder("configadmin-test");
archive.addClasses(ConfigurationAdminTest.class);
archive.addClasses(RuntimeType.TOMCAT, AnnotatedContextListener.class);
archive.addClasses(ServiceD.class, ServiceD1.class);
archive.addAsResource("OSGI-INF/org.jboss.test.gravia.itests.sub.d.ServiceD.xml");
archive.addAsResource("OSGI-INF/org.jboss.test.gravia.itests.sub.d1.ServiceD1.xml");
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, ComponentContext.class, ConfigurationAdmin.class, Resource.class);
builder.addManifestHeader("Service-Component", "OSGI-INF/org.jboss.test.gravia.itests.sub.d.ServiceD.xml,OSGI-INF/org.jboss.test.gravia.itests.sub.d1.ServiceD1.xml");
return builder.openStream();
} else {
ManifestBuilder builder = new ManifestBuilder();
builder.addIdentityCapability(archive.getName(), "1.0.0");
builder.addManifestHeader("Service-Component", "OSGI-INF/org.jboss.test.gravia.itests.sub.d.ServiceD.xml,OSGI-INF/org.jboss.test.gravia.itests.sub.d1.ServiceD1.xml");
return builder.openStream();
}
}
});
return archive.getArchive();
}