Search in sources :

Example 6 with JAXRSArchive

use of org.wildfly.swarm.jaxrs.JAXRSArchive in project wildfly-swarm by wildfly-swarm.

the class DefaultApplicationDeploymentProcessorTest method testApplicationPathAnnotation_DirectlyInArchive.

@Test
public void testApplicationPathAnnotation_DirectlyInArchive() throws Exception {
    JAXRSArchive archive = ShrinkWrap.create(JAXRSArchive.class);
    archive.addClass(MySampleApplication.class);
    DefaultApplicationDeploymentProcessor processor = new DefaultApplicationDeploymentProcessor(archive);
    processor.process();
    Node generated = archive.get(PATH);
    assertThat(generated).isNull();
}
Also used : AnnotationNode(org.objectweb.asm.tree.AnnotationNode) Node(org.jboss.shrinkwrap.api.Node) ClassNode(org.objectweb.asm.tree.ClassNode) JAXRSArchive(org.wildfly.swarm.jaxrs.JAXRSArchive) Test(org.junit.Test)

Example 7 with JAXRSArchive

use of org.wildfly.swarm.jaxrs.JAXRSArchive in project wildfly-swarm by wildfly-swarm.

the class SwaggerArchivePreparerTest method testWithSwaggerConfInWebInfClasses.

@Test
public void testWithSwaggerConfInWebInfClasses() {
    JAXRSArchive archive = ShrinkWrap.create(JAXRSArchive.class);
    archive.addResource(MyResource.class);
    archive.addResource(MyOtherResource.class);
    archive.add(new ByteArrayAsset("packages: com.myapp.mysubstuff".getBytes()), "WEB-INF/classes/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");
}
Also used : ByteArrayAsset(org.jboss.shrinkwrap.api.asset.ByteArrayAsset) JAXRSArchive(org.wildfly.swarm.jaxrs.JAXRSArchive) SwaggerArchive(org.wildfly.swarm.swagger.SwaggerArchive) Test(org.junit.Test)

Example 8 with JAXRSArchive

use of org.wildfly.swarm.jaxrs.JAXRSArchive in project wildfly-swarm by wildfly-swarm.

the class SWARM_513Test method createDeployment.

@Deployment(testable = true)
public static Archive createDeployment() throws Exception {
    URL url = Thread.currentThread().getContextClassLoader().getResource("project-test-defaults-path.yml");
    assertThat(url).isNotNull();
    File projectDefaults = new File(url.toURI());
    JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class, "myapp.war");
    deployment.addResource(TicketEndpoint.class);
    deployment.addClass(Ticket.class);
    deployment.addClass(Tickets.class);
    deployment.addClass(TicketDTO.class);
    deployment.addAsWebInfResource(new ClassLoaderAsset("META-INF/persistence.xml", SWARM_513Test.class.getClassLoader()), "classes/META-INF/persistence.xml");
    deployment.addAsWebInfResource(new ClassLoaderAsset("META-INF/import.sql", SWARM_513Test.class.getClassLoader()), "classes/META-INF/import.sql");
    deployment.addAsResource(projectDefaults, "/project-defaults.yml");
    return deployment;
}
Also used : JAXRSArchive(org.wildfly.swarm.jaxrs.JAXRSArchive) ClassLoaderAsset(org.jboss.shrinkwrap.api.asset.ClassLoaderAsset) File(java.io.File) URL(java.net.URL) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 9 with JAXRSArchive

use of org.wildfly.swarm.jaxrs.JAXRSArchive in project narayana by jbosstm.

the class LRASmokeIT method createDeployment.

@Deployment(testable = false)
public static Archive<?> createDeployment() throws Exception {
    JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class, "lra-smoke-it.war");
    deployment.addPackages(true, "io.narayana.lra.coordinator");
    File[] libs = Maven.resolver().loadPomFromFile("pom.xml").resolve("org.jboss.narayana.rts:lra-filters").withTransitivity().as(File.class);
    deployment.addAsLibraries(libs);
    return deployment;
}
Also used : JAXRSArchive(org.wildfly.swarm.jaxrs.JAXRSArchive) File(java.io.File) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 10 with JAXRSArchive

use of org.wildfly.swarm.jaxrs.JAXRSArchive in project narayana by jbosstm.

the class SpecIT method createDeployment.

@Deployment(testable = false)
public static Archive<?> createDeployment() throws Exception {
    JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class, "lra-smoke-it.war");
    deployment.addPackages(true, "io/narayana/lra/participant");
    File[] libs = Maven.resolver().loadPomFromFile("pom.xml").resolve("org.jboss.narayana.rts:lra-filters").withTransitivity().as(File.class);
    deployment.addAsLibraries(libs);
    return deployment;
}
Also used : JAXRSArchive(org.wildfly.swarm.jaxrs.JAXRSArchive) File(java.io.File) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Aggregations

JAXRSArchive (org.wildfly.swarm.jaxrs.JAXRSArchive)21 Test (org.junit.Test)12 AnnotationNode (org.objectweb.asm.tree.AnnotationNode)7 ClassNode (org.objectweb.asm.tree.ClassNode)7 File (java.io.File)6 Node (org.jboss.shrinkwrap.api.Node)6 Deployment (org.jboss.arquillian.container.test.api.Deployment)5 StringAsset (org.jboss.shrinkwrap.api.asset.StringAsset)4 JavaArchive (org.jboss.shrinkwrap.api.spec.JavaArchive)3 SwaggerArchive (org.wildfly.swarm.swagger.SwaggerArchive)3 Files (java.nio.file.Files)2 TemporalField (java.time.temporal.TemporalField)2 Assertions.assertThat (org.fest.assertions.Assertions.assertThat)2 ShrinkWrap (org.jboss.shrinkwrap.api.ShrinkWrap)2 ByteArrayAsset (org.jboss.shrinkwrap.api.asset.ByteArrayAsset)2 EmptyAsset (org.jboss.shrinkwrap.api.asset.EmptyAsset)2 ExplodedExporter (org.jboss.shrinkwrap.api.exporter.ExplodedExporter)2 ZipExporter (org.jboss.shrinkwrap.api.exporter.ZipExporter)2 After (org.junit.After)2 TempFileManager (org.wildfly.swarm.bootstrap.util.TempFileManager)2