@Deployment
public static Archive<?> deploy() {
return
// EAR archive
create(EnterpriseArchive.class, "test.ear")
// Data-source is defined here
.setApplicationXML("application-ejb.xml")
// JDBC driver for data source
.addAsLibraries(Maven.resolver()
.loadPomFromFile("pom.xml")
.resolve("com.h2database:h2")
.withoutTransitivity()
.asSingleFile())
// EJB module
.addAsModule(
create(JavaArchive.class, "test.jar")
// Persistence unit is defined here, references data source
.addAsResource("META-INF/persistence.xml")
// Service class that uses persistence unit
.addClasses(TestEntity.class, TestService.class)
)
// Web module
// This is needed to prevent Arquillian generating an illegal application.xml
.addAsModule(
create(WebArchive.class, "test.war")
// This class containing the test
.addClass(DataSourceDefinitionApplicationXMLPuEJBTest.class)
);
}