public class PersistenceUnitWarPackagingTestCase {
@Deployment
public static Archive<?> deploy() {
EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "scopedToEar.ear");
JavaArchive lib = ShrinkWrap.create(JavaArchive.class, "lib.jar");
lib.addClasses(Employee.class);
lib.addAsManifestResource(getPersistenceXml(), "persistence.xml");
ear.addAsLibrary(lib);
WebArchive override = ShrinkWrap.create(WebArchive.class, "override.war");
override.addClasses(Organisation.class, OrganisationBean.class, LibPersistenceUnitBean.class, PersistenceUnitWarPackagingTestCase.class);
override.addAsResource(getPersistenceXml(), "META-INF/persistence.xml");
ear.addAsModule(override);
JavaArchive noOverride = ShrinkWrap.create(JavaArchive.class, "noOverride.jar");
noOverride.addClasses(EmployeeBean.class);
ear.addAsModule(noOverride);
return ear;
}