use of org.jboss.shrinkwrap.api.Node in project tomee by apache.
the class OpenEJBArchiveProcessor method createWebApp.
private static WebApp createWebApp(final Archive<?> archive) {
WebApp webApp;
final Node webXml = archive.get(WEB_INF + "web.xml");
if (webXml == null) {
webApp = new WebApp();
} else {
InputStream inputStream = null;
try {
inputStream = webXml.getAsset().openStream();
webApp = Sxc.unmarshalJavaee(new WebApp$JAXB(), inputStream);
} catch (final Exception e) {
webApp = new WebApp();
} finally {
IO.close(inputStream);
}
}
return webApp;
}
use of org.jboss.shrinkwrap.api.Node in project tomee by apache.
the class OpenEJBArchiveProcessor method addValidationXml.
private static void addValidationXml(final Archive<?> archive, final String prefix, final Map<String, Object> testDD, final EjbModule ejbModule) {
Node validationXml = archive.get(prefix.concat(VALIDATION_XML));
// bval tcks
if (validationXml == null && WEB_INF == prefix) {
// we can use == here
validationXml = archive.get(WEB_INF_CLASSES.concat(META_INF).concat(VALIDATION_XML));
}
if (validationXml != null) {
// use same config otherwise behavior is weird
testDD.put(VALIDATION_XML, new AssetSource(validationXml.getAsset(), null));
ejbModule.getAltDDs().put(VALIDATION_XML, new AssetSource(validationXml.getAsset(), null));
}
}
use of org.jboss.shrinkwrap.api.Node in project tomee by apache.
the class OpenEJBArchiveProcessor method createEjbJar.
private static EjbJar createEjbJar(final String prefix, final Archive<?> webArchive) {
final EjbJar webEjbJar;
final Node webEjbJarXml = webArchive.get(prefix.concat(EJB_JAR_XML));
if (webEjbJarXml != null) {
try {
webEjbJar = ReadDescriptors.readEjbJar(webEjbJarXml.getAsset().openStream());
} catch (final OpenEJBException e) {
throw new OpenEJBRuntimeException(e);
}
} else {
webEjbJar = new EjbJar();
}
return webEjbJar;
}
use of org.jboss.shrinkwrap.api.Node in project tomee by apache.
the class MicroProfileOpenTracingTCKDeploymentPackager method generateDeployment.
@Override
public Archive<?> generateDeployment(final TestDeployment testDeployment, final Collection<ProtocolArchiveProcessor> processors) {
final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "microprofile-opentracing.war").merge(testDeployment.getApplicationArchive());
// opentracing-api jar added by Geronimo Impl. Also added by TCK causes issues with same classes in different Classloaders
final Map<ArchivePath, Node> content = webArchive.getContent(object -> object.get().matches(".*opentracing-api.*jar.*"));
content.forEach((archivePath, node) -> webArchive.delete(archivePath));
// TCK expects a MockTracer. Check org/eclipse/microprofile/opentracing/tck/application/TracerWebService.java:133
webArchive.addAsLibrary(jarLocation(MockTracer.class));
webArchive.addAsLibrary(jarLocation(ThreadLocalScopeManager.class));
webArchive.addAsWebInfResource("META-INF/beans.xml");
webArchive.addClass(MicroProfileOpenTracingTCKTracer.class);
System.out.println(webArchive.toString(true));
return super.generateDeployment(new TestDeployment(null, webArchive, testDeployment.getAuxiliaryArchives()), processors);
}
Aggregations