View Javadoc

1   /*
2    * $Id: HttpMultipleCookiesInEndpointTestCase.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.http.functional;
12  
13  import static org.junit.Assert.assertEquals;
14  import static org.junit.Assert.assertNotNull;
15  
16  import org.mule.api.MuleMessage;
17  import org.mule.module.client.MuleClient;
18  import org.mule.tck.AbstractServiceAndFlowTestCase;
19  import org.mule.tck.junit4.rule.DynamicPort;
20  
21  import java.util.Arrays;
22  import java.util.Collection;
23  
24  import org.junit.Rule;
25  import org.junit.Test;
26  import org.junit.runners.Parameterized.Parameters;
27  
28  public class HttpMultipleCookiesInEndpointTestCase extends AbstractServiceAndFlowTestCase
29  {
30  
31      @Rule
32      public DynamicPort dynamicPort = new DynamicPort("port1");
33  
34      public HttpMultipleCookiesInEndpointTestCase(ConfigVariant variant, String configResources)
35      {
36          super(variant, configResources);
37      }
38  
39      @Parameters
40      public static Collection<Object[]> parameters()
41      {
42          return Arrays.asList(new Object[][]{
43              {ConfigVariant.SERVICE, "http-multiple-cookies-on-endpoint-test-service.xml"},
44              {ConfigVariant.FLOW, "http-multiple-cookies-on-endpoint-test-flow.xml"}
45          });
46      }      
47      
48      @Test
49      public void testThatThe2CookiesAreSentAndReceivedByTheComponent() throws Exception
50      {
51          MuleClient client = new MuleClient(muleContext);
52          MuleMessage response = client.send("vm://in", "HELLO", null);
53          assertNotNull(response);
54          assertNotNull(response.getPayload());
55          assertEquals("Both Cookies Found!", response.getPayloadAsString());
56      }
57  
58  }
59  
60