Updated Branches:
  refs/heads/camel-2.11.x 42659f8e7 -> 80d24a15e
  refs/heads/camel-2.12.x 72807c486 -> 61e4948ce
  refs/heads/master c0c130072 -> b99fd1e44


CAMEL-6696 camel-cxf should not setup the holder and wrapperClass interceptors 
in CXF_MESSAGE data format


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b99fd1e4
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b99fd1e4
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b99fd1e4

Branch: refs/heads/master
Commit: b99fd1e449f57012335de5a7e4759579c87c1aee
Parents: c0c1300
Author: Willem Jiang <ningji...@apache.org>
Authored: Tue Sep 3 09:33:45 2013 +0800
Committer: Willem Jiang <ningji...@apache.org>
Committed: Tue Sep 3 09:34:46 2013 +0800

----------------------------------------------------------------------
 .../feature/CXFMessageDataFormatFeature.java    | 23 ++++++
 .../mtom/CxfMtomRouterCxfMessageModeTest.java   | 46 ++++++++++++
 .../CxfMtomRouterCxfMessageModeTest-context.xml | 79 ++++++++++++++++++++
 .../mtom/CxfMtomRouterRawModeTest-context.xml   |  4 +-
 4 files changed, 150 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/b99fd1e4/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/CXFMessageDataFormatFeature.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/CXFMessageDataFormatFeature.java
 
b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/CXFMessageDataFormatFeature.java
index 1d24126..ad1147d 100644
--- 
a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/CXFMessageDataFormatFeature.java
+++ 
b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/feature/CXFMessageDataFormatFeature.java
@@ -17,6 +17,9 @@
 
 package org.apache.camel.component.cxf.feature;
 
+import java.util.ArrayList;
+import java.util.Collection;
+
 import javax.xml.soap.SOAPMessage;
 import javax.xml.transform.Source;
 
@@ -29,8 +32,13 @@ import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.interceptor.AbstractInDatabindingInterceptor;
+import org.apache.cxf.interceptor.ClientFaultConverter;
+import org.apache.cxf.jaxws.interceptors.HolderInInterceptor;
+import org.apache.cxf.jaxws.interceptors.HolderOutInterceptor;
 import org.apache.cxf.jaxws.interceptors.MessageModeInInterceptor;
 import org.apache.cxf.jaxws.interceptors.MessageModeOutInterceptor;
+import org.apache.cxf.jaxws.interceptors.WrapperClassInInterceptor;
+import org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor;
 import org.apache.cxf.service.model.BindingMessageInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.MessageInfo;
@@ -46,6 +54,18 @@ import org.slf4j.LoggerFactory;
 public class CXFMessageDataFormatFeature extends AbstractDataFormatFeature {
     private static final Logger LOG = 
LoggerFactory.getLogger(CXFMessageDataFormatFeature.class);
 
+    private static final Collection<Class<?>> REMOVING_IN_INTERCEPTORS;
+    private static final Collection<Class<?>> REMOVING_OUT_INTERCEPTORS;
+   
+    static {
+        REMOVING_IN_INTERCEPTORS = new ArrayList<Class<?>>();
+        REMOVING_IN_INTERCEPTORS.add(HolderInInterceptor.class);
+        REMOVING_IN_INTERCEPTORS.add(WrapperClassInInterceptor.class);
+        
+        REMOVING_OUT_INTERCEPTORS = new ArrayList<Class<?>>();
+        REMOVING_OUT_INTERCEPTORS.add(HolderOutInterceptor.class);
+        REMOVING_OUT_INTERCEPTORS.add(WrapperClassOutInterceptor.class);
+    }
 
     @Override
     public void initialize(Client client, Bus bus) {
@@ -72,6 +92,9 @@ public class CXFMessageDataFormatFeature extends 
AbstractDataFormatFeature {
         }
         ep.getInInterceptors().add(new MessageModeInInterceptor(fmt, 
ep.getBinding().getBindingInfo().getName()));            
         ep.put(AbstractInDatabindingInterceptor.NO_VALIDATE_PARTS, 
Boolean.TRUE);
+        // need to remove the wrapper class and holder interceptor
+        removeInterceptors(ep.getInInterceptors(), REMOVING_IN_INTERCEPTORS);
+        removeInterceptors(ep.getOutInterceptors(), REMOVING_OUT_INTERCEPTORS);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/b99fd1e4/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomRouterCxfMessageModeTest.java
----------------------------------------------------------------------
diff --git 
a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomRouterCxfMessageModeTest.java
 
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomRouterCxfMessageModeTest.java
new file mode 100644
index 0000000..62c5117
--- /dev/null
+++ 
b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/mtom/CxfMtomRouterCxfMessageModeTest.java
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.cxf.mtom;
+
+import java.net.URL;
+
+import javax.xml.ws.BindingProvider;
+
+import org.apache.camel.cxf.mtom_feature.Hello;
+import org.apache.camel.cxf.mtom_feature.HelloService;
+import org.springframework.test.context.ContextConfiguration;
+
+import static org.junit.Assert.assertNotNull;
+
+
+@ContextConfiguration
+public class CxfMtomRouterCxfMessageModeTest extends 
CxfMtomRouterPayloadModeTest {
+    @Override
+    protected Hello getPort() {
+        URL wsdl = getClass().getResource("/mtom.wsdl");
+        assertNotNull("WSDL is null", wsdl);
+
+        HelloService service = new HelloService(wsdl, HelloService.SERVICE);
+        assertNotNull("Service is null ", service);
+        Hello port = service.getHelloPort();
+        ((BindingProvider)port).getRequestContext()
+            .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
+                 "http://localhost:"; + port1 + 
"/CxfMtomRouterCxfMessageModeTest/jaxws-mtom/hello");
+        return port;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b99fd1e4/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomRouterCxfMessageModeTest-context.xml
----------------------------------------------------------------------
diff --git 
a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomRouterCxfMessageModeTest-context.xml
 
b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomRouterCxfMessageModeTest-context.xml
new file mode 100644
index 0000000..2855d9c
--- /dev/null
+++ 
b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomRouterCxfMessageModeTest-context.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+       xmlns:cxf="http://camel.apache.org/schema/cxf";
+
+       xsi:schemaLocation="
+       http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
+       http://camel.apache.org/schema/cxf 
http://camel.apache.org/schema/cxf/camel-cxf.xsd
+       http://camel.apache.org/schema/spring 
http://camel.apache.org/schema/spring/camel-spring.xsd
+    ">
+    <bean 
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+
+  <!-- START SNIPPET: enableMtom -->
+
+   <cxf:cxfEndpoint id="routerEndpoint" 
address="http://localhost:${CXFTestSupport.port1}/CxfMtomRouterCxfMessageModeTest/jaxws-mtom/hello";
+            wsdlURL="mtom.wsdl"
+            serviceName="ns:HelloService"
+            endpointName="ns:HelloPort"
+            serviceClass="org.apache.camel.cxf.mtom_feature.Hello"
+            xmlns:ns="http://apache.org/camel/cxf/mtom_feature";>
+
+        <cxf:properties>
+            <!--  enable mtom by setting this property to true -->
+            <entry key="mtom-enabled" value="true"/>
+            
+            <!--  set the camel-cxf endpoint data fromat to CXF_MESSAGE mode 
-->
+            <entry key="dataFormat" value="CXF_MESSAGE"/>
+        </cxf:properties>      
+        
+  <!-- END SNIPPET: enableMtom -->
+
+   </cxf:cxfEndpoint>
+            
+   <cxf:cxfEndpoint id="serviceEndpoint" 
address="http://localhost:${CXFTestSupport.port2}/CxfMtomRouterCxfMessageModeTest/jaxws-mtom/hello";
+            wsdlURL="mtom.wsdl"
+            serviceName="ns:HelloService"
+            endpointName="ns:HelloPort"
+            serviceClass="org.apache.camel.cxf.mtom_feature.Hello"
+            xmlns:ns="http://apache.org/camel/cxf/mtom_feature";>
+            
+        <cxf:properties>
+            <entry key="mtom-enabled" value="true"/>
+            <entry key="dataFormat" value="CXF_MESSAGE"/>            
+        </cxf:properties>  
+
+                          
+        <cxf:inInterceptors>
+                   <ref bean="logInbound"/>
+               </cxf:inInterceptors>   
+               <cxf:outInterceptors>
+                   <ref bean="logOutbound"/>
+               </cxf:outInterceptors>
+
+   </cxf:cxfEndpoint>                        
+
+   <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring";>
+      <route>
+          <from uri="cxf:bean:routerEndpoint" />
+          <to uri="cxf:bean:serviceEndpoint" />
+      </route>
+   </camelContext>
+   
+</beans>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/b99fd1e4/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomRouterRawModeTest-context.xml
----------------------------------------------------------------------
diff --git 
a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomRouterRawModeTest-context.xml
 
b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomRouterRawModeTest-context.xml
index 0f61d6d..cb0144a 100644
--- 
a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomRouterRawModeTest-context.xml
+++ 
b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/mtom/CxfMtomRouterRawModeTest-context.xml
@@ -39,7 +39,7 @@
             <entry key="mtom-enabled" value="true"/>
             
             <!--  set the camel-cxf endpoint data fromat to RAW mode -->
-            <entry key="dataFormat" value="CXF_MESSAGE"/>
+            <entry key="dataFormat" value="RAW"/>
         </cxf:properties>      
         
   <!-- END SNIPPET: enableMtom -->
@@ -62,7 +62,7 @@
             
         <cxf:properties>
             <entry key="mtom-enabled" value="true"/>
-            <entry key="dataFormat" value="CXF_MESSAGE"/>            
+            <entry key="dataFormat" value="RAW"/>            
         </cxf:properties>  
 
                           

Reply via email to