1   /*
2    * $Id: VMRequestorTestCase.java 11576 2008-04-15 01:08:06Z rossmason $
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  package org.mule.transport.vm.functional;
11  
12  import org.mule.tck.FunctionalTestCase;
13  import org.mule.module.client.MuleClient;
14  import org.mule.api.MuleMessage;
15  import org.mule.api.MuleException;
16  
17  public class VMRequestorTestCase extends FunctionalTestCase
18  {
19      protected String getConfigResources()
20          {
21              return "vm/vm-functional-test.xml";
22          }
23  
24      public void testRequestorWithUpdateonMessage() throws Exception
25      {
26          final MuleClient client = new MuleClient();
27          Thread t = new Thread(new Runnable() {
28              public void run()
29              {
30                  try
31                  {
32                      client.send("vm://in", "test", null);
33                  }
34                  catch (MuleException e)
35                  {
36                      fail("failed to dispatch event: " + e);
37                      e.printStackTrace();
38                  }
39              }
40          }, "test-thread");
41  
42          t.start();
43          MuleMessage result = client.request("vm://out", 3000L);
44  
45          assertNotNull(result);
46  
47          //This would fail if the owner thread info was not updated
48          result.setProperty("foo", "bar");
49      }
50  }