use of org.jboss.shrinkwrap.api.spec.WebArchive in project javaee7-samples by javaee-samples.
the class SchemaGenScriptsExternalTest method createDeployment.
@Deployment
public static WebArchive createDeployment() throws Exception {
copyURLToFile(currentThread().getContextClassLoader().getResource("META-INF/create.sql"), new File("/tmp/create.sql"));
copyURLToFile(currentThread().getContextClassLoader().getResource("META-INF/drop.sql"), new File("/tmp/drop.sql"));
copyURLToFile(currentThread().getContextClassLoader().getResource("META-INF/load.sql"), new File("/tmp/load.sql"));
WebArchive war = ShrinkWrap.create(WebArchive.class).addPackage("org.javaee7.jpasamples.schema.gen.scripts.external").addAsResource("META-INF/persistence.xml").addAsResource("META-INF/create.sql").addAsResource("META-INF/drop.sql").addAsResource("META-INF/load.sql");
System.out.println(war.toString(true));
return war;
}
use of org.jboss.shrinkwrap.api.spec.WebArchive in project javaee7-samples by javaee-samples.
the class EntityGraphTest method createDeployment.
@Deployment
public static WebArchive createDeployment() {
WebArchive war = ShrinkWrap.create(WebArchive.class).addPackage("org.javaee7.jpa.entitygraph").addAsResource("META-INF/persistence.xml").addAsResource("META-INF/create.sql").addAsResource("META-INF/drop.sql").addAsResource("META-INF/load.sql");
System.out.println(war.toString(true));
return war;
}
use of org.jboss.shrinkwrap.api.spec.WebArchive in project javaee7-samples by javaee-samples.
the class LockingOptimisticTest method createDeployment.
@Deployment
public static WebArchive createDeployment() {
BeansDescriptor beansXml = Descriptors.create(BeansDescriptor.class);
WebArchive war = ShrinkWrap.create(WebArchive.class).addPackage("org.javaee7.jpa.locking.optimistic").addAsResource("META-INF/persistence.xml").addAsResource("META-INF/load.sql").addAsWebInfResource(new StringAsset(beansXml.getOrCreateAlternatives().clazz(MovieBeanAlternative.class.getName()).up().exportAsString()), beansXml.getDescriptorName());
System.out.println(war.toString(true));
return war;
}
use of org.jboss.shrinkwrap.api.spec.WebArchive in project hibernate-orm by hibernate.
the class PackagingTestCase 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(packageTargetDir, fileName);
archive.as(ZipExporter.class).exportTo(testPackage, true);
return testPackage;
}
use of org.jboss.shrinkwrap.api.spec.WebArchive in project deltaspike by apache.
the class EntityManagerFactoryProducerTest method deploy.
@Deployment
public static WebArchive deploy() {
// set the dummy PersistenceProviderResolver which creates our DummyEntityManagerFactory
PersistenceProviderResolverHolder.setPersistenceProviderResolver(new TestPersistenceProviderResolver());
JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "unitDefinitionTest.jar").addPackage(ArchiveUtils.SHARED_PACKAGE).addPackage(EntityManagerFactoryProducerTest.class.getPackage().getName()).addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml").addAsResource(new StringAsset(TestPersistenceProviderResolver.class.getName()), "META-INF/services/javax.persistence.spi.PersistenceProviderResolver");
return ShrinkWrap.create(WebArchive.class).addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndJpaArchive()).addAsLibraries(testJar).addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
}
Aggregations