1
2
3
4
5
6
7
8
9
10
11 package org.mule.transport.ajax;
12
13 import org.mule.transport.ajax.container.MuleAjaxServlet;
14 import org.mule.transport.servlet.MuleServletContextListener;
15
16 import java.util.Arrays;
17 import java.util.Collection;
18
19 import org.junit.runners.Parameterized.Parameters;
20 import org.mortbay.jetty.Server;
21 import org.mortbay.jetty.servlet.Context;
22 import org.mortbay.jetty.servlet.ServletHolder;
23
24 public class AjaxContainerFunctionalTestCase extends AjaxFunctionalTestCase
25 {
26
27 private Server httpServer;
28
29 public AjaxContainerFunctionalTestCase(ConfigVariant variant, String configResources)
30 {
31 super(variant, configResources);
32 }
33
34 @Parameters
35 public static Collection<Object[]> parameters()
36 {
37 return Arrays.asList(new Object[][]{
38 {ConfigVariant.SERVICE, "ajax-container-functional-test-service.xml"},
39 {ConfigVariant.FLOW, "ajax-container-functional-test-flow.xml"}
40 });
41 }
42
43 @Override
44 protected void doSetUp() throws Exception
45 {
46
47
48 httpServer = new Server(dynamicPort.getNumber());
49
50 Context c = new Context(httpServer, "/", Context.SESSIONS);
51 c.addServlet(new ServletHolder(new MuleAjaxServlet()), "/ajax/*");
52 c.addEventListener(new MuleServletContextListener(muleContext, null));
53
54 httpServer.start();
55
56 super.doSetUp();
57 }
58
59 @Override
60 protected void doTearDown() throws Exception
61 {
62 super.doTearDown();
63 if (httpServer != null)
64 {
65 httpServer.stop();
66 }
67 }
68
69 }