View Javadoc

1   /*
2    * $Id: EndpointBridgingTestCase.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.routing;
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.Parameters;
22  
23  import static org.junit.Assert.assertEquals;
24  import static org.junit.Assert.assertNotNull;
25  
26  public class EndpointBridgingTestCase extends AbstractServiceAndFlowTestCase
27  {
28      @Parameters
29      public static Collection<Object[]> parameters()
30      {
31          return Arrays.asList(new Object[][]{
32              {ConfigVariant.SERVICE, "org/mule/test/integration/routing/bridge-mule-service.xml"},
33              {ConfigVariant.FLOW, "org/mule/test/integration/routing/bridge-mule-flow.xml"}});
34      }
35  
36      public EndpointBridgingTestCase(ConfigVariant variant, String configResources)
37      {
38          super(variant, configResources);
39      }
40  
41      @Test
42      public void testSynchronousBridging() throws Exception
43      {
44          MuleClient client = new MuleClient(muleContext);
45          MuleMessage result = client.send("vm://bridge.inbound", "test", null);
46          assertNotNull(result);
47          assertEquals("Received: test", result.getPayloadAsString());
48      }
49  }