View Javadoc

1   /*
2    * $Id: Http10TestCase.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.module.cxf;
12  
13  import org.mule.api.MuleMessage;
14  import org.mule.module.client.MuleClient;
15  import org.mule.tck.FunctionalTestCase;
16  import org.mule.transport.http.HttpConstants;
17  
18  import java.util.HashMap;
19  import java.util.Map;
20  
21  public class Http10TestCase extends FunctionalTestCase
22  {
23      public Http10TestCase()
24      {
25          setDisposeManagerPerSuite(true);
26      }
27  
28      public void testHttp10TransformerNotOnProtocol() throws Exception
29      {
30          MuleClient client = new MuleClient(muleContext);
31          Map<String,String> props = new HashMap<String, String>();
32          
33          MuleMessage result = client.send("cxfOutbound", "Dan", props);
34          assertEquals("Hello Dan", result.getPayload());
35          
36          result = client.request("vm://out", 1000);
37          assertFalse("chunked".equals(result.getOutboundProperty(HttpConstants.HEADER_TRANSFER_ENCODING)));
38      }
39  
40      public void testHttp10TransformerOnProtocol() throws Exception
41      {
42          MuleClient client = new MuleClient(muleContext);
43          Map<String,String> props = new HashMap<String, String>();
44          
45          MuleMessage result = client.send("cxfOutbound2", "Dan", props);
46          assertEquals("Hello Dan", result.getPayload());
47          
48          result = client.request("vm://out", 1000);
49          assertFalse("chunked".equals(result.getOutboundProperty(HttpConstants.HEADER_TRANSFER_ENCODING)));
50      }
51  
52      protected String getConfigResources()
53      {
54          return "http-10-conf.xml";
55      }
56  }