public static EnterpriseArchive createDeployment( GatewayConfig config, Topology topology ) { validateTopology( topology ); loadStacksServiceContributors( config ); Map<String,List<ProviderDeploymentContributor>> providers = selectContextProviders( topology ); Map<String,List<ServiceDeploymentContributor>> services = selectContextServices( topology ); Map<String,ServiceDeploymentContributor> applications = selectContextApplications( config, topology ); EnterpriseArchive ear = ShrinkWrap.create( EnterpriseArchive.class, topology.getName() ); ear.addAsResource( toStringAsset( topology ), "topology.xml" ); if( !services.isEmpty() ) { WebArchive war = createServicesDeployment( config, topology, providers, services ); ear.addAsModule( war ); } if( !applications.isEmpty() ) { for( Map.Entry<String, ServiceDeploymentContributor> application : applications.entrySet() ) { WebArchive war = createApplicationDeployment( config, topology, providers, application ); ear.addAsModule( war ); } } return ear; }
public static EnterpriseArchive createDeployment( GatewayConfig config, Topology topology ) { validateTopology( topology ); loadStacksServiceContributors( config ); Map<String,List<ProviderDeploymentContributor>> providers = selectContextProviders( topology ); Map<String,List<ServiceDeploymentContributor>> services = selectContextServices( topology ); Map<String,ServiceDeploymentContributor> applications = selectContextApplications( config, topology ); EnterpriseArchive ear = ShrinkWrap.create( EnterpriseArchive.class, topology.getName() ); ear.addAsResource( toStringAsset( topology ), "topology.xml" ); if( !services.isEmpty() ) { WebArchive war = createServicesDeployment( config, topology, providers, services ); ear.addAsModule( war ); } if( !applications.isEmpty() ) { for( Map.Entry<String, ServiceDeploymentContributor> application : applications.entrySet() ) { WebArchive war = createApplicationDeployment( config, topology, providers, application ); ear.addAsModule( war ); } } return ear; }
@Deployment public static Archive<?> createTestArchive() throws IllegalArgumentException, IOException { WebArchive war = ShrinkWrap .create( WebArchive.class, "ModuleMemberRegistrationEarArchiveWithJbossDeploymentIT.war" ) .addAsWebInfResource( webXml(), "web.xml" ); JavaArchive ejb = ShrinkWrap .create( JavaArchive.class, "ModuleMemberRegistrationEarArchiveWithJbossDeploymentIT.jar" ) .addClasses( ModuleMemberRegistrationEarArchiveWithJbossDeploymentIT.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() .createModule() .getOrCreateWeb() .webUri( war.getName() ).up().up() .exportAsString(); EnterpriseArchive ear = ShrinkWrap .create( EnterpriseArchive.class, ModuleMemberRegistrationEarArchiveWithJbossDeploymentIT.class.getSimpleName() + ".ear" ) .addAsModules( ejb ) .addAsModule( war ) .addAsResource( "jboss-deployment-structure-hcann.xml", "/jboss-deployment-structure.xml" ) .setApplicationXML( new StringAsset( applicationXml ) ); return ear; }