View Javadoc

1   /*
2    * $Id: SessionPropertiesTestCase.java 22697 2011-08-18 05:21:25Z dirk.olmes $
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.functional;
12  
13  import org.mule.api.MuleMessage;
14  import org.mule.module.client.MuleClient;
15  import org.mule.tck.FunctionalTestCase;
16  
17  import java.util.Collections;
18  
19  public class SessionPropertiesTestCase extends FunctionalTestCase
20  {
21  
22      @Override
23      protected String getConfigResources()
24      {
25          return "vm/session-properties.xml";
26      }
27  
28      public void testVmToVmSessionPropertiesTestCase() throws Exception
29      {
30          final MuleClient client = new MuleClient(muleContext);
31          MuleMessage response = client.send("vm://Flow1s1", "some message", Collections.emptyMap(), 1200000);
32          assertNotNullAndNotExceptionResponse(response);
33      }
34  
35      public void testVm1ToVm2ThenVm1ToVm2SessionPropertiesTestCase() throws Exception
36      {
37          final MuleClient client = new MuleClient(muleContext);
38          MuleMessage response = client.send("vm://Flow1s2", "some message", Collections.emptyMap(), 1200000);
39          assertNotNullAndNotExceptionResponse(response);
40      }
41  
42      private void assertNotNullAndNotExceptionResponse(MuleMessage response)
43      {
44          assertNotNull(response);
45          if (response.getExceptionPayload() != null)
46          {
47              fail(response.getExceptionPayload().getException().getCause().toString());
48          }
49      }
50  
51  
52  }