Search in sources :

Example 1 with BeansDescriptor

use of org.jboss.shrinkwrap.descriptor.api.beans10.BeansDescriptor in project javaee7-samples by javaee-samples.

the class ManagedScheduledBatchTest method createDeployment.

/**
     * We're just going to deploy the application as a +web archive+. Note the inclusion of the following files:
     *
     * [source,file]
     * ----
     * /META-INF/batch-jobs/myJob.xml
     * ----
     *
     * The +myJob.xml+ file is needed for running the batch definition. We are also adding an alternative bean to
     * override the created batch instance do we can track it's status and the modified batch instance.
     *
     * include::MyJobAlternative[]
     *
     * include::MyManagedScheduledBatchAlternative[]
     */
@Deployment
public static WebArchive createDeployment() {
    BeansDescriptor beansXml = Descriptors.create(BeansDescriptor.class);
    WebArchive war = ShrinkWrap.create(WebArchive.class).addClasses(MyBatchlet.class, MyJob.class, MyJobAlternative.class, MyManagedScheduledBatch.class, MyManagedScheduledBatchBean.class, MyManagedScheduledBatchAlternative.class).addAsWebInfResource(new StringAsset(beansXml.getOrCreateAlternatives().clazz(MyManagedScheduledBatchAlternative.class.getName()).up().exportAsString()), beansXml.getDescriptorName()).addAsResource("META-INF/batch-jobs/myJob.xml");
    System.out.println(war.toString(true));
    return war;
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) BeansDescriptor(org.jboss.shrinkwrap.descriptor.api.beans10.BeansDescriptor) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 2 with BeansDescriptor

use of org.jboss.shrinkwrap.descriptor.api.beans10.BeansDescriptor in project javaee7-samples by javaee-samples.

the class LockingOptimisticTest method createDeployment.

@Deployment
public static WebArchive createDeployment() {
    BeansDescriptor beansXml = Descriptors.create(BeansDescriptor.class);
    WebArchive war = ShrinkWrap.create(WebArchive.class).addPackage("org.javaee7.jpa.locking.optimistic").addAsResource("META-INF/persistence.xml").addAsResource("META-INF/load.sql").addAsWebInfResource(new StringAsset(beansXml.getOrCreateAlternatives().clazz(MovieBeanAlternative.class.getName()).up().exportAsString()), beansXml.getDescriptorName());
    System.out.println(war.toString(true));
    return war;
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) BeansDescriptor(org.jboss.shrinkwrap.descriptor.api.beans10.BeansDescriptor) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 3 with BeansDescriptor

use of org.jboss.shrinkwrap.descriptor.api.beans10.BeansDescriptor in project deltaspike by apache.

the class FutureableTest method deploy.

@Deployment
public static WebArchive deploy() {
    // create beans.xml with added interceptor
    BeansDescriptor beans = Descriptors.create(BeansDescriptor.class);
    beans.getOrCreateInterceptors().clazz(FutureableInterceptor.class.getName());
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "FutureableTest.jar").addPackage(Service.class.getPackage().getName()).addAsManifestResource(new StringAsset(beans.exportAsString()), "beans.xml");
    return ShrinkWrap.create(WebArchive.class, "FutureableTest.war").addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive()).addAsLibraries(testJar).addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) FutureableInterceptor(org.apache.deltaspike.core.impl.future.FutureableInterceptor) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) BeansDescriptor(org.jboss.shrinkwrap.descriptor.api.beans10.BeansDescriptor) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 4 with BeansDescriptor

use of org.jboss.shrinkwrap.descriptor.api.beans10.BeansDescriptor in project deltaspike by apache.

the class LockedTest method deploy.

@Deployment
public static WebArchive deploy() {
    // create beans.xml with added interceptor
    BeansDescriptor beans = Descriptors.create(BeansDescriptor.class);
    beans.getOrCreateInterceptors().clazz(LockedInterceptor.class.getName());
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "LockedTest.jar").addPackage(Service.class.getPackage().getName()).addAsManifestResource(new StringAsset(beans.exportAsString()), "beans.xml");
    return ShrinkWrap.create(WebArchive.class, "LockedTest.war").addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive()).addAsLibraries(testJar).addAsWebInfResource(new StringAsset(beans.exportAsString()), "beans.xml");
}
Also used : LockedInterceptor(org.apache.deltaspike.core.impl.lock.LockedInterceptor) StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) BeansDescriptor(org.jboss.shrinkwrap.descriptor.api.beans10.BeansDescriptor) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 5 with BeansDescriptor

use of org.jboss.shrinkwrap.descriptor.api.beans10.BeansDescriptor in project deltaspike by apache.

the class EnableInterceptorsTest method war.

@Deployment
public static WebArchive war() {
    String simpleName = EnableInterceptorsTest.class.getSimpleName();
    String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);
    // CDI 1.0/Weld 1.x needs EnableInterceptorsInterceptor
    BeansDescriptor beansWithEnablingInterceptor = Descriptors.create(BeansDescriptor.class);
    beansWithEnablingInterceptor.getOrCreateInterceptors().clazz(EnableInterceptorsInterceptor.class.getName());
    // war archive needs MyBeanInterceptor enabled
    BeansDescriptor beans = Descriptors.create(BeansDescriptor.class);
    beans.getOrCreateInterceptors().clazz(MyBeanInterceptor.class.getName());
    JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + ".jar").addPackage(EnableInterceptorsTest.class.getPackage()).addAsManifestResource(new StringAsset(beansWithEnablingInterceptor.exportAsString()), "beans.xml");
    return ShrinkWrap.create(WebArchive.class, archiveName + ".war").addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndProxyArchive()).addAsLibraries(testJar).addAsWebInfResource(new StringAsset(beans.exportAsString()), "beans.xml");
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) BeansDescriptor(org.jboss.shrinkwrap.descriptor.api.beans10.BeansDescriptor) EnableInterceptorsInterceptor(org.apache.deltaspike.proxy.util.EnableInterceptorsInterceptor) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Aggregations

Deployment (org.jboss.arquillian.container.test.api.Deployment)5 StringAsset (org.jboss.shrinkwrap.api.asset.StringAsset)5 WebArchive (org.jboss.shrinkwrap.api.spec.WebArchive)5 BeansDescriptor (org.jboss.shrinkwrap.descriptor.api.beans10.BeansDescriptor)5 JavaArchive (org.jboss.shrinkwrap.api.spec.JavaArchive)3 FutureableInterceptor (org.apache.deltaspike.core.impl.future.FutureableInterceptor)1 LockedInterceptor (org.apache.deltaspike.core.impl.lock.LockedInterceptor)1 EnableInterceptorsInterceptor (org.apache.deltaspike.proxy.util.EnableInterceptorsInterceptor)1