View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.transport.soap.axis;
8   
9   import org.mule.DefaultMuleMessage;
10  import org.mule.RequestContext;
11  import org.mule.api.MuleEvent;
12  import org.mule.api.MuleMessage;
13  import org.mule.api.endpoint.InboundEndpoint;
14  import org.mule.module.client.MuleClient;
15  import org.mule.tck.junit4.FunctionalTestCase;
16  import org.mule.tck.junit4.rule.DynamicPort;
17  import org.mule.transport.http.HttpsConnector;
18  
19  import org.junit.Rule;
20  import org.junit.Test;
21  
22  import static org.junit.Assert.assertNotNull;
23  import static org.junit.Assert.assertTrue;
24  
25  public class AxisConnectorHttpsTestCase extends FunctionalTestCase
26  {
27  
28      @Rule
29      public DynamicPort dynamicPort = new DynamicPort("port1");
30  
31      @Override
32      protected String getConfigResources()
33      {
34          return "axis-https-connector-config.xml";
35      }
36  
37      @Test
38      public void testHttpsConnection() throws Exception{
39          MuleClient client = new MuleClient(muleContext);
40          MuleMessage m = client.send(((InboundEndpoint) client.getMuleContext().getRegistry().lookupObject("inTestUMO")).getAddress() + "?method=echo",new DefaultMuleMessage("hello", muleContext));
41          assertNotNull(m);
42  
43          // check that our https connector is being used
44          MuleEvent event = RequestContext.getEvent();
45          assertTrue (event.getEndpoint().getConnector() instanceof HttpsConnector);
46          assertTrue(event.getEndpoint().getConnector().getName().equals("myHttpsConnector"));
47      }
48  
49  }
50  
51