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 2010/05/25 20:34:21 UTC

svn commit: r948161 - in /cxf/branches/2.2.x-fixes: ./ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/

Author: dkulp
Date: Tue May 25 18:34:21 2010
New Revision: 948161

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

........
  r947948 | ema | 2010-05-25 03:15:51 -0400 (Tue, 25 May 2010) | 1 line
  
  [CXF-2822]:Added the interceptors in ClientFactoryBean to ClientIml. This made <jaxws:client> configuration work for dispatch client
........

Added:
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/bus-dispatch.xml
      - copied unchanged from r947948, cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/bus-dispatch.xml
Modified:
    cxf/branches/2.2.x-fixes/   (props changed)
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
    cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/DispatchTest.java

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

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?rev=948161&r1=948160&r2=948161&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java Tue May 25 18:34:21 2010
@@ -616,7 +616,8 @@ public class ServiceImpl extends Service
         for (AbstractFeature af : endpoint.getFeatures()) {
             af.initialize(client, bus);
         }
-        
+        //CXF-2822
+        initIntercepors(client, clientFac);
         if (executor != null) {
             client.getEndpoint().setExecutor(executor);
         }
@@ -664,6 +665,8 @@ public class ServiceImpl extends Service
         for (AbstractFeature af : clientFac.getFeatures()) {
             af.initialize(client, bus);
         }
+        //CXF-2822
+        initIntercepors(client, clientFac);
         if (executor != null) {
             client.getEndpoint().setExecutor(executor);
         }
@@ -691,4 +694,11 @@ public class ServiceImpl extends Service
                        features);
 
     }
+    
+    private void initIntercepors(Client client, JaxWsClientFactoryBean clientFact) {
+        client.getInInterceptors().addAll(clientFact.getInInterceptors());
+        client.getOutInterceptors().addAll(clientFact.getOutInterceptors());
+        client.getInFaultInterceptors().addAll(clientFact.getInFaultInterceptors());
+        client.getOutFaultInterceptors().addAll(clientFact.getOutFaultInterceptors());
+    }
 }

Modified: cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/DispatchTest.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/DispatchTest.java?rev=948161&r1=948160&r2=948161&view=diff
==============================================================================
--- cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/DispatchTest.java (original)
+++ cxf/branches/2.2.x-fixes/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/dispatch/DispatchTest.java Tue May 25 18:34:21 2010
@@ -19,6 +19,7 @@
 package org.apache.cxf.jaxws.dispatch;
 
 import java.net.URL;
+import java.util.List;
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.namespace.QName;
@@ -32,10 +33,16 @@ import javax.xml.ws.soap.SOAPFaultExcept
 
 import org.w3c.dom.Document;
 
+import org.apache.cxf.Bus;
+import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
 import org.apache.cxf.jaxws.AbstractJaxWsTest;
+import org.apache.cxf.jaxws.DispatchImpl;
 import org.apache.cxf.jaxws.MessageReplayObserver;
 import org.apache.cxf.jaxws.ServiceImpl;
+import org.apache.cxf.message.Message;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.Destination;
 import org.apache.hello_world_soap_http.SOAPService;
@@ -136,4 +143,25 @@ public class DispatchTest extends Abstra
         
         fail("SOAPFaultException was not thrown");
     }
+    
+    @Test
+    // CXF-2822
+    public void testInterceptorsConfiguration() throws Exception {
+        String cfgFile = "org/apache/cxf/jaxws/dispatch/bus-dispatch.xml";
+        Bus bus = new SpringBusFactory().createBus(cfgFile, true);
+        ServiceImpl service = new ServiceImpl(bus, getClass().getResource("/wsdl/hello_world.wsdl"),
+                                              serviceName, null);
+
+        Dispatch<Source> disp = service.createDispatch(portName, Source.class, Service.Mode.MESSAGE);
+        List<Interceptor<? extends Message>> interceptors = ((DispatchImpl)disp).getClient()
+            .getInInterceptors();
+        boolean exists = false;
+        for (Interceptor interceptor : interceptors) {
+            if (interceptor instanceof LoggingInInterceptor) {
+                exists = true;
+            }
+        }
+        assertTrue("The LoggingInInterceptor is not configured to dispatch client", exists);
+    }
+    
 }