View Javadoc

1   /*
2    * $Id$
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.functional;
12  
13  import org.mule.api.endpoint.InboundEndpoint;
14  import org.mule.api.processor.MessageProcessor;
15  import org.mule.api.service.Service;
16  import org.mule.endpoint.DefaultInboundEndpoint;
17  import org.mule.module.cxf.CxfInboundMessageProcessor;
18  import org.mule.module.cxf.config.FlowConfiguringMessageProcessor;
19  import org.mule.service.ServiceCompositeMessageSource;
20  import org.mule.tck.FunctionalTestCase;
21  
22  import java.util.List;
23  
24  import org.apache.cxf.endpoint.Server;
25  import org.apache.cxf.service.model.EndpointInfo;
26  
27  public class EndpointBindsToCorrectWdslPortTestCase extends FunctionalTestCase
28  {
29  
30      @Override
31      protected String getConfigResources()
32      {
33          return "org/mule/module/cxf/functional/endpoint-binds-to-correct-wdsl-port.xml";
34      }
35  
36      public void testThatTheCorrectSoapPortIsChosen() throws Exception
37      {
38          final Service service = muleContext.getRegistry().lookupService("CXFProxyService");
39          ServiceCompositeMessageSource messageSource = (ServiceCompositeMessageSource) service.getMessageSource();
40  
41          List<InboundEndpoint> endpoints = messageSource.getEndpoints();
42          DefaultInboundEndpoint inboundEndpoint = (DefaultInboundEndpoint) endpoints.get(0);
43          List<MessageProcessor> processors = inboundEndpoint.getMessageProcessors();
44          FlowConfiguringMessageProcessor wrapper = (FlowConfiguringMessageProcessor) processors.get(0);
45          CxfInboundMessageProcessor cxfProcessor = (CxfInboundMessageProcessor) wrapper.getWrappedMessageProcessor();
46          Server server = cxfProcessor.getServer();
47          EndpointInfo endpointInfo = server.getEndpoint().getEndpointInfo();
48  
49          assertEquals(
50              "The local part of the endpoing name must be the one supplied as the endpointName parameter on the cxf:inbound-endpoint",
51              "ListsSoap", endpointInfo.getName().getLocalPart());
52      }
53  }