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