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