Author: davsclaus
Date: Mon Jun 28 04:41:15 2010
New Revision: 958456

URL: http://svn.apache.org/viewvc?rev=958456&view=rev
Log:
CAMEL-2862: Added fromRoute to NotifyBuilder. Ensure it filters out events 
caused by using ProducerTemplate which is counter intuitive as you only want 
events from the routes.

Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java
    
camel/trunk/camel-core/src/main/java/org/apache/camel/builder/NotifyBuilder.java
    
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
    
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
    
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/UnitOfWorkProcessor.java
    
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/UnitOfWorkProducer.java
    
camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java
    
camel/trunk/camel-core/src/test/java/org/apache/camel/builder/NotifyBuilderTest.java
    
camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RetryRouteScopedUntilRecipientListIssueTest.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java?rev=958456&r1=958455&r2=958456&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java 
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/Exchange.java Mon Jun 
28 04:41:15 2010
@@ -337,8 +337,8 @@ public interface Exchange {
     Exchange copy();
 
     /**
-     * Returns the endpoint which originated this message exchange if a 
consumer on an endpoint created the message exchange
-     * otherwise this property will be null
+     * Returns the endpoint which originated this message exchange if a 
consumer on an endpoint
+     * created the message exchange, otherwise this property will be 
<tt>null</tt>
      */
     Endpoint getFromEndpoint();
 
@@ -351,6 +351,20 @@ public interface Exchange {
     void setFromEndpoint(Endpoint fromEndpoint);
     
     /**
+     * Returns the route id which originated this message exchange if a route 
consumer on an endpoint
+     * created the message exchange, otherwise this property will be 
<tt>null</tt>
+     */
+    String getFromRouteId();
+
+    /**
+     * Sets the route id which originated this message exchange. This method
+     * should typically only be called by the internal framework.
+     *
+     * @param fromRouteId the from route id
+     */
+    void setFromRouteId(String fromRouteId);
+
+    /**
      * Returns the unit of work that this exchange belongs to; which may map to
      * zero, one or more physical transactions
      */

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/builder/NotifyBuilder.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/builder/NotifyBuilder.java?rev=958456&r1=958455&r2=958456&view=diff
==============================================================================
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/builder/NotifyBuilder.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/builder/NotifyBuilder.java
 Mon Jun 28 04:41:15 2010
@@ -30,6 +30,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.Expression;
 import org.apache.camel.Predicate;
 import org.apache.camel.Producer;
+import org.apache.camel.component.direct.DirectEndpoint;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.management.EventNotifierSupport;
 import org.apache.camel.management.event.ExchangeCompletedEvent;
@@ -53,7 +54,7 @@ import org.apache.camel.util.ServiceHelp
 public class NotifyBuilder {
 
     // notifier to hook into Camel to listen for events
-    private final EventNotifier eventNotifier = new ExchangeNotifier();
+    private final EventNotifier eventNotifier;
 
     // the predicates build with this builder
     private final List<EventPredicateHolder> predicates = new 
ArrayList<EventPredicateHolder>();
@@ -74,12 +75,16 @@ public class NotifyBuilder {
      * @param context the Camel context
      */
     public NotifyBuilder(CamelContext context) {
+        eventNotifier = new ExchangeNotifier();
         try {
             ServiceHelper.startService(eventNotifier);
         } catch (Exception e) {
             throw ObjectHelper.wrapRuntimeCamelException(e);
         }
         context.getManagementStrategy().addEventNotifier(eventNotifier);
+        // we only want to match from routes, so skip for example events
+        // which is triggered by producer templates etc.
+        this.fromRoutesOnly();
     }
 
     /**
@@ -112,6 +117,64 @@ public class NotifyBuilder {
     }
 
     /**
+     * Optionally a <tt>from</tt> route which means that this expression 
should only be based
+     * on {...@link Exchange} which is originated from the particular route(s).
+     *
+     * @param routeId id of route or pattern (see the EndpointHelper javadoc)
+     * @return the builder
+     * @see org.apache.camel.util.EndpointHelper#matchEndpoint(String, String)
+     */
+    public NotifyBuilder fromRoute(final String routeId) {
+        stack.push(new EventPredicateSupport() {
+
+            @Override
+            public boolean onExchange(Exchange exchange) {
+                String id = 
EndpointHelper.getRouteIdFromEndpoint(exchange.getFromEndpoint());
+                // filter non matching exchanges
+                return EndpointHelper.matchPattern(id, routeId);
+            }
+
+            public boolean matches() {
+                return true;
+            }
+
+            @Override
+            public String toString() {
+                return "fromRoute(" + routeId + ")";
+            }
+        });
+        return this;
+    }
+
+    private NotifyBuilder fromRoutesOnly() {
+        stack.push(new EventPredicateSupport() {
+
+            @Override
+            public boolean onExchange(Exchange exchange) {
+                // always accept direct endpoints as they are a special case 
as it will create the UoW beforehand
+                // and just continue to route that on the consumer side, which 
causes the EventNotifer not to
+                // emit events when the consumer received the exchange, as its 
alreay done. For example by
+                // ProducerTemplate which creates the UoW before producing 
messages.
+                if (exchange.getFromEndpoint() != null && 
exchange.getFromEndpoint() instanceof DirectEndpoint) {
+                    return true;
+                }
+                return EndpointHelper.matchPattern(exchange.getFromRouteId(), 
"*");
+            }
+
+            public boolean matches() {
+                return true;
+            }
+
+            @Override
+            public String toString() {
+                // we dont want any to string output as this is an internal 
predicate to match only from routes
+                return "";
+            }
+        });
+        return this;
+    }
+
+    /**
      * Optionally a filter to only allow matching {...@link Exchange} to be 
used for matching.
      *
      * @param predicate the predicate to use for the filter

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java?rev=958456&r1=958455&r2=958456&view=diff
==============================================================================
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java 
(original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultExchange.java 
Mon Jun 28 04:41:15 2010
@@ -48,6 +48,7 @@ public final class DefaultExchange imple
     private UnitOfWork unitOfWork;
     private ExchangePattern pattern;
     private Endpoint fromEndpoint;
+    private String fromRouteId;
     private List<Synchronization> onCompletions;
 
     public DefaultExchange(CamelContext context) {
@@ -62,6 +63,7 @@ public final class DefaultExchange imple
     public DefaultExchange(Exchange parent) {
         this(parent.getContext(), parent.getPattern());
         this.fromEndpoint = parent.getFromEndpoint();
+        this.fromRouteId = parent.getFromRouteId();
         this.unitOfWork = parent.getUnitOfWork();
     }
 
@@ -278,6 +280,14 @@ public final class DefaultExchange imple
         this.fromEndpoint = fromEndpoint;
     }
 
+    public String getFromRouteId() {
+        return fromRouteId;
+    }
+
+    public void setFromRouteId(String fromRouteId) {
+        this.fromRouteId = fromRouteId;
+    }
+
     public String getExchangeId() {
         if (exchangeId == null) {
             exchangeId = createExchangeId();

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java?rev=958456&r1=958455&r2=958456&view=diff
==============================================================================
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/impl/DefaultRouteContext.java
 Mon Jun 28 04:41:15 2010
@@ -145,7 +145,7 @@ public class DefaultRouteContext impleme
             Processor processor = Pipeline.newInstance(getCamelContext(), 
eventDrivenProcessors);
 
             // and wrap it in a unit of work so the UoW is on the top, so the 
entire route will be in the same UoW
-            Processor unitOfWorkProcessor = new UnitOfWorkProcessor(this, 
processor);
+            UnitOfWorkProcessor unitOfWorkProcessor = new 
UnitOfWorkProcessor(this, processor);
             Processor target = unitOfWorkProcessor;
 
             // and then optionally add route policy processor if a custom 
policy is set
@@ -172,7 +172,9 @@ public class DefaultRouteContext impleme
 
             // and create the route that wraps the UoW
             Route edcr = new EventDrivenConsumerRoute(this, getEndpoint(), 
wrapper);
-            edcr.getProperties().put(Route.ID_PROPERTY, 
route.idOrCreate(getCamelContext().getNodeIdFactory()));
+            // create the route id
+            String routeId = 
route.idOrCreate(getCamelContext().getNodeIdFactory());
+            edcr.getProperties().put(Route.ID_PROPERTY, routeId);
             edcr.getProperties().put(Route.PARENT_PROPERTY, 
Integer.toHexString(route.hashCode()));
             if (route.getGroup() != null) {
                 edcr.getProperties().put(Route.GROUP_PROPERTY, 
route.getGroup());

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/UnitOfWorkProcessor.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/UnitOfWorkProcessor.java?rev=958456&r1=958455&r2=958456&view=diff
==============================================================================
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/UnitOfWorkProcessor.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/UnitOfWorkProcessor.java
 Mon Jun 28 04:41:15 2010
@@ -28,13 +28,16 @@ import org.apache.commons.logging.LogFac
 import static org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException;
 
 /**
- * Handles calling the UnitOfWork.done() method when processing of an exchange
- * is complete.
+ * Ensures the {...@link Exchange} is routed under the boundaries of an 
{...@link org.apache.camel.spi.UnitOfWork}.
+ * <p/>
+ * Handles calling the {...@link 
org.apache.camel.spi.UnitOfWork#done(org.apache.camel.Exchange)} method
+ * when processing of an {...@link Exchange} is complete.
  */
 public final class UnitOfWorkProcessor extends DelegateAsyncProcessor {
 
     private static final transient Log LOG = 
LogFactory.getLog(UnitOfWorkProcessor.class);
     private final RouteContext routeContext;
+    private final String routeId;
 
     public UnitOfWorkProcessor(Processor processor) {
         this(null, processor);
@@ -47,11 +50,21 @@ public final class UnitOfWorkProcessor e
     public UnitOfWorkProcessor(RouteContext routeContext, Processor processor) 
{
         super(processor);
         this.routeContext = routeContext;
+        if (routeContext != null) {
+            this.routeId = 
routeContext.getRoute().idOrCreate(routeContext.getCamelContext().getNodeIdFactory());
+        } else {
+            this.routeId = null;
+        }
     }
 
     public UnitOfWorkProcessor(RouteContext routeContext, AsyncProcessor 
processor) {
         super(processor);
         this.routeContext = routeContext;
+        if (routeContext != null) {
+            this.routeId = 
routeContext.getRoute().idOrCreate(routeContext.getCamelContext().getNodeIdFactory());
+        } else {
+            this.routeId = null;
+        }
     }
 
     @Override
@@ -65,6 +78,12 @@ public final class UnitOfWorkProcessor e
 
     @Override
     public boolean process(final Exchange exchange, final AsyncCallback 
callback) {
+        // if the exchange doesn't have from route id set, then set it if it 
originated
+        // from this unit of work
+        if (routeId != null && exchange.getFromRouteId() == null) {
+            exchange.setFromRouteId(routeId);
+        }
+
         if (exchange.getUnitOfWork() == null) {
             // If there is no existing UoW, then we should start one and
             // terminate it once processing is completed for the exchange.

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/UnitOfWorkProducer.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/UnitOfWorkProducer.java?rev=958456&r1=958455&r2=958456&view=diff
==============================================================================
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/UnitOfWorkProducer.java
 (original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/processor/UnitOfWorkProducer.java
 Mon Jun 28 04:41:15 2010
@@ -21,6 +21,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.ExchangePattern;
 import org.apache.camel.Processor;
 import org.apache.camel.Producer;
+import org.apache.camel.util.ServiceHelper;
 
 /**
  * Ensures a {...@link Producer} is executed within an {...@link 
org.apache.camel.spi.UnitOfWork}.
@@ -30,6 +31,7 @@ import org.apache.camel.Producer;
 public final class UnitOfWorkProducer implements Producer {
 
     private final Producer producer;
+    private final Processor processor;
 
     /**
      * The producer which should be executed within an {...@link 
org.apache.camel.spi.UnitOfWork}.
@@ -38,6 +40,7 @@ public final class UnitOfWorkProducer im
      */
     public UnitOfWorkProducer(Producer producer) {
         this.producer = producer;
+        this.processor = new UnitOfWorkProcessor(producer);
     }
 
     public Endpoint getEndpoint() {
@@ -57,16 +60,15 @@ public final class UnitOfWorkProducer im
     }
 
     public void process(Exchange exchange) throws Exception {
-        Processor processor = new UnitOfWorkProcessor(producer);
         processor.process(exchange);
     }
 
     public void start() throws Exception {
-        producer.start();
+        ServiceHelper.startService(processor);
     }
 
     public void stop() throws Exception {
-        producer.stop();
+        ServiceHelper.stopService(processor);
     }
 
     public boolean isSingleton() {

Modified: 
camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java?rev=958456&r1=958455&r2=958456&view=diff
==============================================================================
--- 
camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java 
(original)
+++ 
camel/trunk/camel-core/src/main/java/org/apache/camel/util/EndpointHelper.java 
Mon Jun 28 04:41:15 2010
@@ -30,6 +30,7 @@ import org.apache.camel.Exchange;
 import org.apache.camel.PollingConsumer;
 import org.apache.camel.Processor;
 import org.apache.camel.ResolveEndpointFailedException;
+import org.apache.camel.Route;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -143,6 +144,10 @@ public final class EndpointHelper {
      * @return <tt>true</tt> if match, <tt>false</tt> otherwise.
      */
     public static boolean matchPattern(String name, String pattern) {
+        if (name == null || pattern == null) {
+            return false;
+        }
+
         if (name.equals(pattern)) {
             // exact match
             return true;
@@ -337,4 +342,25 @@ public final class EndpointHelper {
         }
     }
 
+    /**
+     * Gets the route id for the given endpoint in which there is a consumer 
listening.
+     *
+     * @param endpoint  the endpoint
+     * @return the route id, or <tt>null</tt> if none found
+     */
+    public static String getRouteIdFromEndpoint(Endpoint endpoint) {
+        if (endpoint == null || endpoint.getCamelContext() == null) {
+            return null;
+        }
+
+        List<Route> routes = endpoint.getCamelContext().getRoutes();
+        for (Route route : routes) {
+            if (route.getEndpoint().equals(endpoint)
+                    || 
route.getEndpoint().getEndpointKey().equals(endpoint.getEndpointKey()) ) {
+                return route.getId();
+            }
+        }
+        return null;
+    }
+
 }

Modified: 
camel/trunk/camel-core/src/test/java/org/apache/camel/builder/NotifyBuilderTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/builder/NotifyBuilderTest.java?rev=958456&r1=958455&r2=958456&view=diff
==============================================================================
--- 
camel/trunk/camel-core/src/test/java/org/apache/camel/builder/NotifyBuilderTest.java
 (original)
+++ 
camel/trunk/camel-core/src/test/java/org/apache/camel/builder/NotifyBuilderTest.java
 Mon Jun 28 04:41:15 2010
@@ -20,12 +20,77 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.component.seda.SedaEndpoint;
 
 /**
  * @version $Revision$
  */
 public class NotifyBuilderTest extends ContextTestSupport {
 
+    public void testDirectWhenExchangeDoneSimple() throws Exception {
+        NotifyBuilder notify = new NotifyBuilder(context)
+                .from("direct:foo").whenDone(1)
+                .create();
+
+        assertEquals("from(direct:foo).whenDone(1)", notify.toString());
+
+        assertEquals(false, notify.matches());
+
+        template.sendBody("direct:foo", "A");
+
+        assertEquals(true, notify.matches());
+    }
+
+    public void testSedaWhenExchangeDoneSimple() throws Exception {
+        NotifyBuilder notify = new NotifyBuilder(context)
+                .from("seda:beer").whenDone(1)
+                .create();
+
+        assertEquals("from(seda:beer).whenDone(1)", notify.toString());
+
+        assertEquals(false, notify.matches());
+
+        template.sendBody("seda:beer", "A");
+
+        // wait up till 5 sec as it should be routed completed now
+        assertEquals(true, notify.matches(5, TimeUnit.SECONDS));
+
+        SedaEndpoint confirm = context.getEndpoint("seda:done", 
SedaEndpoint.class);
+        assertEquals(1, confirm.getExchanges().size());
+    }
+
+    public void testDirectFromRoute() throws Exception {
+        NotifyBuilder notify = new NotifyBuilder(context)
+                .fromRoute("foo").whenDone(1)
+                .create();
+
+        assertEquals("fromRoute(foo).whenDone(1)", notify.toString());
+
+        assertEquals(false, notify.matches());
+
+        template.sendBody("direct:bar", "A");
+        assertEquals(false, notify.matches());
+
+        template.sendBody("direct:foo", "B");
+        assertEquals(true, notify.matches());
+    }
+
+    public void testDirectFromRouteReceived() throws Exception {
+        NotifyBuilder notify = new NotifyBuilder(context)
+                .fromRoute("foo").whenReceived(1)
+                .create();
+
+        assertEquals("fromRoute(foo).whenReceived(1)", notify.toString());
+
+        assertEquals(false, notify.matches());
+
+        template.sendBody("direct:bar", "A");
+        assertEquals(false, notify.matches());
+
+        template.sendBody("direct:foo", "B");
+        assertEquals(true, notify.matches());
+    }
+
     public void testWhenExchangeDone() throws Exception {
         NotifyBuilder notify = new NotifyBuilder(context)
                 .from("direct:foo").whenDone(5)
@@ -89,6 +154,65 @@ public class NotifyBuilderTest extends C
         assertEquals(true, notify.matches());
     }
 
+    public void testFromRouteWhenExchangeDoneAnd() throws Exception {
+        NotifyBuilder notify = new NotifyBuilder(context)
+                .fromRoute("foo").whenDone(5)
+                .and().fromRoute("bar").whenDone(7)
+                .create();
+
+        assertEquals(false, notify.matches());
+
+        template.sendBody("direct:foo", "A");
+        template.sendBody("direct:foo", "B");
+        template.sendBody("direct:foo", "C");
+
+        template.sendBody("direct:bar", "D");
+        template.sendBody("direct:bar", "E");
+
+        assertEquals(false, notify.matches());
+
+        template.sendBody("direct:foo", "F");
+        template.sendBody("direct:bar", "G");
+
+        assertEquals(false, notify.matches());
+
+        template.sendBody("direct:foo", "H");
+        template.sendBody("direct:bar", "I");
+
+        assertEquals(false, notify.matches());
+
+        template.sendBody("direct:bar", "J");
+        template.sendBody("direct:bar", "K");
+        template.sendBody("direct:bar", "L");
+
+        assertEquals(true, notify.matches());
+    }
+
+    public void testFromRouteAndNot() throws Exception {
+        NotifyBuilder notify = new NotifyBuilder(context)
+                .fromRoute("foo").whenDone(2)
+                .and().fromRoute("bar").whenReceived(1)
+                .not().fromRoute("cake").whenDone(1)
+                .create();
+
+        assertEquals(false, notify.matches());
+
+        template.sendBody("direct:foo", "A");
+        template.sendBody("direct:foo", "B");
+        assertEquals(false, notify.matches());
+
+        template.sendBody("direct:bar", "C");
+        assertEquals(true, notify.matches());
+
+        template.sendBody("direct:foo", "D");
+        template.sendBody("direct:bar", "E");
+        assertEquals(true, notify.matches());
+
+        // and now the cake to make it false
+        template.sendBody("direct:cake", "F");
+        assertEquals(false, notify.matches());
+    }
+
     public void testWhenExchangeDoneOr() throws Exception {
         NotifyBuilder notify = new NotifyBuilder(context)
                 .from("direct:foo").whenDone(5)
@@ -334,10 +458,8 @@ public class NotifyBuilderTest extends C
     }
 
     public void testWhenExchangeDoneWithDelay() throws Exception {
-        // There are two done event, one for the exchange which is created by 
DefaultProducerTemplate
-        // the other is for the exchange which is created by route context
         NotifyBuilder notify = new NotifyBuilder(context)
-                .whenDone(2)
+                .whenDone(1)
                 .create();
 
         long start = System.currentTimeMillis();
@@ -355,10 +477,8 @@ public class NotifyBuilderTest extends C
     }
 
     public void testWhenExchangeDoneAndTimeoutWithDelay() throws Exception {
-        // There are two done event, one for the exchange which is created by 
DefaultProducerTemplate
-        // the other is for the exchange which is created by route context
         NotifyBuilder notify = new NotifyBuilder(context)
-                .whenDone(2)
+                .whenDone(1)
                 .create();
 
         template.sendBody("seda:cheese", "Hello Cheese");
@@ -793,15 +913,17 @@ public class NotifyBuilderTest extends C
         return new RouteBuilder() {
             @Override
             public void configure() throws Exception {
-                from("direct:foo").to("mock:foo");
+                from("direct:foo").routeId("foo").to("mock:foo");
 
-                from("direct:bar").to("mock:bar");
+                from("direct:bar").routeId("bar").to("mock:bar");
 
                 from("direct:fail").throwException(new 
IllegalArgumentException("Damn"));
 
                 from("seda:cheese").delay(3000).to("mock:cheese");
 
-                from("direct:cake").transform(body().prepend("Bye 
")).to("log:cake");
+                
from("direct:cake").routeId("cake").transform(body().prepend("Bye 
")).to("log:cake");
+
+                from("seda:beer").to("mock:beer").delay(3000).to("seda:done");
             }
         };
     }

Modified: 
camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RetryRouteScopedUntilRecipientListIssueTest.java
URL: 
http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RetryRouteScopedUntilRecipientListIssueTest.java?rev=958456&r1=958455&r2=958456&view=diff
==============================================================================
--- 
camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RetryRouteScopedUntilRecipientListIssueTest.java
 (original)
+++ 
camel/trunk/camel-core/src/test/java/org/apache/camel/issues/RetryRouteScopedUntilRecipientListIssueTest.java
 Mon Jun 28 04:41:15 2010
@@ -134,7 +134,7 @@ public class RetryRouteScopedUntilRecipi
     public void testRetryUntilRecipientListFailOnly() throws Exception {
         invoked.set(0);
 
-        NotifyBuilder notify = new NotifyBuilder(context).whenDone(2).create();
+        NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create();
 
         getMockEndpoint("mock:result").expectedMessageCount(0);
         getMockEndpoint("mock:foo").expectedMessageCount(0);
@@ -155,7 +155,7 @@ public class RetryRouteScopedUntilRecipi
     public void testRetryUntilRecipientListFailAndOk() throws Exception {
         invoked.set(0);
 
-        NotifyBuilder notify = new NotifyBuilder(context).whenDone(2).create();
+        NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create();
 
         getMockEndpoint("mock:result").expectedMessageCount(0);
         getMockEndpoint("mock:foo").expectedMinimumMessageCount(0);
@@ -212,7 +212,7 @@ public class RetryRouteScopedUntilRecipi
     public void testRetryUntilRecipientFailAndNotFail() throws Exception {
         invoked.set(0);
 
-        NotifyBuilder notify = new NotifyBuilder(context).whenDone(2).create();
+        NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create();
 
         getMockEndpoint("mock:result").expectedMessageCount(0);
         getMockEndpoint("mock:foo").expectedMinimumMessageCount(0);
@@ -233,7 +233,7 @@ public class RetryRouteScopedUntilRecipi
     public void testRetryUntilRecipientNotFailAndFail() throws Exception {
         invoked.set(0);
 
-        NotifyBuilder notify = new NotifyBuilder(context).whenDone(2).create();
+        NotifyBuilder notify = new NotifyBuilder(context).whenDone(1).create();
 
         getMockEndpoint("mock:result").expectedMessageCount(0);
         getMockEndpoint("mock:foo").expectedMinimumMessageCount(0);


Reply via email to