use of org.wildfly.swarm.bootstrap.env.WildFlySwarmManifest in project wildfly-swarm by wildfly-swarm.
the class DependencyManagerTest method testWithApplicationAlsoUsingDep.
@Test
public void testWithApplicationAlsoUsingDep() throws Exception {
// :jaxrs and common dep are explicit, implying application needs common
DeclaredDependencies declaredDependencies = new DeclaredDependencies();
declaredDependencies.add(JAXRS_FRACTION, JAXRS_SPEC);
declaredDependencies.add(JAXRS_FRACTION, COMMON_DEP);
declaredDependencies.add(JAXRS_FRACTION, UNDERTOW_FRACTION);
declaredDependencies.add(JAXRS_FRACTION, SERVLET_SPEC);
declaredDependencies.add(COMMON_DEP);
manager.analyzeDependencies(false, declaredDependencies);
assertThat(manager.getRemovableDependencies()).containsOnly(JAXRS_FRACTION, JAXRS_SPEC, UNDERTOW_FRACTION, SERVLET_SPEC);
assertThat(manager.getDependencies()).containsOnly(JAXRS_FRACTION, JAXRS_SPEC, COMMON_DEP, UNDERTOW_FRACTION, SERVLET_SPEC);
WildFlySwarmManifest manifest = manager.getWildFlySwarmManifest();
assertThat(manifest.bootstrapArtifacts()).containsOnly(JAXRS_FRACTION.mavenGav(), UNDERTOW_FRACTION.mavenGav());
assertThat(manifest.bootstrapModules()).containsOnly("org.wildfly.swarm.jaxrs", "org.wildfly.swarm.undertow");
assertThat(manifest.getDependencies()).containsOnly(COMMON_DEP.mavenGav());
}
use of org.wildfly.swarm.bootstrap.env.WildFlySwarmManifest in project wildfly-swarm by wildfly-swarm.
the class AbstractBootstrapIntegrationTestCase method createBootstrapArchive.
protected JavaArchive createBootstrapArchive(String mainClassName, String appArtifact) throws IOException {
JavaArchive archive = ShrinkWrap.create(JavaArchive.class);
archive.as(ZipImporter.class).importFrom(new JarFile(findBootstrapJar()));
Properties props = new Properties();
if (appArtifact != null) {
props.put(BootstrapProperties.APP_ARTIFACT, appArtifact);
}
ByteArrayOutputStream propsOut = new ByteArrayOutputStream();
props.store(propsOut, "");
propsOut.close();
archive.addAsManifestResource(new ByteArrayAsset(propsOut.toByteArray()), "wildfly-swarm.properties");
if (appArtifact != null) {
WildFlySwarmManifest manifest = new WildFlySwarmManifest();
manifest.setAsset(appArtifact);
archive.add(new StringAsset(manifest.toString()), WildFlySwarmManifest.CLASSPATH_LOCATION);
}
if (mainClassName != null) {
Manifest manifest = new Manifest();
manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
manifest.getMainAttributes().put(new Attributes.Name("Wildfly-Swarm-Main-Class"), mainClassName);
ByteArrayOutputStream out = new ByteArrayOutputStream();
manifest.write(out);
out.close();
archive.addAsManifestResource(new ByteArrayAsset(out.toByteArray()), "MANIFEST.MF");
}
return archive;
}
Aggregations