View Javadoc

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