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;
8   
9   import static org.junit.Assert.assertNotNull;
10  
11  import org.mule.api.MuleMessage;
12  import org.mule.api.endpoint.InboundEndpoint;
13  import org.mule.module.client.MuleClient;
14  import org.mule.tck.junit4.FunctionalTestCase;
15  import org.mule.tck.junit4.rule.DynamicPort;
16  
17  import org.junit.Rule;
18  import org.junit.Test;
19  
20  public class DatabindingTestCase extends FunctionalTestCase
21  {
22  
23      @Rule
24      public DynamicPort dynamicPort = new DynamicPort("port1");
25  
26      @Override
27      protected String getConfigResources()
28      {
29          return "databinding-conf.xml";
30      }
31  
32      @Test
33      public void testEchoWsdl() throws Exception
34      {
35          MuleClient client = new MuleClient(muleContext);
36          MuleMessage result = client.request(((InboundEndpoint) client.getMuleContext()
37              .getRegistry()
38              .lookupObject("httpInbound")).getAddress()
39                                              + "?wsdl", 5000);
40          assertNotNull(result.getPayload());
41      }
42  
43      @Test
44      public void testEchoWsdlAegisBinding() throws Exception
45      {
46          MuleClient client = new MuleClient(muleContext);
47          MuleMessage result = client.request(((InboundEndpoint) client.getMuleContext()
48              .getRegistry()
49              .lookupObject("httpInboundAegis")).getAddress()
50                                              + "?wsdl", 5000);
51          assertNotNull(result.getPayload());
52      }
53  
54      @Test
55      public void testEchoWsdlSourceBinding() throws Exception
56      {
57          MuleClient client = new MuleClient(muleContext);
58          MuleMessage result = client.request(((InboundEndpoint) client.getMuleContext()
59              .getRegistry()
60              .lookupObject("httpInboundSource")).getAddress()
61                                              + "?wsdl", 5000);
62          assertNotNull(result.getPayload());
63      }
64  
65      @Test
66      public void testEchoWsdlJaxbBinding() throws Exception
67      {
68          MuleClient client = new MuleClient(muleContext);
69          MuleMessage result = client.request(((InboundEndpoint) client.getMuleContext()
70              .getRegistry()
71              .lookupObject("httpInboundJaxb")).getAddress()
72                                              + "?wsdl", 5000);
73          assertNotNull(result.getPayload());
74      }
75  
76      @Test
77      public void testEchoWsdlStaxBinding() throws Exception
78      {
79          MuleClient client = new MuleClient(muleContext);
80          MuleMessage result = client.request(((InboundEndpoint) client.getMuleContext()
81              .getRegistry()
82              .lookupObject("httpInboundStax")).getAddress()
83                                              + "?wsdl", 5000);
84          assertNotNull(result.getPayload());
85      }
86  
87      @Test
88      public void testEchoWsdlCustomBinding() throws Exception
89      {
90          MuleClient client = new MuleClient(muleContext);
91          MuleMessage result = client.request(((InboundEndpoint) client.getMuleContext()
92              .getRegistry()
93              .lookupObject("httpInboundCustom")).getAddress()
94                                              + "?wsdl", 5000);
95          assertNotNull(result.getPayload());
96      }
97  
98  }