View Javadoc

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