Java Reference
In-Depth Information
14.8.2
Maven2 cactifyear MOJO
To execute Cactus tests from an EAR file, we have to follow the same procedure as
for the WAR file, except for the cactification of the archive. That's why we cover
the cactifyear Cactus plug-in in this section. Listing 14.21 cactifies our example
EAR package.
Listing 14.21 cactifyear Cactus plug-in declaration
<plugin>
<groupId>org.apache.cactus</groupId>
<artifactId>cactus.integration.maven2</artifactId>
<version>1.8.1</version>
<configuration>
<srcFile>target/${pom.artifactId}-${pom.version}.ear</srcFile>
<destFile>${project.build.directory}/${pom.artifactId}-
cactified.ear</destFile>
B
C
<cactusWar>
<context>/</context>
<testClasses>
<directory>target/test-classes</directory>
<includes>
<include>**/*Test*.*</include>
</includes>
</testClasses>
<version>2.3</version>
</cactusWar>
</configuration>
<executions>
<execution>
<id>cactus-cactifyear</id>
<phase>pre-integration-test</phase>
<goals>
<goal>cactifyear</goal>
</goals>
</execution>
</executions>
</plugin>
This declaration seems simple enough. All we have to do here is provide the srcfile
and destfile parameters B . In the <cactusWar> section C , we describe parameters
related to the WAR application inside our EAR file, such as the context of the applica-
tion D , which test classes to include E , and which version of the web.xml will be used
F . In G we attach the plug-in to the pre-integration phase of Maven. The rest of the
pom.xml is the same as the one in the previous section, so we won't discuss it further.
Now we move on and show you one other way of executing your Cactus tests. This
time we use Jetty as an embedded container. Jetty is not only a servlet container, but it
also provides you with an API for manipulating the container. This API is used by Cac-
tus to fire up the container for you, execute the tests, and then stop the container—all
with a single command.
D
E
F
G
 
 
 
 
 
Search WWH ::




Custom Search