camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject svn commit: r1098630 - in /camel/trunk/components/camel-cxf/src: main/java/org/apache/camel/component/cxf/ test/java/org/apache/camel/component/cxf/
Date Mon, 02 May 2011 15:35:55 GMT
Author: wtam
Date: Mon May  2 15:35:54 2011
New Revision: 1098630

URL: http://svn.apache.org/viewvc?rev=1098630&view=rev
Log:
Commit fix for [CAMEL-3927] on behalf of Aki Yoshida

Added:
    camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadProviderTest.java
  (with props)
Modified:
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
    camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerProviderTest.java

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java?rev=1098630&r1=1098629&r2=1098630&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
(original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/DefaultCxfBinding.java
Mon May  2 15:35:54 2011
@@ -29,9 +29,11 @@ import java.util.TreeMap;
 import javax.activation.DataHandler;
 import javax.security.auth.Subject;
 import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.ws.Holder;
 
+import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
@@ -648,8 +650,13 @@ public class DefaultCxfBinding implement
                 part = ((Holder)part).value;
             }
                         
-            if (part instanceof DOMSource) {
-                Element element = getFirstElement(((DOMSource)part).getNode());
+            if (part instanceof Source) {
+                Element element;
+                if (part instanceof DOMSource) {
+                    element = getFirstElement(((DOMSource)part).getNode());
+                } else {
+                    element = getFirstElement((Source)part);
+                }
 
                 if (element != null) {
                     answer.add(element);
@@ -659,7 +666,6 @@ public class DefaultCxfBinding implement
                     LOG.trace("Extract body element {}",
                               element == null ? "null" : XMLUtils.toString(element));
                 }
-                
             } else if (part instanceof Element) {
                 answer.add((Element)part);
             } else {
@@ -694,6 +700,15 @@ public class DefaultCxfBinding implement
         return DOMUtils.getFirstElement(node);
     }
     
+    private static Element getFirstElement(Source source) {
+        try {
+            return ((Document)XMLUtils.fromSource(source)).getDocumentElement();
+        } catch (Exception e) {
+            // ignore
+        }
+        return null;
+    }
+    
     public void copyJaxWsContext(org.apache.cxf.message.Exchange cxfExchange, Map<String,
Object> context) {
         if (cxfExchange.getOutMessage() != null) {
             org.apache.cxf.message.Message outMessage = cxfExchange.getOutMessage();

Added: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadProviderTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadProviderTest.java?rev=1098630&view=auto
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadProviderTest.java
(added)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadProviderTest.java
Mon May  2 15:35:54 2011
@@ -0,0 +1,26 @@
+/**
+ * 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;
+
+public class CxfConsumerPayloadProviderTest extends CxfConsumerProviderTest {
+
+    @Override
+    protected String getFromEndpointUri() {
+        return super.getFromEndpointUri() + "&dataFormat=PAYLOAD";
+    }
+
+}

Propchange: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadProviderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadProviderTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerProviderTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerProviderTest.java?rev=1098630&r1=1098629&r2=1098630&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerProviderTest.java
(original)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerProviderTest.java
Mon May  2 15:35:54 2011
@@ -17,7 +17,6 @@
 
 package org.apache.camel.component.cxf;
 
-import java.util.List;
 
 import org.w3c.dom.Node;
 
@@ -27,9 +26,6 @@ import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.converter.jaxp.XmlConverter;
 import org.apache.camel.test.junit4.CamelTestSupport;
-import org.apache.cxf.BusFactory;
-import org.apache.cxf.frontend.ClientFactoryBean;
-import org.apache.cxf.frontend.ClientProxyFactoryBean;
 import org.junit.Test;
 
 public class CxfConsumerProviderTest extends CamelTestSupport {
@@ -52,7 +48,7 @@ public class CxfConsumerProviderTest ext
         return new RouteBuilder() {
             public void configure() {
                 errorHandler(noErrorHandler());
-                from(SIMPLE_ENDPOINT_URI).process(new Processor() {
+                from(getFromEndpointUri()).process(new Processor() {
                     public void process(final Exchange exchange) {
                         Message in = exchange.getIn();
                         // Get the parameter list
@@ -87,5 +83,9 @@ public class CxfConsumerProviderTest ext
         assertTrue("Get a wrong response ", response.endsWith(RESPONSE_MESSAGE_END));
     }
 
+    
+    protected String getFromEndpointUri() {
+        return SIMPLE_ENDPOINT_URI;
+    }
 
 }



Mime
View raw message