arquillian-remote 进行EJB测试
一、使用默认的jpa实现进行remote测试
此配置请参照官网的配置http://arquillian.org/guides/getting_started_rinse_and_repeat/,此处不做重复。
二、使用自己的jpa实现进行remote测试1、配置pom.xml由于此测试框架有自己的一套JavaEE的实现jar包,所以会造成与工程内部的jsf和javaee6 api等冲突,使用测试框架时不能启用此jar包(通过配置profile,可参考arquillian官网示例介绍)。@RunWith(Arquillian.class)public class TestServiceTest {@Deploymentpublic static Archive<?> createDeployment() {MavenDependencyResolver resolver = DependencyResolvers.use(MavenDependencyResolver.class).loadMetadataFromPom("pom.xml");WebArchive webInfResource = ShrinkWrap.create(WebArchive.class, "arqTest.war").addClass(MyTestService.class).addAsLibraries(resolver.artifact("org.apache.openjpa:openjpa-all:2.1.1").resolveAsFiles()) .addPackages(true, "com.test.model").addAsResource("META-INF/persistence.xml").addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");System.out.println("webInfResource:" + webInfResource);return webInfResource;}@EJBprivate MyTestService rs;@Testpublic void testCal() {rs.test();}}