1   /*
2    * $Id: VMSynchTestCase.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.transport.vm;
12  
13  import org.mule.api.MuleMessage;
14  import org.mule.module.client.MuleClient;
15  import org.mule.tck.FunctionalTestCase;
16  
17  /**
18   * Simple synch test used to study message flow.
19   */
20  public class VMSynchTestCase extends FunctionalTestCase
21  {
22  
23      protected String getConfigResources()
24      {
25          return "vm/vm-synch-test.xml";
26      }
27  
28      public void testSingleMessage() throws Exception
29      {
30          MuleClient client = new MuleClient();
31          MuleMessage response =  client.send("vm://bridge", "Message", null);
32          assertNotNull("Response is null", response);
33          assertEquals("Message Received", response.getPayload());
34      }
35  
36      public void testManyMessage() throws Exception
37      {
38          for (int i = 0; i < 1000; i++)
39          {
40              testSingleMessage();
41          }
42      }
43  
44  }