View Javadoc

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