activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r522517 - in /activemq/camel/trunk/camel-jbi: ./ src/main/java/org/apache/camel/component/jbi/ src/test/java/org/apache/camel/component/jbi/
Date Mon, 26 Mar 2007 14:02:27 GMT
Author: jstrachan
Date: Mon Mar 26 07:02:25 2007
New Revision: 522517

URL: http://svn.apache.org/viewvc?view=rev&rev=522517
Log:
reorganised imports and added a test case for Camel rules automatically activating JBI endpoints

Added:
    activemq/camel/trunk/camel-jbi/src/test/java/org/apache/camel/component/jbi/SendFromCamelToJbiThenRouteToAnotherJbiComponentTest.java
  (with props)
Modified:
    activemq/camel/trunk/camel-jbi/pom.xml
    activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelJbiComponent.java
    activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelJbiEndpoint.java
    activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/FromJbiProcessor.java
    activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/JbiBinding.java
    activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/JbiEndpoint.java
    activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/JbiException.java
    activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/JbiExchange.java
    activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/JbiMessage.java
    activemq/camel/trunk/camel-jbi/src/test/java/org/apache/camel/component/jbi/JbiTestSupport.java
    activemq/camel/trunk/camel-jbi/src/test/java/org/apache/camel/component/jbi/SendFromCamelToJbiAndBackToCamelTest.java
    activemq/camel/trunk/camel-jbi/src/test/java/org/apache/camel/component/jbi/SendFromCamelToJbiTest.java

Modified: activemq/camel/trunk/camel-jbi/pom.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jbi/pom.xml?view=diff&rev=522517&r1=522516&r2=522517
==============================================================================
--- activemq/camel/trunk/camel-jbi/pom.xml (original)
+++ activemq/camel/trunk/camel-jbi/pom.xml Mon Mar 26 07:02:25 2007
@@ -18,7 +18,7 @@
 -->
 
 <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
-  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
 
   <modelVersion>4.0.0</modelVersion>
 
@@ -51,13 +51,13 @@
       <artifactId>servicemix-jbi</artifactId>
       <version>3.1-incubating</version>
     </dependency>
-    
+
     <dependency>
       <groupId>org.apache.servicemix</groupId>
       <artifactId>servicemix-core</artifactId>
       <version>3.1-incubating</version>
     </dependency>
-    
+
     <dependency>
       <groupId>org.apache.servicemix</groupId>
       <artifactId>servicemix-common</artifactId>

Modified: activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelJbiComponent.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelJbiComponent.java?view=diff&rev=522517&r1=522516&r2=522517
==============================================================================
--- activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelJbiComponent.java
(original)
+++ activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelJbiComponent.java
Mon Mar 26 07:02:25 2007
@@ -17,15 +17,18 @@
 import org.apache.camel.Endpoint;
 import org.apache.camel.EndpointResolver;
 import org.apache.servicemix.common.DefaultComponent;
-import org.apache.servicemix.jbi.util.URISupport;
+import org.apache.servicemix.common.ServiceUnit;
 import org.apache.servicemix.jbi.util.IntrospectionSupport;
+import org.apache.servicemix.jbi.util.URISupport;
+import org.apache.servicemix.jbi.resolver.URIResolver;
 
 import javax.jbi.servicedesc.ServiceEndpoint;
+import javax.xml.namespace.QName;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
-import java.net.URISyntaxException;
-import java.net.URI;
 
 /**
  * Deploys the camel endpoints within JBI
@@ -51,7 +54,6 @@
         return answer;
     }
 
-
     /**
      * @return Class[]
      * @see org.apache.servicemix.common.DefaultComponent#getEndpointClasses()
@@ -78,10 +80,9 @@
         this.binding = binding;
     }
 
-
     @Override
     protected String[] getEPRProtocols() {
-        return new String[] { "camel" };
+        return new String[]{"camel"};
     }
 
     protected org.apache.servicemix.common.Endpoint getResolvedEPR(ServiceEndpoint ep) throws
Exception {
@@ -90,7 +91,6 @@
         return endpoint;
     }
 
-
     /**
      * A factory method for creating endpoints from a service endpoint
      * which is public so that it can be easily unit tested
@@ -119,14 +119,8 @@
     public Endpoint resolveEndpoint(CamelContext context, String uri) throws Exception {
         if (uri.startsWith("jbi:")) {
             uri = uri.substring("jbi:".length());
-            JbiEndpoint camelEndpoint = new JbiEndpoint(uri, context, getComponentContext(),
getBinding());
 
-            // lets expose this endpoint now in JBI
-            // TODO there could already be a component registered in JBI for this??
-            CamelJbiEndpoint jbiEndpoint = new CamelJbiEndpoint(getServiceUnit(), camelEndpoint,
getBinding());
-            addEndpoint(jbiEndpoint);
-            jbiEndpoint.activate();
-            return camelEndpoint;
+            return new JbiEndpoint(this, uri);
         }
         return null;
     }
@@ -137,5 +131,34 @@
 
     public void setCamelContext(CamelContext camelContext) {
         this.camelContext = camelContext;
+    }
+
+    /**
+     * Returns a JBI endpoint created for the given Camel endpoint
+     */
+    public CamelJbiEndpoint activateJbiEndpoint(JbiEndpoint camelEndpoint) throws Exception
{
+        CamelJbiEndpoint jbiEndpoint = null;
+        String endpointUri = camelEndpoint.getEndpointUri();
+        if (endpointUri.startsWith("service:")) {
+            // lets decode "service:serviceNamespace:serviceName:endpointName
+            String uri = endpointUri.substring("service:".length());
+            String[] parts = new String[0];
+            try {
+                parts = URIResolver.split3(uri);
+            }
+            catch (IllegalArgumentException e) {
+                throw new IllegalArgumentException("Expected syntax service:serviceNamespace:serviceName:endpointName
but was given: " + endpointUri + ". Cause: " + e, e);
+            }
+            QName service = new QName(parts[0], parts[1]);
+            String endpoint = parts[2];
+            jbiEndpoint = new CamelJbiEndpoint(getServiceUnit(), service, endpoint, camelEndpoint,
getBinding());
+        }
+        else {
+            jbiEndpoint = new CamelJbiEndpoint(getServiceUnit(), camelEndpoint, getBinding());
+        }
+
+        // the following method will activate the new dynamic JBI endpoint
+        addEndpoint(jbiEndpoint);
+        return jbiEndpoint;
     }
 }

Modified: activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelJbiEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelJbiEndpoint.java?view=diff&rev=522517&r1=522516&r2=522517
==============================================================================
--- activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelJbiEndpoint.java
(original)
+++ activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/CamelJbiEndpoint.java
Mon Mar 26 07:02:25 2007
@@ -12,11 +12,11 @@
  */
 package org.apache.camel.component.jbi;
 
-import org.apache.servicemix.common.ServiceUnit;
-import org.apache.servicemix.common.endpoints.ProviderEndpoint;
 import org.apache.camel.Endpoint;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.servicemix.common.ServiceUnit;
+import org.apache.servicemix.common.endpoints.ProviderEndpoint;
 
 import javax.jbi.messaging.MessageExchange;
 import javax.jbi.messaging.NormalizedMessage;
@@ -29,20 +29,18 @@
  */
 public class CamelJbiEndpoint extends ProviderEndpoint {
     private static final transient Log log = LogFactory.getLog(CamelJbiEndpoint.class);
-
     private static final QName SERVICE_NAME = new QName("http://camel.apache.org/service",
"CamelEndpointComponent");
     private Endpoint camelEndpoint;
     private JbiBinding binding;
 
-    public CamelJbiEndpoint(ServiceUnit serviceUnit, QName service, String endpoint, JbiBinding
binding) {
+    public CamelJbiEndpoint(ServiceUnit serviceUnit, QName service, String endpoint, Endpoint
camelEndpoint, JbiBinding binding) {
         super(serviceUnit, service, endpoint);
+        this.camelEndpoint = camelEndpoint;
         this.binding = binding;
     }
 
     public CamelJbiEndpoint(ServiceUnit serviceUnit, Endpoint camelEndpoint, JbiBinding binding)
{
-        super(serviceUnit, SERVICE_NAME, camelEndpoint.getEndpointUri());
-        this.camelEndpoint = camelEndpoint;
-        this.binding = binding;
+        this(serviceUnit, SERVICE_NAME, camelEndpoint.getEndpointUri(), camelEndpoint, binding);
     }
 
     protected void processInOnly(MessageExchange exchange, NormalizedMessage in) throws Exception
{

Modified: activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/FromJbiProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/FromJbiProcessor.java?view=diff&rev=522517&r1=522516&r2=522517
==============================================================================
--- activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/FromJbiProcessor.java
(original)
+++ activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/FromJbiProcessor.java
Mon Mar 26 07:02:25 2007
@@ -17,9 +17,9 @@
  */
 package org.apache.camel.component.jbi;
 
-import org.apache.servicemix.MessageExchangeListener;
-import org.apache.camel.Processor;
 import org.apache.camel.CamelContext;
+import org.apache.camel.Processor;
+import org.apache.servicemix.MessageExchangeListener;
 
 import javax.jbi.messaging.MessageExchange;
 import javax.jbi.messaging.MessagingException;
@@ -28,7 +28,6 @@
  * @version $Revision$
  */
 public class FromJbiProcessor implements MessageExchangeListener {
-
     private CamelContext context;
     private JbiBinding binding;
     private Processor<JbiExchange> processor;

Modified: activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/JbiBinding.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/JbiBinding.java?view=diff&rev=522517&r1=522516&r2=522517
==============================================================================
--- activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/JbiBinding.java
(original)
+++ activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/JbiBinding.java
Mon Mar 26 07:02:25 2007
@@ -18,17 +18,16 @@
 package org.apache.camel.component.jbi;
 
 import org.apache.camel.Exchange;
-import org.apache.servicemix.client.Destination;
 
 import javax.jbi.messaging.MessageExchange;
+import javax.jbi.messaging.MessageExchangeFactory;
 import javax.jbi.messaging.MessagingException;
 import javax.jbi.messaging.NormalizedMessage;
-import javax.jbi.messaging.MessageExchangeFactory;
 import javax.xml.transform.Source;
 import javax.xml.transform.stream.StreamSource;
+import java.io.StringReader;
 import java.util.Map;
 import java.util.Set;
-import java.io.StringReader;
 
 /**
  * The binding of how Camel messages get mapped to JBI and back again

Modified: activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/JbiEndpoint.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/JbiEndpoint.java?view=diff&rev=522517&r1=522516&r2=522517
==============================================================================
--- activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/JbiEndpoint.java
(original)
+++ activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/JbiEndpoint.java
Mon Mar 26 07:02:25 2007
@@ -17,16 +17,9 @@
  */
 package org.apache.camel.component.jbi;
 
-import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
 import org.apache.camel.impl.DefaultEndpoint;
-import org.apache.servicemix.client.Destination;
-import org.apache.servicemix.client.ServiceMixClient;
-
-import javax.jbi.messaging.MessagingException;
-import javax.jbi.component.ComponentContext;
 
 /**
  * Represents an {@link Endpoint} for interacting with JBI
@@ -34,13 +27,13 @@
  * @version $Revision$
  */
 public class JbiEndpoint extends DefaultEndpoint<Exchange> {
-    private final JbiBinding binding;
     private ToJbiProcessor toJbiProcessor;
+    private final CamelJbiComponent jbiComponent;
 
-    public JbiEndpoint(String endpointUri, CamelContext container, ComponentContext componentContext,
JbiBinding binding) {
-        super(endpointUri, container);
-        this.binding = binding;
-        toJbiProcessor = new ToJbiProcessor(binding, componentContext, endpointUri);
+    public JbiEndpoint(CamelJbiComponent jbiComponent, String uri) {
+        super(uri, jbiComponent.getCamelContext());
+        this.jbiComponent = jbiComponent;
+        toJbiProcessor = new ToJbiProcessor(jbiComponent.getBinding(), jbiComponent.getComponentContext(),
uri);
     }
 
     /**
@@ -54,8 +47,8 @@
     protected void doActivate() throws Exception {
         super.doActivate();
 
-        // TODO once the inbound is activated we need to register a JBI endpoint
-        
+        // lets create and activate the endpoint in JBI
+        jbiComponent.activateJbiEndpoint(this);
     }
 
     public JbiExchange createExchange() {
@@ -63,6 +56,6 @@
     }
 
     public JbiBinding getBinding() {
-        return binding;
+        return jbiComponent.getBinding();
     }
 }

Modified: activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/JbiException.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/JbiException.java?view=diff&rev=522517&r1=522516&r2=522517
==============================================================================
--- activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/JbiException.java
(original)
+++ activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/JbiException.java
Mon Mar 26 07:02:25 2007
@@ -19,8 +19,6 @@
 
 import org.apache.camel.RuntimeCamelException;
 
-import javax.jbi.messaging.MessagingException;
-
 /**
  * @version $Revision$
  */

Modified: activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/JbiExchange.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/JbiExchange.java?view=diff&rev=522517&r1=522516&r2=522517
==============================================================================
--- activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/JbiExchange.java
(original)
+++ activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/JbiExchange.java
Mon Mar 26 07:02:25 2007
@@ -25,7 +25,7 @@
 import javax.jbi.messaging.NormalizedMessage;
 
 /**
- * An {@link Exchange} working with JBI which exposes the underlying JBI features such as
the 
+ * An {@link Exchange} working with JBI which exposes the underlying JBI features such as
the
  * JBI {@link #getMessageExchange()}
  *
  * @version $Revision$
@@ -50,7 +50,6 @@
         setFault(new JbiMessage(messageExchange.getMessage("fault")));
     }
 
-
     @Override
     public JbiMessage getIn() {
         return (JbiMessage) super.getIn();
@@ -73,7 +72,6 @@
         return binding;
     }
 
-
     // Expose JBI features
     //-------------------------------------------------------------------------
 
@@ -114,10 +112,9 @@
         return getFault().getNormalizedMessage();
     }
 
-    
     // Implementation methods
     //-------------------------------------------------------------------------
-    
+
     @Override
     protected JbiMessage createInMessage() {
         return new JbiMessage();

Modified: activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/JbiMessage.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/JbiMessage.java?view=diff&rev=522517&r1=522516&r2=522517
==============================================================================
--- activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/JbiMessage.java
(original)
+++ activemq/camel/trunk/camel-jbi/src/main/java/org/apache/camel/component/jbi/JbiMessage.java
Mon Mar 26 07:02:25 2007
@@ -17,8 +17,8 @@
  */
 package org.apache.camel.component.jbi;
 
-import org.apache.camel.impl.DefaultMessage;
 import org.apache.camel.Message;
+import org.apache.camel.impl.DefaultMessage;
 
 import javax.jbi.messaging.NormalizedMessage;
 import java.util.Iterator;

Modified: activemq/camel/trunk/camel-jbi/src/test/java/org/apache/camel/component/jbi/JbiTestSupport.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jbi/src/test/java/org/apache/camel/component/jbi/JbiTestSupport.java?view=diff&rev=522517&r1=522516&r2=522517
==============================================================================
--- activemq/camel/trunk/camel-jbi/src/test/java/org/apache/camel/component/jbi/JbiTestSupport.java
(original)
+++ activemq/camel/trunk/camel-jbi/src/test/java/org/apache/camel/component/jbi/JbiTestSupport.java
Mon Mar 26 07:02:25 2007
@@ -17,21 +17,21 @@
  */
 package org.apache.camel.component.jbi;
 
-import org.apache.camel.TestSupport;
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
-import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.TestSupport;
 import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.servicemix.jbi.container.ActivationSpec;
 import org.apache.servicemix.jbi.container.SpringJBIContainer;
 
 import javax.xml.namespace.QName;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.CountDownLatch;
-import java.util.List;
 import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 
 /**
  * @version $Revision$
@@ -103,7 +103,7 @@
         camelContext.activateEndpoints();
     }
 
-    protected abstract  void appendJbiActivationSpecs(List<ActivationSpec> activationSpecList);
+    protected abstract void appendJbiActivationSpecs(List<ActivationSpec> activationSpecList);
 
     protected abstract RouteBuilder createRoutes();
 }

Modified: activemq/camel/trunk/camel-jbi/src/test/java/org/apache/camel/component/jbi/SendFromCamelToJbiAndBackToCamelTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jbi/src/test/java/org/apache/camel/component/jbi/SendFromCamelToJbiAndBackToCamelTest.java?view=diff&rev=522517&r1=522516&r2=522517
==============================================================================
--- activemq/camel/trunk/camel-jbi/src/test/java/org/apache/camel/component/jbi/SendFromCamelToJbiAndBackToCamelTest.java
(original)
+++ activemq/camel/trunk/camel-jbi/src/test/java/org/apache/camel/component/jbi/SendFromCamelToJbiAndBackToCamelTest.java
Mon Mar 26 07:02:25 2007
@@ -17,20 +17,15 @@
  */
 package org.apache.camel.component.jbi;
 
-import org.apache.servicemix.tck.ReceiverComponent;
-import org.apache.servicemix.tck.MessageList;
-import org.apache.servicemix.tck.SenderComponent;
-import org.apache.servicemix.jbi.container.ActivationSpec;
-import org.apache.servicemix.jbi.resolver.ServiceNameEndpointResolver;
-import org.apache.servicemix.jbi.resolver.URIResolver;
+import org.apache.camel.Exchange;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.queue.QueueEndpoint;
-import org.apache.camel.Exchange;
+import org.apache.servicemix.jbi.container.ActivationSpec;
+import org.apache.servicemix.jbi.resolver.URIResolver;
+import org.apache.servicemix.tck.SenderComponent;
 
-import javax.jbi.messaging.NormalizedMessage;
 import javax.xml.namespace.QName;
 import java.util.List;
-import java.util.Queue;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.TimeUnit;
 

Modified: activemq/camel/trunk/camel-jbi/src/test/java/org/apache/camel/component/jbi/SendFromCamelToJbiTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jbi/src/test/java/org/apache/camel/component/jbi/SendFromCamelToJbiTest.java?view=diff&rev=522517&r1=522516&r2=522517
==============================================================================
--- activemq/camel/trunk/camel-jbi/src/test/java/org/apache/camel/component/jbi/SendFromCamelToJbiTest.java
(original)
+++ activemq/camel/trunk/camel-jbi/src/test/java/org/apache/camel/component/jbi/SendFromCamelToJbiTest.java
Mon Mar 26 07:02:25 2007
@@ -18,15 +18,12 @@
 package org.apache.camel.component.jbi;
 
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
 import org.apache.servicemix.jbi.container.ActivationSpec;
-import org.apache.servicemix.components.util.EchoComponent;
-import org.apache.servicemix.tck.ReceiverComponent;
 import org.apache.servicemix.tck.MessageList;
+import org.apache.servicemix.tck.ReceiverComponent;
 
-import javax.xml.namespace.QName;
 import javax.jbi.messaging.NormalizedMessage;
+import javax.xml.namespace.QName;
 import java.util.List;
 
 /**
@@ -46,7 +43,6 @@
         log.info("Received: " + message);
 
         assertEquals("cheese header", 123, message.getProperty("cheese"));
-
     }
 
     protected RouteBuilder createRoutes() {

Added: activemq/camel/trunk/camel-jbi/src/test/java/org/apache/camel/component/jbi/SendFromCamelToJbiThenRouteToAnotherJbiComponentTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-jbi/src/test/java/org/apache/camel/component/jbi/SendFromCamelToJbiThenRouteToAnotherJbiComponentTest.java?view=auto&rev=522517
==============================================================================
--- activemq/camel/trunk/camel-jbi/src/test/java/org/apache/camel/component/jbi/SendFromCamelToJbiThenRouteToAnotherJbiComponentTest.java
(added)
+++ activemq/camel/trunk/camel-jbi/src/test/java/org/apache/camel/component/jbi/SendFromCamelToJbiThenRouteToAnotherJbiComponentTest.java
Mon Mar 26 07:02:25 2007
@@ -0,0 +1,70 @@
+/**
+ *
+ * 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.jbi;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.servicemix.jbi.container.ActivationSpec;
+import org.apache.servicemix.tck.MessageList;
+import org.apache.servicemix.tck.ReceiverComponent;
+
+import javax.jbi.messaging.NormalizedMessage;
+import javax.xml.namespace.QName;
+import java.util.List;
+
+/**
+ * @version $Revision$
+ */
+public class SendFromCamelToJbiThenRouteToAnotherJbiComponentTest extends JbiTestSupport
{
+    private ReceiverComponent receiverComponent = new ReceiverComponent();
+
+    public void testCamelInvokingJbi() throws Exception {
+        sendExchange("<foo bar='123'/>");
+        MessageList list = receiverComponent.getMessageList();
+
+        list.assertMessagesReceived(1);
+        List messages = list.getMessages();
+        NormalizedMessage message = (NormalizedMessage) messages.get(0);
+        assertNotNull("null message!", message);
+        log.info("Received: " + message);
+
+        assertEquals("cheese header", 123, message.getProperty("cheese"));
+    }
+
+    protected RouteBuilder createRoutes() {
+        return new RouteBuilder() {
+            public void configure() {
+                from("jbi:service:serviceNamespace:serviceA:endpointA").to("jbi:service:serviceNamespace:serviceB");
+            }
+        };
+    }
+
+    protected void appendJbiActivationSpecs(List<ActivationSpec> activationSpecList)
{
+        ActivationSpec activationSpec = new ActivationSpec();
+        activationSpec.setId("jbiReceiver");
+        activationSpec.setService(new QName("serviceNamespace", "serviceB"));
+        activationSpec.setEndpoint("endpointB");
+        activationSpec.setComponent(receiverComponent);
+
+        activationSpecList.add(activationSpec);
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        camelContext.deactivateEndpoints();
+    }
+}

Propchange: activemq/camel/trunk/camel-jbi/src/test/java/org/apache/camel/component/jbi/SendFromCamelToJbiThenRouteToAnotherJbiComponentTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/camel-jbi/src/test/java/org/apache/camel/component/jbi/SendFromCamelToJbiThenRouteToAnotherJbiComponentTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: activemq/camel/trunk/camel-jbi/src/test/java/org/apache/camel/component/jbi/SendFromCamelToJbiThenRouteToAnotherJbiComponentTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message