View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.test.integration.security;
8   
9   import org.mule.module.spring.security.HttpFilterFunctionalTestCase;
10  import org.mule.transport.servlet.MuleReceiverServlet;
11  import org.mule.transport.servlet.jetty.util.EmbeddedJettyServer;
12  
13  public class ServletHttpFilterFunctionalTestCase extends HttpFilterFunctionalTestCase
14  {
15      public static final int HTTP_PORT = 4567;
16  
17      private EmbeddedJettyServer httpServer;
18  
19      @Override
20      protected String getConfigResources()
21      {
22          return "org/mule/test/integration/security/servlet-http-filter-test.xml";
23      }
24      
25      @Override
26      protected String getUrl()
27      {
28          return "http://localhost:" + HTTP_PORT + "/test/index.html";
29      }
30  
31      @Override
32      protected void doSetUp() throws Exception 
33      {
34          super.doSetUp();
35          
36          httpServer = new EmbeddedJettyServer(HTTP_PORT, "/", "/*", new MuleReceiverServlet(), muleContext);
37          httpServer.start();
38      }
39  
40      @Override
41      protected void doTearDown() throws Exception
42      {
43          if (httpServer != null && httpServer.isStarted())
44          {
45              httpServer.stop();
46          }
47  
48          super.doTearDown();
49      }
50      
51      protected String getNoContextErrorResponse()
52      {
53          return "Registered authentication is set to org.mule.module.spring.security.filters.http.HttpBasicAuthenticationFilter "
54                 + "but there was no security context on the session. Authentication denied on endpoint "
55                 + "servlet://test. Message payload is of type: String";
56      }
57  
58  }