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.functional;
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  public class PersistentUnaddressedVmQueueTestCase extends FunctionalTestCase
19  {
20  
21      private static final int RECEIVE_TIMEOUT = 5000;
22  
23      @Override
24      protected String getConfigResources()
25      {
26          return "vm/persistent-unaddressed-vm-queue-test.xml";
27      }
28  
29      @Test
30      public void testAsynchronousDispatching() throws Exception
31      {
32          MuleClient client = new MuleClient(muleContext);
33          client.dispatch("vm://receiver1?connector=Connector1", "Test", null);
34          MuleMessage result = client.request("vm://out?connector=Connector2", RECEIVE_TIMEOUT);
35          assertNotNull(result);
36          assertEquals(result.getPayloadAsString(),"Test");
37      }
38  
39  }