camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r559812 - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/ camel-core/src/main/java/org/apache/camel/builder/ camel-core/src/main/java/org/apache/camel/impl/ camel-core/src/main/java/org/apache/camel/model/ camel-core/sr...
Date Thu, 26 Jul 2007 13:38:47 GMT
Author: jstrachan
Date: Thu Jul 26 06:38:45 2007
New Revision: 559812

URL: http://svn.apache.org/viewvc?view=rev&rev=559812
Log:
finally got all the test cases working for JAXB2! Phew! :)

Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Route.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/AggregatorBuilder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/MulticastBuilder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PipelineBuilder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ResequencerBuilder.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/EventDrivenConsumerRoute.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/RouteContext.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ResequencerType.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RouteType.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
    activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
    activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/xml/SpringXmlRouteBuilderTest.java
    activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSplitter.xml
    activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildWireTap.xml

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Route.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Route.java?view=diff&rev=559812&r1=559811&r2=559812
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Route.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/Route.java Thu Jul 26 06:38:45
2007
@@ -29,7 +29,7 @@
  *
  * @version $Revision$
  */
-public abstract class Route<E extends Exchange> {
+public class Route<E extends Exchange> {
     private final Map<String, Object> properties = new HashMap<String, Object>(16);
     private Endpoint<E> endpoint;
     private List<Service> services = new ArrayList<Service>();
@@ -38,6 +38,18 @@
         this.endpoint = endpoint;
     }
 
+    public Route(Endpoint<E> endpoint, Service... services) {
+        this(endpoint);
+        for (Service service : services) {
+            addService(service);
+        }
+    }
+
+    @Override
+    public String toString() {
+        return "Route";
+    }
+
     public Endpoint<E> getEndpoint() {
         return endpoint;
     }
@@ -65,7 +77,7 @@
     /**
      * Returns the additional services required for this particular route
      */
-    public List<Service> getServices() throws Exception {
+    public List<Service> getServices() {
         return services;
     }
 
@@ -73,8 +85,13 @@
         this.services = services;
     }
 
+    public void addService(Service service) {
+        getServices().add(service);
+    }
+
     /**
      * Strategy method to allow derived classes to lazily load services for the route
      */
-    protected abstract void addServices(List<Service> services) throws Exception;
+    protected void addServices(List<Service> services) throws Exception {
+    }
 }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/AggregatorBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/AggregatorBuilder.java?view=diff&rev=559812&r1=559811&r2=559812
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/AggregatorBuilder.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/AggregatorBuilder.java
Thu Jul 26 06:38:45 2007
@@ -58,10 +58,7 @@
         final Processor processor = super.createProcessor();
         final Aggregator service = new Aggregator(getFrom(), processor, correlationExpression,
aggregationStrategy);
 
-        return new Route<Exchange>(getFrom()) {
-            protected void addServices(List<Service> list) throws Exception {
-                list.add(service);
-            }
+        return new Route<Exchange>(getFrom(), service) {
 
             @Override
             public String toString() {

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/MulticastBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/MulticastBuilder.java?view=diff&rev=559812&r1=559811&r2=559812
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/MulticastBuilder.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/MulticastBuilder.java
Thu Jul 26 06:38:45 2007
@@ -20,9 +20,12 @@
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
+import org.apache.camel.Producer;
 import org.apache.camel.processor.MulticastProcessor;
 
 import java.util.Collection;
+import java.util.List;
+import java.util.ArrayList;
 
 /**
  * A builder for the {@link MulticastProcessor} pattern
@@ -39,6 +42,6 @@
 
     @Override
     public Processor createProcessor() throws Exception {
-        return new MulticastProcessor(endpoints);
+        return new MulticastProcessor(MulticastProcessor.toProducers(endpoints));
     }
 }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PipelineBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PipelineBuilder.java?view=diff&rev=559812&r1=559811&r2=559812
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PipelineBuilder.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/PipelineBuilder.java
Thu Jul 26 06:38:45 2007
@@ -21,6 +21,7 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.processor.Pipeline;
+import org.apache.camel.processor.MulticastProcessor;
 
 import java.util.Collection;
 
@@ -39,6 +40,6 @@
 
     @Override
     public Processor createProcessor() throws Exception {
-        return new Pipeline(endpoints);
+        return new Pipeline(MulticastProcessor.toProducers(endpoints));
     }
 }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ResequencerBuilder.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ResequencerBuilder.java?view=diff&rev=559812&r1=559811&r2=559812
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ResequencerBuilder.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/ResequencerBuilder.java
Thu Jul 26 06:38:45 2007
@@ -43,11 +43,7 @@
     public Route createRoute() throws Exception {
         final Processor processor = super.createProcessor();
         final Resequencer resequencer = new Resequencer(getFrom(), processor, expressions);
-
-        return new Route<Exchange>(getFrom()) {
-            protected void addServices(List<Service> list) throws Exception {
-                list.add(resequencer);
-            }
+        return new Route<Exchange>(getFrom(), resequencer) {
 
             @Override
             public String toString() {

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/EventDrivenConsumerRoute.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/EventDrivenConsumerRoute.java?view=diff&rev=559812&r1=559811&r2=559812
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/EventDrivenConsumerRoute.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/EventDrivenConsumerRoute.java
Thu Jul 26 06:38:45 2007
@@ -57,6 +57,7 @@
      * Factory method to lazily create the complete list of services required for this route
      * such as adding the processor or consumer
      */
+    @Override
     protected void addServices(List<Service> services) throws Exception {
         Processor processor = getProcessor();
         if (processor instanceof Service) {

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/RouteContext.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/RouteContext.java?view=diff&rev=559812&r1=559811&r2=559812
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/RouteContext.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/RouteContext.java
Thu Jul 26 06:38:45 2007
@@ -18,16 +18,17 @@
 
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
-import org.apache.camel.Processor;
 import org.apache.camel.NoSuchEndpointException;
+import org.apache.camel.Processor;
+import org.apache.camel.Route;
 import org.apache.camel.model.FromType;
 import org.apache.camel.model.ProcessorType;
 import org.apache.camel.model.RouteType;
-import org.apache.camel.processor.CompositeProcessor;
+import org.apache.camel.processor.MulticastProcessor;
 
 import java.util.ArrayList;
-import java.util.List;
 import java.util.Collection;
+import java.util.List;
 
 /**
  * The context used to activate new routing rules
@@ -37,11 +38,14 @@
 public class RouteContext {
     private final RouteType route;
     private final FromType from;
+    private final Collection<Route> routes;
     private Endpoint endpoint;
+    private List<Processor> eventDrivenProcessors = new ArrayList<Processor>();
 
-    public RouteContext(RouteType route, FromType from) {
+    public RouteContext(RouteType route, FromType from, Collection<Route> routes) {
         this.route = route;
         this.from = from;
+        this.routes = routes;
     }
 
     public Endpoint getEndpoint() {
@@ -68,13 +72,16 @@
         return node.wrapProcessor(this, processor);
     }
 
-
     public Processor createProcessor(Collection<ProcessorType> outputs) throws Exception
{
         List<Processor> list = new ArrayList<Processor>();
         for (ProcessorType output : outputs) {
             Processor processor = output.createProcessor(this);
             list.add(processor);
         }
+        return createCompositeProcessor(list);
+    }
+
+    protected Processor createCompositeProcessor(List<Processor> list) {
         if (list.size() == 0) {
             return null;
         }
@@ -83,12 +90,13 @@
             processor = list.get(0);
         }
         else {
-            processor = new CompositeProcessor(list);
+            //processor = new CompositeProcessor(list);
+            // TODO move into the node itself
+            processor = new MulticastProcessor(list);
         }
         return processor;
     }
 
-
     public Endpoint resolveEndpoint(String uri) {
         return route.resolveEndpoint(uri);
     }
@@ -101,13 +109,13 @@
         if (uri != null) {
             endpoint = resolveEndpoint(uri);
             if (endpoint == null) {
-               throw new NoSuchEndpointException(uri);
+                throw new NoSuchEndpointException(uri);
             }
         }
         if (ref != null) {
             endpoint = lookup(ref, Endpoint.class);
             if (endpoint == null) {
-               throw new NoSuchEndpointException("ref:" + ref);
+                throw new NoSuchEndpointException("ref:" + ref);
             }
         }
         if (endpoint == null) {
@@ -123,5 +131,21 @@
      */
     public <T> T lookup(String name, Class<T> type) {
         return getCamelContext().getRegistry().lookup(name, type);
+    }
+
+    /**
+     * Lets complete the route creation, creating a single event driven route for the current
from endpoint
+     * with any processors required
+     */
+    public void commit() {
+        // now lets turn all of the event driven consumer processors into a single route
+        if (!eventDrivenProcessors.isEmpty()) {
+            Processor processor = createCompositeProcessor(eventDrivenProcessors);
+            routes.add(new EventDrivenConsumerRoute(getEndpoint(), processor));
+        }
+    }
+
+    public void addEventDrivenProcessor(Processor processor) {
+        eventDrivenProcessors.add(processor);
     }
 }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java?view=diff&rev=559812&r1=559811&r2=559812
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorType.java
Thu Jul 26 06:38:45 2007
@@ -84,7 +84,7 @@
 
     public void addRoutes(RouteContext routeContext, Collection<Route> routes) throws
Exception {
         Processor processor = makeProcessor(routeContext);
-        routes.add(new EventDrivenConsumerRoute(routeContext.getEndpoint(), processor));
+        routeContext.addEventDrivenProcessor(processor);
     }
 
     /**

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ResequencerType.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ResequencerType.java?view=diff&rev=559812&r1=559811&r2=559812
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ResequencerType.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ResequencerType.java
Thu Jul 26 06:38:45 2007
@@ -44,16 +44,14 @@
         final Processor processor = routeContext.createProcessor(this);
         final Resequencer resequencer = new Resequencer(from, processor, getExpression().createExpression(routeContext));
 
-        Route<Exchange> route = new Route<Exchange>(from) {
-            protected void addServices(List<Service> list) throws Exception {
-                list.add(resequencer);
-            }
+        Route route = new Route<Exchange>(from, resequencer) {
 
             @Override
             public String toString() {
                 return "ResequencerRoute[" + getEndpoint() + " -> " + processor + "]";
             }
         };
+
         routes.add(route);
     }
 }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RouteType.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RouteType.java?view=diff&rev=559812&r1=559811&r2=559812
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RouteType.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/model/RouteType.java Thu
Jul 26 06:38:45 2007
@@ -20,7 +20,9 @@
 import org.apache.camel.CamelContextAware;
 import org.apache.camel.Endpoint;
 import org.apache.camel.Route;
+import org.apache.camel.Processor;
 import org.apache.camel.impl.RouteContext;
+import org.apache.camel.impl.EventDrivenConsumerRoute;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -130,12 +132,14 @@
     }
 
     protected void addRoutes(Collection<Route> routes, FromType fromType) throws Exception
{
-        RouteContext routeContext = new RouteContext(this, fromType);
+        RouteContext routeContext = new RouteContext(this, fromType, routes);
         Endpoint endpoint = routeContext.getEndpoint();
 
         for (ProcessorType output : outputs) {
             output.addRoutes(routeContext, routes);
         }
+
+        routeContext.commit();
     }
 
     protected void configureChild(ProcessorType output) {

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java?view=diff&rev=559812&r1=559811&r2=559812
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
Thu Jul 26 06:38:45 2007
@@ -21,6 +21,7 @@
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
+import org.apache.camel.util.ServiceHelper;
 import org.apache.camel.impl.ServiceSupport;
 
 import java.util.ArrayList;
@@ -30,76 +31,64 @@
  * Implements the Multicast pattern to send a message exchange to a number of endpoints,
each endpoint receiving a copy of
  * the message exchange.
  *
+ * @see Pipeline
  * @version $Revision$
  */
 public class MulticastProcessor extends ServiceSupport implements Processor {
-    private Collection<Producer> producers;
+    private Collection<Processor> processors;
 
     /**
      * A helper method to convert a list of endpoints into a list of processors
      */
-    public static <E extends Exchange> Collection<Producer> toProducers(Collection<Endpoint>
endpoints) throws Exception {
-        Collection<Producer> answer = new ArrayList<Producer>();
+    public static <E extends Exchange> Collection<Processor> toProducers(Collection<Endpoint>
endpoints) throws Exception {
+        Collection<Processor> answer = new ArrayList<Processor>();
         for (Endpoint endpoint : endpoints) {
             answer.add(endpoint.createProducer());
         }
         return answer;
     }
 
-    public MulticastProcessor(Collection<Endpoint> endpoints) throws Exception {
-        this.producers = toProducers(endpoints);
+    public MulticastProcessor(Collection<Processor> processors) {
+        this.processors = processors;
     }
 
     @Override
     public String toString() {
-        return "Multicast" + getEndpoints();
+        return "Multicast" + getProcessors();
     }
 
     public void process(Exchange exchange) throws Exception {
-        for (Producer producer : producers) {
+        for (Processor producer : processors) {
             Exchange copy = copyExchangeStrategy(producer, exchange);
             producer.process(copy);
         }
     }
 
     protected void doStop() throws Exception {
-        for (Producer producer : producers) {
-            producer.stop();
-        }
+        ServiceHelper.stopServices(processors);
     }
 
     protected void doStart() throws Exception {
-        for (Producer producer : producers) {
-            producer.start();
-        }
+        ServiceHelper.startServices(processors);
     }
 
+
     /**
      * Returns the producers to multicast to
      */
-    public Collection<Producer> getProducers() {
-        return producers;
+    public Collection<Processor> getProcessors() {
+        return processors;
     }
 
-    /**
-     * Returns the list of endpoints
-     */
-    public Collection<Endpoint> getEndpoints() {
-        Collection<Endpoint> answer = new ArrayList<Endpoint>();
-        for (Producer producer : producers) {
-            answer.add(producer.getEndpoint());
-        }
-        return answer;
-    }
 
     /**
      * Strategy method to copy the exchange before sending to another endpoint. Derived classes
such as the
      * {@link Pipeline} will not clone the exchange
      *
-     * @param producer the producer that will send the exchange
+     * @param processor the processor that will send the exchange
      * @param exchange @return the current exchange if no copying is required such as for
a pipeline otherwise a new copy of the exchange is returned.
      */
-    protected Exchange copyExchangeStrategy(Producer producer, Exchange exchange) {
-        return producer.createExchange(exchange);
+    protected Exchange copyExchangeStrategy(Processor processor, Exchange exchange) {
+        return exchange.copy();
     }
 }

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java?view=diff&rev=559812&r1=559811&r2=559812
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
(original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/Pipeline.java
Thu Jul 26 06:38:45 2007
@@ -25,20 +25,20 @@
 import java.util.Collection;
 
 /**
- * Creates a Pipeline pattern where the output of the previous step is sent as input to the
next step when working
- * with request/response message exchanges.
+ * Creates a Pipeline pattern where the output of the previous step is sent as input to the
next step, reusing the same
+ * message exchanges
  *
  * @version $Revision$
  */
 public class Pipeline extends MulticastProcessor implements Processor {
-    public Pipeline(Collection<Endpoint> endpoints) throws Exception {
-        super(endpoints);
+    public Pipeline(Collection<Processor> processors) {
+        super(processors);
     }
 
     public void process(Exchange exchange) throws Exception {
         Exchange nextExchange = exchange;
         boolean first = true;
-        for (Producer producer : getProducers()) {
+        for (Processor producer : getProcessors()) {
             if (first) {
                 first = false;
             }
@@ -56,8 +56,8 @@
      * @param previousExchange the previous exchange
      * @return a new exchange
      */
-    protected Exchange createNextExchange(Producer producer, Exchange previousExchange) {
-        Exchange answer = producer.createExchange(previousExchange);
+    protected Exchange createNextExchange(Processor producer, Exchange previousExchange)
{
+        Exchange answer = copyExchangeStrategy(previousExchange);
 
         // now lets set the input of the next exchange to the output of the previous message
if it is not null
         Object output = previousExchange.getOut().getBody();
@@ -80,6 +80,6 @@
 
     @Override
     public String toString() {
-        return "Pipeline" + getEndpoints();
+        return "Pipeline" + getProcessors();
     }
 }

Modified: activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java?view=diff&rev=559812&r1=559811&r2=559812
==============================================================================
--- activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
(original)
+++ activemq/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/RouteBuilderTest.java
Thu Jul 26 06:38:45 2007
@@ -26,6 +26,7 @@
 import org.apache.camel.Processor;
 import org.apache.camel.Route;
 import org.apache.camel.TestSupport;
+import org.apache.camel.Producer;
 import org.apache.camel.impl.EventDrivenConsumerRoute;
 import org.apache.camel.processor.ChoiceProcessor;
 import org.apache.camel.processor.DeadLetterChannel;
@@ -218,11 +219,11 @@
             Processor processor = getProcessorWithoutErrorHandler(route);
 
             MulticastProcessor multicastProcessor = assertIsInstanceOf(MulticastProcessor.class,
processor);
-            List<Endpoint> endpoints = new ArrayList<Endpoint>(multicastProcessor.getEndpoints());
+            List<Processor> endpoints = new ArrayList<Processor>(multicastProcessor.getProcessors());
             assertEquals("Should have 2 endpoints", 2, endpoints.size());
 
-            assertEndpointUri(endpoints.get(0), "seda:tap");
-            assertEndpointUri(endpoints.get(1), "seda:b");
+            assertSendToProcessor(endpoints.get(0), "seda:tap");
+            assertSendToProcessor(endpoints.get(1), "seda:b");
         }
     }
 
@@ -406,6 +407,19 @@
         assertEquals("Endpoint URI", uri, sendProcessor.getDestination().getEndpointUri());
     }
 
+    protected void assertSendToProcessor(Processor processor, String uri) {
+    	if (!(processor instanceof Producer)) {
+    		processor = unwrapErrorHandler(processor);
+    	}
+    	if (processor instanceof SendProcessor) {
+    		assertSendTo(processor, uri);
+    	}
+    	else {
+	        Producer producer = assertIsInstanceOf(Producer.class, processor);
+	        assertEquals("Endpoint URI", uri, producer.getEndpoint().getEndpointUri());
+    	}
+    }
+
     /**
      * By default routes should be wrapped in the {@link DeadLetterChannel} so lets unwrap
that and return the actual processor
      */
@@ -416,8 +430,14 @@
     }
 
     protected Processor unwrapErrorHandler(Processor processor) {
-        assertTrue("Processor should be a DeadLetterChannel but was: " + processor + " with
type: " + processor.getClass().getName(), processor instanceof DeadLetterChannel);
-        DeadLetterChannel deadLetter = (DeadLetterChannel) processor;
-        return deadLetter.getOutput();
+    	if (processor instanceof DeadLetterChannel) {
+    		DeadLetterChannel deadLetter = (DeadLetterChannel) processor;
+    		return deadLetter.getOutput();
+    	}
+    	else {
+    		return processor;
+    	}
     }
 }
+
+    
\ No newline at end of file

Modified: activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/xml/SpringXmlRouteBuilderTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/xml/SpringXmlRouteBuilderTest.java?view=diff&rev=559812&r1=559811&r2=559812
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/xml/SpringXmlRouteBuilderTest.java
(original)
+++ activemq/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/xml/SpringXmlRouteBuilderTest.java
Thu Jul 26 06:38:45 2007
@@ -103,21 +103,6 @@
         // TODO
     }
 
-    @Override
-    public void testWireTap() throws Exception {
-        // TODO
-    }
-
-    @Override
-    public void testRouteDynamicReceipentList() throws Exception {
-        // TODO
-    }
-
-    @Override
-    public void testSplitter() throws Exception {
-        // TODO
-    }
-
     protected List<Route> getRoutesFromContext(String classpathConfigFile) {
         applicationContext = new ClassPathXmlApplicationContext(classpathConfigFile);
         String name = "camel";

Modified: activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSplitter.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSplitter.xml?view=diff&rev=559812&r1=559811&r2=559812
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSplitter.xml
(original)
+++ activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildSplitter.xml
Thu Jul 26 06:38:45 2007
@@ -30,13 +30,9 @@
     <route>
       <from uri="seda:a"/>
       <splitter>
-        <recipients>
-          <bodyAs class="java.lang.String"/>
-          <tokenize token="
- "/>
-        </recipients>
+        <xpath>/invoice/lineItems</xpath>
+        <to uri="seda:b"/>
       </splitter>
-      <to uri="seda:b"/>
     </route>
   </camelContext>
   <!-- END SNIPPET: example -->

Modified: activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildWireTap.xml
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildWireTap.xml?view=diff&rev=559812&r1=559811&r2=559812
==============================================================================
--- activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildWireTap.xml
(original)
+++ activemq/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/spring/xml/buildWireTap.xml
Thu Jul 26 06:38:45 2007
@@ -31,7 +31,6 @@
       <from uri="seda:a"/>
       <to uri="seda:tap"/>
       <to uri="seda:b"/>
-      </to>
     </route>
   </camelContext>
   <!-- END SNIPPET: example -->



Mime
View raw message