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 org.mortbay.jetty.Server;
17 import org.mortbay.jetty.servlet.Context;
18 import org.mortbay.jetty.servlet.ServletHolder;
19
20 import org.junit.runners.Parameterized;
21
22 import java.util.Arrays;
23 import java.util.Collection;
24
25 public class AjaxRPCContainerFunctionalTestCase extends AjaxRPCFunctionalTestCase
26 {
27 private Server httpServer;
28
29 public AjaxRPCContainerFunctionalTestCase(ConfigVariant variant, String configResources)
30 {
31 super(variant, configResources);
32 }
33
34 @Parameterized.Parameters
35 public static Collection<Object[]> parameters()
36 {
37 return Arrays.asList(new Object[][]{
38 {ConfigVariant.SERVICE, "ajax-container-rpc-test.xml"},
39 {ConfigVariant.FLOW, "ajax-container-rpc-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
64 if (httpServer != null)
65 {
66 httpServer.stop();
67 }
68 }
69 }