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.module.cxf.builder;
8   
9   import org.mule.api.MuleException;
10  import org.mule.module.cxf.CxfInboundMessageProcessor;
11  import org.mule.module.cxf.testmodels.Echo;
12  import org.mule.tck.junit4.AbstractMuleContextTestCase;
13  
14  import javax.xml.namespace.QName;
15  
16  import org.junit.Before;
17  import org.junit.Test;
18  import static org.junit.Assert.assertEquals;
19  import static org.junit.Assert.assertNotNull;
20  
21  public class WebServiceMessageProcessorBuilderTestCase extends AbstractMuleContextTestCase
22  {
23      private WebServiceMessageProcessorBuilder serviceMessageProcessorBuilder;
24      private static final String SERVICE_NAME = "Echo";
25      private static final String NAMESPACE = "http://cxf.apache.org/";
26  
27      @Before
28      public void setUp()
29      {
30          serviceMessageProcessorBuilder = new WebServiceMessageProcessorBuilder();
31      }
32  
33      @Test
34      public void testBuildServiceAttribute() throws MuleException
35      {
36          serviceMessageProcessorBuilder.setService(SERVICE_NAME);
37          serviceMessageProcessorBuilder.setNamespace(NAMESPACE);
38          serviceMessageProcessorBuilder.setMuleContext(muleContext);
39          serviceMessageProcessorBuilder.setServiceClass(Echo.class);
40  
41          CxfInboundMessageProcessor messageProcessor = serviceMessageProcessorBuilder.build();
42          assertNotNull(messageProcessor);
43          QName serviceName = messageProcessor.getServer().getEndpoint().getService().getName();
44          assertEquals(new QName(NAMESPACE, SERVICE_NAME), serviceName);
45      }
46  
47  
48  
49  
50  }