1
2
3
4
5
6
7
8
9
10
11 package org.mule.test.integration.messaging.meps;
12
13 import org.mule.api.MuleMessage;
14 import org.mule.module.client.MuleClient;
15 import org.mule.tck.FunctionalTestCase;
16 import org.mule.transport.NullPayload;
17
18 import java.util.HashMap;
19 import java.util.Map;
20
21 import org.apache.activemq.broker.BrokerService;
22
23
24 public class InOptionalOutOutOnlyJMSTestCase extends FunctionalTestCase
25 {
26 public static final long TIMEOUT = 3000;
27
28 private BrokerService broker;
29
30 @Override
31 protected void suitePreSetUp() throws Exception
32 {
33 broker = new BrokerService();
34 broker.addConnector("tcp://localhost:61616");
35 broker.start();
36 }
37
38 @Override
39 protected void suitePostTearDown() throws Exception
40 {
41 broker.stop();
42 }
43
44 protected String getConfigResources()
45 {
46 return "org/mule/test/integration/messaging/meps/pattern_In-Optional-Out_Out-Only_JMS.xml";
47 }
48
49 public void testExchange() throws Exception
50 {
51 MuleClient client = new MuleClient(muleContext);
52
53 MuleMessage result = client.send("inboundEndpoint", "some data", null);
54 assertNotNull(result);
55 assertEquals(NullPayload.getInstance(), result.getPayload());
56
57 Map<String, String> props = new HashMap<String, String>();
58 props.put("foo", "bar");
59 result = client.send("inboundEndpoint", "some data", props, 20000);
60
61
62 Thread.sleep(200);
63
64
65
66 assertEquals(0, broker.getAdminView().getTemporaryQueues().length);
67
68 assertNotNull(result);
69
70 assertEquals("foo header received", result.getPayload());
71 }
72 }
73