Search in sources :

Example 1 with GenericArchive

use of org.jboss.shrinkwrap.api.GenericArchive in project javaee7-samples by javaee-samples.

the class NoteResourceImplTest method createDeployment.

@Deployment
public static Archive createDeployment() {
    final GenericArchive webResources = ShrinkWrap.create(GenericArchive.class).as(ExplodedImporter.class).importDirectory("src/main/webapp").as(GenericArchive.class);
    final File[] seleniumApi = Maven.resolver().loadPomFromFile("pom.xml").resolve("org.seleniumhq.selenium:selenium-api:2.35.0").withTransitivity().asFile();
    return ShrinkWrap.create(WebArchive.class, NoteResourceImplTest.class.getSimpleName() + ".war").addClasses(Note.class, NoteApp.class, NoteResource.class, NoteResourceImpl.class).addAsResource("META-INF/persistence.xml").addAsWebInfResource("enforce-beans.xml", "jboss-all.xml").addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml").addAsLibraries(seleniumApi).merge(webResources);
}
Also used : NoteResourceImpl(com.example.rest.NoteResourceImpl) GenericArchive(org.jboss.shrinkwrap.api.GenericArchive) Note(com.example.domain.Note) NoteResource(com.example.rest.NoteResource) File(java.io.File) NoteApp(com.example.rest.NoteApp) Deployment(org.jboss.arquillian.container.test.api.Deployment)

Example 2 with GenericArchive

use of org.jboss.shrinkwrap.api.GenericArchive in project wildfly by wildfly.

the class DeploymentArchiveTestCase method createCliArchive.

private static File createCliArchive() {
    final WebArchive webArchive = ShrinkWrap.create(WebArchive.class, WEB_ARCHIVE_NAME + ".war");
    webArchive.addClass(SimpleServlet.class);
    final JavaArchive moduleArchive = ShrinkWrap.create(JavaArchive.class, MODULE_ARCHIVE);
    moduleArchive.addClass(DeploymentArchiveTestCase.class);
    final GenericArchive cliArchive = ShrinkWrap.create(GenericArchive.class, "deploymentarchive.cli");
    cliArchive.add(new StringAsset(DEPLOY_SCR), "deploy.scr");
    cliArchive.add(new StringAsset(UNDEPLOY_SCR), "undeploy.scr");
    cliArchive.add(webArchive, "/", ZipExporter.class);
    cliArchive.add(moduleArchive, "/", ZipExporter.class);
    cliArchive.add(new StringAsset(MODULE_XML), "/", "module.xml");
    final String tempDir = TestSuiteEnvironment.getTmpDir();
    final File file = new File(tempDir, "deploymentarchive.cli");
    cliArchive.as(ZipExporter.class).exportTo(file, true);
    return file;
}
Also used : StringAsset(org.jboss.shrinkwrap.api.asset.StringAsset) GenericArchive(org.jboss.shrinkwrap.api.GenericArchive) ZipExporter(org.jboss.shrinkwrap.api.exporter.ZipExporter) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) File(java.io.File) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive)

Aggregations

File (java.io.File)2 GenericArchive (org.jboss.shrinkwrap.api.GenericArchive)2 Note (com.example.domain.Note)1 NoteApp (com.example.rest.NoteApp)1 NoteResource (com.example.rest.NoteResource)1 NoteResourceImpl (com.example.rest.NoteResourceImpl)1 Deployment (org.jboss.arquillian.container.test.api.Deployment)1 StringAsset (org.jboss.shrinkwrap.api.asset.StringAsset)1 ZipExporter (org.jboss.shrinkwrap.api.exporter.ZipExporter)1 JavaArchive (org.jboss.shrinkwrap.api.spec.JavaArchive)1 WebArchive (org.jboss.shrinkwrap.api.spec.WebArchive)1