Search in sources :

Example 1 with TestDeployment

use of org.jboss.arquillian.container.test.spi.TestDeployment in project tomee by apache.

the class MicroProfileOpenAPITCKDeploymentPackager method generateDeployment.

@Override
public Archive<?> generateDeployment(final TestDeployment testDeployment, final Collection<ProtocolArchiveProcessor> processors) {
    final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "microprofile-openapi.war").merge(testDeployment.getApplicationArchive()).addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
    // MP Config in wrong place - See https://github.com/eclipse/microprofile/issues/46.
    if (testDeployment.getApplicationArchive() instanceof WebArchive) {
        final Map<ArchivePath, Node> content = testDeployment.getApplicationArchive().getContent(object -> object.get().matches(".*META-INF/.*"));
        content.forEach((archivePath, node) -> webArchive.addAsResource(node.getAsset(), node.getPath()));
    }
    return super.generateDeployment(new TestDeployment(null, webArchive, testDeployment.getAuxiliaryArchives()), processors);
}
Also used : ArchivePath(org.jboss.shrinkwrap.api.ArchivePath) TestDeployment(org.jboss.arquillian.container.test.spi.TestDeployment) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) Node(org.jboss.shrinkwrap.api.Node)

Example 2 with TestDeployment

use of org.jboss.arquillian.container.test.spi.TestDeployment 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);
}
Also used : ArchivePath(org.jboss.shrinkwrap.api.ArchivePath) ThreadLocalScopeManager(io.opentracing.util.ThreadLocalScopeManager) TestDeployment(org.jboss.arquillian.container.test.spi.TestDeployment) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) Node(org.jboss.shrinkwrap.api.Node) MockTracer(io.opentracing.mock.MockTracer)

Aggregations

TestDeployment (org.jboss.arquillian.container.test.spi.TestDeployment)2 ArchivePath (org.jboss.shrinkwrap.api.ArchivePath)2 Node (org.jboss.shrinkwrap.api.Node)2 WebArchive (org.jboss.shrinkwrap.api.spec.WebArchive)2 MockTracer (io.opentracing.mock.MockTracer)1 ThreadLocalScopeManager (io.opentracing.util.ThreadLocalScopeManager)1