This is a simple example showing how Arquillian can be used with tomcat, using CDI with Weld. Both embedded and remote tests are provided, and can be run with Maven or Gradle.
Maven:
mvn -Ptc6-remote clean test mvn -Ptc6-embedded clean test
Gradle:
gradle clean tc6R gradle clean tc6E
Remote
In order to configure remote testing, JMX needs to be enabled and user access configured for the manager application.
1. JMX
The following options added to tomcat startup parameters enable JMX on port 8099:
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
2. User Access
Tthe "manager" application needs to be deployed, as well as users configured, e.g. in TOMCAT_HOME/conf/tomcat-users.xml:
<tomcat-users> <role rolename="manager" /> <user username="admin" password="pass" roles="manager" /> </tomcat-users>
This will allow deployment of remote tests from arquillian, using the following configuration (arquillian.xml):
<property name="jmxPort">8099</property> <property name="user">admin</property> <property name="pass">pass</property>
Comments