Search in sources :

Example 11 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 12 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 13 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)

Example 14 with ArchivePath

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

the class ScannerTests 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) File(java.io.File) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive)

Example 15 with ArchivePath

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

the class ScannerTest 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) VirtualFile(org.jboss.vfs.VirtualFile) File(java.io.File) JavaArchive(org.jboss.shrinkwrap.api.spec.JavaArchive)

Aggregations

ArchivePath (org.jboss.shrinkwrap.api.ArchivePath)37 File (java.io.File)33 ZipExporter (org.jboss.shrinkwrap.api.exporter.ZipExporter)29 JavaArchive (org.jboss.shrinkwrap.api.spec.JavaArchive)29 VirtualFile (org.jboss.vfs.VirtualFile)10 WebArchive (org.jboss.shrinkwrap.api.spec.WebArchive)6 ArrayList (java.util.ArrayList)4 Map (java.util.Map)4 Archive (org.jboss.shrinkwrap.api.Archive)4 Node (org.jboss.shrinkwrap.api.Node)4 MalformedURLException (java.net.MalformedURLException)3 URL (java.net.URL)3 HashMap (java.util.HashMap)3 OpenEJBException (org.apache.openejb.OpenEJBException)3 WebappAggregatedArchive (org.apache.openejb.config.WebappAggregatedArchive)3 ClassesArchive (org.apache.xbean.finder.archive.ClassesArchive)3 CompositeArchive (org.apache.xbean.finder.archive.CompositeArchive)3 FilteredArchive (org.apache.xbean.finder.archive.FilteredArchive)3 JarArchive (org.apache.xbean.finder.archive.JarArchive)3 Asset (org.jboss.shrinkwrap.api.asset.Asset)3