1   /*
2    * $Id: ComplexTypeMethodTestCase.java 7976 2007-08-21 14:26:13Z dirk.olmes $
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.providers.soap.xfire;
12  
13  import org.mule.extras.client.MuleClient;
14  import org.mule.impl.MuleMessage;
15  import org.mule.tck.FunctionalTestCase;
16  import org.mule.tck.testmodels.services.Person;
17  import org.mule.tck.testmodels.services.PersonResponse;
18  import org.mule.umo.UMOMessage;
19  
20  public class ComplexTypeMethodTestCase extends FunctionalTestCase
21  {
22      public void testSendComplexType() throws Exception
23      {
24          MuleClient client = new MuleClient();
25          UMOMessage result = client.send("xfireEndpoint", new MuleMessage(new Person("Jane", "Doe")));
26          assertNotNull(result.getPayload());
27          assertTrue(result.getPayload() instanceof PersonResponse);
28          assertTrue(((PersonResponse)result.getPayload()).getPerson().getFirstName().equalsIgnoreCase("Jane"));
29          // call this just to be sure it doesn't throw an exception
30          ((PersonResponse)result.getPayload()).getTime();
31      }
32  
33      public void testSendComplexTypeUsingWSDLXfire() throws Exception
34      {
35          MuleClient client = new MuleClient();
36          UMOMessage result = client.send("wsdlEndpoint", new MuleMessage(new Person("Jane", "Doe")));
37          assertNotNull(result.getPayload());
38          assertTrue(result.getPayload() instanceof PersonResponse);
39          assertTrue(((PersonResponse)result.getPayload()).getPerson().getFirstName().equalsIgnoreCase("Jane"));
40          // call this just to be sure it doesn't throw an exception
41          ((PersonResponse)result.getPayload()).getTime();
42      }
43  
44      protected String getConfigResources() 
45      {
46          return "xfire-complex-type-conf.xml";
47      }
48  }