Search in sources :

Example 1 with StringAsset

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;
}
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 StringAsset

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;
}
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 StringAsset

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");
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 4 with StringAsset

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");
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) CustomInterceptorImpl(org.apache.deltaspike.test.core.api.partialbean.shared.CustomInterceptorImpl) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) Asset(org.jboss.shrinkwrap.api.asset.Asset) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 5 with StringAsset

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");
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) CustomInterceptorImpl(org.apache.deltaspike.test.core.api.partialbean.shared.CustomInterceptorImpl) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) Asset(org.jboss.shrinkwrap.api.asset.Asset) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Aggregations

StringAsset (org.jboss.shrinkwrap.api.asset.StringAsset)306 Deployment (org.jboss.arquillian.container.test.api.Deployment)248 JavaArchive (org.jboss.shrinkwrap.api.spec.JavaArchive)175 WebArchive (org.jboss.shrinkwrap.api.spec.WebArchive)168 EnterpriseArchive (org.jboss.shrinkwrap.api.spec.EnterpriseArchive)56 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)44 ResourceAdapterArchive (org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive)34 AbstractMgmtTestBase (org.jboss.as.test.integration.management.base.AbstractMgmtTestBase)24 PropertyPermission (java.util.PropertyPermission)17 ZipExporterImpl (org.jboss.shrinkwrap.impl.base.exporter.zip.ZipExporterImpl)15 File (java.io.File)14 WebAppDescriptor (org.jboss.shrinkwrap.descriptor.api.webapp30.WebAppDescriptor)14 JMSOperations (org.jboss.as.test.integration.common.jms.JMSOperations)11 CommonCriteria (org.jboss.as.test.categories.CommonCriteria)10 Util (org.jboss.as.test.shared.integration.ejb.security.Util)10 BeforeClass (org.junit.BeforeClass)8 SocketPermission (java.net.SocketPermission)7 Properties (java.util.Properties)7 TargetsContainer (org.jboss.arquillian.container.test.api.TargetsContainer)5 ServerPermission (org.jboss.as.server.security.ServerPermission)5