[jboss-svn-commits] JBL Code SVN: r24032 - in labs/jbossesb/workspace/skeagh: runtime/src/main/java/org/jboss/esb/federate and 26 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Nov 21 08:47:36 EST 2008
Author: tfennelly
Date: 2008-11-21 08:47:36 -0500 (Fri, 21 Nov 2008)
New Revision: 24032
Added:
labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/invm/
labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/invm/default.properties
Modified:
labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/AbstractBus.java
labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/Bus.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/invm/InVMBus.java
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/serialization/java/JavaSerializer.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/federate/DeploymentCoordinatorTest.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/jms/JMSBus_Standalone_Test.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/java/org/jboss/esb/routing/scenario_006/RoutingTest.java
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
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_009/RoutingTest.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_010/RoutingTest.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_011/RoutingTest.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_012/RoutingTest.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_013/RoutingTest.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_014/RoutingTest.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_015/RoutingTest.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_016/RoutingTest.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_017/RoutingTest.java
labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_018/RoutingTest.java
labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/jbossesb-default.properties
Log:
https://jira.jboss.org/jira/browse/JBESB-2182
Modified: labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/AbstractBus.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/AbstractBus.java 2008-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/AbstractBus.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -148,4 +148,23 @@
{
this.notificationListener = listener;
}
+
+ /**
+ * Assert that the {@link Bus} is configured.
+ */
+ public final void assertIsConfigured()
+ {
+ if (getDeploymentName() == null)
+ {
+ throw new IllegalStateException("'deploymentName' not set on Bus.");
+ }
+ else if (getDeploymentId() == null)
+ {
+ throw new IllegalStateException("'deploymentId' not set on Bus.");
+ }
+ else if (getProperties() == null)
+ {
+ throw new IllegalStateException("'properties' not set on Bus.");
+ }
+ }
}
Modified: labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/Bus.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/Bus.java 2008-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/api/src/main/java/org/jboss/esb/api/bus/Bus.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -74,9 +74,9 @@
void stopListening();
/**
- * Close the Bus.
+ * Disconnect from the Bus.
*/
- void close();
+ void disconnect();
/**
* Send the supplied message to the specified deployment via the bus.
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-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -127,7 +127,7 @@
}
catch (RoutingException e)
{
- bus.close();
+ bus.disconnect();
logger.error("Unable to start Bus Interface. Failed to deliver Deployment Details Notification (on statrup) to bus '" + bus.getClass().getName() + "'.", e);
return;
}
@@ -197,7 +197,7 @@
}
try
{
- busMediator.getBus().close();
+ busMediator.getBus().disconnect();
}
catch (Throwable t)
{
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/invm/InVMBus.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/invm/InVMBus.java 2008-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/invm/InVMBus.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -19,24 +19,56 @@
*/
package org.jboss.esb.federate.bus.invm;
+import org.apache.log4j.Logger;
+import org.jboss.esb.api.bus.AbstractBus;
import org.jboss.esb.api.bus.AbstractNotification;
import org.jboss.esb.api.bus.BusMessage;
import org.jboss.esb.api.routing.RoutingException;
-import org.jboss.esb.api.bus.AbstractBus;
+import org.jboss.esb.serialization.SerializationException;
+import org.jboss.esb.serialization.java.JavaSerializer;
+import java.util.Collection;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
/**
+ * InVM bus.
+ *
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
*/
public class InVMBus extends AbstractBus
{
-
/**
+ * Logger.
+ */
+ private static Logger logger = Logger.getLogger(InVMBus.class);
+ /**
+ * The InVM ThreadPool size configuration key.
+ */
+ public static final String INVM_THREADPOOL_SIZE = "invm.threadpool.size";
+ /**
+ * InVM Bus interfaces.
+ */
+ private static Map<String, InVMBus> inVMInterfaces = new ConcurrentHashMap<String, InVMBus>();
+ /**
+ * Threadpool executor.
+ */
+ private ExecutorService executor;
+
+ /**
* Connect to the bus.
*
* @throws RoutingException Connection exception.
*/
public void connect() throws RoutingException
{
+ assertIsConfigured();
+
+ configureJobExecutor();
+ inVMInterfaces.put(getDeploymentId(), this);
}
/**
@@ -46,7 +78,7 @@
*/
public boolean isConnected()
{
- return true;
+ return (executor != null);
}
/**
@@ -54,13 +86,34 @@
*/
public void stopListening()
{
+ inVMInterfaces.remove(getDeploymentId());
}
/**
- * Close the Bus.
+ * Disconnect from the Bus.
*/
- public void close()
+ public synchronized void disconnect()
{
+ inVMInterfaces.remove(getDeploymentId());
+ if(executor != null)
+ {
+ try
+ {
+ executor.shutdown();
+ try
+ {
+ executor.awaitTermination(5, TimeUnit.SECONDS);
+ }
+ catch (InterruptedException e)
+ {
+ logger.error("InVM job executor shutdown timed out.");
+ }
+ }
+ finally
+ {
+ executor = null;
+ }
+ }
}
/**
@@ -70,8 +123,18 @@
* @param targetDeploymentId The target deployment ID.
* @throws RoutingException Error sending message onto the Bus.
*/
- public void sendMessage(BusMessage message, String targetDeploymentId) throws RoutingException
+ public void sendMessage(final BusMessage message, final String targetDeploymentId) throws RoutingException
{
+ InVMBus targetInterface = getTargetInterface(targetDeploymentId);
+
+ try
+ {
+ executor.execute(new MessageDeliveryJob(targetInterface, (BusMessage) JavaSerializer.copyObject(message)));
+ }
+ catch (SerializationException e)
+ {
+ logger.error("Failed to deliver message to deployment '" + targetInterface.getDeploymentId() + "' via InVM Bus. BusMessage was not Serializable. Message is lost.", e);
+ }
}
/**
@@ -80,7 +143,145 @@
* @param notification The notification message to be sent onto the Bus.
* @throws RoutingException Error sending notification onto the Bus.
*/
- public void sendNotification(AbstractNotification notification) throws RoutingException
+ public void sendNotification(final AbstractNotification notification) throws RoutingException
{
+ Collection<InVMBus> interfaces = inVMInterfaces.values();
+
+ for (InVMBus targetInterface : interfaces)
+ {
+ if(targetInterface != this)
+ {
+ try
+ {
+ executor.execute(new NotificationDeliveryJob(targetInterface, (AbstractNotification) JavaSerializer.copyObject(notification)));
+ }
+ catch (SerializationException e)
+ {
+ logger.error("Failed to deliver notification to deployment '" + targetInterface.getDeploymentId() + "' via InVM Bus. Notification was not Serializable. Notification is lost.", e);
+ }
+ }
+ }
}
-}
+
+ /**
+ * Get the target InVM {@link org.jboss.esb.api.bus.Bus} interface.
+ * @param targetDeploymentId Target Deployment ID.
+ * @return The target InVM {@link org.jboss.esb.api.bus.Bus} interface.
+ * @throws RoutingException Unknown target ID.
+ */
+ private InVMBus getTargetInterface(final String targetDeploymentId)throws RoutingException
+ {
+ InVMBus targetInterface = inVMInterfaces.get(targetDeploymentId);
+
+ if(targetInterface == null)
+ {
+ throw new RoutingException("Deployment ID '" + targetDeploymentId + "' is not available over the InVM Bus.");
+ }
+
+ return targetInterface;
+ }
+
+ /**
+ * Configure the Bus job executor.
+ */
+ private void configureJobExecutor()
+ {
+ String poolSizeParam = getProperties().getProperty(INVM_THREADPOOL_SIZE, "3");
+ int poolSize;
+
+ try
+ {
+ poolSize = Integer.parseInt(poolSizeParam.trim());
+ }
+ catch(NumberFormatException e)
+ {
+ logger.error("Invalid " + INVM_THREADPOOL_SIZE + " configuration value '" + poolSizeParam + "'. Must be a valid integer.");
+ poolSize = 3;
+ }
+
+ executor = Executors.newFixedThreadPool(poolSize);
+ }
+
+ /**
+ * ESB Message Delivery Job.
+ */
+ private class MessageDeliveryJob implements Runnable
+ {
+ /**
+ * The target InVM Bus interface.
+ */
+ private InVMBus targetInterface;
+ /**
+ * The message to be delivered.
+ */
+ private BusMessage message;
+
+ /**
+ * Constructor.
+ * @param targetInterface The target InVM Bus interface.
+ * @param message The message to be delivered.
+ */
+ MessageDeliveryJob(final InVMBus targetInterface, final BusMessage message)
+ {
+ this.targetInterface = targetInterface;
+ this.message = message;
+ }
+
+ /**
+ * Run the delivery Job.
+ */
+ public void run()
+ {
+ try
+ {
+ targetInterface.getMessageListener().onMessage(message);
+ }
+ catch (RoutingException e)
+ {
+ logger.error("Failed to deliver message to deployment '" + targetInterface.getDeploymentId() + "' via InVM Bus. Message is lost.", e);
+ // TODO: Deliver it to the DLQ?
+ }
+ }
+ }
+
+ /**
+ * ESB Notification Delivery Job.
+ */
+ private class NotificationDeliveryJob implements Runnable
+ {
+ /**
+ * The target InVM Bus interface.
+ */
+ private InVMBus targetInterface;
+ /**
+ * The notification to be delivered.
+ */
+ private AbstractNotification notification;
+
+ /**
+ * Constructor.
+ * @param targetInterface The target InVM Bus interface.
+ * @param notification The notification to be delivered.
+ */
+ NotificationDeliveryJob(final InVMBus targetInterface, final AbstractNotification notification)
+ {
+ this.targetInterface = targetInterface;
+ this.notification = notification;
+ }
+
+ /**
+ * Run the delivery Job.
+ */
+ public void run()
+ {
+ try
+ {
+ targetInterface.getNotificationListener().onNotification(notification);
+ }
+ catch (RoutingException e)
+ {
+ logger.error("Failed to deliver notification to deployment '" + targetInterface.getDeploymentId() + "' via InVM Bus. Notification is lost.", e);
+ }
+ }
+ }
+}
\ No newline at end of file
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-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/bus/jms/JMSBus.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -102,18 +102,7 @@
*/
public final void connect() throws RoutingException
{
- if (getDeploymentName() == null)
- {
- throw new IllegalStateException("'deploymentName' not set on Bus.");
- }
- else if (getDeploymentId() == null)
- {
- throw new IllegalStateException("'deploymentId' not set on Bus.");
- }
- else if (getProperties() == null)
- {
- throw new IllegalStateException("'properties' not set on Bus.");
- }
+ assertIsConfigured();
/*
* Need to set the context classloader to this classes classloader. When deployed/included
@@ -192,9 +181,9 @@
}
/**
- * Close the Bus.
+ * Disconnect from the Bus.
*/
- public final void close()
+ public final void disconnect()
{
try
{
Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/serialization/java/JavaSerializer.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/serialization/java/JavaSerializer.java 2008-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/serialization/java/JavaSerializer.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -19,8 +19,8 @@
*/
package org.jboss.esb.serialization.java;
+import org.jboss.esb.api.message.Message;
import org.jboss.esb.classpath.ContextObjectInputStream;
-import org.jboss.esb.api.message.Message;
import org.jboss.esb.serialization.SerializationException;
import org.jboss.esb.serialization.Serializer;
import org.jboss.esb.util.AssertArgument;
@@ -32,6 +32,7 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
+import java.io.Serializable;
/**
* Java Serializer.
@@ -55,8 +56,20 @@
* @param outStream The OutputStream.
* @throws SerializationException Failed to serialize message.
*/
- public final void serialize(final Message message, final OutputStream outStream) throws SerializationException
+ public void serialize(Message message, OutputStream outStream) throws SerializationException
{
+ serializeObject(message, outStream);
+ }
+
+ /**
+ * Serialize the supplied Object to the supplied {@link OutputStream}.
+ *
+ * @param object The Object.
+ * @param outStream The OutputStream.
+ * @throws SerializationException Failed to serialize message.
+ */
+ public final void serializeObject(final Serializable object, final OutputStream outStream) throws SerializationException
+ {
// Write the message...
ObjectOutputStream output;
@@ -73,7 +86,7 @@
{
try
{
- output.writeObject(message);
+ output.writeObject(object);
}
catch (IOException e)
{
@@ -100,8 +113,20 @@
* @return The Message.
* @throws SerializationException Failed to deserialize message.
*/
- public final Message deserialize(final InputStream messageStream) throws SerializationException
+ public Message deserialize(InputStream messageStream) throws SerializationException
{
+ return (Message) deserializeObject(messageStream);
+ }
+
+ /**
+ * Deserialize an Object from the supplied {@link InputStream}.
+ *
+ * @param messageStream The InputStream.
+ * @return An Object.
+ * @throws SerializationException Failed to deserialize message.
+ */
+ public final Object deserializeObject(final InputStream messageStream) throws SerializationException
+ {
ObjectInputStream input = null;
try
{
@@ -115,7 +140,7 @@
{
try
{
- return (Message) input.readObject();
+ return input.readObject();
}
catch (IOException e)
{
@@ -139,6 +164,7 @@
}
}
+
/**
* Make a complete copy the supplied ESB message.
* <p/>
@@ -150,14 +176,28 @@
*/
public static Message copy(final Message message) throws SerializationException
{
- AssertArgument.isNotNull(message, "message");
+ return (Message) copyObject(message);
+ }
+ /**
+ * Make a complete copy the supplied Object.
+ * <p/>
+ * Serializes and then deserializes the object.
+ *
+ * @param object The object.
+ * @return A full copy of the object.
+ * @throws SerializationException Failed to serialize/deserialize the object.
+ */
+ public static Object copyObject(final Serializable object) throws SerializationException
+ {
+ AssertArgument.isNotNull(object, "object");
+
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
- SERIALIZER.serialize(message, outStream);
+ SERIALIZER.serializeObject(object, outStream);
ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());
- return SERIALIZER.deserialize(inStream);
+ return SERIALIZER.deserializeObject(inStream);
}
}
Modified: 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/UndeployDispatcherDelayTest.java 2008-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/deploy/lifecycle/UndeployDispatcherDelayTest.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -20,13 +20,12 @@
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.test.JmsTestRunner;
import org.jboss.esb.TestInboundRouter;
import org.jboss.esb.TestOutboundRouter;
import org.jboss.esb.TestService;
import org.jboss.esb.api.service.ServiceName;
+import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.deploy.DeploymentUtil;
/**
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -43,94 +42,88 @@
*/
public void test() throws Exception
{
- new JmsTestRunner() {
- @Override
- 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
{
- ServiceName serviceNameA = new ServiceName("Service", "A");
- ServiceName serviceNameB = new ServiceName("Service", "B");
- DeploymentRuntime serviceBDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("03-serviceB-config.xml"));
+ DeploymentRuntime inrouterDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-inrouter-config.xml"));
- serviceBDeployment.setDeploymentName("outrouter");
- serviceBDeployment.deploy();
+ inrouterDeployment.setDeploymentName("inrouter");
+ inrouterDeployment.deploy();
+ Thread.sleep(300); // Allow the deployments to exchange deployment details
try
{
- DeploymentRuntime serviceADeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("02-serviceA-config.xml"));
+ final TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("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();
- serviceADeployment.setDeploymentName("service");
- serviceADeployment.deploy();
- try
- {
- DeploymentRuntime inrouterDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-inrouter-config.xml"));
+ // Slow down the services so as to force the undeploy to wait...
+ serviceA.setSleep(2000);
+ serviceB.setSleep(2000);
- inrouterDeployment.setDeploymentName("inrouter");
- inrouterDeployment.deploy();
- Thread.sleep(300); // Allow the deployments to exchange deployment details
- try
+ final boolean[] messageSent = new boolean[]{false};
+ new Thread() {
+ @Override
+ public void run()
{
- final TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("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();
+ messageSent[0] = true;
+ inrouter.sendMessage("Hi there!!");
+ }
+ }.start();
- // Slow down the services so as to force the undeploy to wait...
- serviceA.setSleep(2000);
- serviceB.setSleep(2000);
+ while(!messageSent[0]){
+ Thread.sleep(10);
+ }
- final boolean[] messageSent = new boolean[]{false};
- new Thread() {
- @Override
- public void run()
- {
- messageSent[0] = true;
- inrouter.sendMessage("Hi there!!");
- }
- }.start();
+ long start = System.currentTimeMillis();
- while(!messageSent[0]){
- Thread.sleep(10);
- }
+ // Wait another fraction, just to make sure the services get into
+ // their sleep states...
+ Thread.sleep(100);
- long start = System.currentTimeMillis();
+ // Run the undeploy... they should wait until all messages have
+ // been processed...
+ inrouterDeployment.undeploy();
+ serviceADeployment.undeploy();
+ serviceBDeployment.undeploy();
- // Wait another fraction, just to make sure the services get into
- // their sleep states...
- Thread.sleep(100);
+ long timeToUndeploy = System.currentTimeMillis() - start;
+ System.out.println("Time to undeploy: " + timeToUndeploy);
- // Run the undeploy... they should wait until all messages have
- // been processed...
- inrouterDeployment.undeploy();
- serviceADeployment.undeploy();
- serviceBDeployment.undeploy();
+ // Make sure the time to undeploy reflects the delays
+ // caused by the sleeps in the services...
+ assertTrue(timeToUndeploy > 3000);
- 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 > 3000);
-
- // 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();
- }
+ // 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
{
- serviceBDeployment.undeploy();
+ inrouterDeployment.undeploy();
}
}
- }.run();
+ finally
+ {
+ serviceADeployment.undeploy();
+ }
+ }
+ finally
+ {
+ serviceBDeployment.undeploy();
+ }
}
}
\ No newline at end of file
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/DeploymentCoordinatorTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/DeploymentCoordinatorTest.java 2008-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/DeploymentCoordinatorTest.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -22,7 +22,6 @@
import junit.framework.TestCase;
import org.jboss.esb.deploy.DeploymentRuntime;
import org.jboss.esb.deploy.DeploymentUtil;
-import org.jboss.esb.test.JmsTestRunner;
/**
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -31,161 +30,149 @@
{
public void test_normal() throws Exception
{
- new JmsTestRunner() {
- @Override
- public void test() throws Exception
- {
- DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("deployment-01.xml"));
- deployment1.setDeploymentName("deployment1");
- deployment1.deploy();
- try {
- DeploymentCoordinator coordinator1 = deployment1.getDeploymentCoordinator();
- DeploymentRuntime deployment2 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("deployment-02.xml"));
+ DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("deployment-01.xml"));
+ deployment1.setDeploymentName("deployment1");
+ deployment1.deploy();
+ try {
+ DeploymentCoordinator coordinator1 = deployment1.getDeploymentCoordinator();
+ DeploymentRuntime deployment2 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("deployment-02.xml"));
- deployment2.setDeploymentName("deployment2");
- deployment2.deploy();
- try {
- Thread.sleep(500);
- DeploymentCoordinator coordinator2 = deployment2.getDeploymentCoordinator();
- DeploymentMonitor monitor;
+ deployment2.setDeploymentName("deployment2");
+ deployment2.deploy();
+ try {
+ Thread.sleep(500);
+ DeploymentCoordinator coordinator2 = deployment2.getDeploymentCoordinator();
+ DeploymentMonitor monitor;
- assertEquals(1, coordinator1.getBusMediators().get(0).getDeploymentMonitors().size());
- assertEquals(1, coordinator2.getBusMediators().get(0).getDeploymentMonitors().size());
+ assertEquals(1, coordinator1.getBusMediators().get(0).getDeploymentMonitors().size());
+ assertEquals(1, coordinator2.getBusMediators().get(0).getDeploymentMonitors().size());
- // So deployment1 should be monitoring deployment2...
- monitor = (DeploymentMonitor) coordinator1.getBusMediators().get(0).getDeploymentMonitors().values().toArray()[0];
- monitor.getServiceSets().setDeploymentId("x");
- assertEquals("{online=true} deployment2:x[Services: [hello:goodbye, JBossESB:DeadLetterPersistanceService]][OutboundRoutedServices: [hello:hello]]", monitor.toString());
+ // So deployment1 should be monitoring deployment2...
+ monitor = (DeploymentMonitor) coordinator1.getBusMediators().get(0).getDeploymentMonitors().values().toArray()[0];
+ monitor.getServiceSets().setDeploymentId("x");
+ assertEquals("{online=true} deployment2:x[Services: [hello:goodbye, JBossESB:DeadLetterPersistanceService]][OutboundRoutedServices: [hello:hello]]", monitor.toString());
- // And deployment2 should be monitoring deployment1...
- monitor = (DeploymentMonitor) coordinator2.getBusMediators().get(0).getDeploymentMonitors().values().toArray()[0];
- monitor.getServiceSets().setDeploymentId("x");
- assertEquals("{online=true} deployment1:x[Services: [hello:hello, JBossESB:DeadLetterPersistanceService]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
+ // And deployment2 should be monitoring deployment1...
+ monitor = (DeploymentMonitor) coordinator2.getBusMediators().get(0).getDeploymentMonitors().values().toArray()[0];
+ monitor.getServiceSets().setDeploymentId("x");
+ assertEquals("{online=true} deployment1:x[Services: [hello:hello, JBossESB:DeadLetterPersistanceService]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
- // Now lets deploy another services
- DeploymentRuntime deployment3 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("deployment-03.xml"));
- deployment3.setDeploymentName("deployment3");
- deployment3.deploy();
- try {
- Thread.sleep(500);
- DeploymentCoordinator coordinator3 = deployment3.getDeploymentCoordinator();
+ // Now lets deploy another services
+ DeploymentRuntime deployment3 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("deployment-03.xml"));
+ deployment3.setDeploymentName("deployment3");
+ deployment3.deploy();
+ try {
+ Thread.sleep(500);
+ DeploymentCoordinator coordinator3 = deployment3.getDeploymentCoordinator();
- // Each of the 3 deployments should be monitoring the other 2 deployments...
- assertEquals(2, coordinator1.getBusMediators().get(0).getDeploymentMonitors().size());
- assertEquals(2, coordinator2.getBusMediators().get(0).getDeploymentMonitors().size());
- assertEquals(2, coordinator3.getBusMediators().get(0).getDeploymentMonitors().size());
+ // Each of the 3 deployments should be monitoring the other 2 deployments...
+ assertEquals(2, coordinator1.getBusMediators().get(0).getDeploymentMonitors().size());
+ assertEquals(2, coordinator2.getBusMediators().get(0).getDeploymentMonitors().size());
+ assertEquals(2, coordinator3.getBusMediators().get(0).getDeploymentMonitors().size());
- // This part of the test will just use toStrings because the monitor maps are not linked i.e. not ordered...
- String monitorsTOString;
+ // This part of the test will just use toStrings because the monitor maps are not linked i.e. not ordered...
+ String monitorsTOString;
- // deployment1 should be monitoring deployment2 and deployment3...
- monitorsTOString = coordinator1.getBusMediators().get(0).getDeploymentMonitors().values().toString();
- assertTrue(monitorsTOString.indexOf("{online=true} deployment2") != -1);
- assertTrue(monitorsTOString.indexOf("{online=true} deployment3") != -1);
+ // deployment1 should be monitoring deployment2 and deployment3...
+ monitorsTOString = coordinator1.getBusMediators().get(0).getDeploymentMonitors().values().toString();
+ assertTrue(monitorsTOString.indexOf("{online=true} deployment2") != -1);
+ assertTrue(monitorsTOString.indexOf("{online=true} deployment3") != -1);
- // deployment2 should be monitoring deployment1 and deployment3...
- monitorsTOString = coordinator2.getBusMediators().get(0).getDeploymentMonitors().values().toString();
- assertTrue(monitorsTOString.indexOf("{online=true} deployment1") != -1);
- assertTrue(monitorsTOString.indexOf("{online=true} deployment3") != -1);
+ // deployment2 should be monitoring deployment1 and deployment3...
+ monitorsTOString = coordinator2.getBusMediators().get(0).getDeploymentMonitors().values().toString();
+ assertTrue(monitorsTOString.indexOf("{online=true} deployment1") != -1);
+ assertTrue(monitorsTOString.indexOf("{online=true} deployment3") != -1);
- // deployment3 should be monitoring deployment1 and deployment2...
- monitorsTOString = coordinator3.getBusMediators().get(0).getDeploymentMonitors().values().toString();
- assertTrue(monitorsTOString.indexOf("{online=true} deployment1") != -1);
- assertTrue(monitorsTOString.indexOf("{online=true} deployment2") != -1);
- } finally {
- deployment3.undeploy();
- }
- Thread.sleep(500);
+ // deployment3 should be monitoring deployment1 and deployment2...
+ monitorsTOString = coordinator3.getBusMediators().get(0).getDeploymentMonitors().values().toString();
+ assertTrue(monitorsTOString.indexOf("{online=true} deployment1") != -1);
+ assertTrue(monitorsTOString.indexOf("{online=true} deployment2") != -1);
+ } finally {
+ deployment3.undeploy();
+ }
+ Thread.sleep(500);
- assertEquals(1, coordinator1.getBusMediators().get(0).getDeploymentMonitors().size());
- assertEquals(1, coordinator2.getBusMediators().get(0).getDeploymentMonitors().size());
+ assertEquals(1, coordinator1.getBusMediators().get(0).getDeploymentMonitors().size());
+ assertEquals(1, coordinator2.getBusMediators().get(0).getDeploymentMonitors().size());
- // So deployment1 should be monitoring deployment2...
- monitor = (DeploymentMonitor) coordinator1.getBusMediators().get(0).getDeploymentMonitors().values().toArray()[0];
- monitor.getServiceSets().setDeploymentId("x");
- assertEquals("{online=true} deployment2:x[Services: [hello:goodbye, JBossESB:DeadLetterPersistanceService]][OutboundRoutedServices: [hello:hello]]", monitor.toString());
+ // So deployment1 should be monitoring deployment2...
+ monitor = (DeploymentMonitor) coordinator1.getBusMediators().get(0).getDeploymentMonitors().values().toArray()[0];
+ monitor.getServiceSets().setDeploymentId("x");
+ assertEquals("{online=true} deployment2:x[Services: [hello:goodbye, JBossESB:DeadLetterPersistanceService]][OutboundRoutedServices: [hello:hello]]", monitor.toString());
- // And deployment2 should be monitoring deployment1...
- monitor = (DeploymentMonitor) coordinator2.getBusMediators().get(0).getDeploymentMonitors().values().toArray()[0];
- monitor.getServiceSets().setDeploymentId("x");
- assertEquals("{online=true} deployment1:x[Services: [hello:hello, JBossESB:DeadLetterPersistanceService]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
- } finally {
- deployment2.undeploy();
- }
- Thread.sleep(500);
-
- // deployment1 should no longer be be monitoring deployment2...
- assertEquals(0, coordinator1.getBusMediators().get(0).getDeploymentMonitors().size());
- } finally {
- deployment1.undeploy();
- }
+ // And deployment2 should be monitoring deployment1...
+ monitor = (DeploymentMonitor) coordinator2.getBusMediators().get(0).getDeploymentMonitors().values().toArray()[0];
+ monitor.getServiceSets().setDeploymentId("x");
+ assertEquals("{online=true} deployment1:x[Services: [hello:hello, JBossESB:DeadLetterPersistanceService]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
+ } finally {
+ deployment2.undeploy();
}
- }.run();
+ Thread.sleep(500);
+
+ // deployment1 should no longer be be monitoring deployment2...
+ assertEquals(0, coordinator1.getBusMediators().get(0).getDeploymentMonitors().size());
+ } finally {
+ deployment1.undeploy();
+ }
}
public void test_online_offline() throws Exception
{
- new JmsTestRunner() {
- @Override
- public void test() throws Exception
- {
- DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("deployment-01.xml"));
- deployment1.setDeploymentName("deployment1");
- deployment1.deploy();
- try {
- DeploymentCoordinator coordinator1 = deployment1.getDeploymentCoordinator();
- DeploymentRuntime deployment2 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("deployment-02.xml"));
+ DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("deployment-01.xml"));
+ deployment1.setDeploymentName("deployment1");
+ deployment1.deploy();
+ try {
+ DeploymentCoordinator coordinator1 = deployment1.getDeploymentCoordinator();
+ DeploymentRuntime deployment2 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("deployment-02.xml"));
- deployment2.setDeploymentName("deployment2");
- deployment2.deploy();
- try {
- Thread.sleep(100);
- DeploymentCoordinator coordinator2 = deployment2.getDeploymentCoordinator();
- DeploymentMonitor monitor;
+ deployment2.setDeploymentName("deployment2");
+ deployment2.deploy();
+ try {
+ Thread.sleep(100);
+ DeploymentCoordinator coordinator2 = deployment2.getDeploymentCoordinator();
+ DeploymentMonitor monitor;
- assertEquals(1, coordinator1.getBusMediators().get(0).getDeploymentMonitors().size());
- assertEquals(1, coordinator2.getBusMediators().get(0).getDeploymentMonitors().size());
+ assertEquals(1, coordinator1.getBusMediators().get(0).getDeploymentMonitors().size());
+ assertEquals(1, coordinator2.getBusMediators().get(0).getDeploymentMonitors().size());
- // So deployment1 should be monitoring deployment2...
- monitor = (DeploymentMonitor) coordinator1.getBusMediators().get(0).getDeploymentMonitors().values().toArray()[0];
- monitor.getServiceSets().setDeploymentId("x");
- assertEquals("{online=true} deployment2:x[Services: [hello:goodbye, JBossESB:DeadLetterPersistanceService]][OutboundRoutedServices: [hello:hello]]", monitor.toString());
+ // So deployment1 should be monitoring deployment2...
+ monitor = (DeploymentMonitor) coordinator1.getBusMediators().get(0).getDeploymentMonitors().values().toArray()[0];
+ monitor.getServiceSets().setDeploymentId("x");
+ assertEquals("{online=true} deployment2:x[Services: [hello:goodbye, JBossESB:DeadLetterPersistanceService]][OutboundRoutedServices: [hello:hello]]", monitor.toString());
- // And deployment2 should be monitoring deployment1...
- monitor = (DeploymentMonitor) coordinator2.getBusMediators().get(0).getDeploymentMonitors().values().toArray()[0];
- monitor.getServiceSets().setDeploymentId("x");
- assertEquals("{online=true} deployment1:x[Services: [hello:hello, JBossESB:DeadLetterPersistanceService]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
+ // And deployment2 should be monitoring deployment1...
+ monitor = (DeploymentMonitor) coordinator2.getBusMediators().get(0).getDeploymentMonitors().values().toArray()[0];
+ monitor.getServiceSets().setDeploymentId("x");
+ assertEquals("{online=true} deployment1:x[Services: [hello:hello, JBossESB:DeadLetterPersistanceService]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
- // Now lets switch off the heartbeat broadcast on deployment1...
- coordinator1.setBroadcastHeartbeat(false);
- Thread.sleep(6000);
+ // Now lets switch off the heartbeat broadcast on deployment1...
+ coordinator1.setBroadcastHeartbeat(false);
+ Thread.sleep(6000);
- // deployment2 should see deployment1 as being offline now...
- monitor = (DeploymentMonitor) coordinator2.getBusMediators().get(0).getDeploymentMonitors().values().toArray()[0];
- monitor.getServiceSets().setDeploymentId("x");
- assertEquals("{online=false} deployment1:x[Services: [hello:hello, JBossESB:DeadLetterPersistanceService]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
+ // deployment2 should see deployment1 as being offline now...
+ monitor = (DeploymentMonitor) coordinator2.getBusMediators().get(0).getDeploymentMonitors().values().toArray()[0];
+ monitor.getServiceSets().setDeploymentId("x");
+ assertEquals("{online=false} deployment1:x[Services: [hello:hello, JBossESB:DeadLetterPersistanceService]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
- // Switch the heartbeat broadcast on deployment1 back on again...
- coordinator1.setBroadcastHeartbeat(true);
- Thread.sleep(6000);
+ // Switch the heartbeat broadcast on deployment1 back on again...
+ coordinator1.setBroadcastHeartbeat(true);
+ Thread.sleep(6000);
- // deployment2 should see deployment1 as being online again...
- monitor = (DeploymentMonitor) coordinator2.getBusMediators().get(0).getDeploymentMonitors().values().toArray()[0];
- monitor.getServiceSets().setDeploymentId("x");
- assertEquals("{online=true} deployment1:x[Services: [hello:hello, JBossESB:DeadLetterPersistanceService]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
+ // deployment2 should see deployment1 as being online again...
+ monitor = (DeploymentMonitor) coordinator2.getBusMediators().get(0).getDeploymentMonitors().values().toArray()[0];
+ monitor.getServiceSets().setDeploymentId("x");
+ assertEquals("{online=true} deployment1:x[Services: [hello:hello, JBossESB:DeadLetterPersistanceService]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
- } finally {
- deployment2.undeploy();
- }
- Thread.sleep(100);
-
- // deployment1 should no longer be be monitoring deployment2...
- assertEquals(0, coordinator1.getBusMediators().get(0).getDeploymentMonitors().size());
- } finally {
- deployment1.undeploy();
- }
+ } finally {
+ deployment2.undeploy();
}
- }.run();
+ Thread.sleep(100);
+
+ // deployment1 should no longer be be monitoring deployment2...
+ assertEquals(0, coordinator1.getBusMediators().get(0).getDeploymentMonitors().size());
+ } finally {
+ deployment1.undeploy();
+ }
}
}
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/jms/JMSBus_Standalone_Test.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/jms/JMSBus_Standalone_Test.java 2008-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/jms/JMSBus_Standalone_Test.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -98,17 +98,17 @@
}
finally
{
- interface3.close();
+ interface3.disconnect();
}
}
finally
{
- interface2.close();
+ interface2.disconnect();
}
}
finally
{
- interface1.close();
+ interface1.disconnect();
}
}
}.run();
@@ -176,17 +176,17 @@
}
finally
{
- interface3.close();
+ interface3.disconnect();
}
}
finally
{
- interface2.close();
+ interface2.disconnect();
}
}
finally
{
- interface1.close();
+ interface1.disconnect();
}
}
}.run();
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-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_001/RoutingTest.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -23,10 +23,9 @@
import org.jboss.esb.TestInboundRouter;
import org.jboss.esb.TestOutboundRouter;
import org.jboss.esb.TestService;
-import org.jboss.esb.test.JmsTestRunner;
+import org.jboss.esb.api.service.ServiceName;
import org.jboss.esb.deploy.DeploymentRuntime;
import org.jboss.esb.deploy.DeploymentUtil;
-import org.jboss.esb.api.service.ServiceName;
/**
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -40,117 +39,105 @@
*/
public void test() throws Exception
{
- new JmsTestRunner() {
- @Override
- public void test() throws Exception
+ ServiceName serviceA = new ServiceName("Service", "A");
+ DeploymentRuntime outrouterDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("03-outrouter-config.xml"));
+
+ outrouterDeployment.setDeploymentName("outrouter");
+ outrouterDeployment.deploy();
+ try
+ {
+ DeploymentRuntime serviceDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("02-service-config.xml"));
+
+ serviceDeployment.setDeploymentName("service");
+ serviceDeployment.deploy();
+ try
{
- ServiceName serviceA = new ServiceName("Service", "A");
- DeploymentRuntime outrouterDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("03-outrouter-config.xml"));
+ DeploymentRuntime inrouterDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-inrouter-config.xml"));
- outrouterDeployment.setDeploymentName("outrouter");
- outrouterDeployment.deploy();
+ inrouterDeployment.setDeploymentName("inrouter");
+ inrouterDeployment.deploy();
+ Thread.sleep(300); // Allow the deployments to exchange deployment details
try
{
- DeploymentRuntime serviceDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("02-service-config.xml"));
+ TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", inrouterDeployment).getRouter();
+ TestService service = (TestService) DeploymentUtil.getService(serviceA, serviceDeployment).getService();
+ TestOutboundRouter outrouter = (TestOutboundRouter) DeploymentUtil.getOutboundRouter(serviceA, "outrouter", outrouterDeployment).getRouter();
- serviceDeployment.setDeploymentName("service");
- serviceDeployment.deploy();
- try
- {
- DeploymentRuntime inrouterDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-inrouter-config.xml"));
+ inrouter.sendMessage("Hi there!!");
- inrouterDeployment.setDeploymentName("inrouter");
- inrouterDeployment.deploy();
- Thread.sleep(300); // Allow the deployments to exchange deployment details
- try
- {
- TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", inrouterDeployment).getRouter();
- TestService service = (TestService) DeploymentUtil.getService(serviceA, serviceDeployment).getService();
- TestOutboundRouter outrouter = (TestOutboundRouter) DeploymentUtil.getOutboundRouter(serviceA, "outrouter", outrouterDeployment).getRouter();
+ service.waitForMessage(10000);
+ outrouter.waitForMessage(10000);
- inrouter.sendMessage("Hi there!!");
-
- service.waitForMessage(10000);
- outrouter.waitForMessage(10000);
-
- // Check that the message has been routed across deployments, from the inrouter
- // to the service instance and then to the outrouter...
- assertEquals("Hi there!!", service.getMessage());
- assertEquals("Hi there!!", outrouter.getMessage());
- }
- finally
- {
- inrouterDeployment.undeploy();
- }
- }
- finally
- {
- serviceDeployment.undeploy();
- }
+ // Check that the message has been routed across deployments, from the inrouter
+ // to the service instance and then to the outrouter...
+ assertEquals("Hi there!!", service.getMessage());
+ assertEquals("Hi there!!", outrouter.getMessage());
}
finally
{
- outrouterDeployment.undeploy();
+ inrouterDeployment.undeploy();
}
}
- }.run();
+ finally
+ {
+ serviceDeployment.undeploy();
+ }
+ }
+ finally
+ {
+ outrouterDeployment.undeploy();
+ }
}
// Reversing the deployment startup order should be ok... should still work...
public void test_reverse_startup_order() throws Exception
{
- new JmsTestRunner() {
- @Override
- public void test() throws Exception
+ ServiceName serviceA = new ServiceName("Service", "A");
+ DeploymentRuntime inrouterDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-inrouter-config.xml"));
+
+ inrouterDeployment.setDeploymentName("inrouter");
+ inrouterDeployment.deploy();
+ try
+ {
+ DeploymentRuntime serviceDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("02-service-config.xml"));
+
+ serviceDeployment.setDeploymentName("service");
+ serviceDeployment.deploy();
+ try
{
- ServiceName serviceA = new ServiceName("Service", "A");
- DeploymentRuntime inrouterDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-inrouter-config.xml"));
+ DeploymentRuntime outrouterDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("03-outrouter-config.xml"));
- inrouterDeployment.setDeploymentName("inrouter");
- inrouterDeployment.deploy();
+ outrouterDeployment.setDeploymentName("outrouter");
+ outrouterDeployment.deploy();
+
+ Thread.sleep(300); // Allow the deployments to exchange deployment details
try
{
- DeploymentRuntime serviceDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("02-service-config.xml"));
+ TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", inrouterDeployment).getRouter();
+ TestService service = (TestService) DeploymentUtil.getService(serviceA, serviceDeployment).getService();
+ TestOutboundRouter outrouter = (TestOutboundRouter) DeploymentUtil.getOutboundRouter(serviceA, "outrouter", outrouterDeployment).getRouter();
- serviceDeployment.setDeploymentName("service");
- serviceDeployment.deploy();
- try
- {
- DeploymentRuntime outrouterDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("03-outrouter-config.xml"));
+ inrouter.sendMessage("Hi there!!");
+ Thread.sleep(300); // Allow the message to be delivered
- outrouterDeployment.setDeploymentName("outrouter");
- outrouterDeployment.deploy();
-
- Thread.sleep(300); // Allow the deployments to exchange deployment details
- try
- {
- TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", inrouterDeployment).getRouter();
- TestService service = (TestService) DeploymentUtil.getService(serviceA, serviceDeployment).getService();
- TestOutboundRouter outrouter = (TestOutboundRouter) DeploymentUtil.getOutboundRouter(serviceA, "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 via the bus... from the inrouter
- // to the service instance and then to the outrouter...
- assertEquals("Hi there!!", service.getMessage());
- assertEquals("Hi there!!", outrouter.getMessage());
- }
- finally
- {
- outrouterDeployment.undeploy();
- }
- }
- finally
- {
- serviceDeployment.undeploy();
- }
+ // Check that the message has been routed across deployments via the bus... from the inrouter
+ // to the service instance and then to the outrouter...
+ assertEquals("Hi there!!", service.getMessage());
+ assertEquals("Hi there!!", outrouter.getMessage());
}
finally
{
- inrouterDeployment.undeploy();
+ outrouterDeployment.undeploy();
}
}
- }.run();
+ finally
+ {
+ serviceDeployment.undeploy();
+ }
+ }
+ finally
+ {
+ inrouterDeployment.undeploy();
+ }
}
}
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-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_002/RoutingTest.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -20,13 +20,12 @@
package org.jboss.esb.routing.scenario_002;
import junit.framework.TestCase;
-import org.jboss.esb.deploy.DeploymentRuntime;
-import org.jboss.esb.deploy.DeploymentUtil;
-import org.jboss.esb.test.JmsTestRunner;
import org.jboss.esb.TestInboundRouter;
import org.jboss.esb.TestOutboundRouter;
import org.jboss.esb.TestService;
import org.jboss.esb.api.service.ServiceName;
+import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.deploy.DeploymentUtil;
/**
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -41,63 +40,57 @@
*/
public void test() throws Exception
{
- new JmsTestRunner() {
- @Override
- public void test() throws Exception
+ ServiceName serviceNameA = new ServiceName("Service", "A");
+ ServiceName serviceNameB = new ServiceName("Service", "B");
+ DeploymentRuntime outrouterDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("03-outrouter-config.xml"));
+
+ outrouterDeployment.setDeploymentName("outrouter");
+ outrouterDeployment.deploy();
+ try
+ {
+ DeploymentRuntime serviceDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("02-service-config.xml"));
+
+ serviceDeployment.setDeploymentName("service");
+ serviceDeployment.deploy();
+ try
{
- ServiceName serviceNameA = new ServiceName("Service", "A");
- ServiceName serviceNameB = new ServiceName("Service", "B");
- DeploymentRuntime outrouterDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("03-outrouter-config.xml"));
+ DeploymentRuntime inrouterDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-inrouter-config.xml"));
- outrouterDeployment.setDeploymentName("outrouter");
- outrouterDeployment.deploy();
+ inrouterDeployment.setDeploymentName("inrouter");
+ inrouterDeployment.deploy();
+ Thread.sleep(300); // Allow the deployments to exchange deployment details
try
{
- DeploymentRuntime serviceDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("02-service-config.xml"));
+ TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", inrouterDeployment).getRouter();
+ TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, serviceDeployment).getService();
+ TestService serviceB = (TestService) DeploymentUtil.getService(serviceNameB, serviceDeployment).getService();
+ TestOutboundRouter outrouter = (TestOutboundRouter) DeploymentUtil.getOutboundRouter(serviceNameB, "outrouter", outrouterDeployment).getRouter();
- serviceDeployment.setDeploymentName("service");
- serviceDeployment.deploy();
- try
- {
- DeploymentRuntime inrouterDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-inrouter-config.xml"));
+ inrouter.sendMessage("Hi there!!");
- inrouterDeployment.setDeploymentName("inrouter");
- inrouterDeployment.deploy();
- Thread.sleep(300); // Allow the deployments to exchange deployment details
- try
- {
- TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", inrouterDeployment).getRouter();
- TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, serviceDeployment).getService();
- TestService serviceB = (TestService) DeploymentUtil.getService(serviceNameB, serviceDeployment).getService();
- TestOutboundRouter outrouter = (TestOutboundRouter) DeploymentUtil.getOutboundRouter(serviceNameB, "outrouter", outrouterDeployment).getRouter();
+ serviceA.waitForMessage(10000);
+ serviceB.waitForMessage(10000);
+ outrouter.waitForMessage(10000);
- inrouter.sendMessage("Hi there!!");
-
- serviceA.waitForMessage(10000);
- serviceB.waitForMessage(10000);
- outrouter.waitForMessage(10000);
-
- // 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
- {
- serviceDeployment.undeploy();
- }
+ // 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
{
- outrouterDeployment.undeploy();
+ inrouterDeployment.undeploy();
}
}
- }.run();
+ finally
+ {
+ serviceDeployment.undeploy();
+ }
+ }
+ finally
+ {
+ outrouterDeployment.undeploy();
+ }
}
}
\ No newline at end of file
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-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_003/RoutingTest.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -20,13 +20,12 @@
package org.jboss.esb.routing.scenario_003;
import junit.framework.TestCase;
-import org.jboss.esb.deploy.DeploymentRuntime;
-import org.jboss.esb.deploy.DeploymentUtil;
-import org.jboss.esb.test.JmsTestRunner;
import org.jboss.esb.TestInboundRouter;
import org.jboss.esb.TestOutboundRouter;
import org.jboss.esb.TestService;
import org.jboss.esb.api.service.ServiceName;
+import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.deploy.DeploymentUtil;
/**
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -40,63 +39,57 @@
*/
public void test() throws Exception
{
- new JmsTestRunner() {
- @Override
- 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
{
- ServiceName serviceNameA = new ServiceName("Service", "A");
- ServiceName serviceNameB = new ServiceName("Service", "B");
- DeploymentRuntime serviceBDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("03-serviceB-config.xml"));
+ DeploymentRuntime inrouterDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-inrouter-config.xml"));
- serviceBDeployment.setDeploymentName("outrouter");
- serviceBDeployment.deploy();
+ inrouterDeployment.setDeploymentName("inrouter");
+ inrouterDeployment.deploy();
+ Thread.sleep(300); // Allow the deployments to exchange deployment details
try
{
- DeploymentRuntime serviceADeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("02-serviceA-config.xml"));
+ TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("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();
- serviceADeployment.setDeploymentName("service");
- serviceADeployment.deploy();
- try
- {
- DeploymentRuntime inrouterDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-inrouter-config.xml"));
+ inrouter.sendMessage("Hi there!!");
- inrouterDeployment.setDeploymentName("inrouter");
- inrouterDeployment.deploy();
- Thread.sleep(300); // Allow the deployments to exchange deployment details
- try
- {
- TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("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();
+ serviceA.waitForMessage(10000);
+ serviceB.waitForMessage(10000);
+ outrouter.waitForMessage(10000);
- inrouter.sendMessage("Hi there!!");
-
- serviceA.waitForMessage(10000);
- serviceB.waitForMessage(10000);
- outrouter.waitForMessage(10000);
-
- // 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();
- }
+ // 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
{
- serviceBDeployment.undeploy();
+ inrouterDeployment.undeploy();
}
}
- }.run();
+ finally
+ {
+ serviceADeployment.undeploy();
+ }
+ }
+ finally
+ {
+ serviceBDeployment.undeploy();
+ }
}
}
\ No newline at end of file
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-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_004/RoutingTest.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -20,12 +20,11 @@
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.test.JmsTestRunner;
import org.jboss.esb.TestInboundRouter;
import org.jboss.esb.TestOutboundRouter;
import org.jboss.esb.api.service.ServiceName;
+import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.deploy.DeploymentUtil;
/**
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -39,45 +38,39 @@
*/
public void test() throws Exception
{
- new JmsTestRunner() {
- @Override
- public void test() throws Exception
- {
- ServiceName serviceNameA = new ServiceName("Service", "A");
- DeploymentRuntime outrouterDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("02-outrouter-config.xml"));
+ 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"));
+ 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("inrouter", inrouterDeployment).getRouter();
- TestOutboundRouter outrouter = (TestOutboundRouter) DeploymentUtil.getOutboundRouter(serviceNameA, "outrouter", outrouterDeployment).getRouter();
+ inrouterDeployment.setDeploymentName("inrouter");
+ inrouterDeployment.deploy();
+ Thread.sleep(300); // Allow the deployments to exchange deployment details
+ try
+ {
+ TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", inrouterDeployment).getRouter();
+ TestOutboundRouter outrouter = (TestOutboundRouter) DeploymentUtil.getOutboundRouter(serviceNameA, "outrouter", outrouterDeployment).getRouter();
- inrouter.sendMessage("Hi there!!");
+ inrouter.sendMessage("Hi there!!");
- outrouter.waitForMessage(10000);
+ outrouter.waitForMessage(10000);
- // 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();
- }
+ // 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());
}
- }.run();
+ finally
+ {
+ inrouterDeployment.undeploy();
+ }
+ }
+ finally
+ {
+ outrouterDeployment.undeploy();
+ }
}
}
\ No newline at end of file
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-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_005/RoutingTest.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -20,11 +20,10 @@
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.test.JmsTestRunner;
import org.jboss.esb.TestInboundRouter;
import org.jboss.esb.api.service.ServiceName;
+import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.deploy.DeploymentUtil;
/**
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -38,35 +37,29 @@
*/
public void test() throws Exception
{
- new JmsTestRunner() {
- @Override
- public void test() throws Exception
- {
- ServiceName serviceNameA = new ServiceName("Service", "A");
- DeploymentRuntime inrouterDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-inrouter-config.xml"));
+ 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("inrouter", inrouterDeployment).getRouter();
+ inrouterDeployment.setDeploymentName("inrouter");
+ inrouterDeployment.deploy();
+ try
+ {
+ TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("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();
- }
+ try
+ {
+ inrouter.sendMessage("Hi there!!");
+ fail("Expected IllegalStateException - no Service or Outbound Routers configured.");
}
- }.run();
+ 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();
+ }
}
}
\ No newline at end of file
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-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_006/RoutingTest.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -20,13 +20,12 @@
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.test.JmsTestRunner;
import org.jboss.esb.TestInboundRouter;
import org.jboss.esb.TestOutboundRouter;
import org.jboss.esb.TestService;
import org.jboss.esb.api.service.ServiceName;
+import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.deploy.DeploymentUtil;
/**
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -40,80 +39,74 @@
*/
public void test() throws Exception
{
- new JmsTestRunner() {
- @Override
- 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
{
- 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"));
+ DeploymentRuntime deployment3 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("03-deployment.xml"));
- deployment1.setDeploymentName("deployment1");
- deployment1.setDeploymentId("deployment1-Id");
- deployment1.deploy();
+ deployment3.setDeploymentName("deployment3");
+ deployment3.setDeploymentId("deployment3-Id");
+ deployment3.deploy();
+ Thread.sleep(300); // Allow the deployments to exchange deployment details
try
{
- DeploymentRuntime deployment2 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("02-deployment.xml"));
+ TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("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();
- deployment2.setDeploymentName("deployment2");
- deployment2.setDeploymentId("deployment2-Id");
- deployment2.deploy();
- try
- {
- DeploymentRuntime deployment3 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("03-deployment.xml"));
+ // Force propagation of the event log...
+ inrouter.sendMessage("Hi there!!", true);
- 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("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();
+ serviceA.waitForMessage(10000);
+ serviceB.waitForMessage(10000);
+ serviceC.waitForMessage(10000);
+ outrouter.waitForMessage(10000);
- // Force propagation of the event log...
- inrouter.sendMessage("Hi there!!", true);
+ // 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());
- serviceA.waitForMessage(10000);
- serviceB.waitForMessage(10000);
- serviceC.waitForMessage(10000);
- outrouter.waitForMessage(10000);
-
- // 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. [deployment1-Id:deployment1] ServiceProcessingEvent: service='Service:A'\n" +
- "\t2. [deployment1-Id:deployment1] BusRouterProcessingEvent: to='Service:B', targetDeploymentId='deployment2-Id:deployment2', busType='JMSBus'\n" +
- "\t3. [deployment2-Id:deployment2] ServiceProcessingEvent: service='Service:B'\n" +
- "\t4. [deployment2-Id:deployment2] BusRouterProcessingEvent: to='Service:C', targetDeploymentId='deployment3-Id:deployment3', busType='JMSBus'\n" +
- "\t5. [deployment3-Id:deployment3] ServiceProcessingEvent: service='Service:C'\n" +
- "\t6. [deployment3-Id:deployment3] OutboundRouterProcessingEvent: config='outrouter'",
- outrouter.getEventLog().toString().trim());
- }
- finally
- {
- deployment3.undeploy();
- }
- }
- finally
- {
- deployment2.undeploy();
- }
+ assertEquals("Message Processing Event Log:\n" +
+ "\t1. [deployment1-Id:deployment1] ServiceProcessingEvent: service='Service:A'\n" +
+ "\t2. [deployment1-Id:deployment1] BusRouterProcessingEvent: to='Service:B', targetDeploymentId='deployment2-Id:deployment2', busType='InVMBus'\n" +
+ "\t3. [deployment2-Id:deployment2] ServiceProcessingEvent: service='Service:B'\n" +
+ "\t4. [deployment2-Id:deployment2] BusRouterProcessingEvent: to='Service:C', targetDeploymentId='deployment3-Id:deployment3', busType='InVMBus'\n" +
+ "\t5. [deployment3-Id:deployment3] ServiceProcessingEvent: service='Service:C'\n" +
+ "\t6. [deployment3-Id:deployment3] OutboundRouterProcessingEvent: config='outrouter'",
+ outrouter.getEventLog().toString().trim());
}
finally
{
- deployment1.undeploy();
+ deployment3.undeploy();
}
}
- }.run();
+ finally
+ {
+ deployment2.undeploy();
+ }
+ }
+ finally
+ {
+ deployment1.undeploy();
+ }
}
}
\ No newline at end of file
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-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_007/RoutingTest.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -20,12 +20,11 @@
package org.jboss.esb.routing.scenario_007;
import junit.framework.TestCase;
-import org.jboss.esb.deploy.DeploymentRuntime;
-import org.jboss.esb.deploy.DeploymentUtil;
-import org.jboss.esb.test.JmsTestRunner;
import org.jboss.esb.TestInboundRouter;
import org.jboss.esb.TestService;
import org.jboss.esb.api.service.ServiceName;
+import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.deploy.DeploymentUtil;
/**
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -42,77 +41,71 @@
*/
public void test() throws Exception
{
- new JmsTestRunner() {
- @Override
- 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
{
- ServiceName serviceNameA = new ServiceName("Service", "A");
- ServiceName serviceNameF = new ServiceName("Service", "F");
- DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-deployment.xml"));
+ DeploymentRuntime deployment3 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("03-deployment.xml"));
- deployment1.setDeploymentName("deployment1");
- deployment1.setDeploymentId("deployment1-Id");
- deployment1.deploy();
+ deployment3.setDeploymentName("deployment3");
+ deployment3.setDeploymentId("deployment3-Id");
+ deployment3.deploy();
+ Thread.sleep(300); // Allow the deployments to exchange deployment details
try
{
- DeploymentRuntime deployment2 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("02-deployment.xml"));
+ TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", deployment1).getRouter();
+ TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
+ TestService serviceF = (TestService) DeploymentUtil.getService(serviceNameF, deployment1).getService();
- deployment2.setDeploymentName("deployment2");
- deployment2.setDeploymentId("deployment2-Id");
- deployment2.deploy();
- try
- {
- DeploymentRuntime deployment3 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("03-deployment.xml"));
+ // Force propagation of the event log...
+ inrouter.sendMessage("Hi there!!", true);
- 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("inrouter", deployment1).getRouter();
- TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
- TestService serviceF = (TestService) DeploymentUtil.getService(serviceNameF, deployment1).getService();
+ serviceA.waitForMessage(10000);
+ serviceF.waitForMessage(10000);
- // Force propagation of the event log...
- inrouter.sendMessage("Hi there!!", true);
+ // 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());
- serviceA.waitForMessage(10000);
- serviceF.waitForMessage(10000);
-
- // 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();
- }
+ 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='InVMBus'\n" +
+ "\t4. [deployment2-Id:deployment2] ServiceProcessingEvent: service='Service:C'\n" +
+ "\t5. [deployment2-Id:deployment2] BusRouterProcessingEvent: to='Service:D', targetDeploymentId='deployment3-Id:deployment3', busType='InVMBus'\n" +
+ "\t6. [deployment3-Id:deployment3] ServiceProcessingEvent: service='Service:D'\n" +
+ "\t7. [deployment3-Id:deployment3] BusRouterProcessingEvent: to='Service:E', targetDeploymentId='deployment2-Id:deployment2', busType='InVMBus'\n" +
+ "\t8. [deployment2-Id:deployment2] ServiceProcessingEvent: service='Service:E'\n" +
+ "\t9. [deployment2-Id:deployment2] BusRouterProcessingEvent: to='Service:F', targetDeploymentId='deployment1-Id:deployment1', busType='InVMBus'\n" +
+ "\t10. [deployment1-Id:deployment1] ServiceProcessingEvent: service='Service:F'",
+ serviceF.getEventLog().toString().trim());
}
finally
{
- deployment1.undeploy();
+ deployment3.undeploy();
}
}
- }.run();
+ finally
+ {
+ deployment2.undeploy();
+ }
+ }
+ finally
+ {
+ deployment1.undeploy();
+ }
}
}
\ No newline at end of file
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_008/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_008/RoutingTest.java 2008-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_008/RoutingTest.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -20,13 +20,12 @@
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.test.JmsTestRunner;
import org.jboss.esb.TestInboundRouter;
-import org.jboss.esb.TestService;
import org.jboss.esb.TestOutboundRouter;
+import org.jboss.esb.TestService;
import org.jboss.esb.api.service.ServiceName;
+import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.deploy.DeploymentUtil;
/**
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -42,80 +41,74 @@
*/
public void test() throws Exception
{
- new JmsTestRunner() {
- @Override
- public void test() throws Exception
+ ServiceName serviceNameA = new ServiceName("Service", "A");
+ ServiceName serviceNameB = new ServiceName("Service", "B");
+ 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
{
- ServiceName serviceNameA = new ServiceName("Service", "A");
- ServiceName serviceNameB = new ServiceName("Service", "B");
- DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-deployment.xml"));
+ DeploymentRuntime deployment3 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("03-deployment.xml"));
- deployment1.setDeploymentName("deployment1");
- deployment1.setDeploymentId("deployment1-Id");
- deployment1.deploy();
+ deployment3.setDeploymentName("deployment3");
+ deployment3.setDeploymentId("deployment3-Id");
+ deployment3.deploy();
+ Thread.sleep(300); // Allow the deployments to exchange deployment details
try
{
- DeploymentRuntime deployment2 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("02-deployment.xml"));
+ TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", deployment1).getRouter();
+ TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment2).getService();
+ TestService serviceB = (TestService) DeploymentUtil.getService(serviceNameB, deployment3).getService();
+ TestOutboundRouter outrouter = (TestOutboundRouter) DeploymentUtil.getOutboundRouter(serviceNameA, "outrouter", deployment2).getRouter();
- deployment2.setDeploymentName("deployment2");
- deployment2.setDeploymentId("deployment2-Id");
- deployment2.deploy();
- try
- {
- DeploymentRuntime deployment3 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("03-deployment.xml"));
+ inrouter.sendMessage("Hi there!!", true);
- 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("inrouter", deployment1).getRouter();
- TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment2).getService();
- TestService serviceB = (TestService) DeploymentUtil.getService(serviceNameB, deployment3).getService();
- TestOutboundRouter outrouter = (TestOutboundRouter) DeploymentUtil.getOutboundRouter(serviceNameA, "outrouter", deployment2).getRouter();
+ serviceA.waitForMessage(10000);
+ serviceB.waitForMessage(10000);
+ outrouter.waitForMessage(10000);
- inrouter.sendMessage("Hi there!!", true);
+ // 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());
- serviceA.waitForMessage(10000);
- serviceB.waitForMessage(10000);
- outrouter.waitForMessage(10000);
+ assertEquals("Message Processing Event Log:\n" +
+ "\t1. [deployment1-Id:deployment1] BusRouterProcessingEvent: to='Service:A', targetDeploymentId='deployment2-Id:deployment2', busType='InVMBus'\n" +
+ "\t2. [deployment2-Id:deployment2] ServiceProcessingEvent: service='Service:A'\n" +
+ "\t3. [deployment2-Id:deployment2] BusRouterProcessingEvent: to='Service:B', targetDeploymentId='deployment3-Id:deployment3', busType='InVMBus'\n" +
+ "\t4. [deployment3-Id:deployment3] ServiceProcessingEvent: service='Service:B'",
+ serviceB.getEventLog().toString().trim());
- // 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());
-
- assertEquals("Message Processing Event Log:\n" +
- "\t1. [deployment1-Id:deployment1] BusRouterProcessingEvent: to='Service:A', targetDeploymentId='deployment2-Id:deployment2', busType='JMSBus'\n" +
- "\t2. [deployment2-Id:deployment2] ServiceProcessingEvent: service='Service:A'\n" +
- "\t3. [deployment2-Id:deployment2] BusRouterProcessingEvent: to='Service:B', targetDeploymentId='deployment3-Id:deployment3', busType='JMSBus'\n" +
- "\t4. [deployment3-Id:deployment3] ServiceProcessingEvent: service='Service:B'",
- serviceB.getEventLog().toString().trim());
-
- assertEquals("Message Processing Event Log:\n" +
- "\t1. [deployment1-Id:deployment1] BusRouterProcessingEvent: to='Service:A', targetDeploymentId='deployment2-Id:deployment2', busType='JMSBus'\n" +
- "\t2. [deployment2-Id:deployment2] ServiceProcessingEvent: service='Service:A'\n" +
- "\t3. [deployment2-Id:deployment2] BusRouterProcessingEvent: to='Service:B', targetDeploymentId='deployment3-Id:deployment3', busType='JMSBus'\n" +
- "\t4. [deployment2-Id:deployment2] OutboundRouterProcessingEvent: config='outrouter'",
- outrouter.getEventLog().toString().trim());
- }
- finally
- {
- deployment3.undeploy();
- }
- }
- finally
- {
- deployment2.undeploy();
- }
+ assertEquals("Message Processing Event Log:\n" +
+ "\t1. [deployment1-Id:deployment1] BusRouterProcessingEvent: to='Service:A', targetDeploymentId='deployment2-Id:deployment2', busType='InVMBus'\n" +
+ "\t2. [deployment2-Id:deployment2] ServiceProcessingEvent: service='Service:A'\n" +
+ "\t3. [deployment2-Id:deployment2] BusRouterProcessingEvent: to='Service:B', targetDeploymentId='deployment3-Id:deployment3', busType='InVMBus'\n" +
+ "\t4. [deployment2-Id:deployment2] OutboundRouterProcessingEvent: config='outrouter'",
+ outrouter.getEventLog().toString().trim());
}
finally
{
- deployment1.undeploy();
+ deployment3.undeploy();
}
}
- }.run();
+ finally
+ {
+ deployment2.undeploy();
+ }
+ }
+ finally
+ {
+ deployment1.undeploy();
+ }
}
}
\ No newline at end of file
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_009/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_009/RoutingTest.java 2008-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_009/RoutingTest.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -20,13 +20,12 @@
package org.jboss.esb.routing.scenario_009;
import junit.framework.TestCase;
-import org.jboss.esb.deploy.DeploymentRuntime;
-import org.jboss.esb.deploy.DeploymentUtil;
-import org.jboss.esb.test.JmsTestRunner;
import org.jboss.esb.TestInboundRouter;
-import org.jboss.esb.TestService;
import org.jboss.esb.TestOutboundRouter;
+import org.jboss.esb.TestService;
import org.jboss.esb.api.service.ServiceName;
+import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.deploy.DeploymentUtil;
/**
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -42,79 +41,73 @@
*/
public void test() throws Exception
{
- new JmsTestRunner() {
- @Override
- public void test() throws Exception
+ ServiceName serviceNameA = new ServiceName("Service", "A");
+ ServiceName serviceNameB = new ServiceName("Service", "B");
+ 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
{
- ServiceName serviceNameA = new ServiceName("Service", "A");
- ServiceName serviceNameB = new ServiceName("Service", "B");
- DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-deployment.xml"));
+ DeploymentRuntime deployment3 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("03-deployment.xml"));
- deployment1.setDeploymentName("deployment1");
- deployment1.setDeploymentId("deployment1-Id");
- deployment1.deploy();
+ deployment3.setDeploymentName("deployment3");
+ deployment3.setDeploymentId("deployment3-Id");
+ deployment3.deploy();
+ Thread.sleep(300); // Allow the deployments to exchange deployment details
try
{
- DeploymentRuntime deployment2 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("02-deployment.xml"));
+ TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", deployment1).getRouter();
+ TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
+ TestService serviceB = (TestService) DeploymentUtil.getService(serviceNameB, deployment3).getService();
+ TestOutboundRouter outrouter = (TestOutboundRouter) DeploymentUtil.getOutboundRouter(serviceNameA, "outrouter", deployment2).getRouter();
- deployment2.setDeploymentName("deployment2");
- deployment2.setDeploymentId("deployment2-Id");
- deployment2.deploy();
- try
- {
- DeploymentRuntime deployment3 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("03-deployment.xml"));
+ inrouter.sendMessage("Hi there!!", true);
- 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("inrouter", deployment1).getRouter();
- TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
- TestService serviceB = (TestService) DeploymentUtil.getService(serviceNameB, deployment3).getService();
- TestOutboundRouter outrouter = (TestOutboundRouter) DeploymentUtil.getOutboundRouter(serviceNameA, "outrouter", deployment2).getRouter();
+ serviceA.waitForMessage(10000);
+ serviceB.waitForMessage(10000);
+ outrouter.waitForMessage(10000);
- inrouter.sendMessage("Hi there!!", true);
+ // 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());
- serviceA.waitForMessage(10000);
- serviceB.waitForMessage(10000);
- outrouter.waitForMessage(10000);
+ assertEquals("Message Processing Event Log:\n" +
+ "\t1. [deployment1-Id:deployment1] ServiceProcessingEvent: service='Service:A'\n" +
+ "\t2. [deployment1-Id:deployment1] BusRouterProcessingEvent: to='Service:B', targetDeploymentId='deployment3-Id:deployment3', busType='InVMBus'\n" +
+ "\t3. [deployment3-Id:deployment3] ServiceProcessingEvent: service='Service:B'",
+ serviceB.getEventLog().toString().trim());
- // 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());
-
- assertEquals("Message Processing Event Log:\n" +
- "\t1. [deployment1-Id:deployment1] ServiceProcessingEvent: service='Service:A'\n" +
- "\t2. [deployment1-Id:deployment1] BusRouterProcessingEvent: to='Service:B', targetDeploymentId='deployment3-Id:deployment3', busType='JMSBus'\n" +
- "\t3. [deployment3-Id:deployment3] ServiceProcessingEvent: service='Service:B'",
- serviceB.getEventLog().toString().trim());
-
- assertEquals("Message Processing Event Log:\n" +
- "\t1. [deployment1-Id:deployment1] ServiceProcessingEvent: service='Service:A'\n" +
- "\t2. [deployment1-Id:deployment1] BusRouterProcessingEvent: to='Service:B', targetDeploymentId='deployment3-Id:deployment3', busType='JMSBus'\n" +
- "\t3. [deployment1-Id:deployment1] BusRouterProcessingEvent: to='Service:A', targetDeploymentId='deployment2-Id:deployment2', busType='JMSBus'\n" +
- "\t4. [deployment2-Id:deployment2] OutboundRouterProcessingEvent: config='outrouter'",
- outrouter.getEventLog().toString().trim());
- }
- finally
- {
- deployment3.undeploy();
- }
- }
- finally
- {
- deployment2.undeploy();
- }
+ assertEquals("Message Processing Event Log:\n" +
+ "\t1. [deployment1-Id:deployment1] ServiceProcessingEvent: service='Service:A'\n" +
+ "\t2. [deployment1-Id:deployment1] BusRouterProcessingEvent: to='Service:B', targetDeploymentId='deployment3-Id:deployment3', busType='InVMBus'\n" +
+ "\t3. [deployment1-Id:deployment1] BusRouterProcessingEvent: to='Service:A', targetDeploymentId='deployment2-Id:deployment2', busType='InVMBus'\n" +
+ "\t4. [deployment2-Id:deployment2] OutboundRouterProcessingEvent: config='outrouter'",
+ outrouter.getEventLog().toString().trim());
}
finally
{
- deployment1.undeploy();
+ deployment3.undeploy();
}
}
- }.run();
+ finally
+ {
+ deployment2.undeploy();
+ }
+ }
+ finally
+ {
+ deployment1.undeploy();
+ }
}
}
\ No newline at end of file
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_010/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_010/RoutingTest.java 2008-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_010/RoutingTest.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -20,13 +20,12 @@
package org.jboss.esb.routing.scenario_010;
import junit.framework.TestCase;
-import org.jboss.esb.deploy.DeploymentRuntime;
-import org.jboss.esb.deploy.DeploymentUtil;
-import org.jboss.esb.test.JmsTestRunner;
import org.jboss.esb.TestInboundRouter;
-import org.jboss.esb.TestService;
import org.jboss.esb.TestOutboundRouter;
+import org.jboss.esb.TestService;
import org.jboss.esb.api.service.ServiceName;
+import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.deploy.DeploymentUtil;
/**
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -41,67 +40,61 @@
*/
public void test() throws Exception
{
- new JmsTestRunner() {
- @Override
- public void test() throws Exception
- {
- ServiceName serviceNameA = new ServiceName("Service", "A");
- ServiceName serviceNameB = new ServiceName("Service", "B");
- DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-deployment.xml"));
+ ServiceName serviceNameA = new ServiceName("Service", "A");
+ ServiceName serviceNameB = new ServiceName("Service", "B");
+ 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"));
+ 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();
- Thread.sleep(300); // Allow the deployments to exchange deployment details
- try
- {
- TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", deployment1).getRouter();
- TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
- TestService serviceB = (TestService) DeploymentUtil.getService(serviceNameB, deployment1).getService();
- TestOutboundRouter outrouter = (TestOutboundRouter) DeploymentUtil.getOutboundRouter(serviceNameA, "outrouter", deployment2).getRouter();
+ deployment2.setDeploymentName("deployment2");
+ deployment2.setDeploymentId("deployment2-Id");
+ deployment2.deploy();
+ Thread.sleep(300); // Allow the deployments to exchange deployment details
+ try
+ {
+ TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", deployment1).getRouter();
+ TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
+ TestService serviceB = (TestService) DeploymentUtil.getService(serviceNameB, deployment1).getService();
+ TestOutboundRouter outrouter = (TestOutboundRouter) DeploymentUtil.getOutboundRouter(serviceNameA, "outrouter", deployment2).getRouter();
- inrouter.sendMessage("Hi there!!", true);
+ inrouter.sendMessage("Hi there!!", true);
- serviceA.waitForMessage(10000);
- serviceB.waitForMessage(10000);
- outrouter.waitForMessage(10000);
+ serviceA.waitForMessage(10000);
+ serviceB.waitForMessage(10000);
+ outrouter.waitForMessage(10000);
- // 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());
+ // 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());
- 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:A', targetDeploymentId='deployment2-Id:deployment2', busType='JMSBus'",
- serviceB.getEventLog().toString().trim());
+ 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:A', targetDeploymentId='deployment2-Id:deployment2', busType='InVMBus'",
+ serviceB.getEventLog().toString().trim());
- 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:A', targetDeploymentId='deployment2-Id:deployment2', busType='JMSBus'\n" +
- "\t4. [deployment2-Id:deployment2] OutboundRouterProcessingEvent: config='outrouter'",
- outrouter.getEventLog().toString().trim());
- }
- finally
- {
- deployment2.undeploy();
- }
- }
- finally
- {
- deployment1.undeploy();
- }
+ 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:A', targetDeploymentId='deployment2-Id:deployment2', busType='InVMBus'\n" +
+ "\t4. [deployment2-Id:deployment2] OutboundRouterProcessingEvent: config='outrouter'",
+ outrouter.getEventLog().toString().trim());
}
- }.run();
+ finally
+ {
+ deployment2.undeploy();
+ }
+ }
+ finally
+ {
+ deployment1.undeploy();
+ }
}
}
\ No newline at end of file
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_011/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_011/RoutingTest.java 2008-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_011/RoutingTest.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -23,12 +23,11 @@
import org.jboss.esb.TestInboundRouter;
import org.jboss.esb.TestOutboundRouter;
import org.jboss.esb.TestService;
-import org.jboss.esb.test.JmsTestRunner;
-import org.jboss.esb.deploy.DeploymentRuntime;
-import org.jboss.esb.deploy.DeploymentUtil;
import org.jboss.esb.api.bus.BusMessage;
import org.jboss.esb.api.service.ServiceException;
import org.jboss.esb.api.service.ServiceName;
+import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.deploy.DeploymentUtil;
/**
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -43,48 +42,42 @@
*/
public void test() throws Exception
{
- new JmsTestRunner() {
- @Override
- public void test() throws Exception
- {
- ServiceName serviceNameA = new ServiceName("Service", "A");
- ServiceName serviceNameB = new ServiceName("Service", "B");
- DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-deployment.xml"));
+ ServiceName serviceNameA = new ServiceName("Service", "A");
+ ServiceName serviceNameB = new ServiceName("Service", "B");
+ DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-deployment.xml"));
- deployment1.setDeploymentName("deployment1");
- deployment1.setDeploymentId("deployment1-Id");
- deployment1.deploy();
- try
- {
- TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", deployment1).getRouter();
- TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
- TestService serviceB = (TestService) DeploymentUtil.getService(serviceNameB, deployment1).getService();
- TestOutboundRouter outrouter = (TestOutboundRouter) DeploymentUtil.getOutboundRouter(serviceNameA, "outrouter", deployment1).getRouter();
- String faultString = "A Service Exception - should route to faultTo address.";
+ deployment1.setDeploymentName("deployment1");
+ deployment1.setDeploymentId("deployment1-Id");
+ deployment1.deploy();
+ try
+ {
+ TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", deployment1).getRouter();
+ TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
+ TestService serviceB = (TestService) DeploymentUtil.getService(serviceNameB, deployment1).getService();
+ TestOutboundRouter outrouter = (TestOutboundRouter) DeploymentUtil.getOutboundRouter(serviceNameA, "outrouter", deployment1).getRouter();
+ String faultString = "A Service Exception - should route to faultTo address.";
- serviceA.setThrowException(new ServiceException(faultString));
+ serviceA.setThrowException(new ServiceException(faultString));
- inrouter.sendMessage("Hi there!!", true);
+ inrouter.sendMessage("Hi there!!", true);
- serviceA.waitForMessage(10000);
- serviceB.waitForMessage(10000);
+ serviceA.waitForMessage(10000);
+ serviceB.waitForMessage(10000);
- // 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());
- BusMessage faultMessage = (BusMessage) serviceB.getMessage();
- assertEquals("Hi there!!", faultMessage.getMessage().getPayload());
- assertEquals("Service:A", faultMessage.getAddressingContext().getTo().toString());
- assertEquals("Service:B", faultMessage.getAddressingContext().getFaultTo().toString());
- assertTrue(faultMessage.getFault() instanceof ServiceException);
- assertEquals(faultString, faultMessage.getFault().getMessage());
- assertEquals(null, outrouter.getMessage());
- }
- finally
- {
- deployment1.undeploy();
- }
- }
- }.run();
+ // 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());
+ BusMessage faultMessage = (BusMessage) serviceB.getMessage();
+ assertEquals("Hi there!!", faultMessage.getMessage().getPayload());
+ assertEquals("Service:A", faultMessage.getAddressingContext().getTo().toString());
+ assertEquals("Service:B", faultMessage.getAddressingContext().getFaultTo().toString());
+ assertTrue(faultMessage.getFault() instanceof ServiceException);
+ assertEquals(faultString, faultMessage.getFault().getMessage());
+ assertEquals(null, outrouter.getMessage());
+ }
+ finally
+ {
+ deployment1.undeploy();
+ }
}
}
\ No newline at end of file
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_012/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_012/RoutingTest.java 2008-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_012/RoutingTest.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -22,13 +22,12 @@
import junit.framework.TestCase;
import org.jboss.esb.TestInboundRouter;
import org.jboss.esb.TestService;
-import org.jboss.esb.test.JmsTestRunner;
+import org.jboss.esb.api.bus.BusMessage;
+import org.jboss.esb.api.service.ServiceName;
import org.jboss.esb.deploy.DeploymentRuntime;
import org.jboss.esb.deploy.DeploymentUtil;
import org.jboss.esb.failure.DeadLetterPersistanceService;
import org.jboss.esb.failure.MockDeadLetterService;
-import org.jboss.esb.api.bus.BusMessage;
-import org.jboss.esb.api.service.ServiceName;
/**
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -43,44 +42,38 @@
*/
public void test() throws Exception
{
- new JmsTestRunner() {
- @Override
- public void test() throws Exception
- {
- ServiceName serviceNameA = new ServiceName("Service", "A");
- DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-deployment.xml"));
+ ServiceName serviceNameA = new ServiceName("Service", "A");
+ DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-deployment.xml"));
- deployment1.setDeploymentName("deployment1");
- deployment1.setDeploymentId("deployment1-Id");
- deployment1.deploy();
- try
- {
- TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", deployment1).getRouter();
- TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
- MockDeadLetterService dlService = (MockDeadLetterService) DeploymentUtil.getService(DeadLetterPersistanceService.SERVICE_NAME, deployment1).getService();
- String faultString = "A Runtime Exception - should route to Dead Letter Service.";
+ deployment1.setDeploymentName("deployment1");
+ deployment1.setDeploymentId("deployment1-Id");
+ deployment1.deploy();
+ try
+ {
+ TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", deployment1).getRouter();
+ TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
+ MockDeadLetterService dlService = (MockDeadLetterService) DeploymentUtil.getService(DeadLetterPersistanceService.SERVICE_NAME, deployment1).getService();
+ String faultString = "A Runtime Exception - should route to Dead Letter Service.";
- serviceA.setThrowException(new RuntimeException(faultString));
- dlService.setExpectingMessages(true);
+ serviceA.setThrowException(new RuntimeException(faultString));
+ dlService.setExpectingMessages(true);
- inrouter.sendMessage("Hi there!!", true);
+ inrouter.sendMessage("Hi there!!", true);
- serviceA.waitForMessage(10000);
+ serviceA.waitForMessage(10000);
- // 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());
- BusMessage dlsMessage = (BusMessage) dlService.getMessages().peek().getPayload();
- assertEquals("Hi there!!", dlsMessage.getMessage().getPayload());
- assertEquals("Service:A", dlsMessage.getAddressingContext().getTo().toString());
- assertTrue(dlsMessage.getFault() instanceof RuntimeException);
- assertEquals(faultString, dlsMessage.getFault().getMessage());
- }
- finally
- {
- deployment1.undeploy();
- }
- }
- }.run();
+ // 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());
+ BusMessage dlsMessage = (BusMessage) dlService.getMessages().peek().getPayload();
+ assertEquals("Hi there!!", dlsMessage.getMessage().getPayload());
+ assertEquals("Service:A", dlsMessage.getAddressingContext().getTo().toString());
+ assertTrue(dlsMessage.getFault() instanceof RuntimeException);
+ assertEquals(faultString, dlsMessage.getFault().getMessage());
+ }
+ finally
+ {
+ deployment1.undeploy();
+ }
}
}
\ No newline at end of file
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_013/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_013/RoutingTest.java 2008-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_013/RoutingTest.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -22,14 +22,13 @@
import junit.framework.TestCase;
import org.jboss.esb.TestInboundRouter;
import org.jboss.esb.TestService;
+import org.jboss.esb.api.bus.BusMessage;
+import org.jboss.esb.api.service.ServiceException;
+import org.jboss.esb.api.service.ServiceName;
import org.jboss.esb.deploy.DeploymentRuntime;
import org.jboss.esb.deploy.DeploymentUtil;
import org.jboss.esb.failure.DeadLetterPersistanceService;
import org.jboss.esb.failure.MockDeadLetterService;
-import org.jboss.esb.api.bus.BusMessage;
-import org.jboss.esb.test.JmsTestRunner;
-import org.jboss.esb.api.service.ServiceName;
-import org.jboss.esb.api.service.ServiceException;
/**
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -47,44 +46,38 @@
*/
public void test() throws Exception
{
- new JmsTestRunner() {
- @Override
- public void test() throws Exception
- {
- ServiceName serviceNameA = new ServiceName("Service", "A");
- DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-deployment.xml"));
+ ServiceName serviceNameA = new ServiceName("Service", "A");
+ DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-deployment.xml"));
- deployment1.setDeploymentName("deployment1");
- deployment1.setDeploymentId("deployment1-Id");
- deployment1.deploy();
- try
- {
- TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", deployment1).getRouter();
- TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
- MockDeadLetterService dlService = (MockDeadLetterService) DeploymentUtil.getService(DeadLetterPersistanceService.SERVICE_NAME, deployment1).getService();
- String faultString = "A Service Exception - should route to Dead Letter Service because there's no faultTo address.";
+ deployment1.setDeploymentName("deployment1");
+ deployment1.setDeploymentId("deployment1-Id");
+ deployment1.deploy();
+ try
+ {
+ TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", deployment1).getRouter();
+ TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
+ MockDeadLetterService dlService = (MockDeadLetterService) DeploymentUtil.getService(DeadLetterPersistanceService.SERVICE_NAME, deployment1).getService();
+ String faultString = "A Service Exception - should route to Dead Letter Service because there's no faultTo address.";
- serviceA.setThrowException(new ServiceException(faultString));
- dlService.setExpectingMessages(true);
+ serviceA.setThrowException(new ServiceException(faultString));
+ dlService.setExpectingMessages(true);
- inrouter.sendMessage("Hi there!!", true);
+ inrouter.sendMessage("Hi there!!", true);
- serviceA.waitForMessage(10000);
+ serviceA.waitForMessage(10000);
- // 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());
- BusMessage dlsMessage = (BusMessage) dlService.getMessages().peek().getPayload();
- assertEquals("Hi there!!", dlsMessage.getMessage().getPayload());
- assertEquals("Service:A", dlsMessage.getAddressingContext().getTo().toString());
- assertTrue(dlsMessage.getFault() instanceof ServiceException);
- assertEquals(faultString, dlsMessage.getFault().getMessage());
- }
- finally
- {
- deployment1.undeploy();
- }
- }
- }.run();
+ // 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());
+ BusMessage dlsMessage = (BusMessage) dlService.getMessages().peek().getPayload();
+ assertEquals("Hi there!!", dlsMessage.getMessage().getPayload());
+ assertEquals("Service:A", dlsMessage.getAddressingContext().getTo().toString());
+ assertTrue(dlsMessage.getFault() instanceof ServiceException);
+ assertEquals(faultString, dlsMessage.getFault().getMessage());
+ }
+ finally
+ {
+ deployment1.undeploy();
+ }
}
}
\ No newline at end of file
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_014/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_014/RoutingTest.java 2008-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_014/RoutingTest.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -23,14 +23,13 @@
import org.jboss.esb.TestInboundRouter;
import org.jboss.esb.TestOutboundRouter;
import org.jboss.esb.TestService;
-import org.jboss.esb.test.JmsTestRunner;
+import org.jboss.esb.api.bus.BusMessage;
+import org.jboss.esb.api.routing.RoutingException;
+import org.jboss.esb.api.service.ServiceName;
import org.jboss.esb.deploy.DeploymentRuntime;
import org.jboss.esb.deploy.DeploymentUtil;
import org.jboss.esb.failure.DeadLetterPersistanceService;
import org.jboss.esb.failure.MockDeadLetterService;
-import org.jboss.esb.api.bus.BusMessage;
-import org.jboss.esb.api.routing.RoutingException;
-import org.jboss.esb.api.service.ServiceName;
/**
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -47,46 +46,40 @@
*/
public void test() throws Exception
{
- new JmsTestRunner() {
- @Override
- public void test() throws Exception
- {
- ServiceName serviceNameA = new ServiceName("Service", "A");
- DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-deployment.xml"));
+ ServiceName serviceNameA = new ServiceName("Service", "A");
+ DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-deployment.xml"));
- deployment1.setDeploymentName("deployment1");
- deployment1.setDeploymentId("deployment1-Id");
- deployment1.deploy();
- try
- {
- TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", deployment1).getRouter();
- TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
- TestOutboundRouter outrouter = (TestOutboundRouter) DeploymentUtil.getOutboundRouter(serviceNameA, "outrouter", deployment1).getRouter();
- MockDeadLetterService dlService = (MockDeadLetterService) DeploymentUtil.getService(DeadLetterPersistanceService.SERVICE_NAME, deployment1).getService();
- String faultString = "A Routing Exception - should route to DLS.";
+ deployment1.setDeploymentName("deployment1");
+ deployment1.setDeploymentId("deployment1-Id");
+ deployment1.deploy();
+ try
+ {
+ TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", deployment1).getRouter();
+ TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
+ TestOutboundRouter outrouter = (TestOutboundRouter) DeploymentUtil.getOutboundRouter(serviceNameA, "outrouter", deployment1).getRouter();
+ MockDeadLetterService dlService = (MockDeadLetterService) DeploymentUtil.getService(DeadLetterPersistanceService.SERVICE_NAME, deployment1).getService();
+ String faultString = "A Routing Exception - should route to DLS.";
- outrouter.setThrowException(new RoutingException(faultString));
- dlService.setExpectingMessages(true);
+ outrouter.setThrowException(new RoutingException(faultString));
+ dlService.setExpectingMessages(true);
- inrouter.sendMessage("Hi there!!", true);
+ inrouter.sendMessage("Hi there!!", true);
- serviceA.waitForMessage(10000);
+ serviceA.waitForMessage(10000);
- // 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());
- BusMessage dlsMessage = (BusMessage) dlService.getMessages().peek().getPayload();
- assertEquals("Hi there!!", dlsMessage.getMessage().getPayload());
- assertEquals("Service:A", dlsMessage.getAddressingContext().getFrom().toString()); // The service was applied, so the from address should reflect this.
- assertEquals("Service:A", dlsMessage.getAddressingContext().getTo().toString());
- assertTrue(dlsMessage.getFault() instanceof RoutingException);
- assertEquals(faultString, dlsMessage.getFault().getMessage());
- }
- finally
- {
- deployment1.undeploy();
- }
- }
- }.run();
+ // 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());
+ BusMessage dlsMessage = (BusMessage) dlService.getMessages().peek().getPayload();
+ assertEquals("Hi there!!", dlsMessage.getMessage().getPayload());
+ assertEquals("Service:A", dlsMessage.getAddressingContext().getFrom().toString()); // The service was applied, so the from address should reflect this.
+ assertEquals("Service:A", dlsMessage.getAddressingContext().getTo().toString());
+ assertTrue(dlsMessage.getFault() instanceof RoutingException);
+ assertEquals(faultString, dlsMessage.getFault().getMessage());
+ }
+ finally
+ {
+ deployment1.undeploy();
+ }
}
}
\ No newline at end of file
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_015/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_015/RoutingTest.java 2008-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_015/RoutingTest.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -22,10 +22,9 @@
import junit.framework.TestCase;
import org.jboss.esb.TestInboundRouter;
import org.jboss.esb.TestService;
+import org.jboss.esb.api.service.ServiceName;
import org.jboss.esb.deploy.DeploymentRuntime;
import org.jboss.esb.deploy.DeploymentUtil;
-import org.jboss.esb.api.service.ServiceName;
-import org.jboss.esb.test.JmsTestRunner;
import org.milyn.io.StreamUtils;
/**
@@ -39,39 +38,33 @@
*/
public void test() throws Exception
{
- new JmsTestRunner() {
- @Override
- public void test() throws Exception
- {
- ServiceName serviceNameA = new ServiceName("Service", "A");
- ServiceName serviceNameB = new ServiceName("Service", "B");
- DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-deployment.xml"));
+ ServiceName serviceNameA = new ServiceName("Service", "A");
+ ServiceName serviceNameB = new ServiceName("Service", "B");
+ DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-deployment.xml"));
- deployment1.setDeploymentName("deployment1");
- deployment1.setDeploymentId("deployment1-Id");
- deployment1.deploy();
- try
- {
- TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", deployment1).getRouter();
- TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
- TestService serviceB = (TestService) DeploymentUtil.getService(serviceNameB, deployment1).getService();
- String messageV1 = StreamUtils.readStreamAsString(getClass().getResourceAsStream("message_v1.xml"));
- String messageV2 = StreamUtils.readStreamAsString(getClass().getResourceAsStream("message_v2.xml"));
+ deployment1.setDeploymentName("deployment1");
+ deployment1.setDeploymentId("deployment1-Id");
+ deployment1.deploy();
+ try
+ {
+ TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", deployment1).getRouter();
+ TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
+ TestService serviceB = (TestService) DeploymentUtil.getService(serviceNameB, deployment1).getService();
+ String messageV1 = StreamUtils.readStreamAsString(getClass().getResourceAsStream("message_v1.xml"));
+ String messageV2 = StreamUtils.readStreamAsString(getClass().getResourceAsStream("message_v2.xml"));
- inrouter.sendMessage(messageV1);
- inrouter.sendMessage(messageV2);
+ inrouter.sendMessage(messageV1);
+ inrouter.sendMessage(messageV2);
- serviceA.waitForMessage(10000);
- serviceB.waitForMessage(10000);
+ serviceA.waitForMessage(10000);
+ serviceB.waitForMessage(10000);
- assertTrue(StreamUtils.compareCharStreams(messageV1, (String) serviceA.getMessage()));
- assertTrue(StreamUtils.compareCharStreams(messageV2, (String) serviceB.getMessage()));
- }
- finally
- {
- deployment1.undeploy();
- }
- }
- }.run();
+ assertTrue(StreamUtils.compareCharStreams(messageV1, (String) serviceA.getMessage()));
+ assertTrue(StreamUtils.compareCharStreams(messageV2, (String) serviceB.getMessage()));
+ }
+ finally
+ {
+ deployment1.undeploy();
+ }
}
}
\ No newline at end of file
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_016/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_016/RoutingTest.java 2008-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_016/RoutingTest.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -22,10 +22,9 @@
import junit.framework.TestCase;
import org.jboss.esb.TestInboundRouter;
import org.jboss.esb.TestService;
+import org.jboss.esb.api.service.ServiceName;
import org.jboss.esb.deploy.DeploymentRuntime;
import org.jboss.esb.deploy.DeploymentUtil;
-import org.jboss.esb.api.service.ServiceName;
-import org.jboss.esb.test.JmsTestRunner;
/**
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -38,36 +37,30 @@
*/
public void test() throws Exception
{
- new JmsTestRunner() {
- @Override
- public void test() throws Exception
- {
- ServiceName serviceNameA = new ServiceName("Service", "A");
- ServiceName serviceNameB = new ServiceName("Service", "B");
- DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-deployment.xml"));
+ ServiceName serviceNameA = new ServiceName("Service", "A");
+ ServiceName serviceNameB = new ServiceName("Service", "B");
+ DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-deployment.xml"));
- deployment1.setDeploymentName("deployment1");
- deployment1.setDeploymentId("deployment1-Id");
- deployment1.deploy();
- try
- {
- TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", deployment1).getRouter();
- TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
- TestService serviceB = (TestService) DeploymentUtil.getService(serviceNameB, deployment1).getService();
+ deployment1.setDeploymentName("deployment1");
+ deployment1.setDeploymentId("deployment1-Id");
+ deployment1.deploy();
+ try
+ {
+ TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", deployment1).getRouter();
+ TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
+ TestService serviceB = (TestService) DeploymentUtil.getService(serviceNameB, deployment1).getService();
- inrouter.sendMessage("Hello");
+ inrouter.sendMessage("Hello");
- serviceA.waitForMessage(10000);
- serviceB.waitForMessage(10000);
+ serviceA.waitForMessage(10000);
+ serviceB.waitForMessage(10000);
- assertEquals("Hello", serviceA.getMessage());
- assertEquals("Hello", serviceB.getMessage());
- }
- finally
- {
- deployment1.undeploy();
- }
- }
- }.run();
+ assertEquals("Hello", serviceA.getMessage());
+ assertEquals("Hello", serviceB.getMessage());
+ }
+ finally
+ {
+ deployment1.undeploy();
+ }
}
}
\ No newline at end of file
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_017/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_017/RoutingTest.java 2008-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_017/RoutingTest.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -22,10 +22,9 @@
import junit.framework.TestCase;
import org.jboss.esb.TestInboundRouter;
import org.jboss.esb.TestService;
+import org.jboss.esb.api.service.ServiceName;
import org.jboss.esb.deploy.DeploymentRuntime;
import org.jboss.esb.deploy.DeploymentUtil;
-import org.jboss.esb.api.service.ServiceName;
-import org.jboss.esb.test.JmsTestRunner;
/**
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -38,37 +37,31 @@
*/
public void test() throws Exception
{
- new JmsTestRunner() {
- @Override
- public void test() throws Exception
- {
- ServiceName serviceNameA = new ServiceName("Service", "A");
- ServiceName serviceNameB = new ServiceName("Service", "B");
- DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-deployment.xml"));
+ ServiceName serviceNameA = new ServiceName("Service", "A");
+ ServiceName serviceNameB = new ServiceName("Service", "B");
+ DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-deployment.xml"));
- deployment1.setDeploymentName("deployment1");
- deployment1.setDeploymentId("deployment1-Id");
- deployment1.deploy();
- try
- {
- TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", deployment1).getRouter();
- TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
- TestService serviceB = (TestService) DeploymentUtil.getService(serviceNameB, deployment1).getService();
+ deployment1.setDeploymentName("deployment1");
+ deployment1.setDeploymentId("deployment1-Id");
+ deployment1.deploy();
+ try
+ {
+ TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", deployment1).getRouter();
+ TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
+ TestService serviceB = (TestService) DeploymentUtil.getService(serviceNameB, deployment1).getService();
- inrouter.sendMessage("AAA");
- inrouter.sendMessage("BBB");
+ inrouter.sendMessage("AAA");
+ inrouter.sendMessage("BBB");
- serviceA.waitForMessage(10000);
- serviceB.waitForMessage(10000);
+ serviceA.waitForMessage(10000);
+ serviceB.waitForMessage(10000);
- assertEquals("AAA:added-by-inrouter-transformer:added-by-serviceA-router", serviceA.getMessage());
- assertEquals("BBB:added-by-inrouter-transformer:added-by-serviceB-router", serviceB.getMessage());
- }
- finally
- {
- deployment1.undeploy();
- }
- }
- }.run();
+ assertEquals("AAA:added-by-inrouter-transformer:added-by-serviceA-router", serviceA.getMessage());
+ assertEquals("BBB:added-by-inrouter-transformer:added-by-serviceB-router", serviceB.getMessage());
+ }
+ finally
+ {
+ deployment1.undeploy();
+ }
}
}
\ No newline at end of file
Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_018/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_018/RoutingTest.java 2008-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/routing/scenario_018/RoutingTest.java 2008-11-21 13:47:36 UTC (rev 24032)
@@ -22,10 +22,9 @@
import junit.framework.TestCase;
import org.jboss.esb.TestInboundRouter;
import org.jboss.esb.TestService;
+import org.jboss.esb.api.service.ServiceName;
import org.jboss.esb.deploy.DeploymentRuntime;
import org.jboss.esb.deploy.DeploymentUtil;
-import org.jboss.esb.api.service.ServiceName;
-import org.jboss.esb.test.JmsTestRunner;
/**
* @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
@@ -38,37 +37,31 @@
*/
public void test() throws Exception
{
- new JmsTestRunner() {
- @Override
- public void test() throws Exception
- {
- ServiceName serviceNameA = new ServiceName("Service", "A");
- ServiceName serviceNameB = new ServiceName("Service", "B");
- DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-deployment.xml"));
+ ServiceName serviceNameA = new ServiceName("Service", "A");
+ ServiceName serviceNameB = new ServiceName("Service", "B");
+ DeploymentRuntime deployment1 = DeploymentUtil.createRuntime(getClass().getResourceAsStream("01-deployment.xml"));
- deployment1.setDeploymentName("deployment1");
- deployment1.setDeploymentId("deployment1-Id");
- deployment1.deploy();
- try
- {
- TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", deployment1).getRouter();
- TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
- TestService serviceB = (TestService) DeploymentUtil.getService(serviceNameB, deployment1).getService();
+ deployment1.setDeploymentName("deployment1");
+ deployment1.setDeploymentId("deployment1-Id");
+ deployment1.deploy();
+ try
+ {
+ TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter("inrouter", deployment1).getRouter();
+ TestService serviceA = (TestService) DeploymentUtil.getService(serviceNameA, deployment1).getService();
+ TestService serviceB = (TestService) DeploymentUtil.getService(serviceNameB, deployment1).getService();
- inrouter.sendMessage("AAA");
- inrouter.sendMessage("BBB");
+ inrouter.sendMessage("AAA");
+ inrouter.sendMessage("BBB");
- serviceA.waitForMessage(10000);
- serviceB.waitForMessage(10000);
+ serviceA.waitForMessage(10000);
+ serviceB.waitForMessage(10000);
- assertEquals("AAA:added-by-serviceA-router", serviceA.getMessage());
- assertEquals("BBB:added-by-serviceB-router", serviceB.getMessage());
- }
- finally
- {
- deployment1.undeploy();
- }
- }
- }.run();
+ assertEquals("AAA:added-by-serviceA-router", serviceA.getMessage());
+ assertEquals("BBB:added-by-serviceB-router", serviceB.getMessage());
+ }
+ finally
+ {
+ deployment1.undeploy();
+ }
}
}
\ No newline at end of file
Copied: labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/invm/default.properties (from rev 24027, labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/jms/default.properties)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/invm/default.properties (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/invm/default.properties 2008-11-21 13:47:36 UTC (rev 24032)
@@ -0,0 +1,6 @@
+###########################################################################################
+# Default InVM bus config for testing.
+#
+##########################################################################################
+
+invm.threadpool.size=3
\ No newline at end of file
Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/invm/default.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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-11-21 13:00:30 UTC (rev 24031)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/jbossesb-default.properties 2008-11-21 13:47:36 UTC (rev 24032)
@@ -6,7 +6,7 @@
coordinator.heartbeat.frequency=700
# Buses to be deployed...
-bus.jms=org.jboss.esb.federate.bus.jms.JMSBus
+bus.invm=org.jboss.esb.federate.bus.invm.InVMBus
# Pre-installed deployment units...
unit.deadletter=deadletter.xml
More information about the jboss-svn-commits
mailing list