View Javadoc

1   /*
2    * $Id: RequestReplyInFlowTestCase.java 22561 2011-07-26 19:59:39Z mike.schilling $
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  package org.mule.test.usecases.routing.response;
11  
12  
13  import org.mule.api.MuleMessage;
14  import org.mule.module.client.MuleClient;
15  import org.mule.tck.AbstractServiceAndFlowTestCase;
16  
17  import java.util.Arrays;
18  import java.util.Collection;
19  
20  import org.junit.Test;
21  import org.junit.runners.Parameterized;
22  
23  import static org.junit.Assert.assertNotNull;
24  import static org.junit.Assert.assertEquals;
25  /**
26   * Test the request-reply construct in flows
27   */
28  public class RequestReplyInFlowTestCase extends AbstractServiceAndFlowTestCase
29  {
30          @Parameterized.Parameters
31      public static Collection<Object[]> parameters()
32      {
33          return Arrays.asList(new Object[][]{
34              {ConfigVariant.FLOW, "org/mule/test/usecases/routing/response/request-reply-flow.xml"}});
35      }
36  
37      public RequestReplyInFlowTestCase(ConfigVariant variant, String configResources)
38      {
39          super(variant, configResources);
40      }
41  
42      @Test
43      public void testRequestReply() throws Exception
44      {
45          MuleClient client = new MuleClient(muleContext);
46          client.dispatch("vm://input", "Message went", null);
47          MuleMessage reply = client.request("vm://destination", 10000);
48          assertNotNull(reply);
49          assertEquals("Message went-out-and-back-in", reply.getPayload());
50      }
51  }