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.endpoints;
8   
9   import org.mule.api.endpoint.EndpointBuilder;
10  import org.mule.api.endpoint.InboundEndpoint;
11  import org.mule.api.endpoint.OutboundEndpoint;
12  import org.mule.tck.junit4.FunctionalTestCase;
13  
14  import org.junit.Test;
15  
16  import static org.junit.Assert.assertEquals;
17  
18  /** Test configuration of content-type in various endpoints */
19  public class EndpointContentTypeTestCase  extends FunctionalTestCase
20  {
21      
22      @Override
23      protected String getConfigResources()
24      {
25          return "content-type-setting-endpoint-configs.xml";
26      }
27  
28      @Test
29      public void testContentType()  throws Exception
30      {
31          InboundEndpoint inbound = muleContext.getRegistry().lookupObject("inbound");
32          assertEquals("text/xml", inbound.getMimeType());
33          assertEquals("utf-8", inbound.getEncoding());
34          OutboundEndpoint outbound = muleContext.getRegistry().lookupObject("outbound");
35          assertEquals("application/json", outbound.getMimeType());
36          assertEquals("iso-8859-2", outbound.getEncoding());
37          EndpointBuilder global = muleContext.getRegistry().lookupEndpointBuilder("global");
38          InboundEndpoint created = global.buildInboundEndpoint();
39          assertEquals("application/xml", created.getMimeType());
40          assertEquals("iso-8859-1", created.getEncoding());
41      }
42  }