@Documented @Retention(value=RUNTIME) @Target(value={METHOD,FIELD,PARAMETER}) public @interface OperateOnDeployment
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) { ... }
public abstract String value
Deployment.name()
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.