Annotation Type OperateOnDeployment


@Documented @Retention(RUNTIME) @Target({METHOD,FIELD,PARAMETER}) public @interface OperateOnDeployment
Defines that the target should operate within the context of the referenced deployment.

When using multiple Deployment's within the same TestCase you need to specify which deployment the individual test methods should operate on.

Within the context of a deployment you will have access to the meta data provided by the deployment and the container where it is deployed, e.g. URLs

Usage Example for test method:


 @Deployment(name = "X")
 public static WebArchive create() {
      return ShrinkWrap.create(WebArchive.class)
          .addClass(MyServletX.class);
 }

 @Deployment(name = "Y")
 public static WebArchive create() {
      return ShrinkWrap.create(WebArchive.class)
          .addClass(MyServletY.class);
 }

 @Test @OperatesOnDeployment("X")
 public void shouldExecuteInX() { ... }

 @Test @OperatesOnDeployment("Y")
 public void shouldExecuteInY() { ... }
 

Additionally you can reference another deployments metadata from within another context by qualifiing OperateOnDeployment on ArquillianResource injection points.

Usage Example for ArquillianResource:


 @Deployment(name = "X")
 public static WebArchive create() {
      return ShrinkWrap.create(WebArchive.class)
          .addClass(MyServletX.class);
 }
 @Deployment(name = "Y")
 public static WebArchive create() {
      return ShrinkWrap.create(WebArchive.class)
          .addClass(MyServletY.class);
 }

 @Test @OperatesOnDeployment("X")
 public void shouldExecuteInX() { ... }

 @Test @OperatesOnDeployment("Y") @RunAsClient
 public void shouldExecuteInY(@ArquillianResource @OperateOnDeployment("X") URL deploymentXURLContext) { ... }
 
Version:
$Revision: $
Author:
Aslak Knutsen
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Refer to the deployment name this should operate on.
  • Element Details

    • value

      String value
      Refer to the deployment name this should operate on.
      Returns:
      The Deployment name this method operates on
      See Also: