[jboss-svn-commits] JBL Code SVN: r23049 - in labs/jbossesb/workspace/skeagh/runtime/src: main/java/org/jboss/esb/dispatch and 12 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Sep 24 11:14:52 EDT 2008
Author: tfennelly
Date: 2008-09-24 11:14:51 -0400 (Wed, 24 Sep 2008)
New Revision: 23049
Added:
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/events/
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/events/BusRouterProcessingEvent.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/events/OutboundRouterProcessingEvent.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/events/ServiceProcessingEvent.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/events/package.html
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
Removed:
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/ServiceProcessingEvent.java
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/dispatch/AbstractDispatcher.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/BusInboundRouter.java
labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusMessage.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/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/scenario_001/RoutingTest.java
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/RoutingTest.java
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/RoutingTest.java
labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/jbossesb-default.properties
Log:
Added the ability to propagate the ProcessingEventLog. This is great for testing because you can see the flow of a message across deployments. Also added more tests.
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-24 14:06:27 UTC (rev 23048)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java 2008-09-24 15:14:51 UTC (rev 23049)
@@ -236,7 +236,7 @@
context.setContextObject(DeploymentRuntime.class, this);
deploymentProperties = PropertiesUtil.getDeploymentConfig(deploymentName);
- deploymentId = deploymentProperties.getProperty("deployment.id", UUID.randomUUID().toString());
+ deploymentId = deploymentProperties.getProperty("deployment.id", deploymentId);
deploymentId += ":" + deploymentName;
logger.info("Starting JBoss ESB deployment: '" + deploymentName + "'.");
@@ -776,6 +776,15 @@
}
/**
+ * Get the deployment properties.
+ * @return The deployment properties.
+ */
+ public final ApplicationProperties getDeploymentProperties()
+ {
+ return deploymentProperties;
+ }
+
+ /**
* Assert whether or not ESB configurations have been added to this
* Runtime.
*
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 14:06:27 UTC (rev 23048)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/dispatch/AbstractDispatcher.java 2008-09-24 15:14:51 UTC (rev 23049)
@@ -28,9 +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.events.OutboundRouterProcessingEvent;
import org.jboss.esb.history.ProcessingEventLog;
-import org.jboss.esb.history.ServiceProcessingEvent;
+import org.jboss.esb.history.events.ServiceProcessingEvent;
import org.jboss.esb.message.Message;
import org.jboss.esb.message.MessageTransformer;
import org.jboss.esb.routing.MessageDispatcher;
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 14:06:27 UTC (rev 23048)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentMonitor.java 2008-09-24 15:14:51 UTC (rev 23049)
@@ -25,7 +25,7 @@
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.events.BusRouterProcessingEvent;
import org.jboss.esb.history.ProcessingEventLog;
import org.jboss.esb.message.Message;
import org.jboss.esb.routing.ServiceInvoker;
@@ -184,11 +184,21 @@
{
try
{
- bus.send(message, targetDeploymentId);
+ ProcessingEventLog eventLog = ProcessingEventLog.getEventLog();
// Log this processing event...
- ProcessingEventLog.getEventLog().logEvent(new BusRouterProcessingEvent(message.getAddressingContext().getTo(), targetDeploymentId, bus.getClass()));
+ eventLog.logEvent(new BusRouterProcessingEvent(message.getAddressingContext().getTo(), targetDeploymentId, bus.getClass()));
+ // We may need to propagate the event log. This should only
+ // be turned on for debugging/tracing purposes...
+ if(eventLog.propagate())
+ {
+ message.setProcessingEventLog(eventLog);
+ }
+
+ // And send the message out onto the bus...
+ bus.send(message, targetDeploymentId);
+
return true;
}
catch (Throwable t)
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-24 14:06:27 UTC (rev 23048)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusInboundRouter.java 2008-09-24 15:14:51 UTC (rev 23049)
@@ -21,6 +21,7 @@
import org.jboss.esb.context.AddressingContext;
import org.jboss.esb.context.InvocationContext;
+import org.jboss.esb.history.ProcessingEventLog;
import org.jboss.esb.message.Message;
import org.jboss.esb.routing.InboundRouter;
import org.jboss.esb.routing.MessageDispatcher;
@@ -66,6 +67,10 @@
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);
@@ -81,7 +86,8 @@
/**
* Dispatch the supplied message to the target service
- * @param esbMessage The ESB Message.
+ *
+ * @param esbMessage The ESB Message.
* @param invocationContext The Invocation Context to be used.
*/
public final void dispatch(final Message esbMessage, final InvocationContext invocationContext)
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusMessage.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusMessage.java 2008-09-24 14:06:27 UTC (rev 23048)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/BusMessage.java 2008-09-24 15:14:51 UTC (rev 23049)
@@ -21,6 +21,7 @@
import org.jboss.esb.context.AddressingContext;
import org.jboss.esb.context.InvocationContext;
+import org.jboss.esb.history.ProcessingEventLog;
import org.jboss.esb.message.Message;
import java.io.Serializable;
@@ -49,6 +50,13 @@
* Message.
*/
private Message message;
+ /**
+ * The processing event log.
+ * <p/>
+ * Only attached for debug/trace purposes. See the "history.event.propagate" property
+ * in the deployment configuration properties.
+ */
+ private ProcessingEventLog processingEventLog;
/**
* Get the invocation parameters provided with the initial
@@ -117,7 +125,34 @@
}
/**
+ * Get the processing event log.
+ * <p/>
+ * Only attached for debug/trace purposes. See the "history.event.propagate" property
+ * in the deployment configuration properties.
+ *
+ * @return The processing event log, or null if not attached.
+ */
+ public final ProcessingEventLog getProcessingEventLog()
+ {
+ return processingEventLog;
+ }
+
+ /**
+ * Set the processing event log.
+ * <p/>
+ * Only attached for debug/trace purposes. See the "history.event.propagate" property
+ * in the deployment configuration properties.
+ *
+ * @param processingEventLog The processing event log, or null if not attached.
+ */
+ public final void setProcessingEventLog(final ProcessingEventLog processingEventLog)
+ {
+ this.processingEventLog = processingEventLog;
+ }
+
+ /**
* Create a {@link BusMessage} instance from the supplied message and the existing thread context.
+ *
* @param theMessage Th message.
* @return The bundled {@link BusMessage} instance.
*/
Deleted: 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 2008-09-24 14:06:27 UTC (rev 23048)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/BusRouterProcessingEvent.java 2008-09-24 15:14:51 UTC (rev 23049)
@@ -1,84 +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.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
Deleted: 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 2008-09-24 14:06:27 UTC (rev 23048)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/OutboundRouterProcessingEvent.java 2008-09-24 15:14:51 UTC (rev 23049)
@@ -1,49 +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.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
Modified: 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 2008-09-24 14:06:27 UTC (rev 23048)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/ProcessingEvent.java 2008-09-24 15:14:51 UTC (rev 23049)
@@ -19,11 +19,53 @@
*/
package org.jboss.esb.history;
+import org.jboss.esb.context.DeploymentContext;
+import org.jboss.esb.deploy.DeploymentRuntime;
+
+import java.io.Serializable;
+
/**
- * Abstract processing Event interface.
+ * Abstract processing Event.
*
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
*/
-public interface ProcessingEvent
+public abstract class ProcessingEvent implements Serializable
{
+ /**
+ * Event time.
+ */
+ private long time;
+ /**
+ * The deployment Id.
+ */
+ private String deploymentId;
+
+ /**
+ * Constructor.
+ */
+ protected ProcessingEvent()
+ {
+ time = System.currentTimeMillis();
+ deploymentId = DeploymentRuntime.getRuntime(DeploymentContext.getContext()).getDeploymentId();
+ }
+
+ /**
+ * Get the event time.
+ *
+ * @return Event Time.
+ */
+ public final long getTime()
+ {
+ return time;
+ }
+
+ /**
+ * Get the deployment Id of the deployment on which the event occured.
+ *
+ * @return The deployment Id.
+ */
+ public final String getDeploymentId()
+ {
+ return deploymentId;
+ }
}
Modified: 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 2008-09-24 14:06:27 UTC (rev 23048)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/ProcessingEventLog.java 2008-09-24 15:14:51 UTC (rev 23049)
@@ -19,9 +19,12 @@
*/
package org.jboss.esb.history;
+import org.jboss.esb.context.DeploymentContext;
import org.jboss.esb.context.InvocationContext;
+import org.jboss.esb.deploy.DeploymentRuntime;
import org.jboss.esb.util.AssertArgument;
+import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@@ -30,34 +33,102 @@
*
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
*/
-public class ProcessingEventLog
+public class ProcessingEventLog implements Serializable
{
/**
+ * Configuration key for event log propogation.
+ */
+ private static final String HISTORY_EVENT_PROPOGATE = "history.event.propagate";
+
+ /**
* Processing events.
*/
private List<ProcessingEvent> processingEvents = new ArrayList<ProcessingEvent>();
+ /**
+ * Flag indicatiing whether or not the event log is to be propagated
+ * across delpoyments.
+ */
+ private boolean propagate;
/**
- * Get the {@link ProcessingEventLog} from the {@linkInvocationContext}.
+ * Public Constructor.
*
+ * @param propagate Propagate the event log across deployments.
+ */
+ public ProcessingEventLog(final boolean propagate)
+ {
+ this.propagate = propagate;
+ }
+
+ /**
+ * Get the {@link ProcessingEventLog} from the current {@linkInvocationContext}.
+ *
* @return The Processing Event Log.
*/
public static ProcessingEventLog getEventLog()
{
- InvocationContext invocationContext = InvocationContext.getContext();
+ return getEventLog(InvocationContext.getContext());
+ }
+
+ /**
+ * Is the event log to be propagated across deployments.
+ *
+ * @return True if the event log is to be propagated, otherwise false.
+ */
+ public final boolean propagate()
+ {
+ return propagate;
+ }
+
+ /**
+ * Set the event log propagation flag.
+ *
+ * @param propagate True if the event log is to be propagated, otherwise false.
+ */
+ public final void setPropagate(final boolean propagate)
+ {
+ this.propagate = propagate;
+ }
+
+ /**
+ * Get the {@link ProcessingEventLog} from the {@linkInvocationContext}.
+ *
+ * @param invocationContext The {@linkInvocationContext}.
+ * @return The Processing Event Log.
+ */
+ public static ProcessingEventLog getEventLog(final InvocationContext invocationContext)
+ {
+ AssertArgument.isNotNull(invocationContext, "invocationContext");
ProcessingEventLog eventLog = (ProcessingEventLog) invocationContext.getContextObject(ProcessingEventLog.class);
- if(eventLog == null)
+ if (eventLog == null)
{
- eventLog = new ProcessingEventLog();
- invocationContext.setContextObject(ProcessingEventLog.class, eventLog);
+ DeploymentContext deploymentContext = DeploymentContext.getContext();
+ DeploymentRuntime runtime = DeploymentRuntime.getRuntime(deploymentContext);
+
+ eventLog = new ProcessingEventLog(runtime.getDeploymentProperties().getBooleanProperty(HISTORY_EVENT_PROPOGATE, false));
+ setEventLog(eventLog, invocationContext);
}
return eventLog;
}
/**
+ * Set the event log instance on the supplied InvocationContext.
+ *
+ * @param eventLog The event log instance.
+ * @param invocationContext The InvocationContext.
+ */
+ public static void setEventLog(final ProcessingEventLog eventLog, final InvocationContext invocationContext)
+ {
+ AssertArgument.isNotNull(eventLog, "eventLog");
+ AssertArgument.isNotNull(invocationContext, "invocationContext");
+ invocationContext.setContextObject(ProcessingEventLog.class, eventLog);
+ }
+
+ /**
* Log a processing event.
+ *
* @param event The event to be logged.
*/
public final void logEvent(final ProcessingEvent event)
@@ -75,4 +146,29 @@
{
return processingEvents;
}
+
+ /**
+ * Get a String representation of the event log.
+ *
+ * @return A String representation of the event log.
+ */
+ public final String toString()
+ {
+ StringBuilder stringBuilder = new StringBuilder();
+
+ stringBuilder.append("Message Processing Event Log:\n");
+ if (processingEvents.isEmpty())
+ {
+ stringBuilder.append("\tNo events logged!");
+ }
+ else
+ {
+ for (int i = 0; i < processingEvents.size(); i++)
+ {
+ stringBuilder.append("\t" + (i + 1) + ". \t[" + processingEvents.get(i).getDeploymentId() + "] " + processingEvents.get(i) + "\n");
+ }
+ }
+
+ return stringBuilder.toString();
+ }
}
Deleted: 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 2008-09-24 14:06:27 UTC (rev 23048)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/ServiceProcessingEvent.java 2008-09-24 15:14:51 UTC (rev 23049)
@@ -1,52 +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.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;
- }
-}
Copied: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/events/BusRouterProcessingEvent.java (from rev 23042, 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/events/BusRouterProcessingEvent.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/events/BusRouterProcessingEvent.java 2008-09-24 15:14:51 UTC (rev 23049)
@@ -0,0 +1,94 @@
+/*
+ * 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.events;
+
+import org.jboss.esb.service.ServiceName;
+import org.jboss.esb.federate.bus.Bus;
+import org.jboss.esb.history.ProcessingEvent;
+
+/**
+ * Bus Router Processing Event.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class BusRouterProcessingEvent extends 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;
+ }
+
+ /**
+ * Get the Event as a String.
+ * @return The Event as a String.
+ */
+ public final String toString()
+ {
+ return "BusRouterProcessingEvent: to='" + to + "', targetDeploymentId='" + targetDeploymentId + "', busType='" + busType.getSimpleName() + "'";
+ }
+}
\ No newline at end of file
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/events/BusRouterProcessingEvent.java
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/events/OutboundRouterProcessingEvent.java (from rev 23042, 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/events/OutboundRouterProcessingEvent.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/events/OutboundRouterProcessingEvent.java 2008-09-24 15:14:51 UTC (rev 23049)
@@ -0,0 +1,65 @@
+/*
+ * 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.events;
+
+import org.jboss.esb.history.ProcessingEvent;
+
+/**
+ * Outbound router event.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class OutboundRouterProcessingEvent extends 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;
+ }
+
+ /**
+ * Get the Event as a String.
+ *
+ * @return The Event as a String.
+ */
+ public final String toString()
+ {
+ return "OutboundRouterProcessingEvent: config='" + configName + "'";
+ }
+}
\ No newline at end of file
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/events/OutboundRouterProcessingEvent.java
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/events/ServiceProcessingEvent.java (from rev 23042, 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/events/ServiceProcessingEvent.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/events/ServiceProcessingEvent.java 2008-09-24 15:14:51 UTC (rev 23049)
@@ -0,0 +1,66 @@
+/*
+ * 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.events;
+
+import org.jboss.esb.history.ProcessingEvent;
+import org.jboss.esb.service.ServiceName;
+
+/**
+ * Service processing event.
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class ServiceProcessingEvent extends 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;
+ }
+
+ /**
+ * Get the Event as a String.
+ *
+ * @return The Event as a String.
+ */
+ public final String toString()
+ {
+ return "ServiceProcessingEvent: service='" + serviceName + "'";
+ }
+}
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/events/ServiceProcessingEvent.java
___________________________________________________________________
Name: svn:eol-style
+ native
Copied: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/events/package.html (from rev 23042, labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/package.html)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/events/package.html (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/history/events/package.html 2008-09-24 15:14:51 UTC (rev 23049)
@@ -0,0 +1,8 @@
+<html>
+<head></head>
+<body>
+Message Processing Events.
+
+<h2>Package Specification</h2>
+</body>
+</html>
\ No newline at end of file
Modified: 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-24 14:06:27 UTC (rev 23048)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/TestInboundRouter.java 2008-09-24 15:14:51 UTC (rev 23049)
@@ -21,6 +21,7 @@
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>
@@ -34,10 +35,21 @@
this.dispatcher = dispatcher;
}
- public void sendMessage(String message)
+ 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, new InvocationContext());
+ dispatcher.dispatch(esbMessage, invocationContext);
+
+ return invocationContext;
}
}
\ No newline at end of file
Modified: 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-24 14:06:27 UTC (rev 23048)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/TestOutboundRouter.java 2008-09-24 15:14:51 UTC (rev 23049)
@@ -23,8 +23,7 @@
import org.jboss.esb.context.DeploymentContext;
import org.jboss.esb.context.InvocationContext;
import org.jboss.esb.message.Message;
-import org.jboss.esb.routing.OutboundRouter;
-import org.jboss.esb.routing.RoutingException;
+import org.jboss.esb.history.ProcessingEventLog;
/**
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -35,6 +34,7 @@
public static InvocationContext invocationContext;
public static AddressingContext addressingContext;
public static DeploymentContext deploymentContext;
+ private ProcessingEventLog eventLog;
public void route(Message message) throws RoutingException
{
@@ -42,10 +42,17 @@
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
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-24 14:06:27 UTC (rev 23048)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_001/RoutingTest.java 2008-09-24 15:14:51 UTC (rev 23049)
@@ -35,15 +35,8 @@
{
/*
- * This is a simple scenario where there are 3 deployments all connected into the same bus:
- * 1. "inrouterDeployment" defines an inrouter for "Service:A".
- * 2. "serviceDeployment" defines the service instance for "Service:A".
- * 3. "outrouterDeployment" defines an outrouter for "Service:A".
- *
- * The message should get routed from the inrouter onto the bus, get picked
- * up by "serviceDeployment", run through "Service:A", sent back onto the bus
- * for "outrouterDeployment", picked up by "outrouterDeployment" and sent to
- * outrouter for "Service:A".
+ * The message should go (across the 3 deployments):
+ * [inrouter_ServiceA] -> [ServiceA] -> [outrouter_ServiceA]
*/
public void test() throws Exception
{
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-24 14:06:27 UTC (rev 23048)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_002/RoutingTest.java 2008-09-24 15:14:51 UTC (rev 23049)
@@ -35,15 +35,9 @@
{
/*
- * This is a simple scenario where there are 3 deployments all connected into the same bus:
- * 1. "inrouterDeployment" defines an inrouter for "Service:A".
- * 2. "serviceDeployment" defines service instances for "Service:A" and "Service:B". It
- * also defines a router from "Service:A" to "Service:B".
- * 3. "outrouterDeployment" defines an outrouter for "Service:B".
+ * The message should go (across the 3 deployments):
+ * [inrouter_ServiceA] -> [ServiceA -> ServiceB] -> [outrouter_ServiceB]
*
- * So the message should go (across the 3 deployments):
- * [inrouter_ServiceA] -> [ServiceA -> ServiceB] -> [outrouter_ServiceB]
- *
*/
public void test() throws Exception
{
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-24 14:06:27 UTC (rev 23048)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_003/RoutingTest.java 2008-09-24 15:14:51 UTC (rev 23049)
@@ -35,16 +35,8 @@
{
/*
- * This is a simple scenario where there are 3 deployments all connected into the same bus:
- * 1. "inrouterDeployment" defines an inrouter for "Service:A".
- * 2. "serviceADeployment" defines a service instance for "Service:A". It
- * also defines a router from "Service:A" to "Service:B".
- * 3. "serviceBDeployment" defines a service instance for "Service:B". It also
- * defines an outrouter for "Service:B".
- *
- * So the message should go (across the 3 deployments):
+ * The message should go (across the 3 deployments):
* [inrouter_ServiceA] -> [ServiceA] -> [ServiceB -> outrouter_ServiceB]
- *
*/
public void test() throws Exception
{
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-24 14:06:27 UTC (rev 23048)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_004/RoutingTest.java 2008-09-24 15:14:51 UTC (rev 23049)
@@ -34,15 +34,8 @@
{
/*
- * 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):
+ * The message should go (across the 2 deployments):
* [inrouter_ServiceA] -> [outrouter_ServiceA]
- *
*/
public void test() throws Exception
{
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-24 14:06:27 UTC (rev 23048)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_005/RoutingTest.java 2008-09-24 15:14:51 UTC (rev 23049)
@@ -34,8 +34,7 @@
/*
* This is a simple scenario where there's just a single deployment connected into the same bus
- * with a single inrouter.
- *
+ * with a single inrouter i.e. no service or outrouters. Should result in an error.
*/
public void test() throws Exception
{
Copied: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_006/01-deployment.xml (from rev 23041, 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_006/01-deployment.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_006/01-deployment.xml 2008-09-24 15:14:51 UTC (rev 23049)
@@ -0,0 +1,23 @@
+<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>
+
+ <!--
+ 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>
+
+ <services>
+ <service serviceCategory="Service" serviceName="A" serviceDescription="A Service" class="org.jboss.esb.routing.TestService" />
+ </services>
+
+</jbossesb>
\ No newline at end of file
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_006/01-deployment.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_006/02-deployment.xml (from rev 23041, 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_006/02-deployment.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_006/02-deployment.xml 2008-09-24 15:14:51 UTC (rev 23049)
@@ -0,0 +1,19 @@
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
+
+ <routing>
+ <!--
+ 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="B" serviceDescription="B Service" class="org.jboss.esb.routing.TestService" />
+ </services>
+
+</jbossesb>
\ No newline at end of file
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_006/02-deployment.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_006/03-deployment.xml (from rev 23041, 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_006/03-deployment.xml (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_006/03-deployment.xml 2008-09-24 15:14:51 UTC (rev 23049)
@@ -0,0 +1,13 @@
+<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" />
+ </services>
+
+ <routing>
+ <outRouters serviceCategory="Service" serviceName="C">
+ <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_006/03-deployment.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_006/RoutingTest.java (from rev 23041, 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_006/RoutingTest.java (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_006/RoutingTest.java 2008-09-24 15:14:51 UTC (rev 23049)
@@ -0,0 +1,114 @@
+/*
+ * 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_006;
+
+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.routing.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):
+ * [inrouter_ServiceA -> ServiceA] -> [ServiceB] -> [ServiceC -> outrouter_ServiceC]
+ */
+ public void test() throws Exception
+ {
+ new JMSTestRunner() {
+ public void test() throws Exception
+ {
+ ServiceName serviceNameA = new ServiceName("Service", "A");
+ ServiceName serviceNameB = new ServiceName("Service", "B");
+ ServiceName serviceNameC = new ServiceName("Service", "C");
+ 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 serviceB = (TestService) DeploymentUtil.getService(serviceNameB, deployment2).getService();
+ TestService serviceC = (TestService) DeploymentUtil.getService(serviceNameC, deployment3).getService();
+ TestOutboundRouter outrouter = (TestOutboundRouter) DeploymentUtil.getOutboundRouter(serviceNameC, "outrouter", deployment3).getRouter();
+
+ // Force propagation of the event log...
+ inrouter.sendMessage("Hi there!!", true);
+ 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!!", serviceA.getMessage());
+ assertEquals("Hi there!!", serviceB.getMessage());
+ assertEquals("Hi there!!", serviceC.getMessage());
+ assertEquals("Hi there!!", outrouter.getMessage());
+
+ assertEquals("Message Processing Event Log:\n" +
+ "\t1. \t[deployment1-Id:deployment1] ServiceProcessingEvent: service='Service:A'\n" +
+ "\t2. \t[deployment1-Id:deployment1] BusRouterProcessingEvent: to='Service:B', targetDeploymentId='deployment2-Id:deployment2', busType='JMSBus'\n" +
+ "\t3. \t[deployment2-Id:deployment2] ServiceProcessingEvent: service='Service:B'\n" +
+ "\t4. \t[deployment2-Id:deployment2] BusRouterProcessingEvent: to='Service:C', targetDeploymentId='deployment3-Id:deployment3', busType='JMSBus'\n" +
+ "\t5. \t[deployment3-Id:deployment3] ServiceProcessingEvent: service='Service:C'\n" +
+ "\t6. \t[deployment3-Id:deployment3] OutboundRouterProcessingEvent: config='outrouter'",
+ outrouter.getEventLog().toString().trim());
+ }
+ finally
+ {
+ deployment3.undeploy();
+ }
+ }
+ finally
+ {
+ deployment2.undeploy();
+ }
+ }
+ finally
+ {
+ deployment1.undeploy();
+ }
+ }
+ }.run();
+ }
+}
\ No newline at end of file
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_006/RoutingTest.java
___________________________________________________________________
Name: svn:mergeinfo
+
Name: svn:eol-style
+ native
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/jbossesb-default.properties
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/jbossesb-default.properties 2008-09-24 14:06:27 UTC (rev 23048)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/jbossesb-default.properties 2008-09-24 15:14:51 UTC (rev 23049)
@@ -9,4 +9,8 @@
bus.jms=org.jboss.esb.federate.bus.jms.JMSBus
# Pre-installed deployment units...
-unit.deadletter=deadletter.xml
\ No newline at end of file
+unit.deadletter=deadletter.xml
+
+# Propagate the event log so tests can trace the message processing
+# Only use for debug/tracing purposes...
+history.event.propagate=false
\ No newline at end of file
More information about the jboss-svn-commits
mailing list