Search in sources :

Example 41 with ArchivePath

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

the class ScannerTests method buildExternalJar.

protected File buildExternalJar() {
    String fileName = "externaljar.jar";
    JavaArchive archive = ShrinkWrap.create(JavaArchive.class, fileName);
    archive.addClasses(Scooter.class);
    ArchivePath path = ArchivePaths.create("META-INF/orm.xml");
    archive.addAsResource("externaljar/META-INF/orm.xml", path);
    File testPackage = new File(shrinkwrapArchiveDirectory, fileName);
    archive.as(ZipExporter.class).exportTo(testPackage, true);
    return testPackage;
}
Also used : ArchivePath(org.jboss.shrinkwrap.api.ArchivePath) ZipExporter(org.jboss.shrinkwrap.api.exporter.ZipExporter) File(java.io.File) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive)

Example 42 with ArchivePath

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

the class ScannerTests method buildSpacePar.

protected File buildSpacePar() {
    String fileName = "space par.par";
    JavaArchive archive = ShrinkWrap.create(JavaArchive.class, fileName);
    archive.addClasses(Bug.class);
    ArchivePath path = ArchivePaths.create("META-INF/persistence.xml");
    archive.addAsResource("space par/META-INF/persistence.xml", path);
    File testPackage = new File(shrinkwrapArchiveDirectory, fileName);
    archive.as(ZipExporter.class).exportTo(testPackage, true);
    return testPackage;
}
Also used : ArchivePath(org.jboss.shrinkwrap.api.ArchivePath) ZipExporter(org.jboss.shrinkwrap.api.exporter.ZipExporter) File(java.io.File) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive)

Example 43 with ArchivePath

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

the class ScannerTest method buildExplodedPar.

protected File buildExplodedPar() {
    String fileName = "explodedpar";
    JavaArchive archive = ShrinkWrap.create(JavaArchive.class, fileName);
    archive.addClasses(Elephant.class, Carpet.class);
    ArchivePath path = ArchivePaths.create("META-INF/persistence.xml");
    archive.addAsResource("explodedpar/META-INF/persistence.xml", path);
    path = ArchivePaths.create("org/hibernate/jpa/test/pack/explodedpar/Elephant.hbm.xml");
    archive.addAsResource("explodedpar/org/hibernate/jpa/test/pack/explodedpar/Elephant.hbm.xml", path);
    path = ArchivePaths.create("org/hibernate/jpa/test/pack/explodedpar/package-info.class");
    archive.addAsResource("org/hibernate/jpa/test/pack/explodedpar/package-info.class", path);
    File testPackage = new File(shrinkwrapArchiveDirectory, fileName);
    archive.as(ExplodedExporter.class).exportExploded(shrinkwrapArchiveDirectory);
    return testPackage;
}
Also used : ArchivePath(org.jboss.shrinkwrap.api.ArchivePath) ExplodedExporter(org.jboss.shrinkwrap.api.exporter.ExplodedExporter) VirtualFile(org.jboss.vfs.VirtualFile) File(java.io.File) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive)

Example 44 with ArchivePath

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

the class ScannerTest method buildExternalJar.

protected File buildExternalJar() {
    String fileName = "externaljar.jar";
    JavaArchive archive = ShrinkWrap.create(JavaArchive.class, fileName);
    archive.addClasses(Scooter.class);
    ArchivePath path = ArchivePaths.create("META-INF/orm.xml");
    archive.addAsResource("externaljar/META-INF/orm.xml", path);
    File testPackage = new File(shrinkwrapArchiveDirectory, fileName);
    archive.as(ZipExporter.class).exportTo(testPackage, true);
    return testPackage;
}
Also used : ArchivePath(org.jboss.shrinkwrap.api.ArchivePath) ZipExporter(org.jboss.shrinkwrap.api.exporter.ZipExporter) VirtualFile(org.jboss.vfs.VirtualFile) File(java.io.File) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive)

Example 45 with ArchivePath

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

the class ScannerTest method buildLargeJar.

protected File buildLargeJar() {
    final String fileName = "large.jar";
    final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, fileName);
    // Build a large jar by adding a lorem ipsum file repeatedly.
    final File loremipsumTxtFile = new File(testSrcDirectory, "resources/org/hibernate/jpa/test/packaging/loremipsum.txt");
    for (int i = 0; i < 100; i++) {
        ArchivePath path = ArchivePaths.create("META-INF/file" + i);
        archive.addAsResource(loremipsumTxtFile, path);
    }
    File testPackage = new File(shrinkwrapArchiveDirectory, fileName);
    archive.as(ZipExporter.class).exportTo(testPackage, true);
    return testPackage;
}
Also used : ArchivePath(org.jboss.shrinkwrap.api.ArchivePath) ZipExporter(org.jboss.shrinkwrap.api.exporter.ZipExporter) VirtualFile(org.jboss.vfs.VirtualFile) File(java.io.File) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive)

Aggregations

ArchivePath (org.jboss.shrinkwrap.api.ArchivePath)61 File (java.io.File)39 JavaArchive (org.jboss.shrinkwrap.api.spec.JavaArchive)33 ZipExporter (org.jboss.shrinkwrap.api.exporter.ZipExporter)31 Node (org.jboss.shrinkwrap.api.Node)19 WebArchive (org.jboss.shrinkwrap.api.spec.WebArchive)17 Map (java.util.Map)13 VirtualFile (org.jboss.vfs.VirtualFile)10 IOException (java.io.IOException)8 ArrayList (java.util.ArrayList)7 Archive (org.jboss.shrinkwrap.api.Archive)7 Deployment (org.jboss.arquillian.container.test.api.Deployment)6 Asset (org.jboss.shrinkwrap.api.asset.Asset)6 URL (java.net.URL)5 ArchiveAsset (org.jboss.shrinkwrap.api.asset.ArchiveAsset)5 JARArchive (org.wildfly.swarm.spi.api.JARArchive)5 Path (java.nio.file.Path)4 HashMap (java.util.HashMap)4 ZipImporter (org.jboss.shrinkwrap.api.importer.ZipImporter)4 MalformedURLException (java.net.MalformedURLException)3