Search in sources :

Example 21 with WARArchive

use of org.wildfly.swarm.undertow.WARArchive in project wildfly-swarm by wildfly-swarm.

the class JAXRSArchiveTest method testDetectJAXRSness_isNot.

@Test
public void testDetectJAXRSness_isNot() {
    WARArchive archive = ShrinkWrap.create(WARArchive.class);
    archive.addClass(MyRandomClass.class);
    assertThat(JAXRSArchive.isJAXRS(archive)).isFalse();
}
Also used : WARArchive(org.wildfly.swarm.undertow.WARArchive) Test(org.junit.Test)

Example 22 with WARArchive

use of org.wildfly.swarm.undertow.WARArchive in project wildfly-swarm by wildfly-swarm.

the class InstallMonitorFilter method process.

@Override
public void process() throws Exception {
    WARArchive warArchive = archive.as(WARArchive.class);
    warArchive.addDependency("org.wildfly.swarm:health-api:jar:" + SwarmInfo.VERSION);
    warArchive.findWebXmlAsset().setContextParam("resteasy.scan", "true");
}
Also used : WARArchive(org.wildfly.swarm.undertow.WARArchive)

Example 23 with WARArchive

use of org.wildfly.swarm.undertow.WARArchive in project wildfly-swarm by wildfly-swarm.

the class SwaggerWebAppDeploymentProducer method swaggerWebApp.

@Produces
public Archive swaggerWebApp() throws ModuleLoadException, IOException {
    // Load the swagger-ui webjars.
    Module module = Module.getBootModuleLoader().loadModule("org.webjars.swagger-ui");
    URL resource = module.getExportedResource("swagger-ui.jar");
    JARArchive webJar = ShrinkWrap.create(JARArchive.class);
    webJar.as(ZipImporter.class).importFrom(resource.openStream());
    JARArchive relocatedJar = ShrinkWrap.create(JARArchive.class);
    Map<ArchivePath, Node> content = webJar.getContent();
    for (ArchivePath path : content.keySet()) {
        Node node = content.get(path);
        Asset asset = node.getAsset();
        if (asset != null) {
            Matcher matcher = PATTERN.matcher(path.get());
            if (matcher.matches()) {
                MatchResult result = matcher.toMatchResult();
                String newPath = "/META-INF/resources/" + result.group(2);
                relocatedJar.add(asset, newPath);
            }
        }
    }
    WARArchive war = ShrinkWrap.create(WARArchive.class, "swagger-ui.war").addAsLibrary(relocatedJar).setContextRoot(this.fraction.getContext());
    war.addClass(SwaggerDefaultUrlChangerServlet.class);
    // If any user content has been provided, merge that with the swagger-ui bits
    Archive<?> userContent = this.fraction.getWebContent();
    if (userContent != null) {
        war.merge(userContent);
    }
    return war;
}
Also used : Matcher(java.util.regex.Matcher) Node(org.jboss.shrinkwrap.api.Node) MatchResult(java.util.regex.MatchResult) WARArchive(org.wildfly.swarm.undertow.WARArchive) URL(java.net.URL) ArchivePath(org.jboss.shrinkwrap.api.ArchivePath) ZipImporter(org.jboss.shrinkwrap.api.importer.ZipImporter) Asset(org.jboss.shrinkwrap.api.asset.Asset) JARArchive(org.wildfly.swarm.spi.api.JARArchive) Module(org.jboss.modules.Module) Produces(javax.enterprise.inject.Produces)

Example 24 with WARArchive

use of org.wildfly.swarm.undertow.WARArchive in project wildfly-swarm by wildfly-swarm.

the class JAXPOverrideTest method createDeployment.

@Deployment
public static Archive createDeployment() throws Exception {
    WARArchive deployment = ShrinkWrap.create(WARArchive.class, "services.war");
    deployment.addAsLibraries(Maven.resolver().resolve("saxon:saxon:8.7").withTransitivity().asFile());
    deployment.addClass(ServicesServlet.class);
    deployment.addClass(TransformerServlet.class);
    return deployment;
}
Also used : WARArchive(org.wildfly.swarm.undertow.WARArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 25 with WARArchive

use of org.wildfly.swarm.undertow.WARArchive in project wildfly-swarm by wildfly-swarm.

the class StaticContentWarSubdirTest method createDeployment.

@Deployment
public static Archive createDeployment() throws Exception {
    WARArchive deployment = ShrinkWrap.create(WARArchive.class);
    deployment.staticContent("foo");
    // Make sure we're testing from contents inside the jar only
    deployment.delete("WEB-INF/undertow-external-mounts.conf");
    return deployment;
}
Also used : WARArchive(org.wildfly.swarm.undertow.WARArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Aggregations

WARArchive (org.wildfly.swarm.undertow.WARArchive)39 Deployment (org.jboss.arquillian.container.test.api.Deployment)15 Test (org.junit.Test)8 WebXmlAsset (org.wildfly.swarm.undertow.descriptors.WebXmlAsset)5 Produces (javax.enterprise.inject.Produces)4 Node (org.jboss.shrinkwrap.api.Node)4 URL (java.net.URL)3 ClassLoaderAsset (org.jboss.shrinkwrap.api.asset.ClassLoaderAsset)3 MockTracer (io.opentracing.mock.MockTracer)2 BufferedReader (java.io.BufferedReader)2 File (java.io.File)2 InputStreamReader (java.io.InputStreamReader)2 List (java.util.List)2 Map (java.util.Map)2 Module (org.jboss.modules.Module)2 ArchivePath (org.jboss.shrinkwrap.api.ArchivePath)2 Asset (org.jboss.shrinkwrap.api.asset.Asset)2 StringAsset (org.jboss.shrinkwrap.api.asset.StringAsset)2 JBossWebAsset (org.wildfly.swarm.undertow.descriptors.JBossWebAsset)2 UndertowExternalMountsAsset (org.wildfly.swarm.undertow.internal.UndertowExternalMountsAsset)2