1   /*
2    * $Id: JettyHttpFunctionalWithQueryTestCase.java 12323 2008-07-13 20:07:11Z rossmason $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.servlet.jetty.functional;
12  
13  import org.mule.api.MuleException;
14  import org.mule.api.MuleMessage;
15  import org.mule.module.client.MuleClient;
16  import org.mule.tck.FunctionalTestCase;
17  
18  import java.util.HashMap;
19  import java.util.Map;
20  
21  public class JettyHttpFunctionalWithQueryTestCase extends FunctionalTestCase
22  {
23      protected String getConfigResources()
24      {
25          return "jetty-http-functional-test-with-query.xml";
26      }
27  
28      public void testSend() throws Exception
29      {
30          MuleClient client = new MuleClient();
31          Map props = new HashMap();
32          MuleMessage result = client.send("clientEndpoint1", null, props);
33          assertEquals("boobar", result.getPayloadAsString());
34      }
35  
36      public void testSendWithParams() throws Exception
37      {
38          MuleClient client = new MuleClient();
39          Map props = new HashMap();
40          props.put("foo", "noo");
41          props.put("far", "nar");
42          MuleMessage result = client.send("clientEndpoint2", null, props);
43          assertEquals("noonar", result.getPayloadAsString());
44      }
45  
46      public void testSendWithBadParams() throws Exception
47      {
48          MuleClient client = new MuleClient();
49          Map props = new HashMap();
50          props.put("hoo", "noo");
51          props.put("har", "nar");
52          try
53          {
54              client.send("clientEndpoint2", null, props);
55              fail("Parameters on the request do not match up");
56          }
57          catch (MuleException e)
58          {
59              //exprected
60          }
61      }
62  }