1   /*
2    * $Id: HttpMethodTestCase.java 7963 2007-08-21 08:53:15Z dirk.olmes $
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.providers.http.functional;
12  
13  import org.mule.extras.client.MuleClient;
14  import org.mule.providers.http.HttpConnector;
15  import org.mule.tck.FunctionalTestCase;
16  import org.mule.umo.UMOMessage;
17  
18  public class HttpStemTestCase extends FunctionalTestCase
19  {
20  
21      protected String getConfigResources()
22      {
23          return "http-stem-test.xml";
24      }
25  
26  
27      public void testStemMatchingHttp() throws Exception
28      {
29          MuleClient client = new MuleClient();
30  
31          UMOMessage result = client.send("http://localhost:60200/foo", "Hello World", null);
32          assertEquals("Hello World", result.getPayloadAsString());
33          assertEquals(200, result.getIntProperty(HttpConnector.HTTP_STATUS_PROPERTY, 0));
34          
35          result = client.send("http://localhost:60200/foo/bar", "Hello World", null);
36          assertEquals("Hello World", result.getPayloadAsString());
37          assertEquals(200, result.getIntProperty(HttpConnector.HTTP_STATUS_PROPERTY, 0));
38      }
39      
40      public void testStemMatchingJetty() throws Exception
41      {
42          MuleClient client = new MuleClient();
43  
44          UMOMessage result = client.send("http://localhost:60201/foo", "Hello World", null);
45          assertEquals("Hello World", result.getPayloadAsString());
46          assertEquals(200, result.getIntProperty(HttpConnector.HTTP_STATUS_PROPERTY, 0));
47          
48          result = client.send("http://localhost:60201/foo/bar", "Hello World", null);
49          assertEquals("Hello World", result.getPayloadAsString());
50          assertEquals(200, result.getIntProperty(HttpConnector.HTTP_STATUS_PROPERTY, 0));
51      }
52  }
53  
54