cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1212037 - in /cxf/trunk: rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
Date Thu, 08 Dec 2011 19:11:16 GMT
Author: dkulp
Date: Thu Dec  8 19:11:15 2011
New Revision: 1212037

URL: http://svn.apache.org/viewvc?rev=1212037&view=rev
Log:
[CXF-3956] Fix problem of Dispatch clients not using the HandlerResolver

Modified:
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
    cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?rev=1212037&r1=1212036&r2=1212037&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java (original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java Thu Dec
 8 19:11:15 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/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java?rev=1212037&r1=1212036&r2=1212037&view=diff
==============================================================================
--- cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
(original)
+++ cxf/trunk/systests/jaxws/src/test/java/org/apache/cxf/systest/handlers/HandlerInvocationTest.java
Thu Dec  8 19:11:15 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



Mime
View raw message