1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.jboss.as.quickstarts.tasksrs;
18
19 import java.io.File;
20
21 import org.jboss.shrinkwrap.api.ShrinkWrap;
22 import org.jboss.shrinkwrap.api.spec.WebArchive;
23
24
25
26
27
28
29
30 public class DefaultDeployment {
31
32 private static final String WEBAPP_SRC = "src/main/webapp";
33
34 private WebArchive webArchive;
35
36 public DefaultDeployment() {
37 webArchive = ShrinkWrap.create(WebArchive.class, "test.war").addAsWebInfResource(
38 new File(WEBAPP_SRC, "WEB-INF/beans.xml"));
39 }
40
41 public DefaultDeployment withPersistence() {
42 webArchive = webArchive.addAsResource("META-INF/test-persistence.xml", "META-INF/persistence.xml").addAsWebInfResource(
43 "test-ds.xml", "test-ds.xml");
44 return this;
45 }
46
47 public DefaultDeployment withImportedData() {
48 webArchive = webArchive.addAsResource("import.sql");
49 return this;
50 }
51
52 public WebArchive getArchive() {
53 return webArchive;
54 }
55 }