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.functional;
8   
9   import static org.junit.Assert.assertEquals;
10  import org.mule.tck.junit4.FunctionalTestCase;
11  import org.mule.tck.junit4.rule.DynamicPort;
12  import org.mule.transport.udp.util.UdpClient;
13  
14  import org.junit.Ignore;
15  import org.junit.Rule;
16  import org.junit.Test;
17  
18  public class UdpResponseTransformerTestCase extends FunctionalTestCase
19  {
20  
21      @Rule
22      public DynamicPort dynamicPort = new DynamicPort("port1");
23  
24      @Override
25      protected String getConfigResources()
26      {
27          return "udp-response-transformer-config.xml";
28      }
29  
30      @Test
31      @Ignore("MULE-6926: Flaky Test")
32      public void testResponseTransformer() throws Exception
33      {
34          UdpClient client = null;
35          try
36          {
37              client = new UdpClient(dynamicPort.getNumber());
38              byte[] response = client.send(TEST_MESSAGE);
39  
40              String expected = TEST_MESSAGE + " In Out Out2";
41              String result = new String(response).trim();
42              assertEquals(expected, result);
43          }
44          finally
45          {
46              if (client != null)
47              {
48                  client.shutdown();
49              }
50          }
51      }
52  }