Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

(1:) Inject DeploymentContextual information from Deployment 1 during in container testing operating under Deployment 2 (2:) Lazy create the Deployments in order, so Deployment 2 can depend on Contextual Data from Deployment 1

View ContextualDeploymentFromDifferentContainer.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
@RunWith(Arquillian.class)
public class ContextualDeploymentFromDifferentContainer
{
@Deployment(name = "Dep-1") @TargetsContainer("Cont-1")
public static WebArchive create()
{
return ShrinkWrap.create(WebArchive.class)
.addClass(RESTServlet.class);
}
@Deployment(name = "Dep-2") @TargetsContainer("Cont-2")
public static WebArchive createDep()
{
return ShrinkWrap.create(WebArchive.class);
}
 
@Test @OperateOnDeployment("Dep-2")
public void shouldInvokeContainer1FromContainer2(@ArquillianResource(RESTServlet.class) @OperateOnDeployment("Dep-1") URL restURLBase)
{
...
}
}
View ContextualDeploymentFromDifferentContainer.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
@RunWith(Arquillian.class)
public class LazyContextualDeploymentCreation
{
@Deployment(name = "Dep-1") @TargetsContainer("Cont-1")
public static WebArchive create()
{
return ShrinkWrap.create(WebArchive.class)
.addClass(RESTServlet.class);
}
@Deployment(name = "Dep-2") @TargetsContainer("Cont-2")
public static WebArchive createDep(@ArquillianResource(RESTServlet.class) @OperateOnDeployment("Dep-1") URL restURLBase)
{
return ShrinkWrap.create(WebArchive.class)
.addAsWebInfResource(new StringAsset(
Descriptors.create(WebAppDescriptor.class)
.contextParam("external.rest.url", restURLBase.toExternalForm());
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.