1
2
3
4
5
6
7 package org.mule.transport.servlet.jetty.functional;
8
9 import static org.junit.Assert.assertEquals;
10 import org.mule.api.MuleMessage;
11 import org.mule.api.transport.DispatchException;
12 import org.mule.module.client.MuleClient;
13 import org.mule.tck.junit4.FunctionalTestCase;
14 import org.mule.tck.junit4.rule.DynamicPort;
15
16 import java.util.HashMap;
17 import java.util.Map;
18
19 import org.junit.Rule;
20 import org.junit.Test;
21
22 public class JettyHttpFunctionalWithQueryTestCase extends FunctionalTestCase
23 {
24
25 @Rule
26 public DynamicPort port = new DynamicPort("port1");
27
28 @Override
29 protected String getConfigResources()
30 {
31 return "jetty-http-functional-test-with-query.xml";
32 }
33
34 @Test
35 public void testSend() throws Exception
36 {
37 MuleClient client = new MuleClient(muleContext);
38 Map<String, Object> props = new HashMap<String, Object>();
39 MuleMessage result = client.send("clientEndpoint1", null, props);
40 assertEquals("boobar", result.getPayloadAsString());
41 }
42
43 @Test
44 public void testSendWithParams() throws Exception
45 {
46 MuleClient client = new MuleClient(muleContext);
47 Map<String, Object> props = new HashMap<String, Object>();
48 props.put("foo", "noo");
49 props.put("far", "nar");
50 MuleMessage result = client.send("clientEndpoint2", null, props);
51 assertEquals("noonar", result.getPayloadAsString());
52 }
53
54 @Test(expected = DispatchException.class)
55 public void testSendWithBadParams() throws Exception
56 {
57 MuleClient client = new MuleClient(muleContext);
58 Map<String, Object> props = new HashMap<String, Object>();
59 props.put("hoo", "noo");
60 props.put("har", "nar");
61
62 client.send("clientEndpoint2", null, props);
63 }
64 }