...
Excerpt |
---|
Cargo provides Ant tasks to perform all the operations available from the Java API. The minimum supported version is Ant 1.9.15. |
Note | ||
---|---|---|
| ||
As documented in CVE-2020-1945, Apache Ant versions 1.1 to 1.9.14 and 1.10.0 to 1.10.7 use the default temporary directory identified by the Java system property We hence strongly recommend only using Apache Ant version 1.9.16 and above (if you need to stick to the Apache Ant 1.9.x branch), or Apache Ant version 1.10.11 and above in general. |
Info | ||
---|---|---|
| ||
The usage of Cargo for executing functional tests on a container does not mandate these ANT Ant tasks. You could directly use the Cargo Java API from your Java unit test classes (JUnit, TestNG, etc), as described on the Functional testing page. |
...
Some additional dependencies might also be required for the ANT Ant task. Please see the Installation page for details.
The Cargo
...
Ant tasks in detail
Here are the different task actions available to call on this plugin:
Action | Description |
---|---|
| Start a container. That task will:
|
|
Note: A container that's started with the |
Ant instance quits (i.e., you see a | |
| Start a container and wait for the user to press
|
|
|
| |
| Stop a container. |
restart | Stop and start again a container. If the container was not running before |
calling | |
| Create the configuration for a local container, without starting it. Note that the |
daemon-start | Start a container using the Cargo Daemon. |
daemon-stop | Stop a container using the Cargo Daemon. |
| Deploy a deployable to a running container. |
| Undeploy a deployable from a running container. |
| Undeploy and deploy again a deployable. If the deployable was not deployed before |
calling |
Info | ||
---|---|---|
| ||
Many wonder the difference between the
|
Include Page | ||||
---|---|---|---|---|
|
Examples
Anchor | ||||
---|---|---|---|---|
|
...
Info | ||
---|---|---|
| ||
It is also possible to load the configuration properties from a file - simply use the the |
...
Add additional properties for defining the following:
Property
Description
tomcat.home
Installation directory of tomcat5x
tomcatlog.dir
This is where our logs are going to be generated
tomcatconfig.dir
Cargo needs an empty config folder
pathtowarfile
The full path of the war file e.g c:/devtools/myapp/dist/myfile.war
Add the following code to your build.xml :
Code Block xml xml <taskdef resource="cargo.tasks"> <classpath> <pathelement location="${cargo-uberjar}"/> <pathelement location="${cargo-antjar}"/> </classpath> </taskdef> <target name="cargostart" depends="war"> <delete dir="${tomcatconfig.dir}" /> <mkdir dir="${tomcatlog.dir}"/> <mkdir dir="${tomcatconfig.dir}"/> <echo message="Starting Cargo..."/> <echo message="Using tomcat.home = ${tomcat.home} "/> <echo message="Using war = ${mywarfile} "/> <echo message="Jars used = ${cargo-uberjar} , ${cargo-antjar}"/> <cargo containerId="tomcat5x" home="${tomcat.home}" output="${tomcatlog.dir}/output.log" log="${tomcatlog.dir}/cargo.log" action="start"> <configuration home="${tomcatconfig.dir}"> <property name="cargo.servlet.port" value="8080"/> <property name="cargo.logging" value="high"/> <deployable type="war" file="${mywarfile}"/> </configuration> </cargo> </target>
...
For more details, please check the example in the Remote Container section for the ANT Ant tasks. The ANT Ant tasks support the deployer actions deploy
, undeploy
and redeploy
.