1   /*
2    * $Id: BridgeMule2540TestCase.java 10789 2008-02-12 20:04:43Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.issues;
12  
13  import org.mule.api.MuleMessage;
14  import org.mule.module.client.MuleClient;
15  import org.mule.tck.FunctionalTestCase;
16  
17  public class BridgeMule2540TestCase extends FunctionalTestCase
18  {
19      
20      private static final int RECEIVE_TIMEOUT = 5000;
21  
22      protected String getConfigResources()
23      {
24          return "issues/bridge-mule-2540-test.xml";
25      }
26  
27      public void testBridge() throws Exception
28      {
29          String input = "Test message";
30          String[] output = {"Test", "message"};
31          MuleClient client = new MuleClient();
32          client.dispatch("vm://receiver", input, null);
33          MuleMessage result = client.request("vm://out", RECEIVE_TIMEOUT);
34          assertNotNull(result);
35          assertNotNull(result.getPayload());
36          assertNull(result.getExceptionPayload());
37          String[] payload = (String[]) result.getPayload();
38          assertEquals(output.length, payload.length);
39          for (int i = 0; i < output.length; i++)
40          {
41              assertEquals(output[i], payload[i]);
42          }
43      }
44  
45  }