View Javadoc

1   /*
2    * $Id: OutboundHttpEndpointAuthenticationTestCase.java 22421 2011-07-15 05:05:06Z dirk.olmes $
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.test.integration.security;
12  
13  import org.mule.module.client.MuleClient;
14  import org.mule.tck.AbstractServiceAndFlowTestCase;
15  
16  import java.util.Arrays;
17  import java.util.Collection;
18  
19  import org.junit.Test;
20  import org.junit.runners.Parameterized.Parameters;
21  
22  import static org.junit.Assert.assertEquals;
23  
24  /**
25   * See MULE-3851
26   */
27  public class OutboundHttpEndpointAuthenticationTestCase extends AbstractServiceAndFlowTestCase
28  {
29      @Parameters
30      public static Collection<Object[]> parameters()
31      {
32          return Arrays.asList(new Object[][]{
33              {ConfigVariant.SERVICE, "org/mule/test/integration/security/outbound-http-endpoint-authentication-test-service.xml"},
34              {ConfigVariant.FLOW, "org/mule/test/integration/security/outbound-http-endpoint-authentication-test-flow.xml"}
35          });
36      }
37  
38      public OutboundHttpEndpointAuthenticationTestCase(ConfigVariant variant, String configResources)
39      {
40          super(variant, configResources);
41      }
42  
43      @Test
44      public void testOutboundAutenticationSend() throws Exception
45      {
46          MuleClient mc = new MuleClient(muleContext);
47          assertEquals(TEST_MESSAGE, mc.send("outbound", TEST_MESSAGE, null).getPayloadAsString());
48      }
49  
50      @Test
51      public void testOutboundAutenticationDispatch() throws Exception
52      {
53          MuleClient mc = new MuleClient(muleContext);
54          mc.dispatch("outbound", TEST_MESSAGE, null);
55          assertEquals(TEST_MESSAGE, mc.request("out", RECEIVE_TIMEOUT).getPayloadAsString());
56      }
57  }