View Javadoc

1   /*
2    * $Id: ServletHttpFilterFunctionalTestCase.java 19191 2010-08-25 21:05:23Z tcarlson $
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.test.integration.security;
12  
13  import org.mule.module.spring.security.HttpFilterFunctionalTestCase;
14  import org.mule.transport.servlet.MuleReceiverServlet;
15  import org.mule.transport.servlet.jetty.util.EmbeddedJettyServer;
16  
17  public class ServletHttpFilterFunctionalTestCase extends HttpFilterFunctionalTestCase
18  {
19      public static final int HTTP_PORT = 4567;
20  
21      private EmbeddedJettyServer httpServer;
22  
23      @Override
24      protected String getConfigResources()
25      {
26          return "org/mule/test/integration/security/servlet-http-filter-test.xml";
27      }
28      
29      @Override
30      protected String getUrl()
31      {
32          return "http://localhost:" + HTTP_PORT + "/test/index.html";
33      }
34  
35      @Override
36      protected void doSetUp() throws Exception 
37      {
38          super.doSetUp();
39          
40          httpServer = new EmbeddedJettyServer(HTTP_PORT, "/", "/*", new MuleReceiverServlet(), muleContext);
41          httpServer.start();
42      }
43  
44      @Override
45      protected void doTearDown() throws Exception
46      {
47          if (httpServer != null && httpServer.isStarted())
48          {
49              httpServer.stop();
50          }
51  
52          super.doTearDown();
53      }
54      
55      protected String getNoContextErrorResponse()
56      {
57          return "Registered authentication is set to org.mule.module.spring.security.filters.http.HttpBasicAuthenticationFilter "
58                 + "but there was no security context on the session. Authentication denied on endpoint "
59                 + "servlet://test. Message payload is of type: String";
60      }
61  
62  }