JBoss Community Archive (Read Only)

Arquillian Old

Tomcat 6.0 - Embedded

A DeployableContainer implementation that manages the complete lifecycle of an embedded (same JVM) Tomcat 6 Servlet Container. (Keep in mind that only select EE APIs are available in Tomcat 6, such as JNDI and Servlet 2.5). Test archives are adapted to Tomcat's StandardContext API by ShrinkWrap and deployed programmatically.

Container Injection Support Matrix

@Resource

@EJB

@EJB (no-interface)

@Inject (CDI)

@Inject (MC)

@PersistenceContext @PersistenceUnit

images/author/download/attachments/23822411/fact_good.png

 

 

images/author/download/attachments/23822411/fact_good.png

 

 

CDI support requires use of Weld Servlet and associated configuration. The WAR will have to be unpacked as well in order for Weld to locate the classes. See the following configuration example.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<arquillian 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://jboss.org/schema/arquillian"
    xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
	
       <container qualifier="tomcat" default="true">
           <configuration>
               <property name="unpackArchive">true</property>
           </configuration>
       </container>
</arquillian>

Configuration

Default Protocol: Servlet 2.5

Container Configuration Options

Name

Type

Default

Description

bindHttpPort

int

9090

The HTTP port the server should bind to.

bindAddress

String

localhost

The host the server should be run on.

tomcatHome

String

 

Optional location of a Tomcat installation to link against.

serverName

String

 

Optional name of the server

appBase

String

 

Optional relative or absolute path to the directory where applications are deployed (e.g., webapps).

workDir

String

 

Optional relative or absolute path to the directory where applications are expanded and session serialization data is stored (e.g., work).

unpackArchive

boolean

true

Specify if the deployment should be deployed exploded or compressed.

Example of Maven profile setup

<profile>
	<id>tomcat-embedded</id>
	<dependencies>
		<dependency>
			<groupId>org.jboss.arquillian.container</groupId>
			<artifactId>arquillian-tomcat-embedded-6</artifactId>
			<version>1.0.0-SNAPSHOT</version>
         <scope>test</scope>
		</dependency>
      <dependency>
         <groupId>org.apache.tomcat</groupId>
         <artifactId>catalina</artifactId>
         <version>6.0.29</version>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.apache.tomcat</groupId>
         <artifactId>coyote</artifactId>
         <version>6.0.29</version>
         <scope>provided</scope>
      </dependency>
      <dependency>
         <groupId>org.apache.tomcat</groupId>
         <artifactId>jasper</artifactId>
         <version>6.0.29</version>
         <scope>provided</scope>
      </dependency>
      <!-- Weld servlet, EL and JSP required for testing CDI injections -->
      <dependency>
         <groupId>org.jboss.weld.servlet</groupId>
         <artifactId>weld-servlet</artifactId>
         <version>1.0.1-Final</version>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.glassfish.web</groupId>
         <artifactId>el-impl</artifactId>
         <version>2.2</version>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>javax.servlet.jsp</groupId>
         <artifactId>jsp-api</artifactId>
         <version>2.2</version>
         <scope>test</scope>
      </dependency>
	</dependencies>
</profile>
JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-10 12:19:43 UTC, last content change 2011-06-06 19:41:27 UTC.