1
2
3
4
5
6
7
8
9
10
11 package org.mule.examples.webapp;
12
13 import org.mortbay.http.HttpContext;
14 import org.mortbay.jetty.Server;
15 import org.mortbay.jetty.servlet.WebApplicationContext;
16
17
18
19
20
21 public class JettyTestCase extends AbstractWebappTestCase
22 {
23 public static final String WEBAPP_WAR_FILE = "/home/travis/mule/examples/webapp/target/mule-examples.war";
24 public static final String WEBAPP_CONTEXT_PATH = "/mule-examples";
25 public static final int JETTY_PORT = 8090;
26
27 Server jetty = null;
28
29 protected void doSetUp() throws Exception
30 {
31 super.doSetUp();
32
33 if (jetty == null)
34 {
35
36 jetty = new Server();
37 WebApplicationContext wc = new WebApplicationContext(WEBAPP_WAR_FILE);
38 wc.setContextPath(WEBAPP_CONTEXT_PATH);
39 wc.setWAR(WEBAPP_WAR_FILE);
40 jetty.addContext(wc);
41
42
43
44
45
46 jetty.start();
47 }
48 }
49
50 protected void suitePreTearDown() throws Exception
51 {
52 super.suitePreTearDown();
53 if (jetty != null)
54 {
55 jetty.stop();
56 }
57 }
58 }