use of org.wildfly.swarm.jaxrs.JAXRSArchive in project wildfly-swarm by wildfly-swarm.
the class DefaultApplicationDeploymentProcessorTest method testMalformedWebXmlApplicationServletMappingAbsent.
@Test
public void testMalformedWebXmlApplicationServletMappingAbsent() throws Exception {
JAXRSArchive archive = ShrinkWrap.create(JAXRSArchive.class);
archive.addClass(MyResource.class);
archive.setWebXML(new StringAsset("blablabla"));
DefaultApplicationDeploymentProcessor processor = new DefaultApplicationDeploymentProcessor(archive);
// Simulate the behavior of loading the project defaults.
processor.applicationPath.set("/api-test");
processor.process();
Node generated = archive.get(PATH);
assertThat(generated).isNotNull();
}
use of org.wildfly.swarm.jaxrs.JAXRSArchive in project wildfly-swarm by wildfly-swarm.
the class DefaultApplicationDeploymentProcessorTest method testWebXmlApplicationServletMappingAbsent.
@Test
public void testWebXmlApplicationServletMappingAbsent() throws Exception {
JAXRSArchive archive = ShrinkWrap.create(JAXRSArchive.class);
archive.addClass(MyResource.class);
archive.setWebXML(new StringAsset("<web-app><display-name>Foo</display-name></web-app>"));
DefaultApplicationDeploymentProcessor processor = new DefaultApplicationDeploymentProcessor(archive);
// Simulate the behavior of loading the project defaults.
processor.applicationPath.set("/api-test");
processor.process();
Node generated = archive.get(PATH);
assertThat(generated).isNotNull();
}
use of org.wildfly.swarm.jaxrs.JAXRSArchive in project wildfly-swarm by wildfly-swarm.
the class FractionUsageAnalyzerTest method testExplodedFractionMatching.
@Test
public void testExplodedFractionMatching() throws Exception {
JAXRSArchive archive = ShrinkWrap.create(JAXRSArchive.class);
archive.addClass(MyResource.class);
FractionUsageAnalyzer analyzer = new FractionUsageAnalyzer();
File dirFile = TempFileManager.INSTANCE.newTempDirectory("fractionusagetest", null);
archive.as(ExplodedExporter.class).exportExplodedInto(dirFile);
analyzer.source(dirFile);
assertThat(analyzer.detectNeededFractions().stream().filter(fd -> fd.getArtifactId().equals("jaxrs")).count()).isEqualTo(1);
}
use of org.wildfly.swarm.jaxrs.JAXRSArchive in project wildfly-swarm by wildfly-swarm.
the class DroolsDeploymentProducer method droolsWar.
@Produces
public Archive droolsWar() throws Exception {
if (System.getProperty("org.drools.server.swarm.web.conf") == null) {
// Path dir = Files.createTempDirectory("swarm-keycloak-config");
File dir = TempFileManager.INSTANCE.newTempDirectory("swarm-drools-web-config", ".d");
System.setProperty("org.drools.server.swarm.conf", dir.getAbsolutePath());
Files.copy(getClass().getClassLoader().getResourceAsStream("config/web/web.xml"), dir.toPath().resolve("web.xml"), StandardCopyOption.REPLACE_EXISTING);
Files.copy(getClass().getClassLoader().getResourceAsStream("config/web/jboss-web.xml"), dir.toPath().resolve("jboss-web.xml"), StandardCopyOption.REPLACE_EXISTING);
configFolder = dir.toPath().toString();
}
DroolsMessages.MESSAGES.configurationDirectory(configFolder);
JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class, "drools-server.war");
deployment.addAllDependencies();
deployment.addAsWebInfResource(new File(configFolder + "/web.xml"), "web.xml");
deployment.addAsWebInfResource(new File(configFolder + "/jboss-web.xml"), "jboss-web.xml");
return deployment;
}
use of org.wildfly.swarm.jaxrs.JAXRSArchive in project wildfly-swarm by wildfly-swarm.
the class SwaggerArchivePreparerTest method testWithSwaggerConfInRoot.
@Test
public void testWithSwaggerConfInRoot() {
JAXRSArchive archive = ShrinkWrap.create(JAXRSArchive.class);
archive.addResource(MyResource.class);
archive.addResource(MyOtherResource.class);
archive.add(new ByteArrayAsset("packages: com.myapp.mysubstuff".getBytes()), "META-INF/swarm.swagger.conf");
SwaggerArchivePreparer preparer = new SwaggerArchivePreparer(archive);
preparer.process();
SwaggerArchive swaggerArchive = archive.as(SwaggerArchive.class);
assertThat(swaggerArchive.getResourcePackages()).containsOnly("com.myapp.mysubstuff");
}
Aggregations