Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 194 Next »

A Maven 2 plugin that wraps the Cargo Java API

Functional tests

Icon

The usage of Cargo for executing functional tests on a container does not need this m2 plugin. You should directly use the Cargo Java API from your Java unit test classes (JUnit, TestNG, etc), as described on the Functional testing page.

Table of Contents

The documentatation for this Maven2 plugin includes:

  • Installation: explains how to install the plugin
  • Getting started: explains how to use the plugin on several use cases
  • Reference Guide: provide reference documentation for all configuration options
  • Tips: tips for using the plugin

Getting Started

As usual the best way to learn to use a tool is through examples. We have several sample projects that we use as our internal functional tests suite. We really recommend that you check them out.

In addition here are the typical uses cases covered by the plugin:

Goals

Description

cargo:start

Start a container and optionally deploy deployables (WAR, EAR, etc)

cargo:stop

Stop a container

cargo:deployer-deploy (aliased to cargo:deploy)

Deploy a deployable to a running container

cargo:deployer-undeploy (aliased to cargo:undeploy)

Undeploy a deployable from a running container

cargo:deployer-start

Start a deployable already installed in a running container

cargo:deployer-stop

Stop a deployed deployable without undeploying it

cargo:deployer-redeploy

Undeploy and deploy again a deployable

cargo:uberwar

Merge several WAR files into one


The configuration elements are described in the configuration section.

Tips

Starting multiple containers conditionally

Maven 2 supports the notion of profiles which can be used with Cargo to decide for example when to run tests on a specific container. Here's how you could use the Cargo m2 plugin to that effect:

Then to start the tomcat 5.x container you would type mvn -P tomcat5x install. if you want to start both containers you would type mvn -P tomcat5x,orion2x install.

If you want to define a profile as the default you can use the <activation> element with an activation strategy. For example if you want a profile to be always on, use:

Starting Tomcat in security mode

Cargo supports passing system properties Passing system properties. So, to start Tomcat in security mode, you need to specify two system properties:

  • java.security.manager
  • java.security.policy

For instance,

How to get Tomcat 5 working with the Java 5 XML Parsers

Tip submitted by Ben P.

Imagine that you have some XML jars in the common/endorsed folder of Tomcat and you have edited your catalina.bat file to specify some extra JVM opts to specify the XML parser. Here's how to achieve the same using Cargo:

This shows how to add classpath elements to a Cargo container using the <dependencies> element.

  • No labels