[jboss-svn-commits] JBL Code SVN: r23075 - in labs/jbossesb/workspace/skeagh: api/service/src/main/java/org/jboss/esb/message and 18 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Sep 25 08:30:03 EDT 2008


Author: tfennelly
Date: 2008-09-25 08:30:03 -0400 (Thu, 25 Sep 2008)
New Revision: 23075

Added:
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/TestInboundRouter.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/TestOutboundRouter.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/TestService.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/01-inrouter-config.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/02-serviceA-config.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/03-serviceB-config.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/BasicTest.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/UndeployDispatcherDelayTest.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/jbossesb-deploy-01.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_008/01-deployment.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_008/02-deployment.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_008/03-deployment.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_008/RoutingTest.java
Removed:
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/DeploymentLifecycleTest.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/jbossesb-deploy-01.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/TestInboundRouter.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/TestOutboundRouter.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/TestService.java
Modified:
   labs/jbossesb/workspace/skeagh/api/routing/src/main/java/org/jboss/esb/routing/MessageDispatcher.java
   labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/Message.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/AbstractDispatcher.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/LocalDispatcher.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/Bus.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusDispatcher.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBus.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_001/01-inrouter-config.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_001/02-service-config.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_001/03-outrouter-config.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_001/RoutingTest.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_002/01-inrouter-config.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_002/02-service-config.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_002/03-outrouter-config.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_002/RoutingTest.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_003/01-inrouter-config.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_003/02-serviceA-config.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_003/03-serviceB-config.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_003/RoutingTest.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_004/01-inrouter-config.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_004/02-outrouter-config.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_004/RoutingTest.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_005/01-inrouter-config.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_005/RoutingTest.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_006/01-deployment.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_006/02-deployment.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_006/03-deployment.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_006/RoutingTest.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_007/01-deployment.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_007/02-deployment.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_007/03-deployment.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_007/RoutingTest.java
Log:
Implemented shutdown wait on dispatchers.

Modified: labs/jbossesb/workspace/skeagh/api/routing/src/main/java/org/jboss/esb/routing/MessageDispatcher.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/routing/src/main/java/org/jboss/esb/routing/MessageDispatcher.java	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/api/routing/src/main/java/org/jboss/esb/routing/MessageDispatcher.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -42,4 +42,18 @@
      * @param invocationContext The InvocationContext for the message dispatch.
      */
     void dispatch(Message message, InvocationContext invocationContext);
+
+    /**
+     * Is the dispatcher instance processing messages.
+     * <p/>
+     * This is required by the undeploy process.  After uninitializing
+     * all {@link InboundRouter} instances, the undeploy waits untill
+     * all dispatchers have completed processing all their messages before
+     * continuing with the undeploy (uninitializing all other components
+     * and resources).
+     *
+     * @return True if the dispatcher has active messages that it is
+     *         processing, otherwise false.
+     */
+    boolean isProcessingMessages();
 }

Modified: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/Message.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/Message.java	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/message/Message.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -19,9 +19,9 @@
  */
 package org.jboss.esb.message;
 
+import java.io.Serializable;
 import java.util.LinkedHashMap;
 import java.util.Map;
-import java.io.Serializable;
 
 /**
  * JBoss ESB Message.
@@ -61,6 +61,7 @@
 
     /**
      * Public default constructor.
+     *
      * @param payload Message payload.
      */
     public Message(final Object payload)
@@ -130,12 +131,39 @@
 
     /**
      * Create a shallow clone of the message.
+     *
      * @return A Shallow clone of the message.
      */
     public final Object clone()
     {
         Message clone = new Message(payload);
-        clone.getAttachments().putAll(getAttachments());        
+        clone.getAttachments().putAll(getAttachments());
         return clone;
     }
+
+    /**
+     * Object hash.
+     * <p/>
+     * Finalizing this method.
+     *
+     * @return The Object hash (as per the {@link Object} class implementation).
+     */
+    public final int hashCode()
+    {
+        return super.hashCode();
+    }
+
+    /**
+     * Object equals.
+     * <p/>
+     * Finalizing this method.
+     *
+     * @param obj The object to be compared against.
+     * @return True if the Object is equal (as per the {@link Object} class implementation),
+     *         otherwise false.
+     */
+    public final boolean equals(final Object obj)
+    {
+        return super.equals(obj);
+    }
 }

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -45,6 +45,7 @@
 import org.jboss.esb.service.Service;
 import org.jboss.esb.service.ServiceName;
 import org.jboss.esb.util.AssertArgument;
+import org.jboss.esb.routing.MessageDispatcher;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -55,6 +56,8 @@
 import java.util.Map;
 import java.util.Set;
 import java.util.UUID;
+import java.util.Collection;
+import java.util.Iterator;
 
 /**
  * JBoss ESB Runtime.
@@ -70,8 +73,11 @@
      * Class logger.
      */
     private static Logger logger = Logger.getLogger(DeploymentRuntime.class);
-
     /**
+     * Shutdown timeout properties key.
+     */
+    private static final String SHUTDOWN_TIMEOUT_KEY = "shutdown.timeout";
+    /**
      * Deployment Context.
      */
     private DeploymentContext context;
@@ -268,6 +274,114 @@
     }
 
     /**
+     * Undeploy the Runtime.
+     *
+     * @throws DeploymentException Error undeploying ESB Runtime.
+     */
+    public final void undeploy() throws DeploymentException
+    {
+        if (context == null)
+        {
+            logger.info("Runtime not deployed (or already undeployed).");
+            return;
+        }
+
+        try
+        {
+            logger.info("Starting JBoss ESB undeployment: '" + deploymentName + "'.");
+
+            // Make sure to undeploy the scheduler first i.e. block scheduled triggers...
+            undeploy(JobScheduler.SCHEDULER_RESOURCE_ID, JobScheduler.getScheduler(context));
+
+            // Undeploy all InboundRouters (including all BusInboundRouters)...
+            undeployInboundRouters();
+
+            // Undeploy any objects manually set in the ESB deployment context...
+            undeploy(context.getAll());
+
+            // Undeploy all objects that were deployed on ESB Startup...
+            undeploy(deployedObjects);
+
+            logger.info("JBoss ESB undeployment completed successfully: '" + deploymentName + "'.");
+        }
+        finally
+        {
+            context = null;
+        }
+    }
+
+    /**
+     * Undeploy all the inbound routers.
+     * <p/>
+     * This includes the {@link BusInboundRouter} instances.
+     */
+    private void undeployInboundRouters()
+    {
+        List<MessageDispatcher> activeDispatchers = new ArrayList<MessageDispatcher>();
+        Collection<List<InboundRouterConfig>> inRouterConfigsMatrix = aggregatedDeploymentUnit.getInboundRouters().values();
+
+        // Undeploy all the "non bus" inbound routers...
+        for (List<InboundRouterConfig> inRouterConfigs : inRouterConfigsMatrix)
+        {
+            for(InboundRouterConfig inRouterConfig : inRouterConfigs)
+            {
+                undeploy(inRouterConfig.getName(), inRouterConfig.getRouter());
+                activeDispatchers.add(inRouterConfig.getDispatcher());
+            }
+        }
+
+        // Stop listening for messages on all connected buses...
+        if(deploymentCoordinator != null)
+        {
+            deploymentCoordinator.stopListeningOnBuses();
+
+            // Add the bus dispatchers to the list of MessageDispatchers...
+            Collection<BusInboundRouter> busInRouters = BusRoutingContext.getContext(context).getBusInRouters().values();
+            for (BusInboundRouter busInRouter : busInRouters)
+            {
+                activeDispatchers.add(busInRouter.getDispatcher());
+            }
+        }
+
+        // Now wait for the dispatchers to complete processing all their messages...
+        long shutdownTimeout = deploymentProperties.getLongProperty(SHUTDOWN_TIMEOUT_KEY, 30000);
+        long start = System.currentTimeMillis();
+        while(!activeDispatchers.isEmpty())
+        {
+            Iterator<MessageDispatcher> iterator = activeDispatchers.iterator();
+            while (iterator.hasNext())
+            {
+                MessageDispatcher dispatcher = iterator.next();
+                if(dispatcher == null || !dispatcher.isProcessingMessages())
+                {
+                    iterator.remove();
+                }
+            }
+
+            // If there are still some dispatchers processing messages...
+            if(!activeDispatchers.isEmpty())
+            {
+                // Check shutdown timeout...
+                if(System.currentTimeMillis() > start + shutdownTimeout)
+                {
+                    logger.error("Shutdown timeout after " + shutdownTimeout + " ms.  Timed out waiting on active message dispatchers to complete message processing. You may need to update the '" + SHUTDOWN_TIMEOUT_KEY + "' deployment property.");
+                    break;
+                }
+
+                try
+                {
+                    Thread.sleep(500);
+                }
+                catch (InterruptedException e)
+                {
+                    logger.error("Shutdown interrupted.  Deployment was still waiting on active message dispatchers to complete message processing.", e);
+                    break;
+                }
+            }
+        }
+    }
+
+    /**
      * Add the pre-installed deployment units.
      * <p/>
      * An example of a "pre-installed" deployment unit would be for a
@@ -283,7 +397,7 @@
             new PropertiesIterator(deploymentProperties)
             {
                 DefaultConfigurationDigester digester = new DefaultConfigurationDigester();
-                
+
                 public void processEntry(String unitName, String unitPath) throws DeploymentException
                 {
                     String deploymentCheckPath = "preinstalled/" + ConfigUtil.urlEncode(deploymentName) + "/" + unitPath;
@@ -334,30 +448,6 @@
     }
 
     /**
-     * Undeploy the Runtime.
-     *
-     * @throws DeploymentException Error undeploying ESB Runtime.
-     */
-    public final void undeploy() throws DeploymentException
-    {
-        try
-        {
-            logger.info("Starting JBoss ESB undeployment: '" + deploymentName + "'.");
-            // Make sure to undeploy the scheduler first i.e. block scheduled triggers...
-            undeploy(JobScheduler.SCHEDULER_RESOURCE_ID, JobScheduler.getScheduler(context));
-            // Undeploy any objects manually set in the ESB deployment context...
-            undeploy(context.getAll());
-            // Undeploy all objects that were deployed on ESB Startup...
-            undeploy(deployedObjects);
-            logger.info("JBoss ESB undeployment completed successfully: '" + deploymentName + "'.");
-        }
-        finally
-        {
-            context = null;
-        }
-    }
-
-    /**
      * Undeploy the Objects supplied in the objectMap.
      *
      * @param objectMap The map of objects to be undeployed.
@@ -387,24 +477,24 @@
      */
     private void undeploy(final Object key, final Object object)
     {
-        // Keeping track of Objects as we undeploy them, so as not to
-        // undeploy the same object twice...
-        if (!undeployedObjects.contains(object))
+        try
         {
-            try
+            // Keeping track of Objects as we undeploy them, so as not to
+            // undeploy the same object twice...
+            if (!undeployedObjects.contains(object))
             {
                 ClassUtil.execAnnotatedMethod(object, Uninitialize.class);
                 undeployedObjects.add(object);
             }
-            catch (InvocationTargetException e)
-            {
-                logger.error("Error while undeploying '" + key + "' (" + object.getClass().getName() + ").", e.getCause());
-            }
-            catch (Throwable t)
-            {
-                logger.error("Error while undeploying '" + key + "' (" + object.getClass().getName() + ").", t);
-            }
         }
+        catch (InvocationTargetException e)
+        {
+            logger.error("Error while undeploying '" + key + "' (" + object.getClass().getName() + ").", e.getCause());
+        }
+        catch (Throwable t)
+        {
+            logger.error("Error while undeploying '" + key + "' (" + object.getClass().getName() + ").", t);
+        }
     }
 
     /**

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/AbstractDispatcher.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/AbstractDispatcher.java	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/AbstractDispatcher.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -28,8 +28,8 @@
 import org.jboss.esb.failure.DeadLetterPersistanceService;
 import org.jboss.esb.federate.bus.BusMessage;
 import org.jboss.esb.federate.bus.BusOutboundRouter;
+import org.jboss.esb.history.ProcessingEventLog;
 import org.jboss.esb.history.events.OutboundRouterProcessingEvent;
-import org.jboss.esb.history.ProcessingEventLog;
 import org.jboss.esb.history.events.ServiceProcessingEvent;
 import org.jboss.esb.message.Message;
 import org.jboss.esb.message.MessageTransformer;
@@ -41,6 +41,8 @@
 import org.jboss.esb.service.ServiceException;
 import org.jboss.esb.service.ServiceName;
 
+import java.util.ArrayList;
+import java.util.Collections;
 import java.util.List;
 
 /**
@@ -80,6 +82,10 @@
      * ServiceInvoker.
      */
     private ServiceInvoker serviceInvoker;
+    /**
+     * Active message list.
+     */
+    private List<Message> activeMessageList = Collections.synchronizedList(new ArrayList<Message>());
 
     /**
      * Public constructor.
@@ -104,6 +110,52 @@
     }
 
     /**
+     * Dispatch the message to the target service.
+     *
+     * @param message           The message to be dispatched.
+     * @param invocationContext The InvocationContext for the message dispatch.
+     */
+    public final void dispatch(final Message message, final InvocationContext invocationContext)
+    {
+        // We're simply keeping track of the number of "active" messages
+        // being handled by the dispatcher instance...
+        activeMessageList.add(message);
+        try
+        {
+            dispatchMessage(message, invocationContext);
+        }
+        finally
+        {
+            activeMessageList.remove(message);
+        }
+    }
+
+    /**
+     * Dispatch the message to the target service and then the configured out routers.
+     *
+     * @param message           The message to be dispatched.
+     * @param invocationContext The InvocationContext for the message dispatch.
+     */
+    public abstract void dispatchMessage(Message message, InvocationContext invocationContext);
+
+    /**
+     * Is the dispatcher instance processing messages.
+     * <p/>
+     * This is required by the undeploy process.  After uninitializing
+     * all {@link org.jboss.esb.routing.InboundRouter} instances, the undeploy waits untill
+     * all dispatchers have completed processing all their messages before
+     * continuing with the undeploy (uninitializing all other components
+     * and resources).
+     *
+     * @return True if the dispatcher has active messages that it is
+     *         processing, otherwise false.
+     */
+    public final boolean isProcessingMessages()
+    {
+        return !activeMessageList.isEmpty();
+    }
+
+    /**
      * Apply the inbound transform set.
      *
      * @param message The message.

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/LocalDispatcher.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/LocalDispatcher.java	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/LocalDispatcher.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -60,7 +60,7 @@
      * @param message           The message to be dispatched.
      * @param invocationContext The InvocationContext for the message dispatch.
      */
-    public final void dispatch(final Message message, final InvocationContext invocationContext)
+    public final void dispatchMessage(final Message message, final InvocationContext invocationContext)
     {
         AssertArgument.isNotNull(message, "message");
         AssertArgument.isNotNull(invocationContext, "invocationContext");

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -272,6 +272,24 @@
     }
 
     /**
+     * Stop listening for ESB messages on all connected buses.
+     */
+    public final void stopListeningOnBuses()
+    {
+        for (BusDeployment busDeployment : busDeployments)
+        {
+            try
+            {
+                busDeployment.bus.stopListening();
+            }
+            catch (Throwable t)
+            {
+                logger.error("Error while stopping message listening on Bus '" + busDeployment.bus.getClass().getName() + "'.", t);
+            }
+        }
+    }
+
+    /**
      * Attach the specified DeploymentMonitor instance to all
      * BusOutboundRouter instances that manage a service or out routers
      * for the Service associated with the BusOutboundRouter instance.

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/Bus.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/Bus.java	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/Bus.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -72,6 +72,11 @@
     boolean isConnected();
 
     /**
+     * Stop listening for ESB messages on the bus.
+     */
+    void stopListening();
+
+    /**
      * Close the Bus.
      */
     void close();

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusDispatcher.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusDispatcher.java	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusDispatcher.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -54,7 +54,7 @@
      * @param message           The message to be dispatched.
      * @param invocationContext The InvocationContext for the message dispatch.
      */
-    public final void dispatch(final Message message, final InvocationContext invocationContext)
+    public final void dispatchMessage(final Message message, final InvocationContext invocationContext)
     {
         AssertArgument.isNotNull(message, "message");
         AssertArgument.isNotNull(invocationContext, "invocationContext");

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -43,6 +43,16 @@
     private MessageDispatcher dispatcher;
 
     /**
+     * Get the {@link MessageDispatcher} for the router.
+     *
+     * @return The {@link MessageDispatcher} instance.
+     */
+    public final MessageDispatcher getDispatcher()
+    {
+        return dispatcher;
+    }
+
+    /**
      * Set the {@link MessageDispatcher} for the router.
      *
      * @param dispatcher The {@link MessageDispatcher} instance.
@@ -67,15 +77,16 @@
 
         AddressingContext addressingContext = busMessage.getAddressingContext();
         InvocationContext invocationContext = new InvocationContext(busMessage.getInvocationParameters());
+
         if (busMessage.getProcessingEventLog() != null)
         {
             ProcessingEventLog.setEventLog(busMessage.getProcessingEventLog(), invocationContext);
         }
-        Message esbMessage = busMessage.getMessage();
 
         AddressingContext.setContext(addressingContext);
         try
         {
+            Message esbMessage = busMessage.getMessage();
             dispatch(esbMessage, invocationContext);
         }
         finally

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBus.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBus.java	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBus.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -317,6 +317,15 @@
     }
 
     /**
+     * Stop listening for ESB messages on the bus.
+     */
+    public final void stopListening()
+    {
+        closeJMSHandler("JMS Bus Listener", jmsBusListener);
+        jmsBusListener = null;
+    }
+
+    /**
      * Connect the deployment coordination listener.
      *
      * @param busProperties Bus configuration properties.

Copied: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/TestInboundRouter.java (from rev 23054, labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/TestInboundRouter.java)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/TestInboundRouter.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/TestInboundRouter.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb;
+
+import org.jboss.esb.context.InvocationContext;
+import org.jboss.esb.message.Message;
+import org.jboss.esb.history.ProcessingEventLog;
+import org.jboss.esb.routing.InboundRouter;
+import org.jboss.esb.routing.MessageDispatcher;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class TestInboundRouter implements InboundRouter
+{
+    private MessageDispatcher dispatcher;
+
+    public void setDispatcher(MessageDispatcher dispatcher)
+    {
+        this.dispatcher = dispatcher;
+    }
+
+    public InvocationContext sendMessage(String message)
+    {
+        return sendMessage(message, false);
+    }
+
+    public InvocationContext sendMessage(String message, boolean propagateEventLog)
+    {
+        Message esbMessage = new Message();
+        InvocationContext invocationContext = new InvocationContext();
+        ProcessingEventLog eventLog = new ProcessingEventLog(propagateEventLog);
+        ProcessingEventLog.setEventLog(eventLog, invocationContext);
+
+        esbMessage.setPayload(message);
+        dispatcher.dispatch(esbMessage, invocationContext);
+
+        return invocationContext;
+    }
+}
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/TestInboundRouter.java
___________________________________________________________________
Name: svn:eol-style
   + native

Copied: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/TestOutboundRouter.java (from rev 23054, labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/TestOutboundRouter.java)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/TestOutboundRouter.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/TestOutboundRouter.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -0,0 +1,75 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb;
+
+import org.jboss.esb.context.AddressingContext;
+import org.jboss.esb.context.DeploymentContext;
+import org.jboss.esb.context.InvocationContext;
+import org.jboss.esb.message.Message;
+import org.jboss.esb.history.ProcessingEventLog;
+import org.jboss.esb.routing.OutboundRouter;
+import org.jboss.esb.routing.RoutingException;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class TestOutboundRouter implements OutboundRouter
+{
+    private String message;
+    public static InvocationContext invocationContext;
+    public static AddressingContext addressingContext;
+    public static DeploymentContext deploymentContext;
+    private ProcessingEventLog eventLog;
+    private long sleep = 0L;
+
+    public void route(Message message) throws RoutingException
+    {
+        try
+        {
+            Thread.sleep(sleep);
+        }
+        catch (InterruptedException e)
+        {
+            e.printStackTrace();
+        }
+
+        this.message = (String) message.getPayload();
+        invocationContext = InvocationContext.getContext();
+        addressingContext = AddressingContext.getContext();
+        deploymentContext = DeploymentContext.getContext();
+
+        eventLog = ProcessingEventLog.getEventLog();
+    }
+
+    public void setSleep(long sleep)
+    {
+        this.sleep = sleep;
+    }
+
+    public String getMessage()
+    {
+        return message;
+    }
+
+    public ProcessingEventLog getEventLog()
+    {
+        return eventLog;
+    }
+}
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/TestOutboundRouter.java
___________________________________________________________________
Name: svn:eol-style
   + native

Copied: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/TestService.java (from rev 23055, labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/TestService.java)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/TestService.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/TestService.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb;
+
+import org.jboss.esb.service.Service;
+import org.jboss.esb.service.ServiceException;
+import org.jboss.esb.message.Message;
+import org.jboss.esb.context.InvocationContext;
+import org.jboss.esb.context.AddressingContext;
+import org.jboss.esb.context.DeploymentContext;
+import org.jboss.esb.history.ProcessingEventLog;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class TestService implements Service
+{
+    private String message;
+    public static InvocationContext invocationContext;
+    public static AddressingContext addressingContext;
+    public static DeploymentContext deploymentContext;
+    private ProcessingEventLog eventLog;
+    private long sleep = 0L;
+
+    public Message process(Message message) throws ServiceException
+    {
+        try
+        {
+            Thread.sleep(sleep);
+        }
+        catch (InterruptedException e)
+        {
+            e.printStackTrace();
+        }
+
+        this.message = (String) message.getPayload();
+        invocationContext = InvocationContext.getContext();
+        addressingContext = AddressingContext.getContext();
+        deploymentContext = DeploymentContext.getContext();
+
+        eventLog = ProcessingEventLog.getEventLog();
+
+        return message;
+    }
+
+    public void setSleep(long sleep)
+    {
+        this.sleep = sleep;
+    }
+
+    public String getMessage()
+    {
+        return message;
+    }
+
+    public ProcessingEventLog getEventLog()
+    {
+        return eventLog;
+    }
+}
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/TestService.java
___________________________________________________________________
Name: svn:eol-style
   + native

Deleted: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/DeploymentLifecycleTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/DeploymentLifecycleTest.java	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/DeploymentLifecycleTest.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -1,78 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2008, JBoss Inc.
- */
-package org.jboss.esb.deploy.config;
-
-import junit.framework.TestCase;
-import org.jboss.esb.deploy.DeploymentException;
-import org.jboss.esb.deploy.DeploymentRuntime;
-import org.jboss.esb.deploy.DeploymentUtil;
-
-import java.io.IOException;
-
-/**
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class DeploymentLifecycleTest extends TestCase
-{
-    protected void setUp() throws Exception
-    {
-        MyInRouter.initialised = false;
-        MyMessageTransformer.initialised = false;
-        MyOutRouter.initialised = false;
-        MyResource.initialised = false;
-        MyTestService.initialised = false;
-    }
-
-    public void test_deploy_01_noexception() throws DeploymentException, IOException
-    {
-        DeploymentRuntime runtime = DeploymentUtil.createRuntime(getClass().getResourceAsStream("jbossesb-deploy-01.xml"));
-        assertDeployed(false);
-        runtime.deploy();
-        assertDeployed(true);
-        runtime.undeploy();
-        assertDeployed(false);
-    }
-
-    public void test_deploy_01_exception() throws DeploymentException, IOException
-    {
-        DeploymentRuntime runtime = DeploymentUtil.createRuntime(getClass().getResourceAsStream("jbossesb-deploy-01.xml"));
-
-        assertDeployed(false);
-        MyInRouter.exception = new Exception("deploy exception");
-        try
-        {
-            runtime.deploy();
-        } catch (DeploymentException e)
-        {
-            assertEquals("Unable to deploy InboundRouter 'inrouter1' (org.jboss.esb.deploy.config.MyInRouter).", e.getMessage());
-            // And check that everything else was undeployed again...
-            assertDeployed(false);
-        }
-    }
-
-    private void assertDeployed(boolean deployed)
-    {
-        assertEquals(deployed, MyInRouter.initialised);
-        assertEquals(deployed, MyMessageTransformer.initialised);
-        assertEquals(deployed, MyOutRouter.initialised);
-        assertEquals(deployed, MyResource.initialised);
-        assertEquals(deployed, MyTestService.initialised);
-    }
-}
\ No newline at end of file

Deleted: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/jbossesb-deploy-01.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/jbossesb-deploy-01.xml	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/jbossesb-deploy-01.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -1,26 +0,0 @@
-<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
-    
-    <resources>
-        <resource id="resource1" class="org.jboss.esb.deploy.config.MyResource" />
-    </resources>
-
-    <services>
-        <service serviceCategory="service-cat" serviceName="service-a" serviceDescription="A Service" class="org.jboss.esb.deploy.config.MyTestService">
-            <property name="prop1">propValue</property>
-        </service>
-    </services>
-
-    <routing>
-        <inRouters serviceCategory="service-cat" serviceName="service-a">
-            <inRouter name="inrouter1" class="org.jboss.esb.deploy.config.MyInRouter" />
-            <inRouter name="inrouter2" class="org.jboss.esb.deploy.config.MyInRouter">
-                <transformers>
-                    <transformer class="org.jboss.esb.deploy.config.MyMessageTransformer" />
-                </transformers>
-            </inRouter>
-        </inRouters>
-        <outRouters serviceCategory="service-cat" serviceName="service-a">
-            <outRouter name="outrouter1" class="org.jboss.esb.deploy.config.MyOutRouter" />
-        </outRouters>
-    </routing>
-</jbossesb>
\ No newline at end of file

Copied: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/01-inrouter-config.xml (from rev 23054, labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_003/01-inrouter-config.xml)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/01-inrouter-config.xml	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/01-inrouter-config.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -0,0 +1,9 @@
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
+    
+    <routing>
+        <inRouters serviceCategory="Service" serviceName="A">
+            <inRouter name="inrouter" class="org.jboss.esb.TestInboundRouter" />
+        </inRouters>
+    </routing>
+
+</jbossesb>
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/01-inrouter-config.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Copied: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/02-serviceA-config.xml (from rev 23054, labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_003/02-serviceA-config.xml)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/02-serviceA-config.xml	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/02-serviceA-config.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -0,0 +1,19 @@
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
+    
+    <services>
+        <service serviceCategory="Service" serviceName="A" serviceDescription="A Service" class="org.jboss.esb.TestService" />
+    </services>
+
+    <routing>
+        <!--
+            Route the message from A to B....
+        -->
+        <outRouters serviceCategory="Service" serviceName="A">
+            <outRouter name="A_to_B_router" class="org.jboss.esb.routing.ServiceRouter">
+                <property name="toCategory">Service</property>
+                <property name="toService">B</property>
+            </outRouter>
+        </outRouters>
+    </routing>
+
+</jbossesb>
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/02-serviceA-config.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Copied: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/03-serviceB-config.xml (from rev 23054, labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_003/03-serviceB-config.xml)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/03-serviceB-config.xml	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/03-serviceB-config.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -0,0 +1,13 @@
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
+
+    <services>
+        <service serviceCategory="Service" serviceName="B" serviceDescription="B Service" class="org.jboss.esb.TestService" />
+    </services>
+
+    <routing>
+        <outRouters serviceCategory="Service" serviceName="B">
+            <outRouter name="outrouter" class="org.jboss.esb.TestOutboundRouter" />
+        </outRouters>
+    </routing>
+    
+</jbossesb>
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/03-serviceB-config.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Copied: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/BasicTest.java (from rev 23054, labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/DeploymentLifecycleTest.java)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/BasicTest.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/BasicTest.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.deploy.lifecycle;
+
+import junit.framework.TestCase;
+import org.jboss.esb.deploy.DeploymentException;
+import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.deploy.DeploymentUtil;
+import org.jboss.esb.deploy.config.MyInRouter;
+import org.jboss.esb.deploy.config.MyMessageTransformer;
+import org.jboss.esb.deploy.config.MyOutRouter;
+import org.jboss.esb.deploy.config.MyResource;
+import org.jboss.esb.deploy.config.MyTestService;
+
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class BasicTest extends TestCase
+{
+    protected void setUp() throws Exception
+    {
+        MyInRouter.initialised = false;
+        MyMessageTransformer.initialised = false;
+        MyOutRouter.initialised = false;
+        MyResource.initialised = false;
+        MyTestService.initialised = false;
+    }
+
+    public void test_deploy_01_noexception() throws DeploymentException, IOException
+    {
+        DeploymentRuntime runtime = DeploymentUtil.createRuntime(getClass().getResourceAsStream("jbossesb-deploy-01.xml"));
+        assertDeployed(false);
+        runtime.deploy();
+        assertDeployed(true);
+        runtime.undeploy();
+        assertDeployed(false);
+    }
+
+    public void test_deploy_01_exception() throws DeploymentException, IOException
+    {
+        DeploymentRuntime runtime = DeploymentUtil.createRuntime(getClass().getResourceAsStream("jbossesb-deploy-01.xml"));
+
+        assertDeployed(false);
+        MyInRouter.exception = new Exception("deploy exception");
+        try
+        {
+            runtime.deploy();
+        } catch (DeploymentException e)
+        {
+            assertEquals("Unable to deploy InboundRouter 'inrouter1' (org.jboss.esb.deploy.config.MyInRouter).", e.getMessage());
+            // And check that everything else was undeployed again...
+            assertDeployed(false);
+        }
+    }
+
+    private void assertDeployed(boolean deployed)
+    {
+        assertEquals(deployed, MyInRouter.initialised);
+        assertEquals(deployed, MyMessageTransformer.initialised);
+        assertEquals(deployed, MyOutRouter.initialised);
+        assertEquals(deployed, MyResource.initialised);
+        assertEquals(deployed, MyTestService.initialised);
+    }
+}
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/BasicTest.java
___________________________________________________________________
Name: svn:eol-style
   + native

Copied: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/UndeployDispatcherDelayTest.java (from rev 23054, labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_003/RoutingTest.java)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/UndeployDispatcherDelayTest.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/UndeployDispatcherDelayTest.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -0,0 +1,129 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.deploy.lifecycle;
+
+import junit.framework.TestCase;
+import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.deploy.DeploymentUtil;
+import org.jboss.esb.jms.JMSTestRunner;
+import org.jboss.esb.TestInboundRouter;
+import org.jboss.esb.TestOutboundRouter;
+import org.jboss.esb.TestService;
+import org.jboss.esb.service.ServiceName;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class UndeployDispatcherDelayTest extends TestCase
+{
+
+    /*
+     * The message should go (across the 3 deployments):
+     *    [inrouter_ServiceA] -> [ServiceA] -> [ServiceB -> outrouter_ServiceB]
+     *
+     * With sleeps in the services, so as to slow down the undeploy and make it "wait".
+     *
+     */
+    public void test() throws Exception
+    {
+        new JMSTestRunner() {
+            public void test() throws Exception
+            {
+                ServiceName serviceNameA = new ServiceName("Service", "A");
+                ServiceName serviceNameB = new ServiceName("Service", "B");
+                DeploymentRuntime serviceBDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("03-serviceB-config.xml"));
+
+                serviceBDeployment.setDeploymentName("outrouter");
+                serviceBDeployment.deploy();
+                try
+                {
+                    DeploymentRuntime serviceADeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("02-serviceA-config.xml"));
+
+                    serviceADeployment.setDeploymentName("service");
+                    serviceADeployment.deploy();
+                    try
+                    {
+                        DeploymentRuntime inrouterDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-inrouter-config.xml"));
+
+                        inrouterDeployment.setDeploymentName("inrouter");
+                        inrouterDeployment.deploy();
+                        Thread.sleep(300); // Allow the deployments to exchange deployment details
+                        try
+                        {
+                            final TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter(serviceNameA, "inrouter", inrouterDeployment).getRouter();
+                            TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, serviceADeployment).getService();
+                            TestService serviceB = (TestService) DeploymentUtil.getService(serviceNameB, serviceBDeployment).getService();
+                            TestOutboundRouter outrouter = (TestOutboundRouter) DeploymentUtil.getOutboundRouter(serviceNameB, "outrouter", serviceBDeployment).getRouter();
+
+                            // Slow down the services so as to force the undeploy to wait...
+                            serviceA.setSleep(2000);
+                            serviceB.setSleep(2000);
+
+                            final boolean[] messageSent = new boolean[]{false};
+                            new Thread() {
+                                public void run()
+                                {
+                                    messageSent[0] = true;
+                                    inrouter.sendMessage("Hi there!!");
+                                }
+                            }.start();
+
+                            while(!messageSent[0]){
+                                Thread.sleep(10);
+                            }
+
+                            // Run the undeploy... they should wait until all messages have
+                            // been processed...
+                            long start = System.currentTimeMillis();
+                            inrouterDeployment.undeploy();
+                            serviceADeployment.undeploy();
+                            serviceBDeployment.undeploy();
+
+                            long timeToUndeploy = System.currentTimeMillis() - start;
+                            System.out.println("Time to undeploy: " + timeToUndeploy);
+
+                            // Make sure the time to undeploy reflects the delays
+                            // caused by the sleeps in the services...
+                            assertTrue(timeToUndeploy > 4000);
+
+                            // Check that the message has been routed across deployments, from the inrouter
+                            // to the service instance and then to the outrouter...
+                            assertEquals("Hi there!!", serviceA.getMessage());
+                            assertEquals("Hi there!!", serviceB.getMessage());
+                            assertEquals("Hi there!!", outrouter.getMessage());
+                        }
+                        finally
+                        {
+                            inrouterDeployment.undeploy();
+                        }
+                    }
+                    finally
+                    {
+                        serviceADeployment.undeploy();
+                    }
+                }
+                finally
+                {
+                    serviceBDeployment.undeploy();
+                }
+            }
+        }.run();
+    }
+}
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/UndeployDispatcherDelayTest.java
___________________________________________________________________
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native

Copied: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/jbossesb-deploy-01.xml (from rev 23054, labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/config/jbossesb-deploy-01.xml)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/jbossesb-deploy-01.xml	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/jbossesb-deploy-01.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -0,0 +1,26 @@
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
+    
+    <resources>
+        <resource id="resource1" class="org.jboss.esb.deploy.config.MyResource" />
+    </resources>
+
+    <services>
+        <service serviceCategory="service-cat" serviceName="service-a" serviceDescription="A Service" class="org.jboss.esb.deploy.config.MyTestService">
+            <property name="prop1">propValue</property>
+        </service>
+    </services>
+
+    <routing>
+        <inRouters serviceCategory="service-cat" serviceName="service-a">
+            <inRouter name="inrouter1" class="org.jboss.esb.deploy.config.MyInRouter" />
+            <inRouter name="inrouter2" class="org.jboss.esb.deploy.config.MyInRouter">
+                <transformers>
+                    <transformer class="org.jboss.esb.deploy.config.MyMessageTransformer" />
+                </transformers>
+            </inRouter>
+        </inRouters>
+        <outRouters serviceCategory="service-cat" serviceName="service-a">
+            <outRouter name="outrouter1" class="org.jboss.esb.deploy.config.MyOutRouter" />
+        </outRouters>
+    </routing>
+</jbossesb>
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/jbossesb-deploy-01.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Deleted: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/TestInboundRouter.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/TestInboundRouter.java	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/TestInboundRouter.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2008, JBoss Inc.
- */
-package org.jboss.esb.routing;
-
-import org.jboss.esb.context.InvocationContext;
-import org.jboss.esb.message.Message;
-import org.jboss.esb.history.ProcessingEventLog;
-
-/**
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class TestInboundRouter implements InboundRouter
-{
-    private MessageDispatcher dispatcher;
-
-    public void setDispatcher(MessageDispatcher dispatcher)
-    {
-        this.dispatcher = dispatcher;
-    }
-
-    public InvocationContext sendMessage(String message)
-    {
-        return sendMessage(message, false);
-    }
-
-    public InvocationContext sendMessage(String message, boolean propagateEventLog)
-    {
-        Message esbMessage = new Message();
-        InvocationContext invocationContext = new InvocationContext();
-        ProcessingEventLog eventLog = new ProcessingEventLog(propagateEventLog);
-        ProcessingEventLog.setEventLog(eventLog, invocationContext);
-
-        esbMessage.setPayload(message);
-        dispatcher.dispatch(esbMessage, invocationContext);
-
-        return invocationContext;
-    }
-}
\ No newline at end of file

Deleted: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/TestOutboundRouter.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/TestOutboundRouter.java	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/TestOutboundRouter.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -1,58 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2008, JBoss Inc.
- */
-package org.jboss.esb.routing;
-
-import org.jboss.esb.context.AddressingContext;
-import org.jboss.esb.context.DeploymentContext;
-import org.jboss.esb.context.InvocationContext;
-import org.jboss.esb.message.Message;
-import org.jboss.esb.history.ProcessingEventLog;
-
-/**
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class TestOutboundRouter implements OutboundRouter
-{
-    private String message;
-    public static InvocationContext invocationContext;
-    public static AddressingContext addressingContext;
-    public static DeploymentContext deploymentContext;
-    private ProcessingEventLog eventLog;
-
-    public void route(Message message) throws RoutingException
-    {
-        this.message = (String) message.getPayload();
-        invocationContext = InvocationContext.getContext();
-        addressingContext = AddressingContext.getContext();
-        deploymentContext = DeploymentContext.getContext();
-
-        eventLog = ProcessingEventLog.getEventLog();
-    }
-
-    public String getMessage()
-    {
-        return message;
-    }
-
-    public ProcessingEventLog getEventLog()
-    {
-        return eventLog;
-    }
-}
\ No newline at end of file

Deleted: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/TestService.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/TestService.java	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/TestService.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2008, JBoss Inc.
- */
-package org.jboss.esb.routing;
-
-import org.jboss.esb.service.Service;
-import org.jboss.esb.service.ServiceException;
-import org.jboss.esb.message.Message;
-import org.jboss.esb.context.InvocationContext;
-import org.jboss.esb.context.AddressingContext;
-import org.jboss.esb.context.DeploymentContext;
-import org.jboss.esb.history.ProcessingEventLog;
-
-/**
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class TestService implements Service
-{
-    private String message;
-    public static InvocationContext invocationContext;
-    public static AddressingContext addressingContext;
-    public static DeploymentContext deploymentContext;
-    private ProcessingEventLog eventLog;
-
-    public Message process(Message message) throws ServiceException
-    {
-        this.message = (String) message.getPayload();
-        invocationContext = InvocationContext.getContext();
-        addressingContext = AddressingContext.getContext();
-        deploymentContext = DeploymentContext.getContext();
-        eventLog = ProcessingEventLog.getEventLog();
-
-        return message;
-    }
-
-    public String getMessage()
-    {
-        return message;
-    }
-
-    public ProcessingEventLog getEventLog()
-    {
-        return eventLog;
-    }
-}
\ No newline at end of file

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_001/01-inrouter-config.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_001/01-inrouter-config.xml	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_001/01-inrouter-config.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -2,7 +2,7 @@
     
     <routing>
         <inRouters serviceCategory="Service" serviceName="A">
-            <inRouter name="inrouter" class="org.jboss.esb.routing.TestInboundRouter" />
+            <inRouter name="inrouter" class="org.jboss.esb.TestInboundRouter" />
         </inRouters>
     </routing>
 

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_001/02-service-config.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_001/02-service-config.xml	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_001/02-service-config.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -1,7 +1,7 @@
 <jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
     
     <services>
-        <service serviceCategory="Service" serviceName="A" serviceDescription="A Service" class="org.jboss.esb.routing.TestService" />
+        <service serviceCategory="Service" serviceName="A" serviceDescription="A Service" class="org.jboss.esb.TestService" />
     </services>
 
 </jbossesb>
\ No newline at end of file

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_001/03-outrouter-config.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_001/03-outrouter-config.xml	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_001/03-outrouter-config.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -2,7 +2,7 @@
     
     <routing>
         <outRouters serviceCategory="Service" serviceName="A">
-            <outRouter name="outrouter" class="org.jboss.esb.routing.TestOutboundRouter" />
+            <outRouter name="outrouter" class="org.jboss.esb.TestOutboundRouter" />
         </outRouters>
     </routing>
     

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_001/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_001/RoutingTest.java	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_001/RoutingTest.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -23,9 +23,9 @@
 import org.jboss.esb.deploy.DeploymentRuntime;
 import org.jboss.esb.deploy.DeploymentUtil;
 import org.jboss.esb.jms.JMSTestRunner;
-import org.jboss.esb.routing.TestInboundRouter;
-import org.jboss.esb.routing.TestOutboundRouter;
-import org.jboss.esb.routing.TestService;
+import org.jboss.esb.TestInboundRouter;
+import org.jboss.esb.TestOutboundRouter;
+import org.jboss.esb.TestService;
 import org.jboss.esb.service.ServiceName;
 
 /**

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_002/01-inrouter-config.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_002/01-inrouter-config.xml	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_002/01-inrouter-config.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -2,7 +2,7 @@
     
     <routing>
         <inRouters serviceCategory="Service" serviceName="A">
-            <inRouter name="inrouter" class="org.jboss.esb.routing.TestInboundRouter" />
+            <inRouter name="inrouter" class="org.jboss.esb.TestInboundRouter" />
         </inRouters>
     </routing>
 

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_002/02-service-config.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_002/02-service-config.xml	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_002/02-service-config.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -1,8 +1,8 @@
 <jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
     
     <services>
-        <service serviceCategory="Service" serviceName="A" serviceDescription="A Service" class="org.jboss.esb.routing.TestService" />
-        <service serviceCategory="Service" serviceName="B" serviceDescription="B Service" class="org.jboss.esb.routing.TestService" />
+        <service serviceCategory="Service" serviceName="A" serviceDescription="A Service" class="org.jboss.esb.TestService" />
+        <service serviceCategory="Service" serviceName="B" serviceDescription="B Service" class="org.jboss.esb.TestService" />
     </services>
 
     <routing>

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_002/03-outrouter-config.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_002/03-outrouter-config.xml	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_002/03-outrouter-config.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -2,7 +2,7 @@
     
     <routing>
         <outRouters serviceCategory="Service" serviceName="B">
-            <outRouter name="outrouter" class="org.jboss.esb.routing.TestOutboundRouter" />
+            <outRouter name="outrouter" class="org.jboss.esb.TestOutboundRouter" />
         </outRouters>
     </routing>
     

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_002/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_002/RoutingTest.java	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_002/RoutingTest.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -23,9 +23,9 @@
 import org.jboss.esb.deploy.DeploymentRuntime;
 import org.jboss.esb.deploy.DeploymentUtil;
 import org.jboss.esb.jms.JMSTestRunner;
-import org.jboss.esb.routing.TestInboundRouter;
-import org.jboss.esb.routing.TestOutboundRouter;
-import org.jboss.esb.routing.TestService;
+import org.jboss.esb.TestInboundRouter;
+import org.jboss.esb.TestOutboundRouter;
+import org.jboss.esb.TestService;
 import org.jboss.esb.service.ServiceName;
 
 /**

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_003/01-inrouter-config.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_003/01-inrouter-config.xml	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_003/01-inrouter-config.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -2,7 +2,7 @@
     
     <routing>
         <inRouters serviceCategory="Service" serviceName="A">
-            <inRouter name="inrouter" class="org.jboss.esb.routing.TestInboundRouter" />
+            <inRouter name="inrouter" class="org.jboss.esb.TestInboundRouter" />
         </inRouters>
     </routing>
 

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_003/02-serviceA-config.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_003/02-serviceA-config.xml	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_003/02-serviceA-config.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -1,7 +1,7 @@
 <jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
     
     <services>
-        <service serviceCategory="Service" serviceName="A" serviceDescription="A Service" class="org.jboss.esb.routing.TestService" />
+        <service serviceCategory="Service" serviceName="A" serviceDescription="A Service" class="org.jboss.esb.TestService" />
     </services>
 
     <routing>

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_003/03-serviceB-config.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_003/03-serviceB-config.xml	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_003/03-serviceB-config.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -1,12 +1,12 @@
 <jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
 
     <services>
-        <service serviceCategory="Service" serviceName="B" serviceDescription="B Service" class="org.jboss.esb.routing.TestService" />
+        <service serviceCategory="Service" serviceName="B" serviceDescription="B Service" class="org.jboss.esb.TestService" />
     </services>
 
     <routing>
         <outRouters serviceCategory="Service" serviceName="B">
-            <outRouter name="outrouter" class="org.jboss.esb.routing.TestOutboundRouter" />
+            <outRouter name="outrouter" class="org.jboss.esb.TestOutboundRouter" />
         </outRouters>
     </routing>
     

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_003/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_003/RoutingTest.java	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_003/RoutingTest.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -23,9 +23,9 @@
 import org.jboss.esb.deploy.DeploymentRuntime;
 import org.jboss.esb.deploy.DeploymentUtil;
 import org.jboss.esb.jms.JMSTestRunner;
-import org.jboss.esb.routing.TestInboundRouter;
-import org.jboss.esb.routing.TestOutboundRouter;
-import org.jboss.esb.routing.TestService;
+import org.jboss.esb.TestInboundRouter;
+import org.jboss.esb.TestOutboundRouter;
+import org.jboss.esb.TestService;
 import org.jboss.esb.service.ServiceName;
 
 /**

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_004/01-inrouter-config.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_004/01-inrouter-config.xml	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_004/01-inrouter-config.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -2,7 +2,7 @@
     
     <routing>
         <inRouters serviceCategory="Service" serviceName="A">
-            <inRouter name="inrouter" class="org.jboss.esb.routing.TestInboundRouter" />
+            <inRouter name="inrouter" class="org.jboss.esb.TestInboundRouter" />
         </inRouters>
     </routing>
 

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_004/02-outrouter-config.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_004/02-outrouter-config.xml	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_004/02-outrouter-config.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -2,7 +2,7 @@
     
     <routing>
         <outRouters serviceCategory="Service" serviceName="A">
-            <outRouter name="outrouter" class="org.jboss.esb.routing.TestOutboundRouter" />
+            <outRouter name="outrouter" class="org.jboss.esb.TestOutboundRouter" />
         </outRouters>
     </routing>
     

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_004/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_004/RoutingTest.java	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_004/RoutingTest.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -23,8 +23,8 @@
 import org.jboss.esb.deploy.DeploymentRuntime;
 import org.jboss.esb.deploy.DeploymentUtil;
 import org.jboss.esb.jms.JMSTestRunner;
-import org.jboss.esb.routing.TestInboundRouter;
-import org.jboss.esb.routing.TestOutboundRouter;
+import org.jboss.esb.TestInboundRouter;
+import org.jboss.esb.TestOutboundRouter;
 import org.jboss.esb.service.ServiceName;
 
 /**

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_005/01-inrouter-config.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_005/01-inrouter-config.xml	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_005/01-inrouter-config.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -2,7 +2,7 @@
     
     <routing>
         <inRouters serviceCategory="Service" serviceName="A">
-            <inRouter name="inrouter" class="org.jboss.esb.routing.TestInboundRouter" />
+            <inRouter name="inrouter" class="org.jboss.esb.TestInboundRouter" />
         </inRouters>
     </routing>
 

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_005/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_005/RoutingTest.java	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_005/RoutingTest.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -23,7 +23,7 @@
 import org.jboss.esb.deploy.DeploymentRuntime;
 import org.jboss.esb.deploy.DeploymentUtil;
 import org.jboss.esb.jms.JMSTestRunner;
-import org.jboss.esb.routing.TestInboundRouter;
+import org.jboss.esb.TestInboundRouter;
 import org.jboss.esb.service.ServiceName;
 
 /**

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_006/01-deployment.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_006/01-deployment.xml	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_006/01-deployment.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -2,7 +2,7 @@
     
     <routing>
         <inRouters serviceCategory="Service" serviceName="A">
-            <inRouter name="inrouter" class="org.jboss.esb.routing.TestInboundRouter" />
+            <inRouter name="inrouter" class="org.jboss.esb.TestInboundRouter" />
         </inRouters>
 
         <!--
@@ -17,7 +17,7 @@
     </routing>
 
     <services>
-        <service serviceCategory="Service" serviceName="A" serviceDescription="A Service" class="org.jboss.esb.routing.TestService" />
+        <service serviceCategory="Service" serviceName="A" serviceDescription="A Service" class="org.jboss.esb.TestService" />
     </services>    
 
 </jbossesb>
\ No newline at end of file

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_006/02-deployment.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_006/02-deployment.xml	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_006/02-deployment.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -13,7 +13,7 @@
     </routing>
 
     <services>
-        <service serviceCategory="Service" serviceName="B" serviceDescription="B Service" class="org.jboss.esb.routing.TestService" />
+        <service serviceCategory="Service" serviceName="B" serviceDescription="B Service" class="org.jboss.esb.TestService" />
     </services>
 
 </jbossesb>
\ No newline at end of file

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_006/03-deployment.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_006/03-deployment.xml	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_006/03-deployment.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -1,12 +1,12 @@
 <jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
 
     <services>
-        <service serviceCategory="Service" serviceName="C" serviceDescription="B Service" class="org.jboss.esb.routing.TestService" />
+        <service serviceCategory="Service" serviceName="C" serviceDescription="B Service" class="org.jboss.esb.TestService" />
     </services>
 
     <routing>
         <outRouters serviceCategory="Service" serviceName="C">
-            <outRouter name="outrouter" class="org.jboss.esb.routing.TestOutboundRouter" />
+            <outRouter name="outrouter" class="org.jboss.esb.TestOutboundRouter" />
         </outRouters>
     </routing>
     

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_006/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_006/RoutingTest.java	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_006/RoutingTest.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -23,9 +23,9 @@
 import org.jboss.esb.deploy.DeploymentRuntime;
 import org.jboss.esb.deploy.DeploymentUtil;
 import org.jboss.esb.jms.JMSTestRunner;
-import org.jboss.esb.routing.TestInboundRouter;
-import org.jboss.esb.routing.TestOutboundRouter;
-import org.jboss.esb.routing.TestService;
+import org.jboss.esb.TestInboundRouter;
+import org.jboss.esb.TestOutboundRouter;
+import org.jboss.esb.TestService;
 import org.jboss.esb.service.ServiceName;
 
 /**

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_007/01-deployment.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_007/01-deployment.xml	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_007/01-deployment.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -2,7 +2,7 @@
     
     <routing>
         <inRouters serviceCategory="Service" serviceName="A">
-            <inRouter name="inrouter" class="org.jboss.esb.routing.TestInboundRouter" />
+            <inRouter name="inrouter" class="org.jboss.esb.TestInboundRouter" />
         </inRouters>
 
         <!--
@@ -26,9 +26,9 @@
     </routing>
 
     <services>
-        <service serviceCategory="Service" serviceName="A" serviceDescription="A Service" class="org.jboss.esb.routing.TestService" />
-        <service serviceCategory="Service" serviceName="B" serviceDescription="B Service" class="org.jboss.esb.routing.TestService" />
-        <service serviceCategory="Service" serviceName="F" serviceDescription="F Service" class="org.jboss.esb.routing.TestService" />
+        <service serviceCategory="Service" serviceName="A" serviceDescription="A Service" class="org.jboss.esb.TestService" />
+        <service serviceCategory="Service" serviceName="B" serviceDescription="B Service" class="org.jboss.esb.TestService" />
+        <service serviceCategory="Service" serviceName="F" serviceDescription="F Service" class="org.jboss.esb.TestService" />
     </services>
 
 </jbossesb>
\ No newline at end of file

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_007/02-deployment.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_007/02-deployment.xml	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_007/02-deployment.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -22,8 +22,8 @@
     </routing>
 
     <services>
-        <service serviceCategory="Service" serviceName="C" serviceDescription="C Service" class="org.jboss.esb.routing.TestService" />
-        <service serviceCategory="Service" serviceName="E" serviceDescription="E Service" class="org.jboss.esb.routing.TestService" />
+        <service serviceCategory="Service" serviceName="C" serviceDescription="C Service" class="org.jboss.esb.TestService" />
+        <service serviceCategory="Service" serviceName="E" serviceDescription="E Service" class="org.jboss.esb.TestService" />
     </services>
 
 </jbossesb>
\ No newline at end of file

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_007/03-deployment.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_007/03-deployment.xml	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_007/03-deployment.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -1,7 +1,7 @@
 <jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
 
     <services>
-        <service serviceCategory="Service" serviceName="D" serviceDescription="D Service" class="org.jboss.esb.routing.TestService" />
+        <service serviceCategory="Service" serviceName="D" serviceDescription="D Service" class="org.jboss.esb.TestService" />
     </services>
 
     <routing>

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_007/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_007/RoutingTest.java	2008-09-25 10:50:11 UTC (rev 23074)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_007/RoutingTest.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -23,8 +23,8 @@
 import org.jboss.esb.deploy.DeploymentRuntime;
 import org.jboss.esb.deploy.DeploymentUtil;
 import org.jboss.esb.jms.JMSTestRunner;
-import org.jboss.esb.routing.TestInboundRouter;
-import org.jboss.esb.routing.TestService;
+import org.jboss.esb.TestInboundRouter;
+import org.jboss.esb.TestService;
 import org.jboss.esb.service.ServiceName;
 
 /**
@@ -34,8 +34,11 @@
 {
 
     /*
-     * The message should go (across the 3 deployments):
-     *      [inrouter_ServiceA -> ServiceA] -> [ServiceB] -> [ServiceC -> outrouter_ServiceC]
+     * The message should go (across the 3 deployments and back):
+     *      [inrouter_ServiceA -> ServiceA -> ServiceB] -> [ServiceC] -> [ServiceD]
+     *                                                                        |
+     *                                                                       \|/
+     *      [               ServiceF                  ] -> [ServiceE] <------- 
      */
     public void test() throws Exception
     {

Copied: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_008/01-deployment.xml (from rev 23055, labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_007/01-deployment.xml)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_008/01-deployment.xml	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_008/01-deployment.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -0,0 +1,34 @@
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
+    
+    <routing>
+        <inRouters serviceCategory="Service" serviceName="A">
+            <inRouter name="inrouter" class="org.jboss.esb.TestInboundRouter" />
+        </inRouters>
+
+        <!--
+            Route the message from A to B....
+        -->
+        <outRouters serviceCategory="Service" serviceName="A">
+            <outRouter name="A_to_B_router" class="org.jboss.esb.routing.ServiceRouter">
+                <property name="toCategory">Service</property>
+                <property name="toService">B</property>
+            </outRouter>
+        </outRouters>
+        <!--
+            Route the message from B to C....
+        -->
+        <outRouters serviceCategory="Service" serviceName="B">
+            <outRouter name="B_to_C_router" class="org.jboss.esb.routing.ServiceRouter">
+                <property name="toCategory">Service</property>
+                <property name="toService">C</property>
+            </outRouter>
+        </outRouters>
+    </routing>
+
+    <services>
+        <service serviceCategory="Service" serviceName="A" serviceDescription="A Service" class="org.jboss.esb.TestService" />
+        <service serviceCategory="Service" serviceName="B" serviceDescription="B Service" class="org.jboss.esb.TestService" />
+        <service serviceCategory="Service" serviceName="F" serviceDescription="F Service" class="org.jboss.esb.TestService" />
+    </services>
+
+</jbossesb>
\ No newline at end of file

Copied: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_008/02-deployment.xml (from rev 23055, labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_007/02-deployment.xml)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_008/02-deployment.xml	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_008/02-deployment.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -0,0 +1,29 @@
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
+
+    <routing>
+        <!--
+            Route the message from C to D....
+        -->
+        <outRouters serviceCategory="Service" serviceName="C">
+            <outRouter name="C_to_D_router" class="org.jboss.esb.routing.ServiceRouter">
+                <property name="toCategory">Service</property>
+                <property name="toService">D</property>
+            </outRouter>
+        </outRouters>
+        <!--
+            Route the message from E to F....
+        -->
+        <outRouters serviceCategory="Service" serviceName="E">
+            <outRouter name="E_to_F_router" class="org.jboss.esb.routing.ServiceRouter">
+                <property name="toCategory">Service</property>
+                <property name="toService">F</property>
+            </outRouter>
+        </outRouters>
+    </routing>
+
+    <services>
+        <service serviceCategory="Service" serviceName="C" serviceDescription="C Service" class="org.jboss.esb.TestService" />
+        <service serviceCategory="Service" serviceName="E" serviceDescription="E Service" class="org.jboss.esb.TestService" />
+    </services>
+
+</jbossesb>
\ No newline at end of file

Copied: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_008/03-deployment.xml (from rev 23055, labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_007/03-deployment.xml)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_008/03-deployment.xml	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_008/03-deployment.xml	2008-09-25 12:30:03 UTC (rev 23075)
@@ -0,0 +1,19 @@
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
+
+    <services>
+        <service serviceCategory="Service" serviceName="D" serviceDescription="D Service" class="org.jboss.esb.TestService" />
+    </services>
+
+    <routing>
+        <!--
+            Route the message from D to E....
+        -->
+        <outRouters serviceCategory="Service" serviceName="D">
+            <outRouter name="D_to_E_router" class="org.jboss.esb.routing.ServiceRouter">
+                <property name="toCategory">Service</property>
+                <property name="toService">E</property>
+            </outRouter>
+        </outRouters>
+    </routing>
+    
+</jbossesb>
\ No newline at end of file

Copied: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_008/RoutingTest.java (from rev 23055, labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_007/RoutingTest.java)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_008/RoutingTest.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_008/RoutingTest.java	2008-09-25 12:30:03 UTC (rev 23075)
@@ -0,0 +1,115 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.routing.scenario_008;
+
+import junit.framework.TestCase;
+import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.deploy.DeploymentUtil;
+import org.jboss.esb.jms.JMSTestRunner;
+import org.jboss.esb.TestInboundRouter;
+import org.jboss.esb.TestService;
+import org.jboss.esb.service.ServiceName;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class RoutingTest extends TestCase
+{
+
+    /*
+     * The message should go (across the 3 deployments and back):
+     *      [inrouter_ServiceA -> ServiceA -> ServiceB] -> [ServiceC] -> [ServiceD]
+     *                                                                        |
+     *                                                                       \|/
+     *      [               ServiceF                  ] -> [ServiceE] <-------
+     */
+    public void test() throws Exception
+    {
+        new JMSTestRunner() {
+            public void test() throws Exception
+            {
+                ServiceName serviceNameA = new ServiceName("Service", "A");
+                ServiceName serviceNameF = new ServiceName("Service", "F");
+                DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-deployment.xml"));
+
+                deployment1.setDeploymentName("deployment1");
+                deployment1.setDeploymentId("deployment1-Id");
+                deployment1.deploy();
+                try
+                {
+                    DeploymentRuntime deployment2 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("02-deployment.xml"));
+
+                    deployment2.setDeploymentName("deployment2");
+                    deployment2.setDeploymentId("deployment2-Id");
+                    deployment2.deploy();
+                    try
+                    {
+                        DeploymentRuntime deployment3 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("03-deployment.xml"));
+
+                        deployment3.setDeploymentName("deployment3");
+                        deployment3.setDeploymentId("deployment3-Id");
+                        deployment3.deploy();
+                        Thread.sleep(300); // Allow the deployments to exchange deployment details
+                        try
+                        {
+                            TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter(serviceNameA, "inrouter", deployment1).getRouter();
+                            TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
+                            TestService serviceF = (TestService) DeploymentUtil.getService(serviceNameF, deployment1).getService();
+
+                            // Force propagation of the event log...
+                            inrouter.sendMessage("Hi there!!", true);
+                            Thread.sleep(1000); // Allow the message to be delivered
+
+                            // Check that the message has been routed across deployments, from the inrouter
+                            // to the service instance and then to the outrouter...
+                            assertEquals("Hi there!!", serviceA.getMessage());
+                            assertEquals("Hi there!!", serviceF.getMessage());
+
+                            assertEquals("Message Processing Event Log:\n" +
+                                    "\t1.   [deployment1-Id:deployment1] ServiceProcessingEvent: service='Service:A'\n" +
+                                    "\t2.   [deployment1-Id:deployment1] ServiceProcessingEvent: service='Service:B'\n" +
+                                    "\t3.   [deployment1-Id:deployment1] BusRouterProcessingEvent: to='Service:C', targetDeploymentId='deployment2-Id:deployment2', busType='JMSBus'\n" +
+                                    "\t4.   [deployment2-Id:deployment2] ServiceProcessingEvent: service='Service:C'\n" +
+                                    "\t5.   [deployment2-Id:deployment2] BusRouterProcessingEvent: to='Service:D', targetDeploymentId='deployment3-Id:deployment3', busType='JMSBus'\n" +
+                                    "\t6.   [deployment3-Id:deployment3] ServiceProcessingEvent: service='Service:D'\n" +
+                                    "\t7.   [deployment3-Id:deployment3] BusRouterProcessingEvent: to='Service:E', targetDeploymentId='deployment2-Id:deployment2', busType='JMSBus'\n" +
+                                    "\t8.   [deployment2-Id:deployment2] ServiceProcessingEvent: service='Service:E'\n" +
+                                    "\t9.   [deployment2-Id:deployment2] BusRouterProcessingEvent: to='Service:F', targetDeploymentId='deployment1-Id:deployment1', busType='JMSBus'\n" +
+                                    "\t10.  [deployment1-Id:deployment1] ServiceProcessingEvent: service='Service:F'",
+                                    serviceF.getEventLog().toString().trim());
+                        }
+                        finally
+                        {
+                            deployment3.undeploy();
+                        }
+                    }
+                    finally
+                    {
+                        deployment2.undeploy();
+                    }
+                }
+                finally
+                {
+                    deployment1.undeploy();
+                }
+            }
+        }.run();
+    }
+}
\ No newline at end of file




More information about the jboss-svn-commits mailing list