You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2011/12/08 20:17:03 UTC

svn commit: r1212043 - in /cxf/branches/2.4.x-fixes: ./ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java

Author: dkulp
Date: Thu Dec  8 19:17:02 2011
New Revision: 1212043

URL: http://svn.apache.org/viewvc?rev=1212043&view=rev
Log:
Merged revisions 1212037 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1212037 | dkulp | 2011-12-08 14:11:15 -0500 (Thu, 08 Dec 2011) | 1 line
  
  [CXF-3956] Fix problem of Dispatch clients not using the HandlerResolver
........

Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
    cxf/branches/2.4.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?rev=1212043&r1=1212042&r2=1212043&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java (original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java Thu Dec  8 19:17:02 2011
@@ -644,7 +644,11 @@ public class ServiceImpl extends Service
             && clientFac.getBus() != null) {
             clientBus = clientFac.getBus();
         }
-        endpoint.getJaxwsBinding().setHandlerChain(clientFac.getHandlers());
+        List<Handler> hc = clientFac.getHandlers();
+        //CXF-3956
+        hc.addAll(handlerResolver.getHandlerChain(portInfos.get(portName)));        
+        endpoint.getJaxwsBinding().setHandlerChain(hc);
+        
         // create the client object, then initialize the endpoint features against it
         Client client = new ClientImpl(clientBus, endpoint, clientFac.getConduitSelector());
         for (AbstractFeature af : endpoint.getFeatures()) {

Modified: cxf/branches/2.4.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java?rev=1212043&r1=1212042&r2=1212043&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java (original)
+++ cxf/branches/2.4.x-fixes/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java Thu Dec  8 19:17:02 2011
@@ -58,7 +58,6 @@ import javax.xml.ws.soap.SOAPFaultExcept
 
 import org.w3c.dom.Element;
 
-import org.apache.cxf.BusException;
 import org.apache.cxf.common.util.PackageUtils;
 import org.apache.cxf.helpers.CastUtils;
 import org.apache.cxf.helpers.DOMUtils;
@@ -89,22 +88,17 @@ public class HandlerInvocationTest exten
     }
 
     @Before
-    public void setUp() throws BusException {
-        try {
-            super.createBus();
+    public void setUp() throws Exception {
+        super.createBus();
 
-            wsdl = HandlerInvocationTest.class.getResource("/wsdl/handler_test.wsdl");
-            service = new HandlerTestService(wsdl, serviceName);
-            handlerTest = service.getPort(portName, HandlerTest.class);
-            setAddress(handlerTest, "http://localhost:" + port + "/HandlerTest/SoapPort");
-        } catch (Exception ex) {
-            ex.printStackTrace();
-            fail(ex.toString());
-        }
+        wsdl = HandlerInvocationTest.class.getResource("/wsdl/handler_test.wsdl");
+        service = new HandlerTestService(wsdl, serviceName);
+        handlerTest = service.getPort(portName, HandlerTest.class);
+        setAddress(handlerTest, "http://localhost:" + port + "/HandlerTest/SoapPort");
     }
 
     @Test
-    public void testAddHandlerThroughHandlerResolverClientSide() {
+    public void testAddHandlerThroughHandlerResolverClientSide() throws Exception {
         TestHandler<LogicalMessageContext> handler1 = new TestHandler<LogicalMessageContext>(false);
         TestHandler<LogicalMessageContext> handler2 = new TestHandler<LogicalMessageContext>(false);
 
@@ -121,6 +115,16 @@ public class HandlerInvocationTest exten
         assertEquals("http://schemas.xmlsoap.org/wsdl/soap/http", bindingID);
         assertEquals(1, handler1.getHandleMessageInvoked());
         assertEquals(1, handler2.getHandleMessageInvoked());
+        
+        //CXF-3956 - check to make sure a Dispatch can also get the handlers
+        JAXBContext context = JAXBContext.newInstance(org.apache.handler_test.types.ObjectFactory.class);
+        Dispatch<Object> disp = service.createDispatch(portName, context, Service.Mode.PAYLOAD);
+        setAddress(disp, "http://localhost:" + port + "/HandlerTest/SoapPort");
+        disp.invokeOneWay(new org.apache.handler_test.types.PingOneWay());
+        
+        assertEquals(2, handler1.getHandleMessageInvoked());
+        assertEquals(2, handler2.getHandleMessageInvoked());
+
     }
 
     @Test