View Javadoc

1   /*
2    * $Id: DynamicEndpointWithConnectorTestCase.java 22943 2011-09-14 01:06:54Z pablo.kraan $
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.transport.jms;
12  
13  import org.mule.DefaultMuleMessage;
14  import org.mule.api.MuleMessage;
15  import org.mule.api.client.LocalMuleClient;
16  import org.mule.tck.junit4.FunctionalTestCase;
17  
18  import org.junit.Test;
19  
20  import static org.junit.Assert.assertEquals;
21  import static org.junit.Assert.assertNotNull;
22  
23  public class DynamicEndpointWithConnectorTestCase extends FunctionalTestCase
24  {
25  
26      @Override
27      protected String getConfigResources()
28      {
29          return "dynamic-endpoint-with-connector-config.xml";
30      }
31  
32      @Test
33      public void testDynamicEndpointAcceptsConnectorRef() throws Exception
34      {
35          LocalMuleClient client = muleContext.getClient();
36  
37          String testMessage = "TEST";
38          DefaultMuleMessage message = new DefaultMuleMessage(testMessage, muleContext);
39          message.setOutboundProperty("queueName", "test.out");
40  
41          MuleMessage test = client.send("vm://input", message, null);
42          assertNotNull(test);
43  
44          MuleMessage response = client.request("jms://test.out", 5000);
45          assertEquals(testMessage, response.getPayload());
46      }
47  }