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.test.routing;
8   
9   import org.mule.api.FutureMessageResult;
10  import org.mule.api.MuleMessage;
11  import org.mule.module.client.MuleClient;
12  import org.mule.tck.junit4.FunctionalTestCase;
13  
14  import org.junit.Test;
15  
16  import static org.junit.Assert.assertEquals;
17  import static org.junit.Assert.assertNotNull;
18  
19  public class DynamicEndpointRoutingTestCase extends FunctionalTestCase
20  {
21  
22      @Override
23      protected String getConfigResources()
24      {
25          return "dynamic-endpoint-routing-test.xml";
26      }
27  
28      @Test
29      public void testDynamicEndpoint() throws Exception
30      {
31          MuleClient client = new MuleClient(muleContext);
32          FutureMessageResult result = client.sendAsync("vm://inBound", "Hello,world", null, 5000);
33          MuleMessage response = result.getMessage(5000);
34          assertNotNull(response);
35          assertNotNull(response.getPayload());
36          assertEquals("step2Service", response.getPayloadAsString());
37      }
38  }