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.test.usecases.axis.clientbridge;
8   
9   import org.mule.api.MuleMessage;
10  import org.mule.module.client.MuleClient;
11  import org.mule.tck.junit4.FunctionalTestCase;
12  import org.mule.tck.junit4.rule.DynamicPort;
13  
14  import org.junit.Rule;
15  import org.junit.Test;
16  
17  import static org.junit.Assert.assertEquals;
18  import static org.junit.Assert.assertNotNull;
19  import static org.junit.Assert.assertTrue;
20  
21  public class ClientBridgeTestCase extends FunctionalTestCase
22  {
23  
24      @Rule
25      public DynamicPort dynamicPort = new DynamicPort("port1");
26  
27      @Override
28      protected String getConfigResources()
29      {
30          return "org/mule/test/usecases/axis/clientbridge/client-mule-config.xml";
31      }
32  
33      @Test
34      public void testBridgeVMToAxis() throws Exception
35      {
36          MuleClient client = new MuleClient(muleContext);
37          MuleMessage message = client.send("vm://complexRequest", new ComplexData("Foo", new Integer(84)), null);
38  
39          assertNotNull(message);
40          assertTrue(message.getPayload() instanceof ComplexData);
41          ComplexData result = (ComplexData)message.getPayload();
42          assertEquals(new Integer(84), result.getSomeInteger());
43          assertEquals("Foo", result.getSomeString());
44      }
45  
46  }