Search in sources :

Example 1 with ArchivePath

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

the class ScannerTest method buildWar.

protected File buildWar() {
    String fileName = "war.war";
    WebArchive archive = ShrinkWrap.create(WebArchive.class, fileName);
    archive.addClasses(org.hibernate.jpa.test.pack.war.ApplicationServer.class, org.hibernate.jpa.test.pack.war.IncrementListener.class, org.hibernate.jpa.test.pack.war.Lighter.class, org.hibernate.jpa.test.pack.war.Money.class, org.hibernate.jpa.test.pack.war.Mouse.class, org.hibernate.jpa.test.pack.war.OtherIncrementListener.class, org.hibernate.jpa.test.pack.war.Version.class);
    ArchivePath path = ArchivePaths.create("WEB-INF/classes/META-INF/orm.xml");
    archive.addAsResource("war/WEB-INF/classes/META-INF/orm.xml", path);
    path = ArchivePaths.create("WEB-INF/classes/META-INF/persistence.xml");
    archive.addAsResource("war/WEB-INF/classes/META-INF/persistence.xml", path);
    path = ArchivePaths.create("WEB-INF/classes/org/hibernate/jpa/test/pack/war/Mouse.hbm.xml");
    archive.addAsResource("war/WEB-INF/classes/org/hibernate/jpa/test/pack/war/Mouse.hbm.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) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) VirtualFile(org.jboss.vfs.VirtualFile) File(java.io.File)

Example 2 with ArchivePath

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

the class ScannerTests method buildDefaultPar.

protected File buildDefaultPar() {
    final String fileName = "defaultpar.par";
    final File physicalParFile = new File(shrinkwrapArchiveDirectory, fileName);
    if (physicalParFile.exists()) {
        return physicalParFile;
    }
    JavaArchive archive = ShrinkWrap.create(JavaArchive.class, fileName);
    archive.addClasses(ApplicationServer.class, Lighter.class, Money.class, Mouse.class, OtherIncrementListener.class, IncrementListener.class, Version.class);
    ArchivePath path = ArchivePaths.create("META-INF/orm.xml");
    archive.addAsResource("defaultpar/META-INF/orm.xml", path);
    path = ArchivePaths.create("META-INF/persistence.xml");
    archive.addAsResource("defaultpar/META-INF/persistence.xml", path);
    path = ArchivePaths.create("org/hibernate/jpa/test/pack/defaultpar/Mouse.hbm.xml");
    archive.addAsResource("defaultpar/org/hibernate/jpa/test/pack/defaultpar/Mouse.hbm.xml", path);
    path = ArchivePaths.create("org/hibernate/jpa/test/pack/defaultpar/package-info.class");
    archive.addAsResource("org/hibernate/jpa/test/pack/defaultpar/package-info.class", path);
    archive.as(ZipExporter.class).exportTo(physicalParFile, true);
    return physicalParFile;
}
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 3 with ArchivePath

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

the class ScannerTests method buildExcludeHbmPar.

protected File buildExcludeHbmPar() {
    String fileName = "excludehbmpar.par";
    JavaArchive archive = ShrinkWrap.create(JavaArchive.class, fileName);
    archive.addClasses(Caipirinha.class);
    ArchivePath path = ArchivePaths.create("META-INF/orm2.xml");
    archive.addAsResource("excludehbmpar/META-INF/orm2.xml", path);
    path = ArchivePaths.create("META-INF/persistence.xml");
    archive.addAsResource("excludehbmpar/META-INF/persistence.xml", path);
    path = ArchivePaths.create("org/hibernate/jpa/test/pack/excludehbmpar/Mouse.hbm.xml");
    archive.addAsResource("excludehbmpar/org/hibernate/jpa/test/pack/excludehbmpar/Mouse.hbm.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 4 with ArchivePath

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

the class ScannerTests method buildWar.

protected File buildWar() {
    String fileName = "war.war";
    WebArchive archive = ShrinkWrap.create(WebArchive.class, fileName);
    archive.addClasses(org.hibernate.jpa.test.pack.war.ApplicationServer.class, org.hibernate.jpa.test.pack.war.IncrementListener.class, org.hibernate.jpa.test.pack.war.Lighter.class, org.hibernate.jpa.test.pack.war.Money.class, org.hibernate.jpa.test.pack.war.Mouse.class, org.hibernate.jpa.test.pack.war.OtherIncrementListener.class, org.hibernate.jpa.test.pack.war.Version.class);
    ArchivePath path = ArchivePaths.create("WEB-INF/classes/META-INF/orm.xml");
    archive.addAsResource("war/WEB-INF/classes/META-INF/orm.xml", path);
    path = ArchivePaths.create("WEB-INF/classes/META-INF/persistence.xml");
    archive.addAsResource("war/WEB-INF/classes/META-INF/persistence.xml", path);
    path = ArchivePaths.create("WEB-INF/classes/org/hibernate/jpa/test/pack/war/Mouse.hbm.xml");
    archive.addAsResource("war/WEB-INF/classes/org/hibernate/jpa/test/pack/war/Mouse.hbm.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) WebArchive(org.jboss.shrinkwrap.api.spec.WebArchive) File(java.io.File)

Example 5 with ArchivePath

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

the class ScannerTests method buildOverridenPar.

protected File buildOverridenPar() {
    String fileName = "overridenpar.jar";
    JavaArchive archive = ShrinkWrap.create(JavaArchive.class, fileName);
    archive.addClasses(org.hibernate.jpa.test.pack.overridenpar.Bug.class);
    ArchivePath path = ArchivePaths.create("META-INF/persistence.xml");
    archive.addAsResource("overridenpar/META-INF/persistence.xml", path);
    path = ArchivePaths.create("overridenpar.properties");
    archive.addAsResource("overridenpar/overridenpar.properties", 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)

Aggregations

ArchivePath (org.jboss.shrinkwrap.api.ArchivePath)60 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)18 WebArchive (org.jboss.shrinkwrap.api.spec.WebArchive)17 Map (java.util.Map)12 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 ZipImporter (org.jboss.shrinkwrap.api.importer.ZipImporter)4 MalformedURLException (java.net.MalformedURLException)3 HashMap (java.util.HashMap)3