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.wsrm;
8   
9   import org.mule.DefaultMuleMessage;
10  import org.mule.api.MuleMessage;
11  import org.mule.api.client.MuleClient;
12  import org.mule.client.DefaultLocalMuleClient;
13  import org.mule.tck.junit4.FunctionalTestCase;
14  import org.mule.tck.junit4.rule.DynamicPort;
15  
16  import org.junit.Rule;
17  import org.junit.Test;
18  
19  import static org.junit.Assert.assertEquals;
20  
21  public class WSRMTest extends FunctionalTestCase
22  {
23  
24      @Rule
25      public DynamicPort dynamicPort1 = new DynamicPort("port1");
26  
27      @Rule
28      public DynamicPort dynamicPort2 = new DynamicPort("port2");
29  
30      @Override
31      protected String getConfigResources()
32      {
33          return "org/mule/module/cxf/wsrm/wsrm-conf.xml";
34      }
35  
36      @Test
37      public void testAnonymous() throws Exception
38      {
39          MuleClient client = new DefaultLocalMuleClient(muleContext);
40          MuleMessage result = client.send("anonymousReplyClientEndpoint", new DefaultMuleMessage("test", muleContext));
41          assertEquals("Hello test", result.getPayloadAsString());
42      }
43  
44      @Test
45      public void testDecoupled() throws Exception
46      {
47          MuleClient client = new DefaultLocalMuleClient(muleContext);
48          MuleMessage result = client.send("decoupledClientEndpoint", new DefaultMuleMessage("test", muleContext));
49          assertEquals("Hello test", result.getPayloadAsString());
50      }
51  
52  }
53  
54