camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1305007 - in /camel/trunk/components: camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/common/message/ camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/ camel-cxf/src/test/resources/org/apache/camel/component/...
Date Sun, 25 Mar 2012 11:30:14 GMT
Author: ningjiang
Date: Sun Mar 25 11:30:13 2012
New Revision: 1305007

URL: http://svn.apache.org/viewvc?rev=1305007&view=rev
Log:
CAMEL-5115 CxfBeanDestination should copy the in message header to the out message

Modified:
    camel/trunk/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/common/message/DefaultCxfMesssageMapper.java
    camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTest.java
    camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanTest-context.xml

Modified: camel/trunk/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/common/message/DefaultCxfMesssageMapper.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/common/message/DefaultCxfMesssageMapper.java?rev=1305007&r1=1305006&r2=1305007&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/common/message/DefaultCxfMesssageMapper.java
(original)
+++ camel/trunk/components/camel-cxf-transport/src/main/java/org/apache/camel/component/cxf/common/message/DefaultCxfMesssageMapper.java
Sun Mar 25 11:30:13 2012
@@ -80,6 +80,8 @@ public class DefaultCxfMesssageMapper im
         }
 
         Map<String, Object> camelHeaders = exchange.getOut().getHeaders();
+        // copy the in message header to out message
+        camelHeaders.putAll(exchange.getIn().getHeaders());
         
         Map<String, List<String>> cxfHeaders =
             CastUtils.cast((Map<?, ?>)cxfMessage.get(Message.PROTOCOL_HEADERS));

Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTest.java?rev=1305007&r1=1305006&r2=1305007&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTest.java
(original)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/cxfbean/CxfBeanTest.java
Sun Mar 25 11:30:13 2012
@@ -26,6 +26,7 @@ import javax.xml.ws.Holder;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.component.cxf.CXFTestSupport;
+import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.wsdl_first.Person;
 import org.apache.camel.wsdl_first.PersonService;
 import org.apache.http.HttpResponse;
@@ -80,9 +81,21 @@ public class CxfBeanTest extends Abstrac
         assertTrue(testedEndpointWithProviders);
     }
     
+    @Test
+    public void testMessageHeadersAfterCxfBeanEndpoint() throws Exception {
+        MockEndpoint endpoint = (MockEndpoint)camelContext.getEndpoint("mock:endpointA");
+        endpoint.reset();
+        invokeRsService("http://localhost:" + PORT1 + "/customerservice/customers/123",
+            "{\"Customer\":{\"id\":123,\"name\":\"John\"}}");
+        endpoint.expectedMessageCount(1);
+        endpoint.expectedHeaderReceived("key", "customer");
+        endpoint.assertIsSatisfied();
+    }
+    
     private void invokeRsService(String getUrl, String expected) throws Exception {
         HttpGet get = new HttpGet(getUrl);
         get.addHeader("Accept" , "application/json");
+        get.addHeader("key", "customer");
         HttpClient httpclient = new DefaultHttpClient();
 
         try {

Modified: camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanTest-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanTest-context.xml?rev=1305007&r1=1305006&r2=1305007&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanTest-context.xml
(original)
+++ camel/trunk/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/cxfbean/CxfBeanTest-context.xml
Sun Mar 25 11:30:13 2012
@@ -75,6 +75,7 @@
 		<route>
 			<from ref="ep1" />
 			<to uri="cxfbean:customerServiceBean" />
+			<to uri="mock:endpointA" />
 		</route>
 		<!-- END SNIPPET: routeDefinition -->	
 		<route>



Mime
View raw message