Java Reference
In-Depth Information
nested elements that the war task supports. Nothing explains better than an example,
so let's start the test cases from this chapter using Ant. We walk through the build.xml
in listing 14.14 and then discuss it.
Listing 14.14
Build.xml to present cactifywar task
<target name="cactifywar" depends="init,load.tasks, prepareWar">
<cactifywar srcfile="${target.dir}/ch14.war"
destfile="${target.dir}/ch14-cactified.war"/>
</target>
In the cactifywar target we call the cactifywar task, which we imported in the first
steps (in the load.tasks target). As you can see, the cactifywar task takes the follow-
ing parameters: srcfile , destfile , and a list of redirectors we want to define. There's
a bunch of other, nonrequired parameters, all of which are perfectly documented on
the Cactus website ( http://jakarta.apache.org/cactus ), where you can find additional
help. Also, once again, because the cactifywar task extends the war task, you can pass
all the parameters for the war task to it—they're all valid.
In the srcfile attribute you specify the archive file of the application that you
want to cactify. The important thing to notice here is that you may need to specify not
only the name of the file but also the destination path to it. In the destfile parame-
ter, you specify the name of the cactified file to produce.
You also may want to describe a list of redirectors in the cactifywar task. This list
of redirectors describes URL patterns to map the Cactus test redirectors to the nested
elements filterredirector , jspredirector, and servletredirector . If you don't
specify those elements, the test redirectors will be mapped to the default URL pattern.
After executing the target with
ant cactifywar
we should get the desired cactified archive, which we can examine.
T HE CACTIFYEAR TASK
The cactifyear task is the analogue of the cactifywar task, but instead it's used to
cactify EAR applications. It's a bit different from cactifywar , because in most cases
EAR applications contain a WAR archive that needs to be cactified. The cactifyear
task is, again, an external task that comes from the Cactus team and extends the Ant
ear task. This way it accepts all of the parameters that are valid for the ear task.
Let's now execute our tests from an EAR archive (listing 14.15), and then we'll walk
through the example application and discuss the different aspects.
Listing 14.15
Build.xml to present cactifyear task
<cactifyear srcfile="${target.dir}/ch14.ear"
destfile="${target.dir}/ch14-cactified.ear">
<cactuswar srcfile="${target.dir}/ch14.war"
mergewebxml="${src.webapp.dir}/WEB-INF/web.xml"
context="/">
B
 
 
 
 
 
Search WWH ::




Custom Search