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.transport.udp;
8   
9   import org.mule.api.MuleMessage;
10  import org.mule.tck.junit4.FunctionalTestCase;
11  import org.mule.tck.junit4.rule.DynamicPort;
12  
13  import org.junit.Rule;
14  import org.junit.Test;
15  
16  import static org.junit.Assert.assertEquals;
17  
18  public class UdpRequestResponseTestCase extends FunctionalTestCase
19  {
20      private static final String EXPECTED = TEST_MESSAGE + " received";
21  
22      @Rule
23      public DynamicPort dynamicPort = new DynamicPort("port1");
24  
25      @Override
26      protected String getConfigResources()
27      {
28          return "udp-request-response.xml";
29      }
30  
31      @Test
32      public void testRequestResponse() throws Exception
33      {
34          MuleMessage response = muleContext.getClient().send("vm://fromTest", TEST_MESSAGE, null);
35          assertEquals(EXPECTED, response.getPayloadAsString());
36      }
37  }