1
2
3
4
5
6
7 package org.mule.transport.jms.integration;
8
9 import org.hamcrest.core.Is;
10 import org.hamcrest.core.IsNull;
11 import org.junit.Test;
12 import org.mule.api.MuleMessage;
13 import org.mule.api.transport.PropertyScope;
14 import org.mule.module.client.MuleClient;
15
16 import static org.hamcrest.core.Is.is;
17 import static org.junit.Assert.assertThat;
18
19 public class JmsResponseElementTestCase extends AbstractJmsFunctionalTestCase
20 {
21
22 public static final String MESSAGE = "A Message";
23 public static final String EXPECTED_MODIFIED_MESSAGE = "A Message jms flow content";
24
25 @Override
26 protected String getConfigResources()
27 {
28 return "integration/jms-response-element.xml";
29 }
30
31 @Test
32 public void testOutboundEndpointResponse() throws Exception
33 {
34 MuleClient client = new MuleClient(muleContext);
35 MuleMessage response = client.send("vm://vminbound", "some message", null);
36 assertThat(response.getPayloadAsString(), is(EXPECTED_MODIFIED_MESSAGE));
37 assertThat(response.<String>getProperty("test", PropertyScope.INBOUND), Is.is("test"));
38 assertThat(response.getExceptionPayload(), IsNull.<Object>nullValue());
39 }
40
41 @Test
42 public void testInboundEndpointResponse() throws Exception
43 {
44 MuleClient client = new MuleClient(muleContext);
45 MuleMessage response = client.send("vm://vminbound2", MESSAGE, null);
46 assertThat(response.getPayloadAsString(), is(EXPECTED_MODIFIED_MESSAGE));
47 assertThat(response.getExceptionPayload(), IsNull.<Object>nullValue());
48 }
49 }