@RunWith(Arquillian.class)
public class JCATest {
@Deployment
public static EnterpriseArchive deploy() throws Exception {
JavaArchive rarlib = ShrinkWrap.create(JavaArchive.class, "rarlib.jar")
.addClasses(
IMyConnection.class,
MyConnectionImpl.class,
IMyConnectionFactory.class,
MyConnectionFactoryImpl.class,
MyManagedConnectionFactory.class,
...);
ResourceAdapterArchive rar = ShrinkWrap.create(ResourceAdapterArchive.class, "testra.rar")
.addAsLibrary(rarlib);
JavaArchive testjar = ShrinkWrap.create(JavaArchive.class, "test.jar")
.addClasses(JCATest.class)
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
.addAsModule(rar)
.addAsLibrary(testjar);
return ear;
}
@Resource
private IMyConnectionFactory connectionFactory;
@Test
public void test() {
...
}
}