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