Created
March 21, 2011 18:00
-
-
Save aslakknutsen/879884 to your computer and use it in GitHub Desktop.
(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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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) | |
{ | |
... | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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