Java Reference
In-Depth Information
<classes dir="${classes.dir}">
<include name="Test*.class"/>
</classes>
<fileset dir="${src.webapp.dir}">
<include name="*.jsp"/>
</fileset>
<lib dir="${lib.dir}">
<include name="commons-beanutils*.jar"/>
</lib>
</cactuswar>
</cactifyear>
Once again, we use the build.xml skeleton from listing 14.13, and here we list the tar-
get that's responsible for the cactification of the already packaged
EAR
file.
As you can see, the
cactifyear
task accepts the
srcfile
and
destfile
parame-
ters again
B
. Their meaning here is exactly the same as for the
cactifywar
task.
The new component here is a
cactuswar
nested element. This element has all the
parameters of the
cactifywar
task except the
destfile
parameter. The web applica-
tion will always be named cactus.war and placed in the root of the
EAR
. We also add
the commons-beanutils.jar file to the web application
C
, because our servlet and fil-
ter test cases need it.
Once we execute with
C
ant cactifyear
we get the cactified archive, which we can examine.
T
HE
CACTUS
TASK
Because the other Cactus-related tasks are external Ant tasks that extend some of the
internal Ant tasks, this concept is also valid for the
cactus
task. The
cactus
task is
used to execute the Cactus tests, and because every Cactus test is a pure
JU
nit test,
you've probably already figured out what task the
cactus
task extends. That's right—
the
cactus
task extends the
junit
task. This way, all the parameters that the
junit
task accepts are also valid for the
cactus
task.
Listing 14.16 extends listing 14.13 with the
cactus
task that executes the tests from
the
EAR
archive.
Listing 14.16
The test target to demonstrate the
cactus
task
[...]
<target name="test" depends="init,cactifyear">
<cactus earfile="${target.dir}/ch14-cactified.ear"
printsummary="yes">
<classpath>
<path refid="compile.cp"/>
<pathelement location="${classes.dir}"/>
<pathelement location="${test.classes.dir}"/>
</classpath>
<containerset>
<cargo containerId="${jboss.container.id}"
B
C
D