View Javadoc

1   /*
2    * $Id: JettyHttpBadEncodingFunctionalTestCase.java 22518 2011-07-22 07:00:22Z claude.mamo $
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.servlet.jetty.functional;
12  
13  import static org.junit.Assert.assertEquals;
14  import static org.junit.Assert.assertNotNull;
15  
16  import org.mule.DefaultMuleMessage;
17  import org.mule.api.MuleMessage;
18  import org.mule.module.client.MuleClient;
19  import org.mule.transport.http.HttpConnector;
20  
21  public class JettyHttpBadEncodingFunctionalTestCase extends JettyHttpEncodingFunctionalTestCase
22  {
23  
24      public JettyHttpBadEncodingFunctionalTestCase(ConfigVariant variant, String configResources)
25      {
26          super(variant, configResources);
27      }
28  
29      @Override
30      public void testSend() throws Exception
31      {
32          MuleClient client = new MuleClient(muleContext);
33  
34          // Send as bytes so that the StringRequestEntity isn't used. If it is used
35          // it will throw an exception and stop us from testing the server side.
36          DefaultMuleMessage msg = new DefaultMuleMessage(TEST_MESSAGE.getBytes(), muleContext);
37          msg.setEncoding("UTFF-912");
38          MuleMessage reply = client.send("clientEndpoint", msg);
39          assertNotNull(reply);
40          assertEquals("500", reply.getInboundProperty(HttpConnector.HTTP_STATUS_PROPERTY));
41          assertNotNull(reply.getExceptionPayload());
42      }
43  
44  }