View Javadoc

1   /*
2    * $Id: HttpHeadersTestCase.java 20297 2010-11-22 18:49:18Z aperepel $
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.http.functional;
12  
13  import org.mule.api.MuleMessage;
14  import org.mule.module.client.MuleClient;
15  import org.mule.tck.DynamicPortTestCase;
16  import org.mule.transport.http.HttpConstants;
17  
18  public class HttpHeadersTestCase extends DynamicPortTestCase
19  {
20  
21      @Override
22      protected String getConfigResources()
23      {
24          return "http-headers-config.xml";
25      }
26  
27      public void testJettyHeaders() throws Exception 
28      {
29          MuleClient client = new MuleClient(muleContext);
30          MuleMessage result = client.send("clientEndpoint", null, null);
31  
32          String contentTypeProperty = result.getInboundProperty(HttpConstants.HEADER_CONTENT_TYPE);
33          assertNotNull(contentTypeProperty); 
34          assertEquals("application/x-download", contentTypeProperty);
35  
36          String contentDispositionProperty = result.getInboundProperty(HttpConstants.HEADER_CONTENT_DISPOSITION);
37          assertNotNull(contentDispositionProperty);
38          assertEquals("attachment; filename=foo.zip", contentDispositionProperty);
39      }
40  
41      @Override
42      protected int getNumPortsToFind()
43      {
44          return 2;
45      }
46  
47  }