Created
May 11, 2017 17:24
-
-
Save moelholm/cd21ac9422a12e4437e2ab49f1ad8326 to your computer and use it in GitHub Desktop.
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(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