Pax Exam's Tomcat container is a web plus CDI container, without any OSGi or full Java EE support. It is intended for testing plain old web applications and can be used with OpenWebBeans or Weld as CDI providers.
If your web application does not use CDI itself, just add a CDI provider for testing so that injection into test cases will work.
This container launches Tomcat 7.x embedded in the same VM and deploys a WAR test probe built on the fly from the classpath contents.
pax-exam-container-tomcat depends on Embedded Tomcat Maven artifacts. There is no need for a separate Tomcat installation.
This is the standard lifecycle of the Tomcat container:
Tomcat is started via org.apache.catalina.startup.Tomcat. A temporary directory is used as catalina.base.
Any WAR modules configured by the user are deployed.
A WAR probe is built and deployed.
All tests contained in the probe are executed within the container.
All WAR modules (including the WAR probe, if any) are undeployed.
Tomcat is stopped.
The catalina.base temporary directory is deleted (depending on the configuration options).
A context.xml configuration file can be placed in one of the following locations:
Pax Exam automatically configures a CDI servlet context listener, depending on the CDI provider. The CDI provider is defined by a configuration property in exam.properties:
pax.exam.system = javaee
pax.exam.tomcat.listener = openwebbeans # or weld
Tomcat JULI logging is not yet redirected to SLF4J, the preferred logging solution in Pax Exam.