View Javadoc

1   /*
2    * $Id: JettyHttpFunctionalTestCase.java 22518 2011-07-22 07:00:22Z claude.mamo $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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;
12  
13  import static org.junit.Assert.assertEquals;
14  
15  import org.mule.api.MuleMessage;
16  import org.mule.api.client.LocalMuleClient;
17  import org.mule.transport.http.HttpConstants;
18  import org.mule.transport.http.functional.HttpFunctionalTestCase;
19  
20  import java.util.Arrays;
21  import java.util.Collection;
22  import java.util.HashMap;
23  import java.util.Map;
24  
25  import org.junit.Test;
26  import org.junit.runners.Parameterized.Parameters;
27  
28  public class JettyHttpFunctionalTestCase extends HttpFunctionalTestCase
29  {
30  
31      public JettyHttpFunctionalTestCase(ConfigVariant variant, String configResources)
32      {
33          super(variant, configResources);
34      }
35  
36      @Parameters
37      public static Collection<Object[]> parameters()
38      {
39          return Arrays.asList(new Object[][]{
40              {ConfigVariant.SERVICE, "jetty-http-functional-test-service.xml"},
41              {ConfigVariant.FLOW, "jetty-http-functional-test-flow.xml"}
42          });
43      }      
44      
45      @Test
46      public void testNonRootUrls() throws Exception
47      {
48          LocalMuleClient client = muleContext.getClient();
49          Map props = new HashMap();
50          props.put(HttpConstants.HEADER_CONTENT_TYPE, "text/plain;charset=UTF-8");
51          MuleMessage result = client.send("anotherClientEndpoint", TEST_MESSAGE, props);
52          assertEquals(TEST_MESSAGE + " Received", result.getPayloadAsString());
53      }
54  
55  }