camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1340446 - in /camel/trunk/camel-core/src: main/java/org/apache/camel/impl/ main/java/org/apache/camel/management/event/ main/java/org/apache/camel/management/mbean/ main/java/org/apache/camel/processor/ main/java/org/apache/camel/spi/ main...
Date Sat, 19 May 2012 12:48:06 GMT
Author: davsclaus
Date: Sat May 19 12:48:05 2012
New Revision: 1340446

URL: http://svn.apache.org/viewvc?rev=1340446&view=rev
Log:
CAMEL-5287: Added ExchangeSendingEvent to event notifer, so we have both a before and after event.

Added:
    camel/trunk/camel-core/src/main/java/org/apache/camel/management/event/ExchangeSendingEvent.java
      - copied, changed from r1339606, camel/trunk/camel-core/src/main/java/org/apache/camel/management/event/ExchangeSentEvent.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierExchangeSentParallelTest.java
      - copied, changed from r1340371, camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierExchangeSentTest.java
Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/management/event/DefaultEventFactory.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/management/event/ExchangeCreatedEvent.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/management/event/ExchangeSentEvent.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedEventNotifier.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedEventNotifierMBean.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/spi/EventFactory.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/spi/EventNotifier.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/support/EventNotifierSupport.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/util/EventHelper.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/management/AddEventNotifierTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierEventsTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierExchangeSentTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierFailureHandledEventsTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierRedeliveryEventsTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxNotificationEventNotifierTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/management/MultipleEventNotifierEventsTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/management/PublishEventNotifierTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/management/PublishEventNotifierToRouteTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/management/RemoveEventNotifierTest.java
    camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/DebugTest.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java?rev=1340446&r1=1340445&r2=1340446&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java Sat May 19 12:48:05 2012
@@ -219,6 +219,9 @@ public class ProducerCache extends Servi
         }
 
         try {
+            if (exchange != null) {
+                EventHelper.notifyExchangeSending(exchange.getContext(), exchange, endpoint);
+            }
             // invoke the callback
             answer = callback.doInProducer(producer, exchange, pattern);
         } catch (Throwable e) {
@@ -280,6 +283,9 @@ public class ProducerCache extends Servi
         final StopWatch watch = exchange != null ? new StopWatch() : null;
 
         try {
+            if (exchange != null) {
+                EventHelper.notifyExchangeSending(exchange.getContext(), exchange, endpoint);
+            }
             // invoke the callback
             AsyncProcessor asyncProcessor = AsyncProcessorConverterHelper.convert(producer);
             sync = producerCallback.doInAsyncProducer(producer, asyncProcessor, exchange, pattern, new AsyncCallback() {
@@ -347,6 +353,7 @@ public class ProducerCache extends Servi
                 // send the exchange using the processor
                 StopWatch watch = new StopWatch();
                 try {
+                    EventHelper.notifyExchangeSending(exchange.getContext(), exchange, endpoint);
                     // ensure we run in an unit of work
                     Producer target = new UnitOfWorkProducer(producer);
                     target.process(exchange);

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/management/event/DefaultEventFactory.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/management/event/DefaultEventFactory.java?rev=1340446&r1=1340445&r2=1340446&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/management/event/DefaultEventFactory.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/management/event/DefaultEventFactory.java Sat May 19 12:48:05 2012
@@ -92,6 +92,10 @@ public class DefaultEventFactory impleme
         return new ExchangeRedeliveryEvent(exchange, attempt);
     }
 
+    public EventObject createExchangeSendingEvent(Exchange exchange, Endpoint endpoint) {
+        return new ExchangeSendingEvent(exchange, endpoint);
+    }
+
     public EventObject createExchangeSentEvent(Exchange exchange, Endpoint endpoint, long timeTaken) {
         return new ExchangeSentEvent(exchange, endpoint, timeTaken);
     }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/management/event/ExchangeCreatedEvent.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/management/event/ExchangeCreatedEvent.java?rev=1340446&r1=1340445&r2=1340446&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/management/event/ExchangeCreatedEvent.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/management/event/ExchangeCreatedEvent.java Sat May 19 12:48:05 2012
@@ -19,6 +19,12 @@ package org.apache.camel.management.even
 import org.apache.camel.Exchange;
 
 /**
+ * Event after an {@link Exchange} has been created.
+ * <p/>
+ * <b>Notice:</b> This event may be emitted after an {@link ExchangeSendingEvent}, and
+ * therefore its not guaranteed this event is the first event being send for a given {@link Exchange}
+ * lifecycle.
+ *
  * @version 
  */
 public class ExchangeCreatedEvent extends AbstractExchangeEvent {

Copied: camel/trunk/camel-core/src/main/java/org/apache/camel/management/event/ExchangeSendingEvent.java (from r1339606, camel/trunk/camel-core/src/main/java/org/apache/camel/management/event/ExchangeSentEvent.java)
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/management/event/ExchangeSendingEvent.java?p2=camel/trunk/camel-core/src/main/java/org/apache/camel/management/event/ExchangeSendingEvent.java&p1=camel/trunk/camel-core/src/main/java/org/apache/camel/management/event/ExchangeSentEvent.java&r1=1339606&r2=1340446&rev=1340446&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/management/event/ExchangeSentEvent.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/management/event/ExchangeSendingEvent.java Sat May 19 12:48:05 2012
@@ -20,31 +20,35 @@ import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 
 /**
+ * Event for <b>before</b> sending an {@link Exchange} to an {@link Endpoint}.
+ * <p/>
+ * This event is emitted before attempting to send the {@link Exchange} to an {@link Endpoint}.
+ * There is still some internal processing occurring before the actual sending takes places, and
+ * therefore its not a 100% guarantee that the sending actually happens, as there may cause an
+ * internal error before.
+ * <p/>
+ * The {@link ExchangeSentEvent} is an event which is emitted <b>after</b> the sending is done.
+ *
+ * @see ExchangeSentEvent
  * @version 
  */
-public class ExchangeSentEvent extends AbstractExchangeEvent {
-    private static final long serialVersionUID = -19248832613958123L;
+public class ExchangeSendingEvent extends AbstractExchangeEvent {
+    private static final long serialVersionUID = -19248832613958122L;
 
     private final Endpoint endpoint;
-    private final long timeTaken;
 
-    public ExchangeSentEvent(Exchange source, Endpoint endpoint, long timeTaken) {
+    public ExchangeSendingEvent(Exchange source, Endpoint endpoint) {
         super(source);
         this.endpoint = endpoint;
-        this.timeTaken = timeTaken;
     }
 
     public Endpoint getEndpoint() {
         return endpoint;
     }
 
-    public long getTimeTaken() {
-        return timeTaken;
-    }
-
     @Override
     public String toString() {
-        return getExchange().getExchangeId() + " exchange " + getExchange() + " sent to: " + endpoint.getEndpointUri() + " took: " + timeTaken + " ms.";
+        return getExchange().getExchangeId() + " exchange " + getExchange() + " is being sent to: " + endpoint.getEndpointUri();
     }
 
 }
\ No newline at end of file

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/management/event/ExchangeSentEvent.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/management/event/ExchangeSentEvent.java?rev=1340446&r1=1340445&r2=1340446&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/management/event/ExchangeSentEvent.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/management/event/ExchangeSentEvent.java Sat May 19 12:48:05 2012
@@ -20,7 +20,10 @@ import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
 
 /**
- * @version 
+ * Event for <b>after</b> an {@link Exchange} has been sent to an {@link Endpoint}.
+ *
+ * @see ExchangeSendingEvent
+ * @version
  */
 public class ExchangeSentEvent extends AbstractExchangeEvent {
     private static final long serialVersionUID = -19248832613958123L;

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedEventNotifier.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedEventNotifier.java?rev=1340446&r1=1340445&r2=1340446&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedEventNotifier.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedEventNotifier.java Sat May 19 12:48:05 2012
@@ -125,13 +125,21 @@ public class ManagedEventNotifier extend
         getEventNotifier().setIgnoreExchangeSentEvents(ignoreExchangeSentEvents);
     }
     
+    public boolean isIgnoreExchangeSendingEvents() {
+        return getEventNotifier().isIgnoreExchangeSendingEvents();
+    }
+
+    public void setIgnoreExchangeSendingEvents(boolean ignoreExchangeSendingEvents) {
+        getEventNotifier().setIgnoreExchangeSendingEvents(ignoreExchangeSendingEvents);
+    }
+
     public MBeanNotificationInfo[] getNotificationInfo() {
         // all the class names in the event package
         String[] names = {"CamelContextStartedEvent", "CamelContextStartingEvent", "CamelContextStartupFailureEvent"
                 , "CamelContextStopFailureEvent", "CamelContextStoppedEvent", "CamelContextStoppingEvent"
                 , "CamelContextSuspendingEvent", "CamelContextSuspendedEvent", "CamelContextResumingEvent", "CamelContextResumedEvent"
                 , "CamelContextResumeFailureEvent", "ExchangeCompletedEvent", "ExchangeCreatedEvent", "ExchangeFailedEvent"
-                , "ExchangeFailureHandledEvent", "ExchangeRedeliveryEvents", "ExchangeSentEvent", "RouteStartedEvent"
+                , "ExchangeFailureHandledEvent", "ExchangeRedeliveryEvents", "ExchangeSendingEvent", "ExchangeSentEvent", "RouteStartedEvent"
                 , "RouteStoppedEvent", "ServiceStartupFailureEvent", "ServiceStopFailureEvent"};
 
         List<MBeanNotificationInfo> infos = new ArrayList<MBeanNotificationInfo>();

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedEventNotifierMBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedEventNotifierMBean.java?rev=1340446&r1=1340445&r2=1340446&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedEventNotifierMBean.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/management/mbean/ManagedEventNotifierMBean.java Sat May 19 12:48:05 2012
@@ -54,4 +54,7 @@ public interface ManagedEventNotifierMBe
 
     void setIgnoreExchangeSentEvents(boolean ignoreExchangeSentEvents);
 
+    boolean isIgnoreExchangeSendingEvents();
+
+    void setIgnoreExchangeSendingEvents(boolean ignoreExchangeSendingEvents);
 }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java?rev=1340446&r1=1340445&r2=1340446&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/processor/MulticastProcessor.java Sat May 19 12:48:05 2012
@@ -571,6 +571,9 @@ public class MulticastProcessor extends 
                 traced.pushBlock();
             }
 
+            if (producer != null) {
+                EventHelper.notifyExchangeSending(exchange.getContext(), exchange, producer.getEndpoint());
+            }
             // let the prepared process it, remember to begin the exchange pair
             AsyncProcessor async = AsyncProcessorConverterHelper.convert(processor);
             pair.begin();
@@ -703,6 +706,9 @@ public class MulticastProcessor extends 
                 traced.pushBlock();
             }
 
+            if (producer != null) {
+                EventHelper.notifyExchangeSending(exchange.getContext(), exchange, producer.getEndpoint());
+            }
             // let the prepared process it, remember to begin the exchange pair
             // we invoke it synchronously as parallel async routing is too hard
             AsyncProcessor async = AsyncProcessorConverterHelper.convert(processor);

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/spi/EventFactory.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/EventFactory.java?rev=1340446&r1=1340445&r2=1340446&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/spi/EventFactory.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/spi/EventFactory.java Sat May 19 12:48:05 2012
@@ -164,7 +164,16 @@ public interface EventFactory {
     EventObject createExchangeRedeliveryEvent(Exchange exchange, int attempt);
 
     /**
-     * Creates an {@link EventObject} when an {@link org.apache.camel.Exchange} has completely been sent to the endpoint.
+     * Creates an {@link EventObject} when an {@link org.apache.camel.Exchange} is about to be sent to the endpoint (eg before).
+     *
+     * @param exchange  the exchange
+     * @param endpoint  the destination
+     * @return the created event
+     */
+    EventObject createExchangeSendingEvent(Exchange exchange, Endpoint endpoint);
+
+    /**
+     * Creates an {@link EventObject} when an {@link org.apache.camel.Exchange} has completely been sent to the endpoint (eg after).
      *
      * @param exchange  the exchange
      * @param endpoint  the destination

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/spi/EventNotifier.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/EventNotifier.java?rev=1340446&r1=1340445&r2=1340446&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/spi/EventNotifier.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/spi/EventNotifier.java Sat May 19 12:48:05 2012
@@ -80,4 +80,8 @@ public interface EventNotifier {
 
     void setIgnoreExchangeSentEvents(boolean ignoreExchangeSentEvents);
 
+    boolean isIgnoreExchangeSendingEvents();
+
+    void setIgnoreExchangeSendingEvents(boolean ignoreExchangeSendingEvents);
+
 }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/support/EventNotifierSupport.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/support/EventNotifierSupport.java?rev=1340446&r1=1340445&r2=1340446&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/support/EventNotifierSupport.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/support/EventNotifierSupport.java Sat May 19 12:48:05 2012
@@ -35,6 +35,7 @@ public abstract class EventNotifierSuppo
     private boolean ignoreExchangeCompletedEvent;
     private boolean ignoreExchangeFailedEvents;
     private boolean ignoreExchangeRedeliveryEvents;
+    private boolean ignoreExchangeSendingEvents;
     private boolean ignoreExchangeSentEvents;
 
     public boolean isIgnoreCamelContextEvents() {
@@ -108,4 +109,12 @@ public abstract class EventNotifierSuppo
     public void setIgnoreExchangeSentEvents(boolean ignoreExchangeSentEvents) {
         this.ignoreExchangeSentEvents = ignoreExchangeSentEvents;
     }
+
+    public boolean isIgnoreExchangeSendingEvents() {
+        return ignoreExchangeSendingEvents;
+    }
+
+    public void setIgnoreExchangeSendingEvents(boolean ignoreExchangeSendingEvents) {
+        this.ignoreExchangeSendingEvents = ignoreExchangeSendingEvents;
+    }
 }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/util/EventHelper.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/util/EventHelper.java?rev=1340446&r1=1340445&r2=1340446&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/util/EventHelper.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/util/EventHelper.java Sat May 19 12:48:05 2012
@@ -413,6 +413,34 @@ public final class EventHelper {
         }
     }
 
+    public static void notifyExchangeSending(CamelContext context, Exchange exchange, Endpoint endpoint) {
+        if (exchange.getProperty(Exchange.NOTIFY_EVENT, false, Boolean.class)) {
+            // do not generate events for an notify event
+            return;
+        }
+
+        List<EventNotifier> notifiers = context.getManagementStrategy().getEventNotifiers();
+        if (notifiers == null || notifiers.isEmpty()) {
+            return;
+        }
+
+        for (EventNotifier notifier : notifiers) {
+            if (notifier.isIgnoreExchangeEvents() || notifier.isIgnoreExchangeSentEvents()) {
+                continue;
+            }
+
+            EventFactory factory = context.getManagementStrategy().getEventFactory();
+            if (factory == null) {
+                return;
+            }
+            EventObject event = factory.createExchangeSendingEvent(exchange, endpoint);
+            if (event == null) {
+                return;
+            }
+            doNotifyEvent(notifier, event);
+        }
+    }
+
     public static void notifyExchangeSent(CamelContext context, Exchange exchange, Endpoint endpoint, long timeTaken) {
         if (exchange.getProperty(Exchange.NOTIFY_EVENT, false, Boolean.class)) {
             // do not generate events for an notify event

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/management/AddEventNotifierTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/management/AddEventNotifierTest.java?rev=1340446&r1=1340445&r2=1340446&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/management/AddEventNotifierTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/management/AddEventNotifierTest.java Sat May 19 12:48:05 2012
@@ -73,7 +73,7 @@ public class AddEventNotifierTest extend
         template.sendBody("direct:start", "Bye World");
         assertMockEndpointsSatisfied();
 
-        assertEquals(5, events.size());
+        assertEquals(8, events.size());
 
         // remove and we should not get new events
         context.getManagementStrategy().removeEventNotifier(notifier);
@@ -83,7 +83,7 @@ public class AddEventNotifierTest extend
         template.sendBody("direct:start", "Hi World");
         assertMockEndpointsSatisfied();
 
-        assertEquals(5, events.size());
+        assertEquals(8, events.size());
     }
 
     @Override

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierEventsTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierEventsTest.java?rev=1340446&r1=1340445&r2=1340446&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierEventsTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierEventsTest.java Sat May 19 12:48:05 2012
@@ -35,6 +35,7 @@ import org.apache.camel.management.event
 import org.apache.camel.management.event.ExchangeCompletedEvent;
 import org.apache.camel.management.event.ExchangeCreatedEvent;
 import org.apache.camel.management.event.ExchangeFailedEvent;
+import org.apache.camel.management.event.ExchangeSendingEvent;
 import org.apache.camel.management.event.ExchangeSentEvent;
 import org.apache.camel.management.event.RouteStartedEvent;
 import org.apache.camel.management.event.RouteStoppedEvent;
@@ -83,26 +84,26 @@ public class EventNotifierEventsTest ext
 
         assertMockEndpointsSatisfied();
 
-        assertEquals(9, events.size());
+        assertEquals(12, events.size());
         assertIsInstanceOf(CamelContextStartingEvent.class, events.get(0));
         assertIsInstanceOf(RouteStartedEvent.class, events.get(1));
         assertIsInstanceOf(RouteStartedEvent.class, events.get(2));
         assertIsInstanceOf(CamelContextStartedEvent.class, events.get(3));
-        assertIsInstanceOf(ExchangeCreatedEvent.class, events.get(4));
-        assertIsInstanceOf(ExchangeSentEvent.class, events.get(5));
-        assertIsInstanceOf(ExchangeSentEvent.class, events.get(6));
-        assertIsInstanceOf(ExchangeCompletedEvent.class, events.get(7));
+        assertIsInstanceOf(ExchangeCreatedEvent.class, events.get(5));
+        assertIsInstanceOf(ExchangeSentEvent.class, events.get(7));
+        assertIsInstanceOf(ExchangeSentEvent.class, events.get(9));
+        assertIsInstanceOf(ExchangeCompletedEvent.class, events.get(10));
 
         // this is the sent using the produce template to start the test
-        assertIsInstanceOf(ExchangeSentEvent.class, events.get(8));
+        assertIsInstanceOf(ExchangeSentEvent.class, events.get(11));
 
         context.stop();
 
-        assertEquals(13, events.size());
-        assertIsInstanceOf(CamelContextStoppingEvent.class, events.get(9));
-        assertIsInstanceOf(RouteStoppedEvent.class, events.get(10));
-        assertIsInstanceOf(RouteStoppedEvent.class, events.get(11));
-        assertIsInstanceOf(CamelContextStoppedEvent.class, events.get(12));
+        assertEquals(16, events.size());
+        assertIsInstanceOf(CamelContextStoppingEvent.class, events.get(12));
+        assertIsInstanceOf(RouteStoppedEvent.class, events.get(13));
+        assertIsInstanceOf(RouteStoppedEvent.class, events.get(14));
+        assertIsInstanceOf(CamelContextStoppedEvent.class, events.get(15));
     }
 
     public void testExchangeFailed() throws Exception {
@@ -114,23 +115,24 @@ public class EventNotifierEventsTest ext
             assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
         }
 
-        assertEquals(7, events.size());
+        assertEquals(8, events.size());
         assertIsInstanceOf(CamelContextStartingEvent.class, events.get(0));
         assertIsInstanceOf(RouteStartedEvent.class, events.get(1));
         assertIsInstanceOf(RouteStartedEvent.class, events.get(2));
         assertIsInstanceOf(CamelContextStartedEvent.class, events.get(3));
-        assertIsInstanceOf(ExchangeCreatedEvent.class, events.get(4));
-        assertIsInstanceOf(ExchangeFailedEvent.class, events.get(5));
+        assertIsInstanceOf(ExchangeSendingEvent.class, events.get(4));
+        assertIsInstanceOf(ExchangeCreatedEvent.class, events.get(5));
+        assertIsInstanceOf(ExchangeFailedEvent.class, events.get(6));
         // this is the sent using the produce template to start the test
-        assertIsInstanceOf(ExchangeSentEvent.class, events.get(6));
+        assertIsInstanceOf(ExchangeSentEvent.class, events.get(7));
 
         context.stop();
 
-        assertEquals(11, events.size());
-        assertIsInstanceOf(CamelContextStoppingEvent.class, events.get(7));
-        assertIsInstanceOf(RouteStoppedEvent.class, events.get(8));
+        assertEquals(12, events.size());
+        assertIsInstanceOf(CamelContextStoppingEvent.class, events.get(8));
         assertIsInstanceOf(RouteStoppedEvent.class, events.get(9));
-        assertIsInstanceOf(CamelContextStoppedEvent.class, events.get(10));
+        assertIsInstanceOf(RouteStoppedEvent.class, events.get(10));
+        assertIsInstanceOf(CamelContextStoppedEvent.class, events.get(11));
     }
 
     public void testSuspendResume() throws Exception {

Copied: camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierExchangeSentParallelTest.java (from r1340371, camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierExchangeSentTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierExchangeSentParallelTest.java?p2=camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierExchangeSentParallelTest.java&p1=camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierExchangeSentTest.java&r1=1340371&r2=1340446&rev=1340446&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierExchangeSentTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierExchangeSentParallelTest.java Sat May 19 12:48:05 2012
@@ -16,85 +16,15 @@
  */
 package org.apache.camel.management;
 
-import java.util.ArrayList;
 import java.util.EventObject;
-import java.util.List;
 
-import org.apache.camel.CamelContext;
-import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.impl.DefaultCamelContext;
-import org.apache.camel.management.event.ExchangeSentEvent;
-import org.apache.camel.support.EventNotifierSupport;
+import org.apache.camel.management.event.ExchangeSendingEvent;
 
 /**
  * @version 
  */
-public class EventNotifierExchangeSentTest extends ContextTestSupport {
-
-    private static List<EventObject> events = new ArrayList<EventObject>();
-
-    @Override
-    public void setUp() throws Exception {
-        events.clear();
-        super.setUp();
-    }
-
-    @Override
-    protected CamelContext createCamelContext() throws Exception {
-        DefaultCamelContext context = new DefaultCamelContext(createRegistry());
-        context.getManagementStrategy().addEventNotifier(new EventNotifierSupport() {
-            public void notify(EventObject event) throws Exception {
-                events.add(event);
-            }
-
-            public boolean isEnabled(EventObject event) {
-                return true;
-            }
-
-            @Override
-            protected void doStart() throws Exception {
-                // filter out unwanted events
-                setIgnoreCamelContextEvents(true);
-                setIgnoreServiceEvents(true);
-                setIgnoreRouteEvents(true);
-                setIgnoreExchangeCreatedEvent(true);
-                setIgnoreExchangeCompletedEvent(true);
-                setIgnoreExchangeFailedEvents(true);
-                setIgnoreExchangeRedeliveryEvents(true);
-            }
-
-            @Override
-            protected void doStop() throws Exception {
-            }
-        });
-        return context;
-    }
-
-    public void testExchangeSent() throws Exception {
-        getMockEndpoint("mock:result").expectedMessageCount(1);
-
-        template.sendBody("direct:start", "Hello World");
-
-        assertMockEndpointsSatisfied();
-
-        assertEquals(4, events.size());
-        ExchangeSentEvent e0 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(0));
-        ExchangeSentEvent e1 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(1));
-        ExchangeSentEvent e2 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(2));
-        ExchangeSentEvent e3 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(3));
-
-        assertEquals("log://foo", e0.getEndpoint().getEndpointUri());
-        assertEquals("direct://bar", e1.getEndpoint().getEndpointUri());
-        long time = e1.getTimeTaken();
-        assertTrue("Should take about 0.5 sec, was: " + time, time > 400);
-
-        assertEquals("mock://result", e2.getEndpoint().getEndpointUri());
-
-        assertEquals("direct://start", e3.getEndpoint().getEndpointUri());
-        time = e3.getTimeTaken();
-        assertTrue("Should take about 0.5 sec, was: " + time, time > 400);
-    }
+public class EventNotifierExchangeSentParallelTest extends EventNotifierExchangeSentTest {
 
     public void testExchangeSentRecipient() throws Exception {
         getMockEndpoint("mock:result").expectedMessageCount(1);
@@ -104,22 +34,22 @@ public class EventNotifierExchangeSentTe
         assertMockEndpointsSatisfied();
 
         // give it time to complete
-        Thread.sleep(100);
+        Thread.sleep(200);
+
+        assertEquals(12, events.size());
 
-        assertEquals(6, events.size());
-        ExchangeSentEvent e0 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(0));
-        ExchangeSentEvent e1 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(1));
-        ExchangeSentEvent e2 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(2));
-        ExchangeSentEvent e3 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(3));
-        ExchangeSentEvent e4 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(4));
-        ExchangeSentEvent e5 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(5));
-
-        assertEquals("direct://cool", e0.getEndpoint().getEndpointUri());
-        assertEquals("log://foo", e1.getEndpoint().getEndpointUri());
-        assertEquals("direct://bar", e2.getEndpoint().getEndpointUri());
-        assertEquals("mock://result", e3.getEndpoint().getEndpointUri());
-        assertEquals("direct://start", e4.getEndpoint().getEndpointUri());
-        assertEquals("direct://foo", e5.getEndpoint().getEndpointUri());
+        // we run parallel so just assert we got 6 sending and 6 sent events
+        int sent = 0;
+        int sending = 0;
+        for (EventObject event : events) {
+            if (event instanceof ExchangeSendingEvent) {
+                sending++;
+            } else {
+                sent++;
+            }
+        }
+        assertEquals(6, sending);
+        assertEquals(6, sent);
     }
 
     @Override
@@ -131,7 +61,7 @@ public class EventNotifierExchangeSentTe
 
                 from("direct:bar").delay(500);
 
-                from("direct:foo").recipientList().header("foo");
+                from("direct:foo").recipientList(header("foo")).parallelProcessing();
 
                 from("direct:cool").delay(1000);
             }

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierExchangeSentTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierExchangeSentTest.java?rev=1340446&r1=1340445&r2=1340446&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierExchangeSentTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierExchangeSentTest.java Sat May 19 12:48:05 2012
@@ -24,6 +24,7 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.ContextTestSupport;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.management.event.ExchangeSendingEvent;
 import org.apache.camel.management.event.ExchangeSentEvent;
 import org.apache.camel.support.EventNotifierSupport;
 
@@ -32,7 +33,7 @@ import org.apache.camel.support.EventNot
  */
 public class EventNotifierExchangeSentTest extends ContextTestSupport {
 
-    private static List<EventObject> events = new ArrayList<EventObject>();
+    protected static List<EventObject> events = new ArrayList<EventObject>();
 
     @Override
     public void setUp() throws Exception {
@@ -78,21 +79,31 @@ public class EventNotifierExchangeSentTe
 
         assertMockEndpointsSatisfied();
 
-        assertEquals(4, events.size());
-        ExchangeSentEvent e0 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(0));
-        ExchangeSentEvent e1 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(1));
+        assertEquals(8, events.size());
+        ExchangeSendingEvent e0 = assertIsInstanceOf(ExchangeSendingEvent.class, events.get(0));
+        ExchangeSendingEvent e1 = assertIsInstanceOf(ExchangeSendingEvent.class, events.get(1));
         ExchangeSentEvent e2 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(2));
-        ExchangeSentEvent e3 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(3));
+        ExchangeSendingEvent e3 = assertIsInstanceOf(ExchangeSendingEvent.class, events.get(3));
+        ExchangeSentEvent e4 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(4));
+        ExchangeSendingEvent e5 = assertIsInstanceOf(ExchangeSendingEvent.class, events.get(5));
+        ExchangeSentEvent e6 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(6));
+        ExchangeSentEvent e7 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(7));
+
+        assertEquals("direct://start", e0.getEndpoint().getEndpointUri());
 
-        assertEquals("log://foo", e0.getEndpoint().getEndpointUri());
-        assertEquals("direct://bar", e1.getEndpoint().getEndpointUri());
-        long time = e1.getTimeTaken();
+        assertEquals("log://foo", e1.getEndpoint().getEndpointUri());
+        assertEquals("log://foo", e2.getEndpoint().getEndpointUri());
+
+        assertEquals("direct://bar", e3.getEndpoint().getEndpointUri());
+        assertEquals("direct://bar", e4.getEndpoint().getEndpointUri());
+        long time = e4.getTimeTaken();
         assertTrue("Should take about 0.5 sec, was: " + time, time > 400);
 
-        assertEquals("mock://result", e2.getEndpoint().getEndpointUri());
+        assertEquals("mock://result", e5.getEndpoint().getEndpointUri());
+        assertEquals("mock://result", e6.getEndpoint().getEndpointUri());
 
-        assertEquals("direct://start", e3.getEndpoint().getEndpointUri());
-        time = e3.getTimeTaken();
+        assertEquals("direct://start", e7.getEndpoint().getEndpointUri());
+        time = e7.getTimeTaken();
         assertTrue("Should take about 0.5 sec, was: " + time, time > 400);
     }
 
@@ -104,22 +115,34 @@ public class EventNotifierExchangeSentTe
         assertMockEndpointsSatisfied();
 
         // give it time to complete
-        Thread.sleep(100);
+        Thread.sleep(200);
 
-        assertEquals(6, events.size());
-        ExchangeSentEvent e0 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(0));
-        ExchangeSentEvent e1 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(1));
+        assertEquals(12, events.size());
+        ExchangeSendingEvent e0 = assertIsInstanceOf(ExchangeSendingEvent.class, events.get(0));
+        ExchangeSendingEvent e1 = assertIsInstanceOf(ExchangeSendingEvent.class, events.get(1));
         ExchangeSentEvent e2 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(2));
-        ExchangeSentEvent e3 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(3));
-        ExchangeSentEvent e4 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(4));
+        ExchangeSendingEvent e3 = assertIsInstanceOf(ExchangeSendingEvent.class, events.get(3));
+        ExchangeSendingEvent e4 = assertIsInstanceOf(ExchangeSendingEvent.class, events.get(4));
         ExchangeSentEvent e5 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(5));
-
-        assertEquals("direct://cool", e0.getEndpoint().getEndpointUri());
-        assertEquals("log://foo", e1.getEndpoint().getEndpointUri());
-        assertEquals("direct://bar", e2.getEndpoint().getEndpointUri());
-        assertEquals("mock://result", e3.getEndpoint().getEndpointUri());
-        assertEquals("direct://start", e4.getEndpoint().getEndpointUri());
-        assertEquals("direct://foo", e5.getEndpoint().getEndpointUri());
+        ExchangeSendingEvent e6 = assertIsInstanceOf(ExchangeSendingEvent.class, events.get(6));
+        ExchangeSentEvent e7 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(7));
+        ExchangeSendingEvent e8 = assertIsInstanceOf(ExchangeSendingEvent.class, events.get(8));
+        ExchangeSentEvent e9 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(9));
+        ExchangeSentEvent e10 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(10));
+        ExchangeSentEvent e11 = assertIsInstanceOf(ExchangeSentEvent.class, events.get(11));
+
+        assertEquals("direct://foo", e0.getEndpoint().getEndpointUri());
+        assertEquals("direct://cool", e1.getEndpoint().getEndpointUri());
+        assertEquals("direct://cool", e2.getEndpoint().getEndpointUri());
+        assertEquals("direct://start", e3.getEndpoint().getEndpointUri());
+        assertEquals("log://foo", e4.getEndpoint().getEndpointUri());
+        assertEquals("log://foo", e5.getEndpoint().getEndpointUri());
+        assertEquals("direct://bar", e6.getEndpoint().getEndpointUri());
+        assertEquals("direct://bar", e7.getEndpoint().getEndpointUri());
+        assertEquals("mock://result", e8.getEndpoint().getEndpointUri());
+        assertEquals("mock://result", e9.getEndpoint().getEndpointUri());
+        assertEquals("direct://start", e10.getEndpoint().getEndpointUri());
+        assertEquals("direct://foo", e11.getEndpoint().getEndpointUri());
     }
 
     @Override

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierFailureHandledEventsTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierFailureHandledEventsTest.java?rev=1340446&r1=1340445&r2=1340446&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierFailureHandledEventsTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierFailureHandledEventsTest.java Sat May 19 12:48:05 2012
@@ -29,6 +29,7 @@ import org.apache.camel.management.event
 import org.apache.camel.management.event.ExchangeCompletedEvent;
 import org.apache.camel.management.event.ExchangeCreatedEvent;
 import org.apache.camel.management.event.ExchangeFailureHandledEvent;
+import org.apache.camel.management.event.ExchangeSendingEvent;
 import org.apache.camel.management.event.ExchangeSentEvent;
 import org.apache.camel.management.event.RouteStartedEvent;
 import org.apache.camel.processor.SendProcessor;
@@ -90,23 +91,25 @@ public class EventNotifierFailureHandled
         template.sendBody("direct:start", "Hello World");
         assertMockEndpointsSatisfied();
 
-        assertEquals(8, events.size());
+        assertEquals(10, events.size());
         assertIsInstanceOf(CamelContextStartingEvent.class, events.get(0));
         assertIsInstanceOf(RouteStartedEvent.class, events.get(1));
         assertIsInstanceOf(CamelContextStartedEvent.class, events.get(2));
-        assertIsInstanceOf(ExchangeCreatedEvent.class, events.get(3));
-        assertIsInstanceOf(ExchangeSentEvent.class, events.get(4));
+        assertIsInstanceOf(ExchangeSendingEvent.class, events.get(3));
+        assertIsInstanceOf(ExchangeCreatedEvent.class, events.get(4));
+        assertIsInstanceOf(ExchangeSendingEvent.class, events.get(5));
+        assertIsInstanceOf(ExchangeSentEvent.class, events.get(6));
 
-        ExchangeFailureHandledEvent e = assertIsInstanceOf(ExchangeFailureHandledEvent.class, events.get(5));
+        ExchangeFailureHandledEvent e = assertIsInstanceOf(ExchangeFailureHandledEvent.class, events.get(7));
         assertEquals("should be DLC", true, e.isDeadLetterChannel());
         SendProcessor send = assertIsInstanceOf(SendProcessor.class, e.getFailureHandler());
         assertEquals("mock://dead", send.getDestination().getEndpointUri());
 
         // dead letter channel will mark the exchange as completed
-        assertIsInstanceOf(ExchangeCompletedEvent.class, events.get(6));
+        assertIsInstanceOf(ExchangeCompletedEvent.class, events.get(8));
         // and the last event should be the direct:start
-        assertIsInstanceOf(ExchangeSentEvent.class, events.get(7));
-        ExchangeSentEvent sent = (ExchangeSentEvent) events.get(7);
+        assertIsInstanceOf(ExchangeSentEvent.class, events.get(9));
+        ExchangeSentEvent sent = (ExchangeSentEvent) events.get(9);
         assertEquals("direct://start", sent.getEndpoint().getEndpointUri());
     }
 
@@ -125,21 +128,23 @@ public class EventNotifierFailureHandled
         template.sendBody("direct:start", "Hello World");
         assertMockEndpointsSatisfied();
 
-        assertEquals(8, events.size());
+        assertEquals(10, events.size());
         assertIsInstanceOf(CamelContextStartingEvent.class, events.get(0));
         assertIsInstanceOf(RouteStartedEvent.class, events.get(1));
         assertIsInstanceOf(CamelContextStartedEvent.class, events.get(2));
-        assertIsInstanceOf(ExchangeCreatedEvent.class, events.get(3));
-        assertIsInstanceOf(ExchangeSentEvent.class, events.get(4));
+        assertIsInstanceOf(ExchangeSendingEvent.class, events.get(3));
+        assertIsInstanceOf(ExchangeCreatedEvent.class, events.get(4));
+        assertIsInstanceOf(ExchangeSendingEvent.class, events.get(5));
+        assertIsInstanceOf(ExchangeSentEvent.class, events.get(6));
 
-        ExchangeFailureHandledEvent e = assertIsInstanceOf(ExchangeFailureHandledEvent.class, events.get(5));
+        ExchangeFailureHandledEvent e = assertIsInstanceOf(ExchangeFailureHandledEvent.class, events.get(7));
         assertEquals("should NOT be DLC", false, e.isDeadLetterChannel());
 
         // onException will handle the exception
-        assertIsInstanceOf(ExchangeCompletedEvent.class, events.get(6));
+        assertIsInstanceOf(ExchangeCompletedEvent.class, events.get(8));
         // and the last event should be the direct:start
-        assertIsInstanceOf(ExchangeSentEvent.class, events.get(7));
-        ExchangeSentEvent sent = (ExchangeSentEvent) events.get(7);
+        assertIsInstanceOf(ExchangeSentEvent.class, events.get(9));
+        ExchangeSentEvent sent = (ExchangeSentEvent) events.get(9);
         assertEquals("direct://start", sent.getEndpoint().getEndpointUri());
     }
 

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierRedeliveryEventsTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierRedeliveryEventsTest.java?rev=1340446&r1=1340445&r2=1340446&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierRedeliveryEventsTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/management/EventNotifierRedeliveryEventsTest.java Sat May 19 12:48:05 2012
@@ -28,6 +28,7 @@ import org.apache.camel.management.event
 import org.apache.camel.management.event.ExchangeCreatedEvent;
 import org.apache.camel.management.event.ExchangeFailureHandledEvent;
 import org.apache.camel.management.event.ExchangeRedeliveryEvent;
+import org.apache.camel.management.event.ExchangeSendingEvent;
 import org.apache.camel.management.event.ExchangeSentEvent;
 import org.apache.camel.support.EventNotifierSupport;
 
@@ -90,21 +91,23 @@ public class EventNotifierRedeliveryEven
         template.sendBody("direct:start", "Hello World");
         assertMockEndpointsSatisfied();
 
-        assertEquals(9, events.size());
+        assertEquals(11, events.size());
 
-        assertIsInstanceOf(ExchangeCreatedEvent.class, events.get(0));
-        ExchangeRedeliveryEvent e = assertIsInstanceOf(ExchangeRedeliveryEvent.class, events.get(1));
+        assertIsInstanceOf(ExchangeSendingEvent.class, events.get(0));
+        assertIsInstanceOf(ExchangeCreatedEvent.class, events.get(1));
+        ExchangeRedeliveryEvent e = assertIsInstanceOf(ExchangeRedeliveryEvent.class, events.get(2));
         assertEquals(1, e.getAttempt());
-        e = assertIsInstanceOf(ExchangeRedeliveryEvent.class, events.get(2));
-        assertEquals(2, e.getAttempt());
         e = assertIsInstanceOf(ExchangeRedeliveryEvent.class, events.get(3));
-        assertEquals(3, e.getAttempt());
+        assertEquals(2, e.getAttempt());
         e = assertIsInstanceOf(ExchangeRedeliveryEvent.class, events.get(4));
+        assertEquals(3, e.getAttempt());
+        e = assertIsInstanceOf(ExchangeRedeliveryEvent.class, events.get(5));
         assertEquals(4, e.getAttempt());
-        assertIsInstanceOf(ExchangeSentEvent.class, events.get(5));
-        assertIsInstanceOf(ExchangeFailureHandledEvent.class, events.get(6));
-        assertIsInstanceOf(ExchangeCompletedEvent.class, events.get(7));
-        assertIsInstanceOf(ExchangeSentEvent.class, events.get(8));
+        assertIsInstanceOf(ExchangeSendingEvent.class, events.get(6));
+        assertIsInstanceOf(ExchangeSentEvent.class, events.get(7));
+        assertIsInstanceOf(ExchangeFailureHandledEvent.class, events.get(8));
+        assertIsInstanceOf(ExchangeCompletedEvent.class, events.get(9));
+        assertIsInstanceOf(ExchangeSentEvent.class, events.get(10));
     }
 
     public void testExchangeRedeliveryAsync() throws Exception {
@@ -124,16 +127,17 @@ public class EventNotifierRedeliveryEven
 
         Thread.sleep(250);
 
-        assertEquals(9, events.size());
+        assertEquals(11, events.size());
 
-        assertIsInstanceOf(ExchangeCreatedEvent.class, events.get(0));
-        ExchangeRedeliveryEvent e = assertIsInstanceOf(ExchangeRedeliveryEvent.class, events.get(1));
+        assertIsInstanceOf(ExchangeSendingEvent.class, events.get(0));
+        assertIsInstanceOf(ExchangeCreatedEvent.class, events.get(1));
+        ExchangeRedeliveryEvent e = assertIsInstanceOf(ExchangeRedeliveryEvent.class, events.get(2));
         assertEquals(1, e.getAttempt());
-        e = assertIsInstanceOf(ExchangeRedeliveryEvent.class, events.get(2));
-        assertEquals(2, e.getAttempt());
         e = assertIsInstanceOf(ExchangeRedeliveryEvent.class, events.get(3));
-        assertEquals(3, e.getAttempt());
+        assertEquals(2, e.getAttempt());
         e = assertIsInstanceOf(ExchangeRedeliveryEvent.class, events.get(4));
+        assertEquals(3, e.getAttempt());
+        e = assertIsInstanceOf(ExchangeRedeliveryEvent.class, events.get(5));
         assertEquals(4, e.getAttempt());
 
         // since its async the ordering of the rest can be different depending per OS and timing

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxNotificationEventNotifierTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxNotificationEventNotifierTest.java?rev=1340446&r1=1340445&r2=1340446&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxNotificationEventNotifierTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/management/JmxNotificationEventNotifierTest.java Sat May 19 12:48:05 2012
@@ -81,7 +81,7 @@ public class JmxNotificationEventNotifie
 
         assertMockEndpointsSatisfied();
         
-        assertEquals("Get a wrong number of events", 5, listener.getEventCounter());
+        assertEquals("Get a wrong number of events", 8, listener.getEventCounter());
 
         context.stop();
     }
@@ -107,7 +107,7 @@ public class JmxNotificationEventNotifie
             assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
         }
         
-        assertEquals("Get a wrong number of events", 3, listener.getEventCounter());
+        assertEquals("Get a wrong number of events", 4, listener.getEventCounter());
 
         context.stop();
     }

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/management/MultipleEventNotifierEventsTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/management/MultipleEventNotifierEventsTest.java?rev=1340446&r1=1340445&r2=1340446&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/management/MultipleEventNotifierEventsTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/management/MultipleEventNotifierEventsTest.java Sat May 19 12:48:05 2012
@@ -31,6 +31,7 @@ import org.apache.camel.management.event
 import org.apache.camel.management.event.ExchangeCompletedEvent;
 import org.apache.camel.management.event.ExchangeCreatedEvent;
 import org.apache.camel.management.event.ExchangeFailedEvent;
+import org.apache.camel.management.event.ExchangeSendingEvent;
 import org.apache.camel.management.event.ExchangeSentEvent;
 import org.apache.camel.management.event.RouteStartedEvent;
 import org.apache.camel.management.event.RouteStoppedEvent;
@@ -106,33 +107,39 @@ public class MultipleEventNotifierEvents
 
         assertMockEndpointsSatisfied();
 
-        assertEquals(9, events.size());
+        assertEquals(12, events.size());
         assertIsInstanceOf(CamelContextStartingEvent.class, events.get(0));
         assertIsInstanceOf(RouteStartedEvent.class, events.get(1));
         assertIsInstanceOf(RouteStartedEvent.class, events.get(2));
         assertIsInstanceOf(CamelContextStartedEvent.class, events.get(3));
-        assertIsInstanceOf(ExchangeCreatedEvent.class, events.get(4));
-        assertIsInstanceOf(ExchangeSentEvent.class, events.get(5));
-        assertIsInstanceOf(ExchangeSentEvent.class, events.get(6));
-        assertIsInstanceOf(ExchangeCompletedEvent.class, events.get(7));
-        assertIsInstanceOf(ExchangeSentEvent.class, events.get(8));
-
-        assertEquals(5, events2.size());
-        assertIsInstanceOf(ExchangeCreatedEvent.class, events2.get(0));
-        assertIsInstanceOf(ExchangeSentEvent.class, events2.get(1));
-        assertIsInstanceOf(ExchangeSentEvent.class, events2.get(2));
-        assertIsInstanceOf(ExchangeCompletedEvent.class, events2.get(3));
-        assertIsInstanceOf(ExchangeSentEvent.class, events2.get(4));
+        assertIsInstanceOf(ExchangeSendingEvent.class, events.get(4));
+        assertIsInstanceOf(ExchangeCreatedEvent.class, events.get(5));
+        assertIsInstanceOf(ExchangeSendingEvent.class, events.get(6));
+        assertIsInstanceOf(ExchangeSentEvent.class, events.get(7));
+        assertIsInstanceOf(ExchangeSendingEvent.class, events.get(8));
+        assertIsInstanceOf(ExchangeSentEvent.class, events.get(9));
+        assertIsInstanceOf(ExchangeCompletedEvent.class, events.get(10));
+        assertIsInstanceOf(ExchangeSentEvent.class, events.get(11));
+
+        assertEquals(8, events2.size());
+        assertIsInstanceOf(ExchangeSendingEvent.class, events2.get(0));
+        assertIsInstanceOf(ExchangeCreatedEvent.class, events2.get(1));
+        assertIsInstanceOf(ExchangeSendingEvent.class, events2.get(2));
+        assertIsInstanceOf(ExchangeSentEvent.class, events2.get(3));
+        assertIsInstanceOf(ExchangeSendingEvent.class, events2.get(4));
+        assertIsInstanceOf(ExchangeSentEvent.class, events2.get(5));
+        assertIsInstanceOf(ExchangeCompletedEvent.class, events2.get(6));
+        assertIsInstanceOf(ExchangeSentEvent.class, events2.get(7));
 
         context.stop();
 
-        assertEquals(13, events.size());
-        assertIsInstanceOf(CamelContextStoppingEvent.class, events.get(9));
-        assertIsInstanceOf(RouteStoppedEvent.class, events.get(10));
-        assertIsInstanceOf(RouteStoppedEvent.class, events.get(11));
-        assertIsInstanceOf(CamelContextStoppedEvent.class, events.get(12));
+        assertEquals(16, events.size());
+        assertIsInstanceOf(CamelContextStoppingEvent.class, events.get(12));
+        assertIsInstanceOf(RouteStoppedEvent.class, events.get(13));
+        assertIsInstanceOf(RouteStoppedEvent.class, events.get(14));
+        assertIsInstanceOf(CamelContextStoppedEvent.class, events.get(15));
 
-        assertEquals(5, events2.size());
+        assertEquals(8, events2.size());
     }
 
     public void testExchangeFailed() throws Exception {
@@ -144,29 +151,31 @@ public class MultipleEventNotifierEvents
             assertIsInstanceOf(IllegalArgumentException.class, e.getCause());
         }
 
-        assertEquals(7, events.size());
+        assertEquals(8, events.size());
         assertIsInstanceOf(CamelContextStartingEvent.class, events.get(0));
         assertIsInstanceOf(RouteStartedEvent.class, events.get(1));
         assertIsInstanceOf(RouteStartedEvent.class, events.get(2));
         assertIsInstanceOf(CamelContextStartedEvent.class, events.get(3));
-        assertIsInstanceOf(ExchangeCreatedEvent.class, events.get(4));
-        assertIsInstanceOf(ExchangeFailedEvent.class, events.get(5));
-        assertIsInstanceOf(ExchangeSentEvent.class, events.get(6));
+        assertIsInstanceOf(ExchangeSendingEvent.class, events.get(4));
+        assertIsInstanceOf(ExchangeCreatedEvent.class, events.get(5));
+        assertIsInstanceOf(ExchangeFailedEvent.class, events.get(6));
+        assertIsInstanceOf(ExchangeSentEvent.class, events.get(7));
 
-        assertEquals(3, events2.size());
+        assertEquals(4, events2.size());
 
         context.stop();
-        assertIsInstanceOf(ExchangeCreatedEvent.class, events2.get(0));
-        assertIsInstanceOf(ExchangeFailedEvent.class, events2.get(1));
-        assertIsInstanceOf(ExchangeSentEvent.class, events2.get(2));
-
-        assertEquals(11, events.size());
-        assertIsInstanceOf(CamelContextStoppingEvent.class, events.get(7));
-        assertIsInstanceOf(RouteStoppedEvent.class, events.get(8));
+        assertIsInstanceOf(ExchangeSendingEvent.class, events2.get(0));
+        assertIsInstanceOf(ExchangeCreatedEvent.class, events2.get(1));
+        assertIsInstanceOf(ExchangeFailedEvent.class, events2.get(2));
+        assertIsInstanceOf(ExchangeSentEvent.class, events2.get(3));
+
+        assertEquals(12, events.size());
+        assertIsInstanceOf(CamelContextStoppingEvent.class, events.get(8));
         assertIsInstanceOf(RouteStoppedEvent.class, events.get(9));
-        assertIsInstanceOf(CamelContextStoppedEvent.class, events.get(10));
+        assertIsInstanceOf(RouteStoppedEvent.class, events.get(10));
+        assertIsInstanceOf(CamelContextStoppedEvent.class, events.get(11));
 
-        assertEquals(3, events2.size());
+        assertEquals(4, events2.size());
     }
 
     @Override

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/management/PublishEventNotifierTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/management/PublishEventNotifierTest.java?rev=1340446&r1=1340445&r2=1340446&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/management/PublishEventNotifierTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/management/PublishEventNotifierTest.java Sat May 19 12:48:05 2012
@@ -46,7 +46,7 @@ public class PublishEventNotifierTest ex
 
     public void testExchangeDone() throws Exception {
         getMockEndpoint("mock:result").expectedMessageCount(1);
-        getMockEndpoint("mock:event").expectedMessageCount(6);
+        getMockEndpoint("mock:event").expectedMessageCount(9);
 
         template.sendBody("direct:start", "Hello World");
 
@@ -54,7 +54,7 @@ public class PublishEventNotifierTest ex
     }
 
     public void testExchangeFailed() throws Exception {
-        getMockEndpoint("mock:event").expectedMessageCount(4);
+        getMockEndpoint("mock:event").expectedMessageCount(5);
 
         try {
             template.sendBody("direct:fail", "Hello World");

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/management/PublishEventNotifierToRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/management/PublishEventNotifierToRouteTest.java?rev=1340446&r1=1340445&r2=1340446&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/management/PublishEventNotifierToRouteTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/management/PublishEventNotifierToRouteTest.java Sat May 19 12:48:05 2012
@@ -54,7 +54,7 @@ public class PublishEventNotifierToRoute
     }
 
     public void testExchangeFailed() throws Exception {
-        getMockEndpoint("mock:event").expectedMessageCount(4);
+        getMockEndpoint("mock:event").expectedMinimumMessageCount(4);
 
         try {
             template.sendBody("direct:fail", "Hello World");

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/management/RemoveEventNotifierTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/management/RemoveEventNotifierTest.java?rev=1340446&r1=1340445&r2=1340446&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/management/RemoveEventNotifierTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/management/RemoveEventNotifierTest.java Sat May 19 12:48:05 2012
@@ -72,7 +72,7 @@ public class RemoveEventNotifierTest ext
         template.sendBody("direct:start", "Hello World");
         assertMockEndpointsSatisfied();
 
-        assertEquals(8, events.size());
+        assertEquals(11, events.size());
 
         // remove and we should not get new events
         context.getManagementStrategy().removeEventNotifier(notifier);
@@ -82,7 +82,7 @@ public class RemoveEventNotifierTest ext
         template.sendBody("direct:start", "Bye World");
         assertMockEndpointsSatisfied();
 
-        assertEquals(8, events.size());
+        assertEquals(11, events.size());
     }
 
     @Override

Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/DebugTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/DebugTest.java?rev=1340446&r1=1340445&r2=1340446&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/DebugTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/DebugTest.java Sat May 19 12:48:05 2012
@@ -156,7 +156,7 @@ public class DebugTest extends ContextTe
 
         assertMockEndpointsSatisfied();
 
-        assertEquals(7, logs.size());
+        assertEquals(10, logs.size());
 
         // remove the breakpoint
         context.getDebugger().removeBreakpoint(breakpoint);



Mime
View raw message