Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save moelholm/cd21ac9422a12e4437e2ab49f1ad8326 to your computer and use it in GitHub Desktop.
Save moelholm/cd21ac9422a12e4437e2ab49f1ad8326 to your computer and use it in GitHub Desktop.
@RunWith(WildFlyEmbeddedArquillianRunner.class)
public class MultiDeploymentIntegrationTest {
@Deployment(name = "myapp", order = 1)
public static EnterpriseArchive createEar() {
return ShrinkWrap.create(EnterpriseArchive.class, "myapp.ear")
.addAsModule(
ShrinkWrap.create(JavaArchive.class, "myejbmodule.jar")
.addClass(BusinessServiceBean.class)
.addClass(AnotherBusinessServiceBean.class)
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"));
}
@Deployment(name = "myweb", order = 2)
public static WebArchive createJar() {
return ShrinkWrap.create(WebArchive.class, "myweb.war")
.addClass(WildFlyEmbeddedArquillianRunner.class)
.addClass(ArquillianJndiUtils.class)
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsManifestResource("jboss-deployment-structure.xml");
}
@EJB(lookup = "java:global/myapp/myejbmodule/BusinessServiceBean")
private BusinessServiceBean ejb;
@Test
@OperateOnDeployment("myweb")
public void sayHello_whenGivenDuke_thenReturnsHelloDuke() {
assertEquals("Hello duke", ejb.sayHello("duke"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment