View Javadoc

1   /*
2    * $Id: ChainingRouterSessionPropertiesTestCase.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  package org.mule.test.properties;
11  
12  import org.mule.DefaultMuleMessage;
13  import org.mule.api.MuleMessage;
14  import org.mule.module.client.MuleClient;
15  import org.mule.tck.FunctionalTestCase;
16  
17  public class ChainingRouterSessionPropertiesTestCase extends FunctionalTestCase
18  {
19  
20      public static final String EXPECTED_MESSAGE = "First property value is sessionProp1Val other property value is sessionProp2Val.";
21  
22      @Override
23  	protected String getConfigResources()
24      {
25  		return "org/mule/test/properties/chaining-router-session-properties.xml";
26  	}
27  	
28  	public void testSettingPropertyAfterCallingEndpoints() throws Exception {
29  		MuleClient client = new MuleClient(muleContext);
30  		MuleMessage msg = new DefaultMuleMessage("test", muleContext);
31  		msg = client.send("vm://Service1Request", msg);
32  		assertEquals(EXPECTED_MESSAGE, msg.getPayload());
33  		
34  	}
35  	
36  	public void testSettingPropertyBeforeCallingEndpoints() throws Exception
37      {
38  		MuleClient client = new MuleClient(muleContext);
39  		MuleMessage msg = new DefaultMuleMessage("test", muleContext);
40  		msg = client.send("vm://Service2Request", msg);
41  		assertEquals(EXPECTED_MESSAGE, msg.getPayload());
42  	}
43  
44  }