public static Archive<?> tryWrapEAR(WebArchive webArchive) { if (getBoolean("useEarForJaspic")) { return // EAR archive create(EnterpriseArchive.class, "test.ear") // Liberty needs to have the binding file in an ear. // TODO: this is no longer the case and this code can be removed (-bnd.xml // needs to be moved to correct place) .addAsManifestResource(resource("ibm-application-bnd.xml")) // Web module // This is needed to prevent Arquillian generating an illegal application.xml .addAsModule( webArchive ); } else { return webArchive; } }
/** * This method sets a new JBoss deployment structure for an enterprise * archive. * * @param enterpriseArchive * is the {@link EnterpriseArchive} to be edited. * @param jbossDeploymentStructure * is the content of the new deployment structure. * @throws IOException * No application.xml found */ public static void setJBossDeploymentStructureXml( EnterpriseArchive enterpriseArchive, String jbossDeploymentStructure) throws IOException { File tempFile = File.createTempFile( JBOSS_DEPLOYMENT_STRUCTURE_XML_FILE_NAME, ".temp"); tempFile.deleteOnExit(); IOUtils.write(jbossDeploymentStructure, new FileOutputStream(tempFile)); // delete the old descriptor enterpriseArchive.delete(JBOSS_DEPLOYMENT_STRUCTURE_XML_PATH); // set the new descriptor enterpriseArchive.addAsManifestResource(tempFile, JBOSS_DEPLOYMENT_STRUCTURE_XML_FILE_NAME); }
@Deployment public static Archive<?> createTestArchive() { JavaArchive ejb = ShrinkWrap .create( JavaArchive.class, "ModuleMemberRegistrationEarArchiveIT.jar" ) .addClasses( ModuleMemberRegistrationEarArchiveIT.class, Member.class, MemberRegistration.class, Resources.class ) .addAsManifestResource( persistenceXml(), "persistence.xml" ) .addAsManifestResource( EmptyAsset.INSTANCE, "beans.xml" ); String applicationXml = Descriptors.create( ApplicationDescriptor.class ).createModule().ejb( ejb.getName() ).up().exportAsString(); EnterpriseArchive ear = ShrinkWrap .create( EnterpriseArchive.class, "ModuleMemberRegistrationEarArchiveIT.ear" ) .addAsManifestResource( "jboss-deployment-structure-hcann.xml", "jboss-deployment-structure.xml" ) .addAsModules( ejb ) .setApplicationXML( new StringAsset( applicationXml ) ); return ear; }
@Deployment public static Archive<?> createTestArchive() { JavaArchive ejb = ShrinkWrap .create( JavaArchive.class, "MemberRegistrationEarArchiveIT.jar" ) .addClasses( MemberRegistrationEarArchiveIT.class, Member.class, MemberRegistration.class, Resources.class ) .addAsManifestResource( persistenceXml(), "persistence.xml" ) .addAsManifestResource( EmptyAsset.INSTANCE, "beans.xml" ); String applicationXml = Descriptors.create( ApplicationDescriptor.class ).createModule().ejb( ejb.getName() ).up().exportAsString(); EnterpriseArchive ear = ShrinkWrap .create( EnterpriseArchive.class, "MemberRegistrationEarArchiveIT.ear" ) .addAsModules( ejb ) .addAsManifestResource( "jboss-deployment-structure-hcann.xml", "/jboss-deployment-structure.xml" ) .addAsLibraries( PackagerHelper.hibernateSearchLibraries() ) .setApplicationXML( new StringAsset( applicationXml ) ); return ear; }