View Javadoc

1   /*
2    * $Id: DynamicJmsEndpointRoutingTestCase.java 22431 2011-07-18 07:40:35Z dirk.olmes $
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.routing;
12  
13  import org.mule.api.FutureMessageResult;
14  import org.mule.api.MuleMessage;
15  import org.mule.module.client.MuleClient;
16  import org.mule.tck.AbstractServiceAndFlowTestCase;
17  
18  import java.util.Arrays;
19  import java.util.Collection;
20  
21  import org.junit.Test;
22  import org.junit.runners.Parameterized.Parameters;
23  
24  import static org.junit.Assert.assertEquals;
25  import static org.junit.Assert.assertNotNull;
26  
27  // MULE-5162
28  // FIXME: refactor since it's a copy of DynamicEndpointRoutingTestCase with a jms outbound endpoint
29  public class DynamicJmsEndpointRoutingTestCase extends AbstractServiceAndFlowTestCase
30  {
31      @Parameters
32      public static Collection<Object[]> parameters()
33      {
34          return Arrays.asList(new Object[][]{
35              {ConfigVariant.SERVICE, "dynamic-endpoint-routing-test-service.xml"},
36              {ConfigVariant.FLOW, "dynamic-endpoint-routing-test-flow.xml"}});
37      }
38  
39      public DynamicJmsEndpointRoutingTestCase(ConfigVariant variant, String configResources)
40      {
41          super(variant, configResources);
42      }
43  
44      @Test
45      public void testDynamicEndpoint() throws Exception
46      {
47          MuleClient client = new MuleClient(muleContext);
48          FutureMessageResult result = client.sendAsync("vm://inBound", "Hello,world", null, 5000);
49          MuleMessage response = result.getMessage(5000);
50          assertNotNull(response);
51          assertNotNull(response.getPayload());
52          assertEquals("step2Service", response.getPayloadAsString());
53      }
54  }