View Javadoc

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