View Javadoc

1   /*
2    * $Id: WSATest.java 22450 2011-07-19 08:20:41Z 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.module.cxf.wsa;
12  
13  import org.mule.example.employee.EmployeeDirectory;
14  import org.mule.example.employee.EmployeeDirectory_Service;
15  import org.mule.tck.junit4.FunctionalTestCase;
16  import org.mule.tck.junit4.rule.DynamicPort;
17  
18  import javax.xml.ws.BindingProvider;
19  import javax.xml.ws.soap.AddressingFeature;
20  
21  import org.junit.Rule;
22  import org.junit.Test;
23  
24  public class WSATest extends FunctionalTestCase
25  {
26      @Rule
27      public DynamicPort dynamicPort = new DynamicPort("port1");
28  
29      @Override
30      protected String getConfigResources()
31      {
32          return "wsa-conf.xml";
33      }
34  
35      @Test
36      public void testWSA() throws Exception
37      {
38          EmployeeDirectory_Service svc = new EmployeeDirectory_Service();
39  
40          EmployeeDirectory port = svc.getEmployeeDirectoryPort(new AddressingFeature());
41          BindingProvider bp = (BindingProvider) port;
42          bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
43              "http://localhost:" + dynamicPort.getNumber() + "/services/employee");
44      }
45  
46  }
47  
48