View Javadoc

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