1   /*
2    * $Id: HttpStemTestCase.java 10789 2008-02-12 20:04:43Z dfeist $
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.http.functional;
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.http.HttpConnector;
17  
18  public class HttpStemTestCase extends FunctionalTestCase
19  {
20  
21      protected String getConfigResources()
22      {
23          return "http-stem-test.xml";
24      }
25  
26      public void testStemMatchingHttp() throws Exception
27      {
28          MuleClient client = new MuleClient();
29          doTest(client, "http://localhost:60200/foo");
30          doTest(client, "http://localhost:60200/foo/bar");
31      }
32      
33      public void testStemMatchingJetty() throws Exception
34      {
35          MuleClient client = new MuleClient();
36          doTest(client, "http://localhost:60201/foo");
37          doTest(client, "http://localhost:60201/foo/bar");
38      }
39  
40      protected void doTest(MuleClient client, String url) throws Exception
41      {
42          MuleMessage result = client.send(url, "Hello World", null);
43          assertEquals("Hello World", result.getPayloadAsString());
44          assertEquals(200, result.getIntProperty(HttpConnector.HTTP_STATUS_PROPERTY, 0));
45      }
46  
47  }
48  
49