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.usecases.http;
8   
9   import static org.junit.Assert.assertEquals;
10  import static org.junit.Assert.assertNotNull;
11  
12  import org.mule.api.MuleMessage;
13  import org.mule.api.transport.PropertyScope;
14  import org.mule.module.client.MuleClient;
15  import org.mule.tck.junit4.FunctionalTestCase;
16  import org.mule.tck.junit4.rule.DynamicPort;
17  
18  import org.junit.Rule;
19  import org.junit.Test;
20  
21  public class HttpPutTestCase extends FunctionalTestCase
22  {
23  
24      @Rule
25      public DynamicPort dynamicPort = new DynamicPort("port1");
26  
27      @Override
28      protected String getConfigResources()
29      {
30          return "org/mule/test/usecases/http/http-put-config.xml";
31      }
32  
33      @Test
34      public void testPreservesContentType() throws Exception
35      {
36          MuleClient client = new MuleClient(muleContext);
37  
38          MuleMessage message = client.send("httpRequest", "TEST", null);
39  
40          assertNotNull(message);
41          assertEquals("TEST", message.getPayloadAsString());
42          assertEquals("application/xml", message.getProperty("Content-type", PropertyScope.INBOUND));
43      }
44  }