archive.merge(aux);
}
loadableExtensions.add(JMXProtocolEndpointExtension.class.getName());
// Generate the manifest with it's dependencies
archive.setManifest(new Asset() {
public InputStream openStream() {
ManifestBuilder builder = ManifestBuilder.newInstance();
StringBuffer dependencies = new StringBuffer();
dependencies.append("org.jboss.as.jmx,");
dependencies.append("org.jboss.as.server,");
dependencies.append("org.jboss.as.osgi,");
dependencies.append("org.jboss.jandex,");
dependencies.append("org.jboss.logging,");
dependencies.append("org.jboss.modules,");
dependencies.append("org.jboss.msc,");
dependencies.append("org.jboss.osgi.framework,");
dependencies.append("org.osgi.core");
builder.addManifestHeader("Dependencies", dependencies.toString());
return builder.openStream();
}
});
// Add the ServiceActivator
String serviceActivatorPath = "META-INF/services/" + ServiceActivator.class.getName();
final URL serviceActivatorURL = this.getClass().getClassLoader().getResource("arquillian-service/" + serviceActivatorPath);
if (serviceActivatorURL == null) {
throw new RuntimeException("No arquillian-service/" + serviceActivatorPath + " found by classloader: " + this.getClass().getClassLoader());
}
archive.addAsResource(new UrlAsset(serviceActivatorURL), serviceActivatorPath);
// Add META-INF/jbosgi-xservice.properties which registers the arquillian service with the OSGi layer
// Generated default imports for OSGi tests are defined in {@link AbstractOSGiApplicationArchiveProcessor}
StringBuffer props = new StringBuffer(Constants.BUNDLE_SYMBOLICNAME + ": " + archive.getName() + "\n");
props.append(Constants.EXPORT_PACKAGE + ": ");
props.append("org.jboss.arquillian.container.test.api,org.jboss.arquillian.junit,org.jboss.arquillian.osgi,org.jboss.arquillian.test.api,");
props.append("org.jboss.osgi.testing,");
props.append("org.jboss.shrinkwrap.api,org.jboss.shrinkwrap.api.asset,org.jboss.shrinkwrap.api.spec,");
props.append("org.junit,org.junit.runner,javax.inject,org.osgi.framework");
archive.add(new StringAsset(props.toString()), XSERVICE_PROPERTIES_NAME);
// Replace the loadable extensions with the collected set
archive.delete(ArchivePaths.create(loadableExtentionsPath));
archive.addAsResource(new Asset() {
@Override
public InputStream openStream() {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintWriter pw = new PrintWriter(new OutputStreamWriter(baos));
for (String line : loadableExtensions) {