use of org.jboss.shrinkwrap.api.asset.StringAsset 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.api.asset.StringAsset 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.api.asset.StringAsset in project deltaspike by apache.
the class EntityManagerFactoryProducerTest method deploy.
@Deployment
public static WebArchive deploy() {
// set the dummy PersistenceProviderResolver which creates our DummyEntityManagerFactory
PersistenceProviderResolverHolder.setPersistenceProviderResolver(new TestPersistenceProviderResolver());
JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "unitDefinitionTest.jar").addPackage(ArchiveUtils.SHARED_PACKAGE).addPackage(EntityManagerFactoryProducerTest.class.getPackage().getName()).addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml").addAsResource(new StringAsset(TestPersistenceProviderResolver.class.getName()), "META-INF/services/javax.persistence.spi.PersistenceProviderResolver");
return ShrinkWrap.create(WebArchive.class).addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive()).addAsLibraries(testJar).addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
}
use of org.jboss.shrinkwrap.api.asset.StringAsset in project deltaspike by apache.
the class MethodLevelInterceptorTest method war.
@Deployment
public static WebArchive war() {
Asset beansXml = new StringAsset("<beans><interceptors><class>" + CustomInterceptorImpl.class.getName() + "</class></interceptors></beans>");
String simpleName = MethodLevelInterceptorTest.class.getSimpleName();
String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);
//don't create a completely empty web-archive
if (CdiContainerUnderTest.is(CONTAINER_WELD_2_0_0)) {
return ShrinkWrap.create(WebArchive.class, archiveName + ".war").addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive());
}
JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + ".jar").addPackage(MethodLevelInterceptorTest.class.getPackage()).addPackage(TestPartialBeanBinding.class.getPackage()).addAsManifestResource(beansXml, "beans.xml");
return ShrinkWrap.create(WebArchive.class, archiveName + ".war").addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive()).addAsLibraries(testJar).addAsWebInfResource(beansXml, "beans.xml");
}
use of org.jboss.shrinkwrap.api.asset.StringAsset in project deltaspike by apache.
the class ClassLevelInterceptorTest method war.
@Deployment
public static WebArchive war() {
Asset beansXml = new StringAsset("<beans><interceptors><class>" + CustomInterceptorImpl.class.getName() + "</class></interceptors></beans>");
String simpleName = ClassLevelInterceptorTest.class.getSimpleName();
String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);
//don't create a completely empty web-archive
if (CdiContainerUnderTest.is(CONTAINER_WELD_2_0_0)) {
return ShrinkWrap.create(WebArchive.class, archiveName + ".war").addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive());
}
JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + ".jar").addPackage(ClassLevelInterceptorTest.class.getPackage()).addPackage(TestPartialBeanBinding.class.getPackage()).addAsManifestResource(beansXml, "beans.xml");
return ShrinkWrap.create(WebArchive.class, archiveName + ".war").addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive()).addAsLibraries(testJar).addAsWebInfResource(beansXml, "beans.xml");
}
Aggregations