View Javadoc

1   /*
2    * $Id: BindingInOnlyInOutOutOnlyTestCase.java 22422 2011-07-15 08:22:16Z 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.integration.messaging.meps;
12  
13  import org.mule.api.MuleMessage;
14  import org.mule.api.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.Parameters;
22  
23  import static org.junit.Assert.assertEquals;
24  import static org.junit.Assert.assertNotNull;
25  
26  //START SNIPPET: full-class
27  public class BindingInOnlyInOutOutOnlyTestCase extends AbstractServiceAndFlowTestCase
28  {
29      public static final long TIMEOUT = 3000;
30  
31      @Parameters
32      public static Collection<Object[]> parameters()
33      {
34          return Arrays.asList(new Object[][] {
35              {ConfigVariant.SERVICE,
36                  "org/mule/test/integration/messaging/meps/pattern_binding-In-Only_In-Out_Out-Only-service.xml"},
37              {ConfigVariant.FLOW,
38                  "org/mule/test/integration/messaging/meps/pattern_binding-In-Only_In-Out_Out-Only-flow.xml"}});
39      }
40  
41      public BindingInOnlyInOutOutOnlyTestCase(ConfigVariant variant, String configResources)
42      {
43          super(variant, configResources);
44      }
45  
46      @Test
47      public void testExchange() throws Exception
48      {
49          MuleClient client = muleContext.getClient();
50  
51          client.dispatch("inboundEndpoint", new int[]{1, 2, 3, 4, 5}, null);
52  
53          MuleMessage result = client.request("receivedEndpoint", TIMEOUT);
54          assertNotNull(result);
55          assertEquals("Total: 15", result.getPayloadAsString());
56      }
57  }