camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r1448509 - in /camel/trunk/components/camel-cxf/src: main/java/org/apache/camel/component/cxf/CxfConsumer.java test/java/org/apache/camel/component/cxf/CxfOneWayRouteTest.java
Date Thu, 21 Feb 2013 04:29:23 GMT
Author: ningjiang
Date: Thu Feb 21 04:29:22 2013
New Revision: 1448509

URL: http://svn.apache.org/r1448509
Log:
CAMEL-6092 set the MEP according to the BindingOperationInfo in CxfConsumer

Modified:
    camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
    camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfOneWayRouteTest.java

Modified: camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java?rev=1448509&r1=1448508&r2=1448509&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
(original)
+++ camel/trunk/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfConsumer.java
Thu Feb 21 04:29:22 2013
@@ -23,6 +23,7 @@ import java.util.Map;
 import javax.xml.ws.WebFault;
 import org.w3c.dom.Element;
 import org.apache.camel.AsyncCallback;
+import org.apache.camel.ExchangePattern;
 import org.apache.camel.Processor;
 import org.apache.camel.component.cxf.common.message.CxfConstants;
 import org.apache.camel.impl.DefaultConsumer;
@@ -145,7 +146,7 @@ public class CxfConsumer extends Default
                 CxfEndpoint endpoint = (CxfEndpoint)getEndpoint();
                 CxfBinding binding = endpoint.getCxfBinding();
 
-                // create a Camel exchange
+                // create a Camel exchange, the default MEP is InOut
                 org.apache.camel.Exchange camelExchange = endpoint.createExchange();
                 DataFormat dataFormat = endpoint.getDataFormat();
 
@@ -159,6 +160,10 @@ public class CxfConsumer extends Default
                 if (boi != null) {
                     camelExchange.setProperty(BindingOperationInfo.class.getName(), boi);
                     LOG.trace("Set exchange property: BindingOperationInfo: {}", boi);
+                    // set the message exchange patter with the boi
+                    if (boi.getOperationInfo().isOneWay()) {
+                        camelExchange.setPattern(ExchangePattern.InOnly);
+                    }
                 }
                 
                 // set data format mode in Camel exchange

Modified: camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfOneWayRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfOneWayRouteTest.java?rev=1448509&r1=1448508&r2=1448509&view=diff
==============================================================================
--- camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfOneWayRouteTest.java
(original)
+++ camel/trunk/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfOneWayRouteTest.java
Thu Feb 21 04:29:22 2013
@@ -23,6 +23,7 @@ import javax.xml.namespace.QName;
 import javax.xml.ws.Service;
 
 import org.apache.camel.Exchange;
+import org.apache.camel.ExchangePattern;
 import org.apache.camel.Processor;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.spring.CamelSpringTestSupport;
@@ -88,6 +89,8 @@ public class CxfOneWayRouteTest extends 
         static final byte[] MAGIC = {(byte)0xca, 0x3e, 0x1e};
 
         public void process(Exchange exchange) throws Exception {
+            // just check the MEP here
+            assertEquals("Don't get the right MEP", ExchangePattern.InOnly, exchange.getPattern());
             // adding some binary segment
             String msg = exchange.getIn().getBody(String.class);
             ByteArrayOutputStream bos = new ByteArrayOutputStream();



Mime
View raw message