View Javadoc

1   /*
2    * $Id: AjaxContainerFunctionalTestCase.java 20321 2010-11-24 15:21:24Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
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  public class AjaxContainerFunctionalTestCase extends AjaxFunctionalTestCase
21  {
22      private Server httpServer;
23  
24      @Override
25      protected String getConfigResources()
26      {
27          return "ajax-container-functional-test.xml";
28      }
29  
30      @Override
31      protected void doSetUp() throws Exception
32      {
33          // FIXME DZ: we don't use the inherited SERVER_PORT here because it's not set
34          // at this point and we can't move super.doSetUp() above this
35          httpServer = new Server(getPorts().get(0));
36  
37          Context c = new Context(httpServer, "/", Context.SESSIONS);
38          c.addServlet(new ServletHolder(new MuleAjaxServlet()), "/ajax/*");
39          c.addEventListener(new MuleServletContextListener(muleContext, null)); 
40  
41          httpServer.start();
42  
43          super.doSetUp();
44  
45      }
46  
47      @Override
48      protected void doTearDown() throws Exception
49      {
50          super.doTearDown();
51          if(httpServer!=null) httpServer.stop();
52  
53      }
54  
55  
56  }