servicemix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ff...@apache.org
Subject svn commit: r654696 - in /servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src: main/java/org/apache/servicemix/camel/ test/java/org/apache/servicemix/camel/ test/java/org/apache/servicemix/camel/su6/
Date Fri, 09 May 2008 06:59:02 GMT
Author: ffang
Date: Thu May  8 23:59:02 2008
New Revision: 654696

URL: http://svn.apache.org/viewvc?rev=654696&view=rev
Log:
[SM-1343]apply patch on behalf of Willem Jiang with thanks

Modified:
    servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiBinding.java
    servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiExchange.java
    servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiMessage.java
    servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/ToJbiProcessor.java
    servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JavaCamelRouteTest.java
    servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOutTest.java
    servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/NonJbiCamelEndpointsIntegrationTest.java
    servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/su6/MyRouter.java

Modified: servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiBinding.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiBinding.java?rev=654696&r1=654695&r2=654696&view=diff
==============================================================================
--- servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiBinding.java
(original)
+++ servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiBinding.java
Thu May  8 23:59:02 2008
@@ -25,6 +25,7 @@
 import javax.jbi.messaging.MessageExchangeFactory;
 import javax.jbi.messaging.MessagingException;
 import javax.jbi.messaging.NormalizedMessage;
+import javax.xml.namespace.QName;
 import javax.xml.transform.Source;
 
 import org.apache.camel.Exchange;
@@ -36,7 +37,7 @@
 
 /**
  * The binding of how Camel messages get mapped to JBI and back again
- * 
+ *
  * @version $Revision: 563665 $
  */
 public class JbiBinding {
@@ -81,7 +82,7 @@
 
     /**
      * Sets the message exchange pattern to use for communicating with JBI
-     * 
+     *
      * @param messageExchangePattern
      */
     public void setMessageExchangePattern(String messageExchangePattern) {
@@ -89,7 +90,7 @@
     }
 
     protected MessageExchange createJbiMessageExchange(Exchange camelExchange,
-        MessageExchangeFactory exchangeFactory, String defaultMep) 
+        MessageExchangeFactory exchangeFactory, String defaultMep)
         throws MessagingException, URISyntaxException {
 
         ExchangePattern mep = camelExchange.getPattern();
@@ -124,6 +125,15 @@
                 answer = exchangeFactory.createInOutExchange();
             }
         }
+
+        if (camelExchange.getProperty("jbi.operation") != null) {
+
+            String operationName = (String) camelExchange.getProperty("jbi.operation");
+            QName operationQName = QName.valueOf(operationName);
+            answer.setOperation(operationQName);
+
+        }
+
         return answer;
     }
 

Modified: servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiExchange.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiExchange.java?rev=654696&r1=654695&r2=654696&view=diff
==============================================================================
--- servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiExchange.java
(original)
+++ servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiExchange.java
Thu May  8 23:59:02 2008
@@ -27,7 +27,7 @@
  * An {@link org.apache.camel.Exchange} working with JBI which exposes the underlying JBI
  * features such as the JBI {@link #getMessageExchange()},
  * {@link #getInMessage()} and {@link #getOutMessage()}
- * 
+ *
  * @version $Revision: 563665 $
  */
 public class JbiExchange extends DefaultExchange {
@@ -82,6 +82,11 @@
         return (JbiMessage) super.getFault(lazyCreate);
     }
 
+    @Override
+    public org.apache.camel.Exchange newInstance() {        
+        return new JbiExchange(this.getContext(), this.getBinding(), this.getMessageExchange());
+    }
+
     /**
      * @return the Camel <-> JBI binding
      */
@@ -95,7 +100,7 @@
     /**
      * Returns the underlying JBI message exchange for an inbound exchange or
      * null for outbound messages
-     * 
+     *
      * @return the inbound message exchange
      */
     public MessageExchange getMessageExchange() {
@@ -104,7 +109,7 @@
 
     /**
      * Returns the underlying In {@link NormalizedMessage}
-     * 
+     *
      * @return the In message
      */
     public NormalizedMessage getInMessage() {
@@ -113,7 +118,7 @@
 
     /**
      * Returns the underlying Out {@link NormalizedMessage}
-     * 
+     *
      * @return the Out message
      */
     public NormalizedMessage getOutMessage() {
@@ -122,7 +127,7 @@
 
     /**
      * Returns the underlying Fault {@link NormalizedMessage}
-     * 
+     *
      * @return the Fault message
      */
     public NormalizedMessage getFaultMessage() {

Modified: servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiMessage.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiMessage.java?rev=654696&r1=654695&r2=654696&view=diff
==============================================================================
--- servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiMessage.java
(original)
+++ servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/JbiMessage.java
Thu May  8 23:59:02 2008
@@ -28,7 +28,7 @@
 /**
  * A JBI {@link org.apache.camel.Message} which provides access to the underlying JBI features
  * such as {@link #getNormalizedMessage()}
- * 
+ *
  * @version $Revision: 563665 $
  */
 public class JbiMessage extends DefaultMessage {
@@ -57,7 +57,7 @@
 
     /**
      * Returns the underlying JBI message
-     * 
+     *
      * @return the underlying JBI message
      */
     public NormalizedMessage getNormalizedMessage() {
@@ -81,6 +81,15 @@
     }
 
     @Override
+    public void setHeader(String name , Object value) {
+        if (normalizedMessage != null) {
+            normalizedMessage.setProperty(name, value);
+        } else {
+            super.setHeader(name, value);
+        }
+    }
+
+    @Override
     public JbiMessage newInstance() {
         return new JbiMessage();
     }

Modified: servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/ToJbiProcessor.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/ToJbiProcessor.java?rev=654696&r1=654695&r2=654696&view=diff
==============================================================================
--- servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/ToJbiProcessor.java
(original)
+++ servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/main/java/org/apache/servicemix/camel/ToJbiProcessor.java
Thu May  8 23:59:02 2008
@@ -27,6 +27,7 @@
 import javax.jbi.messaging.MessageExchangeFactory;
 import javax.jbi.messaging.MessagingException;
 import javax.jbi.messaging.NormalizedMessage;
+import javax.xml.namespace.QName;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
@@ -36,7 +37,7 @@
 
 /**
  * A
- * 
+ *
  * @{link Processor} which takes a Camel {@link Exchange} and invokes it into
  *        JBI using the straight JBI API
  * @version $Revision: 563665 $
@@ -50,6 +51,8 @@
 
     private String mep;
 
+    private String operation;
+
     public ToJbiProcessor(JbiBinding binding, ComponentContext componentContext, String destinationUri)
{
         this.binding = binding;
         this.componentContext = componentContext;
@@ -62,6 +65,7 @@
                 if (mep != null && !mep.startsWith("http://www.w3.org/ns/wsdl/"))
{
                     mep = "http://www.w3.org/ns/wsdl/" + mep;
                 }
+                operation = (String) params.get("operation");
                 this.destinationUri = destinationUri.substring(0, idx);
             }
         } catch (URISyntaxException e) {
@@ -91,6 +95,10 @@
             MessageExchangeFactory exchangeFactory = deliveryChannel.createExchangeFactory();
             MessageExchange messageExchange = binding.makeJbiMessageExchange(exchange, exchangeFactory,
mep);
 
+            if (operation != null) {
+                messageExchange.setOperation(QName.valueOf(operation));
+            }
+
             URIResolver.configureExchange(messageExchange, componentContext, destinationUri);
             deliveryChannel.sendSync(messageExchange);
 

Modified: servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JavaCamelRouteTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JavaCamelRouteTest.java?rev=654696&r1=654695&r2=654696&view=diff
==============================================================================
--- servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JavaCamelRouteTest.java
(original)
+++ servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JavaCamelRouteTest.java
Thu May  8 23:59:02 2008
@@ -16,6 +16,8 @@
  */
 package org.apache.servicemix.camel;
 
+import javax.jbi.messaging.MessageExchange;
+
 /**
  * @version $Revision: 1.1 $
  */
@@ -28,4 +30,10 @@
         super.setUp();
         suName = "su6";
     }
+
+    @Override
+    protected void checkResult(MessageExchange exchange) {
+        assertNotNull(exchange.getMessage("out"));
+        assertNotNull(exchange.getMessage("out").getProperty("operation"));
+    }
 }
\ No newline at end of file

Modified: servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOutTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOutTest.java?rev=654696&r1=654695&r2=654696&view=diff
==============================================================================
--- servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOutTest.java
(original)
+++ servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/JbiInOutTest.java
Thu May  8 23:59:02 2008
@@ -21,7 +21,6 @@
 import javax.xml.namespace.QName;
 
 import org.apache.servicemix.client.ServiceMixClient;
-import org.apache.servicemix.components.util.EchoComponent;
 
 /**
  * @version $Revision: 1.1 $
@@ -36,7 +35,7 @@
         suName = "su5";
         super.setUp();
 
-        EchoComponent echo = new EchoComponent();
+        MyEchoComponent echo = new MyEchoComponent();
         echo.setService(new QName("namespace", "echo"));
         echo.setEndpoint("endpoint");
         container.activateComponent(echo, "echo");

Modified: servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/NonJbiCamelEndpointsIntegrationTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/NonJbiCamelEndpointsIntegrationTest.java?rev=654696&r1=654695&r2=654696&view=diff
==============================================================================
--- servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/NonJbiCamelEndpointsIntegrationTest.java
(original)
+++ servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/NonJbiCamelEndpointsIntegrationTest.java
Thu May  8 23:59:02 2008
@@ -74,9 +74,9 @@
                 configureExchange(client, exchange);
                 populateExchange(exchange);
                 client.sendSync(exchange);
-                assertNotNull(exchange.getMessage("out"));
+                checkResult(exchange);
                 //assertNotNull(exchange.getMessage("out").getContent());
-                // TODO: check out
+                // TODO: check out the exchange
                 client.done(exchange);
 
                 // Stop and undeploy
@@ -103,6 +103,10 @@
         }
     }
 
+    protected void checkResult(MessageExchange exchange) {
+        assertNotNull(exchange.getMessage("out"));
+    }
+
     /*
      * @see TestCase#setUp()
      */
@@ -141,7 +145,7 @@
 
     protected InOut createExchange(ServiceMixClient client)
         throws MessagingException {
-        
+
         return client.createInOutExchange();
     }
 

Modified: servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/su6/MyRouter.java
URL: http://svn.apache.org/viewvc/servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/su6/MyRouter.java?rev=654696&r1=654695&r2=654696&view=diff
==============================================================================
--- servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/su6/MyRouter.java
(original)
+++ servicemix/smx3/trunk/deployables/serviceengines/servicemix-camel/src/test/java/org/apache/servicemix/camel/su6/MyRouter.java
Thu May  8 23:59:02 2008
@@ -23,6 +23,6 @@
  */
 public class MyRouter extends RouteBuilder {
     public void configure() throws Exception {
-        from("jbi:name:cheese").to("jbi:service:namespace:echo?mep=in-out");
+        from("jbi:name:cheese").to("jbi:service:namespace:echo?mep=in-out&operation={http://hello}echo");
     }
 }



Mime
View raw message