Search in sources :

Example 66 with StringAsset

use of org.jboss.shrinkwrap.api.asset.StringAsset in project wildfly by wildfly.

the class DomainDeployWithRuntimeNameTestCase method createWarFile.

private File createWarFile(String content) throws IOException {
    WebArchive war = ShrinkWrap.create(WebArchive.class, "HelloServlet.war");
    war.addClass(SimpleHelloWorldServlet.class);
    war.addAsWebInfResource(SimpleHelloWorldServlet.class.getPackage(), "web.xml", "web.xml");
    war.addAsWebResource(new StringAsset(content), "page.html");
    File tempFile = new File(System.getProperty("java.io.tmpdir"), "HelloServlet.war");
    new ZipExporterImpl(war).exportTo(tempFile, true);
    return tempFile;
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) SimpleHelloWorldServlet(org.jboss.as.test.integration.management.util.SimpleHelloWorldServlet) File(java.io.File) ZipExporterImpl(org.jboss.shrinkwrap.impl.base.exporter.zip.ZipExporterImpl)

Example 67 with StringAsset

use of org.jboss.shrinkwrap.api.asset.StringAsset in project wildfly by wildfly.

the class SimpleApplicationClientTestCase method deploy.

@Deployment(testable = false)
public static Archive<?> deploy() {
    final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, APP_NAME + ".ear");
    final JavaArchive lib = ShrinkWrap.create(JavaArchive.class, "lib.jar");
    lib.addClasses(AppClientSingletonRemote.class, AppClientWrapper.class, CallbackHandler.class);
    ear.addAsLibrary(lib);
    final JavaArchive ejb = ShrinkWrap.create(JavaArchive.class, MODULE_NAME + ".jar");
    ejb.addClasses(SimpleApplicationClientTestCase.class, AppClientStateSingleton.class);
    ear.addAsModule(ejb);
    final JavaArchive appClient = ShrinkWrap.create(JavaArchive.class, "client-annotation.jar");
    appClient.addClasses(AppClientMain.class);
    appClient.addAsManifestResource(new StringAsset("Main-Class: " + AppClientMain.class.getName() + "\n"), "MANIFEST.MF");
    ear.addAsModule(appClient);
    final JavaArchive clientDD = ShrinkWrap.create(JavaArchive.class, "client-dd.jar");
    clientDD.addClasses(DescriptorClientMain.class);
    clientDD.addAsManifestResource(new StringAsset("Main-Class: " + DescriptorClientMain.class.getName() + "\n"), "MANIFEST.MF");
    clientDD.addAsManifestResource(SimpleApplicationClientTestCase.class.getPackage(), "application-client.xml", "application-client.xml");
    ear.addAsModule(clientDD);
    final JavaArchive clientOverride = ShrinkWrap.create(JavaArchive.class, "client-override.jar");
    clientOverride.addClasses(DescriptorClientMain.class);
    clientOverride.addAsManifestResource(new StringAsset("Main-Class: " + DescriptorClientMain.class.getName() + "\n"), "MANIFEST.MF");
    clientOverride.addAsManifestResource(SimpleApplicationClientTestCase.class.getPackage(), "application-client.xml", "application-client.xml");
    clientOverride.addAsManifestResource(SimpleApplicationClientTestCase.class.getPackage(), "jboss-client.xml", "jboss-client.xml");
    clientOverride.addAsManifestResource(SimpleApplicationClientTestCase.class.getPackage(), "wildfly-config.xml", "wildfly-config.xml");
    ear.addAsModule(clientOverride);
    archive = ear;
    return ear;
}
Also used : EnterpriseArchive(org.jboss.shrinkwrap.api.spec.EnterpriseArchive) StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 68 with StringAsset

use of org.jboss.shrinkwrap.api.asset.StringAsset in project wildfly by wildfly.

the class EarJBossDeploymentStructureTestCase method createDeployment.

/**
     * .ear
     * |
     * |--- META-INF
     * |       |
     * |       |--- jboss-deployment-structure.xml
     * |
     * |--- ejb.jar
     * |
     * |--- available.jar
     * |
     * |--- ignored.jar
     *
     * @return
     */
@Deployment
public static Archive<?> createDeployment() {
    final EnterpriseArchive ear = ShrinkWrap.create(EnterpriseArchive.class, "deployment-structure.ear");
    ear.addAsManifestResource(EarJBossDeploymentStructureTestCase.class.getPackage(), "jboss-deployment-structure.xml", "jboss-deployment-structure.xml");
    final JavaArchive jarOne = ShrinkWrap.create(JavaArchive.class, "available.jar");
    jarOne.addClass(Available.class);
    jarOne.addAsManifestResource(new StringAsset("test resource"), METAINF_RESOURCE_TXT);
    final JavaArchive ignoredJar = ShrinkWrap.create(JavaArchive.class, "ignored.jar");
    ignoredJar.addClass(ToBeIgnored.class);
    final JavaArchive ejbJar = ShrinkWrap.create(JavaArchive.class, "ejb.jar");
    ejbJar.addClasses(ClassLoadingEJB.class, EarJBossDeploymentStructureTestCase.class);
    // grant necessary permissions
    ejbJar.addAsResource(createPermissionsXmlAsset(new RuntimePermission("getProtectionDomain")), "META-INF/jboss-permissions.xml");
    ear.addAsModule(jarOne);
    ear.addAsModule(ignoredJar);
    ear.addAsModule(ejbJar);
    return ear;
}
Also used : EnterpriseArchive(org.jboss.shrinkwrap.api.spec.EnterpriseArchive) StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 69 with StringAsset

use of org.jboss.shrinkwrap.api.asset.StringAsset in project wildfly by wildfly.

the class InfinispanInjectionTestCase method deployment.

@Deployment
public static Archive<?> deployment() {
    JavaArchive jar = ShrinkWrap.create(JavaArchive.class, "infinispan-injection.jar");
    jar.addClasses(InfinispanManagedBean.class, InfinispanInjectionTestCase.class);
    jar.addAsResource(new StringAsset("Manifest-Version: 1.0\nDependencies: org.infinispan export\n"), "META-INF/MANIFEST.MF");
    return jar;
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 70 with StringAsset

use of org.jboss.shrinkwrap.api.asset.StringAsset in project wildfly by wildfly.

the class InfinispanResourceRefTestCase method deployment.

@Deployment
public static Archive<?> deployment() {
    WebArchive war = ShrinkWrap.create(WebArchive.class, "infinispan-resource-ref.war");
    war.addClasses(InfinispanBean.class, InfinispanResourceRefTestCase.class);
    war.addAsWebInfResource(getWebXml(), "web.xml");
    war.setManifest(new StringAsset(Descriptors.create(ManifestDescriptor.class).attribute("Dependencies", "org.infinispan export").exportAsString()));
    war.addAsManifestResource(createPermissionsXmlAsset(new MBeanPermission("-#-[-]", "queryNames"), new MBeanPermission("org.infinispan.*[jboss.infinispan:*,type=Cache]", "registerMBean"), new ReflectPermission("suppressAccessChecks"), new RuntimePermission("accessDeclaredMembers"), new RuntimePermission("getClassLoader")), "permissions.xml");
    return war;
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) MBeanPermission(javax.management.MBeanPermission) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) ReflectPermission(java.lang.reflect.ReflectPermission) 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