[jboss-svn-commits] JBL Code SVN: r23042 - in labs/jbossesb/workspace/skeagh/runtime/src: main/java/org/jboss/esb/dispatch and 7 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Sep 24 06:14:28 EDT 2008


Author: tfennelly
Date: 2008-09-24 06:14:27 -0400 (Wed, 24 Sep 2008)
New Revision: 23042

Added:
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/BusRouterProcessingEvent.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/OutboundRouterProcessingEvent.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/ProcessingEvent.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/ProcessingEventLog.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/ServiceProcessingEvent.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/package.html
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_004/
   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/
   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/
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_007/
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_008/
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_009/
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_010/
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/LocalDispatcher.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/MockDeadLetterService.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentMonitor.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusOutboundRouter.java
Log:
Added ProcessingEventLog.  Makes testing easier and is something that will be of more general use too.

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-24 09:03:38 UTC (rev 23041)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/AbstractDispatcher.java	2008-09-24 10:14:27 UTC (rev 23042)
@@ -28,6 +28,9 @@
 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.OutboundRouterProcessingEvent;
+import org.jboss.esb.history.ProcessingEventLog;
+import org.jboss.esb.history.ServiceProcessingEvent;
 import org.jboss.esb.message.Message;
 import org.jboss.esb.message.MessageTransformer;
 import org.jboss.esb.routing.MessageDispatcher;
@@ -139,6 +142,10 @@
             {
                 Message outMessage = service.process(theMessage);
                 AddressingContext.getContext().setFrom(getServiceName());
+
+                // Log this processing event...
+                ProcessingEventLog.getEventLog().logEvent(new ServiceProcessingEvent(getServiceName()));
+
                 return outMessage;
             }
             catch (ServiceException e)
@@ -261,6 +268,9 @@
                         try
                         {
                             outRouter.route(outMessage);
+
+                            // Log this processing event...
+                            ProcessingEventLog.getEventLog().logEvent(new OutboundRouterProcessingEvent(outboundRouterConfig.getName()));
                         }
                         catch (Throwable t)
                         {
@@ -272,7 +282,8 @@
                         finally
                         {
                             // Reset the message contents in case there are multiple
-                            // outrouters...
+                            // outrouters.  They may have transformers that modified
+                            // the original message...
                             outMessage.setPayload(clone.getPayload());
                             outMessage.getAttachments().clear();
                             outMessage.getAttachments().putAll(clone.getAttachments());

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-24 09:03:38 UTC (rev 23041)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/LocalDispatcher.java	2008-09-24 10:14:27 UTC (rev 23042)
@@ -25,6 +25,7 @@
 import org.jboss.esb.context.InvocationContext;
 import org.jboss.esb.message.Message;
 import org.jboss.esb.util.AssertArgument;
+import org.jboss.esb.history.ProcessingEventLog;
 
 /**
  * Local message dispatcher.
@@ -91,15 +92,24 @@
                     }
                     outMessage = dispatchToService(message);
                     applyOutboundRouters(outMessage);
-                } finally
+
+                    // Make sure the message was processed...
+                    if(ProcessingEventLog.getEventLog().getProcessingEvents().isEmpty())
+                    {
+                        throw new IllegalStateException("Message not processed for Service Name '" + getServiceName() + "'.  No Service instance or Outbound Router instances applied.");
+                    }
+                }
+                finally
                 {
                     InvocationContext.setContext(null);
                 }
-            } finally
+            }
+            finally
             {
                 AddressingContext.setContext(null);
             }
-        } finally
+        }
+        finally
         {
             DeploymentContext.setContext(null);
         }

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/MockDeadLetterService.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/MockDeadLetterService.java	2008-09-24 09:03:38 UTC (rev 23041)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/failure/MockDeadLetterService.java	2008-09-24 10:14:27 UTC (rev 23042)
@@ -41,6 +41,10 @@
      */
     private boolean expectingMessages = false;
     /**
+     * Exception to throw.
+     */
+    private Exception throwException = null;
+    /**
      * Messages.
      */
     private Queue<Message> messages = new ConcurrentLinkedQueue<Message>();
@@ -54,10 +58,20 @@
      */
     public final Message process(final Message message) throws ServiceException
     {
+        if(throwException instanceof RuntimeException)
+        {
+            throw (RuntimeException) throwException;
+        }
+        else if(throwException instanceof ServiceException)
+        {
+            throw (ServiceException) throwException;
+        }
+
         if(expectingMessages)
         {
             throw new RuntimeException("No expecting Dead Letter message deliveries. Call setExpectingMessages(true) to turn off this error.");
         }
+
         messages.add(message);
         return message;
     }
@@ -91,4 +105,25 @@
     {
         this.expectingMessages = expectingMessages;
     }
+
+    /**
+     * Set the exception to be thrown from the process method.
+     * @param throwException The exception to be thrown.
+     */
+    public void setThrowException(Exception throwException)
+    {
+        if(throwException instanceof RuntimeException)
+        {
+            // Lovely...
+        }
+        else if(throwException instanceof ServiceException)
+        {
+            // Lovely...
+        }
+        else
+        {
+            throw new IllegalArgumentException("Must be a " + RuntimeException.class.getName() + " or " + ServiceException.class.getName() + ".");
+        }
+        this.throwException = throwException;
+    }
 }

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentMonitor.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentMonitor.java	2008-09-24 09:03:38 UTC (rev 23041)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentMonitor.java	2008-09-24 10:14:27 UTC (rev 23042)
@@ -25,6 +25,8 @@
 import org.jboss.esb.failure.DeadLetterPersistanceService;
 import org.jboss.esb.federate.bus.Bus;
 import org.jboss.esb.federate.bus.BusMessage;
+import org.jboss.esb.history.BusRouterProcessingEvent;
+import org.jboss.esb.history.ProcessingEventLog;
 import org.jboss.esb.message.Message;
 import org.jboss.esb.routing.ServiceInvoker;
 import org.jboss.esb.service.ServiceName;
@@ -183,6 +185,10 @@
         try
         {
             bus.send(message, targetDeploymentId);
+
+            // Log this processing event...
+            ProcessingEventLog.getEventLog().logEvent(new BusRouterProcessingEvent(message.getAddressingContext().getTo(), targetDeploymentId, bus.getClass()));
+
             return true;
         }
         catch (Throwable t)

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusOutboundRouter.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusOutboundRouter.java	2008-09-24 09:03:38 UTC (rev 23041)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusOutboundRouter.java	2008-09-24 10:14:27 UTC (rev 23042)
@@ -98,7 +98,7 @@
             else
             {
                 // If we route to a Service, we don't route to outbound routers.  The target
-                // Service will handle that....
+                // Service will handle that after it processes the message....
                 if (routeToService(busMessage))
                 {
                     return;

Added: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/BusRouterProcessingEvent.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/BusRouterProcessingEvent.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/BusRouterProcessingEvent.java	2008-09-24 10:14:27 UTC (rev 23042)
@@ -0,0 +1,84 @@
+/*
+ * 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.history;
+
+import org.jboss.esb.service.ServiceName;
+import org.jboss.esb.federate.bus.Bus;
+
+/**
+ * Bus Router Processing Event.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class BusRouterProcessingEvent implements ProcessingEvent
+{
+    /**
+     * The 'to' service.
+     */
+    private ServiceName to;
+    /**
+     * The target deployment ID.
+     */
+    private String targetDeploymentId;
+    /**
+     * The bus type used to transport the message.
+     */
+    private Class<? extends Bus> busType;
+
+    /**
+     * Public constructor.
+     * @param to The target service.
+     * @param targetDeploymentId The target deployment hosting the service.
+     * @param busType The bus type used to transport the message.
+     */
+    public BusRouterProcessingEvent(final ServiceName to, final String targetDeploymentId, final Class<? extends Bus> busType)
+    {
+        this.to = to;
+        this.targetDeploymentId = targetDeploymentId;
+        this.busType = busType;
+    }
+
+    /**
+     * Get the 'to' service name.
+     * @return The 'to' service name.
+     */
+    public final ServiceName getTo()
+    {
+        return to;
+    }
+
+    /**
+     * Get the target deployment ID.
+     * @return The target deployment ID.
+     */
+    public final String getTargetDeploymentId()
+    {
+        return targetDeploymentId;
+    }
+
+    /**
+     * Get the bus type used.
+     * @return The bus type used.
+     */
+    public final Class<? extends Bus> getBusType()
+    {
+        return busType;
+    }
+}
\ No newline at end of file


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

Added: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/OutboundRouterProcessingEvent.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/OutboundRouterProcessingEvent.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/OutboundRouterProcessingEvent.java	2008-09-24 10:14:27 UTC (rev 23042)
@@ -0,0 +1,49 @@
+/*
+ * 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.history;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class OutboundRouterProcessingEvent implements ProcessingEvent
+{
+    /**
+     * The outrouter configuration name.
+     */
+    private String configName;
+
+    /**
+     * Public constructor.
+     * @param configName The outrouter configuration name.
+     */
+    public OutboundRouterProcessingEvent(final String configName)
+    {
+        this.configName = configName;
+    }
+
+    /**
+     * Get the outrouter configuration name.
+     * @return The outrouter configuration name.
+     */
+    public final String getConfigName()
+    {
+        return configName;
+    }
+}
\ No newline at end of file


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

Added: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/ProcessingEvent.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/ProcessingEvent.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/ProcessingEvent.java	2008-09-24 10:14:27 UTC (rev 23042)
@@ -0,0 +1,29 @@
+/*
+ * 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.history;
+
+/**
+ * Abstract processing Event interface.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public interface ProcessingEvent
+{
+}


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

Added: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/ProcessingEventLog.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/ProcessingEventLog.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/ProcessingEventLog.java	2008-09-24 10:14:27 UTC (rev 23042)
@@ -0,0 +1,78 @@
+/*
+ * 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.history;
+
+import org.jboss.esb.context.InvocationContext;
+import org.jboss.esb.util.AssertArgument;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Processing event Log.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class ProcessingEventLog
+{
+    /**
+     * Processing events.
+     */
+    private List<ProcessingEvent> processingEvents = new ArrayList<ProcessingEvent>();
+
+    /**
+     * Get the {@link ProcessingEventLog} from the {@linkInvocationContext}.
+     *
+     * @return The Processing Event Log.
+     */
+    public static ProcessingEventLog getEventLog()
+    {
+        InvocationContext invocationContext = InvocationContext.getContext();
+        ProcessingEventLog eventLog = (ProcessingEventLog) invocationContext.getContextObject(ProcessingEventLog.class);
+
+        if(eventLog == null)
+        {
+            eventLog = new ProcessingEventLog();
+            invocationContext.setContextObject(ProcessingEventLog.class, eventLog);
+        }
+
+        return eventLog;
+    }
+
+    /**
+     * Log a processing event.
+     * @param event The event to be logged.
+     */
+    public final void logEvent(final ProcessingEvent event)
+    {
+        AssertArgument.isNotNull(event, "event");
+        processingEvents.add(event);
+    }
+
+    /**
+     * Get the list of logged processing events.
+     *
+     * @return The list of logged processing events.
+     */
+    public final List<ProcessingEvent> getProcessingEvents()
+    {
+        return processingEvents;
+    }
+}


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

Added: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/ServiceProcessingEvent.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/ServiceProcessingEvent.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/ServiceProcessingEvent.java	2008-09-24 10:14:27 UTC (rev 23042)
@@ -0,0 +1,52 @@
+/*
+ * 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.history;
+
+import org.jboss.esb.service.ServiceName;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class ServiceProcessingEvent implements ProcessingEvent
+{
+    /**
+     * The name of the Service that processed the message.
+     */
+    private ServiceName serviceName;
+
+    /**
+     * Public constructor.
+     *
+     * @param serviceName The name of the Service.
+     */
+    public ServiceProcessingEvent(final ServiceName serviceName)
+    {
+        this.serviceName = serviceName;
+    }
+
+    /**
+     * The the name of the Service.
+     * @return The name of the Service.
+     */
+    public final ServiceName getServiceName()
+    {
+        return serviceName;
+    }
+}


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

Copied: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/package.html (from rev 23018, labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/routing/package.html)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/package.html	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/package.html	2008-09-24 10:14:27 UTC (rev 23042)
@@ -0,0 +1,8 @@
+<html>
+<head></head>
+<body>
+Message Processing History.
+
+<h2>Package Specification</h2>
+</body>
+</html>
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/package.html
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_004/01-inrouter-config.xml (from rev 23018, 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_004/01-inrouter-config.xml	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_004/01-inrouter-config.xml	2008-09-24 10:14:27 UTC (rev 23042)
@@ -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.routing.TestInboundRouter" />
+        </inRouters>
+    </routing>
+
+</jbossesb>
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_004/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/routing/scenario_004/02-outrouter-config.xml (from rev 23018, 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_004/02-outrouter-config.xml	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_004/02-outrouter-config.xml	2008-09-24 10:14:27 UTC (rev 23042)
@@ -0,0 +1,9 @@
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
+    
+    <routing>
+        <outRouters serviceCategory="Service" serviceName="A">
+            <outRouter name="outrouter" class="org.jboss.esb.routing.TestOutboundRouter" />
+        </outRouters>
+    </routing>
+    
+</jbossesb>
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_004/02-outrouter-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/routing/scenario_004/RoutingTest.java (from rev 23018, 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/RoutingTest.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_004/RoutingTest.java	2008-09-24 10:14:27 UTC (rev 23042)
@@ -0,0 +1,88 @@
+/*
+ * 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_004;
+
+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.routing.TestInboundRouter;
+import org.jboss.esb.routing.TestOutboundRouter;
+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
+{
+
+    /*
+     * This is a simple scenario where there are 2 deployments connected into the same bus:
+     * 1. "inrouterDeployment" defines an inrouter for "Service:A".
+     * 2. "outrouterDeployment" defines an outrouter for "Service:A".
+     *
+     * i.e. there's no Service, just in and out across deployments...
+     *
+     * So the message should go (across the 2 deployments):
+     *    [inrouter_ServiceA] -> [outrouter_ServiceA]
+     *
+     */
+    public void test() throws Exception
+    {
+        new JMSTestRunner() {
+            public void test() throws Exception
+            {
+                ServiceName serviceNameA = new ServiceName("Service", "A");
+                DeploymentRuntime outrouterDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("02-outrouter-config.xml"));
+
+                outrouterDeployment.setDeploymentName("outrouter");
+                outrouterDeployment.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
+                    {
+                        TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter(serviceNameA, "inrouter", inrouterDeployment).getRouter();
+                        TestOutboundRouter outrouter = (TestOutboundRouter) DeploymentUtil.getOutboundRouter(serviceNameA, "outrouter", outrouterDeployment).getRouter();
+
+                        inrouter.sendMessage("Hi there!!");
+                        Thread.sleep(300); // 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!!", outrouter.getMessage());
+                    }
+                    finally
+                    {
+                        inrouterDeployment.undeploy();
+                    }
+                }
+                finally
+                {
+                    outrouterDeployment.undeploy();
+                }
+            }
+        }.run();
+    }
+}
\ No newline at end of file


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

Added: 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	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_005/01-inrouter-config.xml	2008-09-24 10:14:27 UTC (rev 23042)
@@ -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.routing.TestInboundRouter" />
+        </inRouters>
+    </routing>
+
+</jbossesb>
\ No newline at end of file


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

Added: 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	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_005/RoutingTest.java	2008-09-24 10:14:27 UTC (rev 23042)
@@ -0,0 +1,72 @@
+/*
+ * 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_005;
+
+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.routing.TestInboundRouter;
+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
+{
+
+    /*
+     * This is a simple scenario where there's just a single deployment connected into the same bus
+     * with a single inrouter.
+     *
+     */
+    public void test() throws Exception
+    {
+        new JMSTestRunner() {
+            public void test() throws Exception
+            {
+                ServiceName serviceNameA = new ServiceName("Service", "A");
+                DeploymentRuntime inrouterDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-inrouter-config.xml"));
+
+                inrouterDeployment.setDeploymentName("inrouter");
+                inrouterDeployment.deploy();
+                try
+                {
+                    TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter(serviceNameA, "inrouter", inrouterDeployment).getRouter();
+
+                    try
+                    {
+                        inrouter.sendMessage("Hi there!!");
+                        fail("Expected IllegalStateException - no Service or Outbound Routers configured.");
+                    }
+                    catch(IllegalStateException e)
+                    {
+                        assertEquals("Message not processed for Service Name 'Service:A'.  No Service instance or Outbound Router instances applied.", e.getMessage());
+                    }
+
+                }
+                finally
+                {
+                    inrouterDeployment.undeploy();
+                }
+            }
+        }.run();
+    }
+}
\ No newline at end of file


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




More information about the jboss-svn-commits mailing list