use of org.jboss.shrinkwrap.api.ArchivePath in project wildfly by wildfly.
the class ScannerTests method buildExplicitPar.
protected File buildExplicitPar() {
String fileName = "explicitpar.par";
JavaArchive archive = ShrinkWrap.create(JavaArchive.class, fileName);
archive.addClasses(Airplane.class, Seat.class, Cat.class, Kitten.class, Distributor.class, Item.class);
ArchivePath path = ArchivePaths.create("META-INF/orm.xml");
archive.addAsResource("explicitpar/META-INF/orm.xml", path);
path = ArchivePaths.create("META-INF/persistence.xml");
archive.addAsResource("explicitpar/META-INF/persistence.xml", path);
File testPackage = new File(shrinkwrapArchiveDirectory, fileName);
archive.as(ZipExporter.class).exportTo(testPackage, true);
return testPackage;
}
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;
}
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;
}
use of org.jboss.shrinkwrap.api.ArchivePath in project wildfly by wildfly.
the class ScannerTests 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;
}
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;
}
Aggregations