org.jboss.shrinkwrap.api.spec.EnterpriseArchive Java Examples

The following examples show how to use org.jboss.shrinkwrap.api.spec.EnterpriseArchive. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EventStorePersistenceJPATest.java    From JEEventStore with MIT License 6 votes vote down vote up
@Deployment
public static EnterpriseArchive deployment() {
    EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "test.ear");
    DefaultDeployment.addDependencies(ear, "org.jeeventstore:jeeventstore-persistence-jpa", false);
    ear.addAsModule(ShrinkWrap.create(JavaArchive.class, "ejb.jar")
            .addAsManifestResource(new File("src/test/resources/META-INF/beans.xml"))
            .addAsManifestResource(new File("src/test/resources/META-INF/persistence.xml"))
            .addAsManifestResource(new File(
                    "src/test/resources/META-INF/ejb-jar-EventStorePersistenceJPATest.xml"),
                    "ejb-jar.xml")
            .addClass(XMLSerializer.class)
            .addClass(TestUTF8Utils.class)
            .addClass(PersistenceTestHelper.class)
            .addPackage(AbstractPersistenceTest.class.getPackage())
            .addPackage(EventStorePersistenceJPA.class.getPackage())
            );
    return ear;
}
 
Example #2
Source File: EarClassLoaderTest.java    From tomee with Apache License 2.0 6 votes vote down vote up
@Deployment(testable = false)
public static Archive<?> ear() {
    return ShrinkWrap.create(EnterpriseArchive.class, "broken.ear")
            .addAsModule(
                    ShrinkWrap.create(WebArchive.class, "broken-web.war")
                            .addClasses(LoadJodaFromTheWebAppResource.class)
                            .addAsLibraries(
                                    Maven.configureResolver()
                                            .workOffline()
                                            .withClassPathResolution(true)
                                            .resolve("joda-time:joda-time:2.5")
                                            .using(new AcceptScopesStrategy(ScopeType.COMPILE, ScopeType.RUNTIME))
                                            .asFile()
                            )
            );
}
 
Example #3
Source File: Deployments.java    From pnc with Apache License 2.0 6 votes vote down vote up
public static EnterpriseArchive testEar() {
    EnterpriseArchive ear = ShrinkWrap.createFromZipFile(EnterpriseArchive.class, getBaseEar());

    WebArchive restWar = prepareRestArchive(ear);
    ear.addAsModule(archiveToTest(restWar));
    // remove the old rest
    ear.delete("rest.war");

    addTestPersistenceXml(ear);
    ear.setApplicationXML("application-new.xml");

    addKeycloakServiceClientMock(ear);

    logger.info("Ear archive listing: {}", ear.toString(true));

    return ear;
}
 
Example #4
Source File: ConfigPropertyEARTest.java    From deltaspike with Apache License 2.0 6 votes vote down vote up
@Deployment
public static EnterpriseArchive deployEar()
{
    JavaArchive ejbJar = ShrinkWrap
            .create(JavaArchive.class, "ejb-jar.jar")
            .addClasses(BaseTestConfigProperty.class, ConfigPropertyEARTest.class,
                    MyBean.class, MyCustomEarPropertyFileConfig.class)
            .addAsResource(CONFIG_FILE_NAME)
            .addAsServiceProvider(PropertyFileConfig.class, MyCustomEarPropertyFileConfig.class)
            .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsManifestResource(new StringAsset("org.apache.deltaspike.ProjectStage = UnitTest"),
                    "apache-deltaspike.properties");

    WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war")
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");

    EnterpriseArchive enterpriseArchive = ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
            .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())
            .addAsModule(ejbJar)
            .addAsModule(war)
            .setApplicationXML("application.xml");

    return enterpriseArchive;
}
 
Example #5
Source File: TimedMethodTimerBeanTest.java    From metrics-cdi with Apache License 2.0 6 votes vote down vote up
@Deployment
public static Archive<?> createTestArchive() {
    return ShrinkWrap.create(EnterpriseArchive.class)
        .addAsLibraries(
            Maven.configureResolver()
                .workOffline()
                .loadPomFromFile("pom.xml")
                .resolve("io.astefanutti.metrics.cdi:metrics-cdi")
                .withTransitivity()
                .as(JavaArchive.class))
        .addAsModule(
            ShrinkWrap.create(JavaArchive.class)
                .addClass(TimedMethodTimerBean.class)
                .addClass(CallCounter.class)
                // FIXME: Test class must be added until ARQ-659 is fixed
                .addClass(TimedMethodTimerBeanTest.class)
                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"));
}
 
Example #6
Source File: SpringContextBindingDependenciesEarTest.java    From wildfly-camel with Apache License 2.0 6 votes vote down vote up
@Deployment
public static EnterpriseArchive createDeployment() {
    return ShrinkWrap.create(EnterpriseArchive.class, "spring-jndi-binding-tests.ear")
        .addAsModule(
            ShrinkWrap.create(JavaArchive.class, "spring-jndi-binding-tests.jar")
                .addClasses(SpringContextBindingDependenciesEarTest.class, DelayedBinderServiceActivator.class,
                    DelayedBinderService.class, CamelContextStartupEventNotifier.class)
                .addAsResource("spring/jndi-bindings-camel-context.xml", "jndi-bindings-camel-context.xml")
                .addAsManifestResource(new StringAsset(DelayedBinderServiceActivator.class.getName()), "services/org.jboss.msc.service.ServiceActivator")
                .setManifest(() -> {
                    ManifestBuilder builder = new ManifestBuilder();
                    builder.addManifestHeader("Dependencies", "org.jboss.as.server");
                    return builder.openStream();
                })
        );
}
 
Example #7
Source File: DataEarTest.java    From tomee with Apache License 2.0 6 votes vote down vote up
@Deployment(testable = false)
public static EnterpriseArchive createDeployment() {

    final JavaArchive clientJar = ShrinkWrap.create(JavaArchive.class, "client.jar")
            .addClasses(Data.class, DataBusiness.class, DataBusinessHome.class);

    final JavaArchive ejbJar = ShrinkWrap.create(JavaArchive.class, "ejb-jar.jar")
            .addClasses(DataBusinessBean.class)
            .addAsResource(new ClassLoaderAsset("org/apache/openejb/arquillian/tests/jsp/ejb-jar.xml"), "META-INF/ejb-jar.xml");

    final WebArchive testWar = ShrinkWrap.create(WebArchive.class, "test.war")
            .add(new ClassLoaderAsset("org/apache/openejb/arquillian/tests/jsp/test.jsp"), "test.jsp")
            .addAsWebInfResource(new ClassLoaderAsset("org/apache/openejb/arquillian/tests/jsp/web.xml"), "web.xml");

    final EnterpriseArchive archive = ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
            .addAsLibrary(clientJar)
            .addAsModule(ejbJar)
            .addAsModule(testWar);

    System.out.println(archive.toString(true));
    return archive;
}
 
Example #8
Source File: TomEEContainerEarWithExplodedWarTest.java    From tomee with Apache License 2.0 6 votes vote down vote up
@Deployment
public static WebArchive createDeployment() throws Exception {
    final WebArchive web = ShrinkWrap.create(WebArchive.class, WAR_FILE)
            .addClass(TestServlet.class)
            .addClass(TestEjb.class)
            .setWebXML(new StringAsset(Descriptors.create(WebAppDescriptor.class)
                    .createServlet().servletName(SERVLET_NAME).servletClass(TestServlet.class.getName()).up()
                    .createServletMapping().servletName(SERVLET_NAME).urlPattern(URL_PATTERN).up()
                    .exportAsString()));
    ShrinkWrap.create(EnterpriseArchive.class, EAR_FILE).addAsModule(web)
            .setApplicationXML(new StringAsset(Descriptors.create(ApplicationDescriptor.class)
                    .createModule().getOrCreateWeb().contextRoot(CONTEXT_PATH).webUri(WAR_FILE).up().up()
                    .exportAsString()))
            .as(ExplodedExporter.class).exportExploded(new File(TARGET_FOLDER));
    return ShrinkWrap.create(WebArchive.class);
}
 
Example #9
Source File: LibTest.java    From appengine-tck with Apache License 2.0 6 votes vote down vote up
@Deployment
public static EnterpriseArchive getDeployment() {
    WebArchive module1 = getTckSubDeployment(1);
    module1.addClass(LibTest.class);

    // dummy module
    WebArchive module2 = getTckSubDeployment(2);

    final EnterpriseArchive ear = getEarDeployment(module1, module2);

    JavaArchive lib = ShrinkWrap.create(JavaArchive.class);
    lib.addClass(LibHelper.class);

    new LibUtils().addGaeAsLibrary(ear);
    ear.addAsLibraries(lib);

    return ear;
}
 
Example #10
Source File: TimedMethodWithElNameBeanTest.java    From metrics-cdi with Apache License 2.0 6 votes vote down vote up
@Deployment
public static Archive<?> createTestArchive() {
    return ShrinkWrap.create(EnterpriseArchive.class)
        .addAsLibraries(
            Maven.configureResolver()
                .workOffline()
                .loadPomFromFile("pom.xml")
                .resolve("io.astefanutti.metrics.cdi:metrics-cdi")
                .withTransitivity()
                .as(JavaArchive.class))
        .addAsLibrary(
            ShrinkWrap.create(JavaArchive.class)
                .addClass(TimedMethodWithElNameBean.class)
                .addClass(TimerIdBean.class)
                // FIXME: Test class must be added until ARQ-659 is fixed
                .addClass(TimedMethodWithElNameBeanTest.class)
                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"));
}
 
Example #11
Source File: TestFoxPlatformClientAsEjbModule_onePaAsLib.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
/**
 * Deployment layout
 * 
 * test-application.ear    
 *    |-- lib /
 *        |-- processes.jar
 *          |-- META-INF/processes.xml
 *          |-- org/camunda/bpm/integrationtest/testDeployProcessArchive.bpmn20.xml
 *          
 *    |-- fox-platform-client.jar  <<===============================||      
 *                                                                  ||  Class-Path reference
 *    |-- test.war (contains the test-class but also processes)     ||
 *        |-- META-INF/MANIFEST.MF =================================||
 *        |-- WEB-INF/beans.xml
 *        |-- + test classes
 *        
 */   
@Deployment
public static EnterpriseArchive onePaAsLib() {    
  
  JavaArchive processArchiveJar = ShrinkWrap.create(JavaArchive.class, "processes.jar")
    .addAsResource("org/camunda/bpm/integrationtest/testDeployProcessArchive.bpmn20.xml")
    .addAsResource("META-INF/processes.xml", "META-INF/processes.xml");
  
  JavaArchive foxPlatformClientJar = DeploymentHelper.getEjbClient();
  
  WebArchive testJar = ShrinkWrap.create(WebArchive.class, "test.war")
    .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
    .setManifest(new ByteArrayAsset(("Class-Path: " + foxPlatformClientJar.getName()+"\n").getBytes()))
    .addClass(AbstractFoxPlatformIntegrationTest.class)
    .addClass(TestFoxPlatformClientAsEjbModule_onePaAsLib.class);

  return ShrinkWrap.create(EnterpriseArchive.class, "onePaAsLib.ear")            
    .addAsLibrary(processArchiveJar)
    .addAsModule(foxPlatformClientJar)
    .addAsModule(testJar)
    .addAsLibrary(DeploymentHelper.getEngineCdi());
}
 
Example #12
Source File: TestFoxPlatformClientAsEjbModule_pasAsEjbModule.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
/**
 * This only works if EAR classloader isolation is turned OFF (which is the default in AS7)
 * 
 * test-application.ear          
 *    |-- pa.jar   
 *        |-- META-INF/processes.xml         
 *        |-- org/camunda/bpm/integrationtest/deployment/ear/paAsEjbModule-process.bpmn20.xml
 *                                               
 *    |-- fox-platform-client.jar  
 *        |-- META-INF/MANIFEST.MF 
 *                                               
 *    |-- test.war                                                  
 *        |-- META-INF/MANIFEST.MF 
 *        |-- WEB-INF/beans.xml
 *        |-- + test classes
 *        
 */   
@Deployment
public static EnterpriseArchive paAsEjbModule() throws Exception {    
  
  JavaArchive processArchive1Jar = ShrinkWrap.create(JavaArchive.class, "pa.jar")
    .addClass(EeComponent.class) // need to add at least one EE component, otherwise the jar is not detected as an EJB module by Jboss AS
    .addAsResource("org/camunda/bpm/integrationtest/deployment/ear/paAsEjbModule-process.bpmn20.xml")
    .addAsResource("org/camunda/bpm/integrationtest/deployment/ear/paAsEjbModule-pa.xml", "META-INF/processes.xml");
  
  JavaArchive foxPlatformClientJar = DeploymentHelper.getEjbClient();   
  
  WebArchive testJar = ShrinkWrap.create(WebArchive.class, "paAsEjbModule-test.war")
    .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
    .addClass(AbstractFoxPlatformIntegrationTest.class)
    .addClass(TestFoxPlatformClientAsEjbModule_pasAsEjbModule.class);

  return ShrinkWrap.create(EnterpriseArchive.class, "paAsEjbModule.ear")            
    .addAsModule(processArchive1Jar)
    .addAsModule(foxPlatformClientJar)
    .addAsModule(testJar)
    .addAsLibrary(DeploymentHelper.getEngineCdi());
}
 
Example #13
Source File: DefaultDeployment.java    From JEEventStore with MIT License 6 votes vote down vote up
public static void addDependencies(EnterpriseArchive ear, String artifact, boolean includeArtifact) {
    String lib = artifact.split(":")[1];
    try {
        File[] libs = resolve(artifact);
        for (int i = 0; i < libs.length; i++) {
            if (i == 0 && !includeArtifact)
                continue;
            File f = libs[i];
            String filename = (i > 0 ? f.getName() : lib + ".jar");
            System.out.println("Adding dependency #" + i 
                    + ": " + f.getAbsolutePath() 
                    + " as " + filename);
            ear.addAsLibrary(f, filename);
        }
    } catch (RuntimeException e) {
        // printing the error helps with testing
        System.err.println(">>>>>> ERROR: " + e + " / " + e.getCause());
        throw e;
    }
}
 
Example #14
Source File: TimedMethodScheduledBeanTest.java    From metrics-cdi with Apache License 2.0 6 votes vote down vote up
@Deployment
public static Archive<?> createTestArchive() {
    return ShrinkWrap.create(EnterpriseArchive.class)
        .addAsLibraries(
            Maven.configureResolver()
                .workOffline()
                .loadPomFromFile("pom.xml")
                .resolve("io.astefanutti.metrics.cdi:metrics-cdi")
                .withTransitivity()
                .as(JavaArchive.class))
        .addAsModule(
            ShrinkWrap.create(JavaArchive.class)
                .addClass(TimedMethodScheduledBean.class)
                .addClass(CallCounter.class)
                // FIXME: Test class must be added until ARQ-659 is fixed
                .addClass(TimedMethodScheduledBeanTest.class)
                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml"));
}
 
Example #15
Source File: OptimisticEventStoreServiceTest.java    From JEEventStore with MIT License 6 votes vote down vote up
@Deployment
public static Archive<?> deployment() {
    EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
            .addAsModule(ShrinkWrap.create(JavaArchive.class, "ejb.jar")
                    .addAsManifestResource(new File("src/test/resources/META-INF/beans.xml"))
                    .addAsManifestResource(new File(
                            "src/test/resources/META-INF/ejb-jar-OptimisticEventStoreServiceTest.xml"),
                            "ejb-jar.xml")
                    .addPackage(ChangeSet.class.getPackage())
                    .addPackage(EventStoreCommitNotifier.class.getPackage())
                    .addPackage(OptimisticEventStoreService.class.getPackage())
                    .addPackage(SyncEventStoreCommitNotifier.class.getPackage())
                    .addClass(IteratorUtils.class)
                    .addClass(MockPersistence.class)
                    .addClass(EventStorePersistence.class)
            );
    return ear;
}
 
Example #16
Source File: KnoxCLI.java    From knox with Apache License 2.0 6 votes vote down vote up
/**
 *
 * @param t - Topology to use for config
 * @return - path of shiro.ini config file.
 */
protected String getConfig(Topology t){
  File tmpDir = new File(System.getProperty("java.io.tmpdir"));
  DeploymentFactory.setGatewayServices(services);
  EnterpriseArchive archive = DeploymentFactory.createDeployment(getGatewayConfig(), t);
  File war = archive.as(ExplodedExporter.class).exportExploded(tmpDir, t.getName() + "_deploy.tmp");
  war.deleteOnExit();
  String config = war.getAbsolutePath() + "/%2F/WEB-INF/shiro.ini";
  try{
    FileUtils.forceDeleteOnExit(war);
  } catch (IOException e) {
    out.println(e.toString());
    war.deleteOnExit();
  }
  return config;
}
 
Example #17
Source File: PartialBeanWithProducerEarFileTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment
public static EnterpriseArchive deployEar()
{
    //workaround for tomee - the ear-file needs to have the same name as the war-file
    String simpleName = PartialBeanWithProducerWarFileTest.class.getSimpleName();
    String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);

    return ShrinkWrap.create(EnterpriseArchive.class, archiveName + ".ear")
            .addAsModule(PartialBeanWithProducerWarFileTest.deploy());
}
 
Example #18
Source File: JMXTest.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Deployment
public static EnterpriseArchive createDeployment() {

    final JavaArchive ejbJar = new Mvn.Builder()
            .name("jmx-ejb.jar")
            .build(JavaArchive.class)
            .addClass(JMXTest.class)
            .addClass(TestEjb.class);

    final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "jmx.ear")
            .addAsModule(ejbJar);

    return ear;
}
 
Example #19
Source File: SimpleRegistrationEarFileTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment
public static EnterpriseArchive deployEar()
{
    //workaround for tomee - the ear-file needs to have the same name as the war-file
    String simpleName = SimpleRegistrationWarFileTest.class.getSimpleName();
    String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);

    return ShrinkWrap.create(EnterpriseArchive.class, archiveName + ".ear")
            .addAsModule(SimpleRegistrationWarFileTest.deploy());
}
 
Example #20
Source File: JndiUtilsEarFileTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment
public static EnterpriseArchive deployEar()
{
    //workaround for tomee - the ear-file needs to have the same name as the war-file
    String simpleName = JndiUtilsWarFileTest.class.getSimpleName();
    String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);

    return ShrinkWrap.create(EnterpriseArchive.class, archiveName + ".ear")
            .addAsModule(JndiUtilsWarFileTest.deploy());
}
 
Example #21
Source File: TestDeployments.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
public static void addToEarManifestIfExists(EnterpriseArchive archive, String resource)
{
    URL url = TestDeployment.class.getClassLoader().getResource(resource);
    if (url != null) {
        archive.addAsManifestResource(resource);
    }
}
 
Example #22
Source File: Deployments.java    From arquillian-suite-extension with Apache License 2.0 5 votes vote down vote up
@Deployment(name = "autogenerated_web", order = 1)
@TargetsContainer("app")
public static Archive<?> generateAutogeneratedWebDeployment() {
    EnterpriseArchive ear = EarGenericBuilder.getModuleDeployment(ModuleType.WAR, "test-war-module");
    ear.delete("lib/glassfish-embedded-all-3.1.2.2.jar");
    return ear;
}
 
Example #23
Source File: BeanManagerProviderEarFileTest.java    From deltaspike with Apache License 2.0 5 votes vote down vote up
@Deployment
public static EnterpriseArchive deployEar()
{
    //workaround for tomee - the ear-file needs to have the same name as the war-file
    String simpleName = BeanManagerProviderWarFileTest.class.getSimpleName();
    String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);

    return ShrinkWrap.create(EnterpriseArchive.class, archiveName + ".ear")
            .addAsModule(BeanManagerProviderWarFileTest.deploy());
}
 
Example #24
Source File: EarGenericBuilder.java    From arquillian-suite-extension with Apache License 2.0 5 votes vote down vote up
/**
 * Dodaje główny moduł do archiwum EAR.
 *
 * @param ear archiwum EAR
 * @param type typ głównego modułu
 * @param module główny moduł
 * @param descriptorBuilder deskreptor builder dla EAR'a
 */
private static void addMainModule(EnterpriseArchive ear, ModuleType type, Archive<?> module, EarDescriptorBuilder descriptorBuilder) {
    if (type.isModule()) {
        ear.addAsModule(module);
        if (type == ModuleType.EJB) {
            descriptorBuilder.addEjb(module.getName());
        }
        if (type == ModuleType.WAR) {
            descriptorBuilder.addWeb(module.getName());
        }
    } else {
        ear.addAsLibrary(module);
    }
}
 
Example #25
Source File: CDIEarNamedCamelContextTest.java    From wildfly-camel with Apache License 2.0 5 votes vote down vote up
@Deployment(testable = false, name = "named-context.ear")
public static EnterpriseArchive createEarDeployment() {
    return ShrinkWrap.create(EnterpriseArchive.class, "named-context.ear")
        .addAsModule(ShrinkWrap.create(WebArchive.class, "named-context.war")
            .addClass(NamedCamelContextProducer.class)
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
        );
}
 
Example #26
Source File: ResourceTest.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Deployment
public static EnterpriseArchive createDeployment() {

    final JavaArchive ejbJar = ShrinkWrap.create(JavaArchive.class, "test-ejb.jar")
            .addAsResource("META-INF/resources.xml", "META-INF/resources.xml")
            .addClass(ResourceTest.class)
            .addClass(Destroyable.class)
            .addClass(Hello.class)
            .addClass(TestEjb.class);

    final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
            .addAsModule(ejbJar);

    return ear;
}
 
Example #27
Source File: TestFoxPlatformClientAsEjbModule_twoPasAsLib.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
/**
 * Deployment layout
 * 
 * test-application.ear    
 *    |-- lib /
 *        |-- processes1.jar
 *          |-- META-INF/processes.xml
 *          |-- org/camunda/bpm/integrationtest/deployment/ear/process1.bpmn20.xml
 *        |-- processes2.jar
 *          |-- META-INF/processes.xml
 *          |-- org/camunda/bpm/integrationtest/deployment/ear/process2.bpmn20.xml
 *          
 *    |-- fox-platform-client.jar  <<===============================||      
 *                                                                  ||  Class-Path reference
 *    |-- test.war (contains the test-class but also processes)     ||
 *        |-- META-INF/MANIFEST.MF =================================||
 *        |-- WEB-INF/beans.xml
 *        |-- + test classes
 *        
 */   
@Deployment
public static EnterpriseArchive twoPasAsLib() {    
  
  JavaArchive processArchive1Jar = ShrinkWrap.create(JavaArchive.class, "processes1.jar")
    .addAsResource("org/camunda/bpm/integrationtest/deployment/ear/process1.bpmn20.xml")
    .addAsResource("org/camunda/bpm/integrationtest/deployment/ear/pa1.xml", "META-INF/processes.xml");
  
  JavaArchive processArchive2Jar = ShrinkWrap.create(JavaArchive.class, "processes.jar")
    .addAsResource("org/camunda/bpm/integrationtest/deployment/ear/process2.bpmn20.xml")
    .addAsResource("org/camunda/bpm/integrationtest/deployment/ear/pa2.xml", "META-INF/processes.xml");
  
  JavaArchive foxPlatformClientJar = DeploymentHelper.getEjbClient();
  
  WebArchive testJar = ShrinkWrap.create(WebArchive.class, "client-test.war")
    .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
    .setManifest(new ByteArrayAsset(("Class-Path: " + foxPlatformClientJar.getName()+"\n").getBytes()))
    .addClass(AbstractFoxPlatformIntegrationTest.class)
    .addClass(TestFoxPlatformClientAsEjbModule_twoPasAsLib.class);

  return ShrinkWrap.create(EnterpriseArchive.class, "twoPasAsLib.ear")            
    .addAsLibrary(processArchive1Jar)
    .addAsLibrary(processArchive2Jar)
    .addAsModule(foxPlatformClientJar)
    .addAsModule(testJar)
    .addAsLibrary(DeploymentHelper.getEngineCdi());
}
 
Example #28
Source File: CDIEarQualifiedCamelContextTest.java    From wildfly-camel with Apache License 2.0 5 votes vote down vote up
@Deployment(testable = false, name = "qualified-context.ear")
public static EnterpriseArchive createEarDeployment() {
    return ShrinkWrap.create(EnterpriseArchive.class, "qualified-context.ear")
        .addAsModule(ShrinkWrap.create(WebArchive.class, "qualified-context.war")
            .addPackage(WildFlyCamelContextQualifier.class.getPackage())
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
        );
}
 
Example #29
Source File: CustomOrmXmlEarTest.java    From tomee with Apache License 2.0 5 votes vote down vote up
@Deployment(testable = false)
public static EnterpriseArchive createDeployment() {

    final JavaArchive clientJar = ShrinkWrap.create(JavaArchive.class, "client.jar")
            .addClasses(ActorDetails.class, LocalActor.class, LocalActorHome.class,
                    LocalMovie.class, LocalMovieHome.class, MovieDetails.class,
                    MoviesBusiness.class, MoviesBusinessHome.class);

    final JavaArchive ejbJar = ShrinkWrap.create(JavaArchive.class, "ejb-jar.jar")
            .addClasses(ActorBean.class, MovieBean.class, MovieDetails.class, MoviesBusinessBean.class)
            .addAsResource(new ClassLoaderAsset("org/apache/openejb/arquillian/tests/cmp/sample/custom-orm.xml"), "META-INF/custom-orm.xml")
            .addAsResource(new ClassLoaderAsset("org/apache/openejb/arquillian/tests/cmp/sample/persistence.xml"), "META-INF/persistence.xml")
            .addAsResource(new ClassLoaderAsset("org/apache/openejb/arquillian/tests/cmp/sample/openejb-jar.xml"), "META-INF/openejb-jar.xml")
            .addAsResource(new ClassLoaderAsset("org/apache/openejb/arquillian/tests/cmp/sample/ejb-jar.xml"), "META-INF/ejb-jar.xml");

    final WebArchive testWar = ShrinkWrap.create(WebArchive.class, "test.war")
            .addClass(MoviesServlet.class)
            .addAsWebInfResource(new ClassLoaderAsset("org/apache/openejb/arquillian/tests/cmp/sample/web.xml"), "web.xml");

    final EnterpriseArchive archive = ShrinkWrap.create(EnterpriseArchive.class, "test.ear")
            .addAsLibrary(clientJar)
            .addAsModule(ejbJar)
            .addAsModule(testWar);

    System.out.println(archive.toString(true));
    return archive;
}
 
Example #30
Source File: CamelEnablementImportResourceWarInEarTest.java    From wildfly-camel with Apache License 2.0 5 votes vote down vote up
@Deployment(name = "camel-import-resource-tests.ear", managed = true, testable = false)
public static EnterpriseArchive createEarDeployment() {

    WebArchive war = ShrinkWrap.create(WebArchive.class, "camel-import-resource-tests.war")
            .addClass(XmlRouteBuilder.class)
            .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
            .addAsResource("classloading/spring-camel-context.xml");

    EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "camel-import-resource-tests.ear")
            .addAsModule(war);

    return ear;
}