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;
8   
9   import static org.junit.Assert.assertEquals;
10  import static org.junit.Assert.assertFalse;
11  import static org.junit.Assert.assertNull;
12  import org.mule.api.MuleMessage;
13  import org.mule.api.client.MuleClient;
14  import org.mule.tck.junit4.FunctionalTestCase;
15  import org.mule.transport.NullPayload;
16  
17  import java.util.ArrayList;
18  import java.util.List;
19  
20  import org.junit.Test;
21  
22  public class SessionPropertiesInExceptionStrategyTestCase extends FunctionalTestCase
23  {
24  
25      @Override
26      protected String getConfigResources()
27      {
28          return "org/mule/properties/session-properties-in-exception-strategy-config.xml";
29      }
30  
31      @Test
32      public void sessionPropertyIsNotLost() throws Exception
33      {
34          MuleClient client = muleContext.getClient();
35  
36          List list = new ArrayList<String>();
37          list.add("one");
38          list.add("two");
39          list.add("three");
40  
41          MuleMessage result = client.send("vm://testInput", list, null);
42  
43          assertNull(result.getExceptionPayload());
44          assertFalse(result.getPayload() instanceof NullPayload);
45          assertEquals(list.size(), result.getSessionProperty("ErrorCount"));
46      }
47  }