Last active
July 1, 2018 21:21
-
-
Save albihasani94/5413c3410fd027dd98688f7a1cb8ea7a to your computer and use it in GitHub Desktop.
Thorntail 2.0 with Arquillian 1.2.1.Final
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.wildfly.swarm.jaxrs.rest; | |
import javax.ws.rs.client.Client; | |
import javax.ws.rs.client.ClientBuilder; | |
import javax.ws.rs.client.Invocation; | |
import javax.ws.rs.client.WebTarget; | |
import javax.ws.rs.core.MediaType; | |
import javax.ws.rs.core.Response; | |
import org.jboss.arquillian.container.test.api.Deployment; | |
import org.jboss.arquillian.junit.Arquillian; | |
import org.jboss.shrinkwrap.api.Archive; | |
import org.jboss.shrinkwrap.api.ShrinkWrap; | |
import org.junit.Assert; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.wildfly.swarm.Swarm; | |
import org.wildfly.swarm.arquillian.CreateSwarm; | |
import org.wildfly.swarm.jaxrs.JAXRSArchive; | |
@RunWith(Arquillian.class) | |
public class ApplicationTest { | |
private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationTest.class); | |
private static final String CREATE_DEPLOYMENT = "=====Create deployment====="; | |
private static final String RETURN_DEPLOYMENT_ARCHIVE = "=====Return deployment archive: {}====="; | |
private static final String CREATE_SWARM = "=====Create swarm====="; | |
@Deployment(name = "arquillian_test_single_deployment") | |
public static Archive createDeployment() { | |
LOGGER.info(CREATE_DEPLOYMENT); | |
JAXRSArchive deployment = ShrinkWrap.create(JAXRSArchive.class); | |
deployment.addClass(HelloWorldEndpoint.class); | |
deployment.addClass(JAXRSConfiguration.class); | |
LOGGER.info(RETURN_DEPLOYMENT_ARCHIVE, deployment.getName()); | |
return deployment; | |
} | |
@CreateSwarm | |
public static Swarm newContainer() throws Exception { | |
LOGGER.info(CREATE_SWARM); | |
return new Swarm(); | |
} | |
@Test | |
public void testMyService() { | |
Client client = ClientBuilder.newClient(); | |
WebTarget target = client.target("http://localhost:8080/hello"); | |
Invocation.Builder invocationBuilder = target.request(MediaType.TEXT_PLAIN_TYPE); | |
Response response = invocationBuilder.get(); | |
Assert.assertEquals(200, response.getStatus()); | |
} | |
@Test | |
public void doNothing() { | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<parent> | |
<groupId>org.wildfly.swarm</groupId> | |
<artifactId>wf-swarm-examples</artifactId> | |
<version>1.0.0-SNAPSHOT</version> | |
</parent> | |
<artifactId>jaxrs</artifactId> | |
<name>Thorntail JAXRS with Arquillian</name> | |
<version>1.0.0-SNAPSHOT</version> | |
<packaging>war</packaging> | |
<properties> | |
<version.io.thorntail>2.0.0.Final</version.io.thorntail> | |
<version.jboss.arquillian>1.2.1.Final</version.jboss.arquillian> | |
<version.org.slf4j>1.7.25</version.org.slf4j> | |
<maven.compiler.source>1.8</maven.compiler.source> | |
<maven.compiler.target>1.8</maven.compiler.target> | |
<failOnMissingWebXml>false</failOnMissingWebXml> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
</properties> | |
<dependencyManagement> | |
<dependencies> | |
<dependency> | |
<groupId>io.thorntail</groupId> | |
<artifactId>bom-all</artifactId> | |
<version>${version.io.thorntail}</version> | |
<type>pom</type> | |
<scope>import</scope> | |
</dependency> | |
<dependency> | |
<groupId>org.jboss.arquillian</groupId> | |
<artifactId>arquillian-bom</artifactId> | |
<version>${version.jboss.arquillian}</version> | |
<type>pom</type> | |
<scope>import</scope> | |
</dependency> | |
</dependencies> | |
</dependencyManagement> | |
<build> | |
<finalName>jaxrs-example</finalName> | |
<plugins> | |
<plugin> | |
<groupId>io.thorntail</groupId> | |
<artifactId>thorntail-maven-plugin</artifactId> | |
<version>${version.io.thorntail}</version> | |
<executions> | |
<execution> | |
<goals> | |
<goal>package</goal> | |
</goals> | |
</execution> | |
</executions> | |
</plugin> | |
</plugins> | |
</build> | |
<dependencies> | |
<dependency> | |
<groupId>javax</groupId> | |
<artifactId>javaee-api</artifactId> | |
<version>7.0</version> | |
<scope>provided</scope> | |
</dependency> | |
<dependency> | |
<groupId>io.thorntail</groupId> | |
<artifactId>jaxrs</artifactId> | |
</dependency> | |
<dependency> | |
<groupId>io.thorntail</groupId> | |
<artifactId>arquillian</artifactId> | |
<scope>test</scope> | |
</dependency> | |
<dependency> | |
<groupId>org.jboss.arquillian.junit</groupId> | |
<artifactId>arquillian-junit-container</artifactId> | |
<scope>test</scope> | |
</dependency> | |
<dependency> | |
<groupId>org.slf4j</groupId> | |
<artifactId>slf4j-simple</artifactId> | |
<version>${version.org.slf4j}</version> | |
<scope>test</scope> | |
</dependency> | |
</dependencies> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thorntail.2.0.arquillian.1.2.1.log