servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r704429 - in /servicemix/components/engines/servicemix-eip/trunk/src: main/java/org/apache/servicemix/eip/patterns/WireTap.java test/java/org/apache/servicemix/eip/WireTapTest.java
Date Tue, 14 Oct 2008 10:08:34 GMT
Author: ffang
Date: Tue Oct 14 03:08:34 2008
New Revision: 704429

URL: http://svn.apache.org/viewvc?rev=704429&view=rev
Log:
[SM-1612]EIP wiretap should save operationname by default

Modified:
    servicemix/components/engines/servicemix-eip/trunk/src/main/java/org/apache/servicemix/eip/patterns/WireTap.java
    servicemix/components/engines/servicemix-eip/trunk/src/test/java/org/apache/servicemix/eip/WireTapTest.java

Modified: servicemix/components/engines/servicemix-eip/trunk/src/main/java/org/apache/servicemix/eip/patterns/WireTap.java
URL: http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-eip/trunk/src/main/java/org/apache/servicemix/eip/patterns/WireTap.java?rev=704429&r1=704428&r2=704429&view=diff
==============================================================================
--- servicemix/components/engines/servicemix-eip/trunk/src/main/java/org/apache/servicemix/eip/patterns/WireTap.java
(original)
+++ servicemix/components/engines/servicemix-eip/trunk/src/main/java/org/apache/servicemix/eip/patterns/WireTap.java
Tue Oct 14 03:08:34 2008
@@ -162,6 +162,10 @@
      * @see org.apache.servicemix.eip.EIPEndpoint#processSync(javax.jbi.messaging.MessageExchange)
      */
     protected void processSync(MessageExchange exchange) throws Exception {
+        if (null == target.getOperation()) {
+            //not specify operation for the target, so save the src one by default
+            target.setOperation(exchange.getOperation());
+        }
         // Create exchange for target
         MessageExchange tme = getExchangeFactory().createExchange(exchange.getPattern());
         target.configureTarget(tme, getContext());
@@ -187,6 +191,10 @@
      * @see org.apache.servicemix.eip.EIPEndpoint#processAsync(javax.jbi.messaging.MessageExchange)
      */
     protected void processAsync(MessageExchange exchange) throws Exception {
+        if (null == target.getOperation()) {
+            //not specify operation for the target, so save the src one by default
+            target.setOperation(exchange.getOperation());
+        }
         if (exchange.getRole() == MessageExchange.Role.PROVIDER
             && exchange.getProperty(correlation) == null) {
             // Create exchange for target

Modified: servicemix/components/engines/servicemix-eip/trunk/src/test/java/org/apache/servicemix/eip/WireTapTest.java
URL: http://svn.apache.org/viewvc/servicemix/components/engines/servicemix-eip/trunk/src/test/java/org/apache/servicemix/eip/WireTapTest.java?rev=704429&r1=704428&r2=704429&view=diff
==============================================================================
--- servicemix/components/engines/servicemix-eip/trunk/src/test/java/org/apache/servicemix/eip/WireTapTest.java
(original)
+++ servicemix/components/engines/servicemix-eip/trunk/src/test/java/org/apache/servicemix/eip/WireTapTest.java
Tue Oct 14 03:08:34 2008
@@ -388,4 +388,33 @@
         listener.assertExchangeCompleted();
     }
     
+    public void testCopyOperationName() throws Exception {
+        activateReceiver("target");
+
+        InOnly me = client.createInOnlyExchange();
+        me.setService(new QName("wireTap"));
+        QName operation = new QName("operationNeedSave");
+        me.setOperation(operation);
+        me.getInMessage().setContent(createSource("<hello/>"));
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.DONE, me.getStatus());
+        //since we didn't specify the operation for the target, so should save
+        //the operation name from the src MessageExchange
+        assertEquals(operation, wireTap.getTarget().getOperation());
+        
+        me = client.createInOnlyExchange();
+        me.setService(new QName("wireTap"));
+        operation = new QName("operationNeedSave");
+        me.setOperation(operation);
+        me.getInMessage().setContent(createSource("<hello/>"));
+        QName targetOperation = new QName("targetOperation");
+        wireTap.getTarget().setOperation(targetOperation);
+        client.sendSync(me);
+        assertEquals(ExchangeStatus.DONE, me.getStatus());
+        //since we specify the operation for the target, so should use the specified one
+        assertEquals(targetOperation, wireTap.getTarget().getOperation());
+        
+        listener.assertExchangeCompleted();
+    }
+    
 }



Mime
View raw message