View Javadoc

1   /*
2    * $Id$
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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.test.integration.endpoints;
12  
13  import org.mule.DefaultMuleMessage;
14  import org.mule.api.MuleMessage;
15  import org.mule.api.transformer.DataType;
16  import org.mule.tck.FunctionalTestCase;
17  
18  /**
19   *
20   */
21  public class DynamicEndpointConfigTestCase extends FunctionalTestCase
22  {
23  
24      @Override
25      protected String getConfigResources()
26      {
27          return "org/mule/test/integration/endpoints/dynamic-endpoint-config.xml";
28      }
29  
30      public void testName() throws Exception
31      {
32  
33          MuleMessage msg = new DefaultMuleMessage("Data", muleContext);
34          msg.setOutboundProperty("testProp", "testPath");
35          MuleMessage response = muleContext.getClient().send("vm://in1", msg);
36          assertNotNull(response);
37          assertNull(response.getExceptionPayload());
38          assertEquals("Data Received", response.getPayload(DataType.STRING_DATA_TYPE));
39  
40          response = muleContext.getClient().send("vm://in2", msg);
41          assertNotNull(response);
42          assertNull(response.getExceptionPayload());
43          assertEquals("Data Received", response.getPayload(DataType.STRING_DATA_TYPE));
44  
45          response = muleContext.getClient().send("vm://in3", msg);
46          assertNotNull(response);
47          assertNull(response.getExceptionPayload());
48          String payload = response.getPayload(DataType.STRING_DATA_TYPE);
49          assertEquals("Data Also Received", payload);
50      }
51  }