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;
}
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;
}
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");
}
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");
}
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");
}
Aggregations