[jboss-svn-commits] JBL Code SVN: r22925 - in labs/jbossesb/workspace/skeagh: routing/esb/src/test/java/org/jboss/esb and 7 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Sep 19 10:32:12 EDT 2008


Author: tfennelly
Date: 2008-09-19 10:32:12 -0400 (Fri, 19 Sep 2008)
New Revision: 22925

Added:
   labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/TestInboundRouter.java
   labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/TestOutboundRouter.java
   labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/TestService.java
   labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/
   labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/01-inrouter-config.xml
   labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/02-service-config.xml
   labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/03-outrouter-config.xml
   labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/RoutingTest.java
   labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_002/
   labs/jbossesb/workspace/skeagh/routing/esb/src/test/resources/META-INF/
   labs/jbossesb/workspace/skeagh/routing/esb/src/test/resources/META-INF/jbossesb/
   labs/jbossesb/workspace/skeagh/routing/esb/src/test/resources/META-INF/jbossesb/busconfig/
   labs/jbossesb/workspace/skeagh/routing/esb/src/test/resources/META-INF/jbossesb/busconfig/jms/
   labs/jbossesb/workspace/skeagh/routing/esb/src/test/resources/META-INF/jbossesb/busconfig/jms/default.properties
Removed:
   labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/01-inrouter-config.xml
   labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/02-service-config.xml
   labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/03-outrouter-config.xml
   labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/BusTest.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario2/
Modified:
   labs/jbossesb/workspace/skeagh/routing/esb/src/main/java/org/jboss/esb/ServiceRouter.java
Log:
moved some of the tests around

Modified: labs/jbossesb/workspace/skeagh/routing/esb/src/main/java/org/jboss/esb/ServiceRouter.java
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/esb/src/main/java/org/jboss/esb/ServiceRouter.java	2008-09-19 14:12:52 UTC (rev 22924)
+++ labs/jbossesb/workspace/skeagh/routing/esb/src/main/java/org/jboss/esb/ServiceRouter.java	2008-09-19 14:32:12 UTC (rev 22925)
@@ -225,6 +225,7 @@
                 String deploymentId = entry.getKey();
                 DeploymentMonitor monitor = entry.getValue();
 
+                // Is the deployment online and does it host the target service...
                 if(monitor.isOnline() && monitor.hasService(toServiceName))
                 {
                     BusMessage busMessage = new BusMessage();

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


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

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


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

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


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

Copied: labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001 (from rev 22895, labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1)

Deleted: labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/01-inrouter-config.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/01-inrouter-config.xml	2008-09-18 19:39:08 UTC (rev 22895)
+++ labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/01-inrouter-config.xml	2008-09-19 14:32:12 UTC (rev 22925)
@@ -1,9 +0,0 @@
-<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd" xmlns:xprot="http://www.jboss.org/jbossesb/xsd/xprot/xprot.xsd">
-    
-    <routing>
-        <inRouters serviceCategory="Service" serviceName="A">
-            <inRouter name="inrouter" class="org.jboss.esb.dispatch.HelloInboundRouter" />
-        </inRouters>
-    </routing>
-
-</jbossesb>
\ No newline at end of file

Copied: labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/01-inrouter-config.xml (from rev 22924, labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/01-inrouter-config.xml)
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/01-inrouter-config.xml	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/01-inrouter-config.xml	2008-09-19 14:32:12 UTC (rev 22925)
@@ -0,0 +1,9 @@
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
+    
+    <routing>
+        <inRouters serviceCategory="Service" serviceName="A">
+            <inRouter name="inrouter" class="org.jboss.esb.TestInboundRouter" />
+        </inRouters>
+    </routing>
+
+</jbossesb>
\ No newline at end of file

Deleted: labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/02-service-config.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/02-service-config.xml	2008-09-18 19:39:08 UTC (rev 22895)
+++ labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/02-service-config.xml	2008-09-19 14:32:12 UTC (rev 22925)
@@ -1,7 +0,0 @@
-<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd" xmlns:xprot="http://www.jboss.org/jbossesb/xsd/xprot/xprot.xsd">
-    
-    <services>
-        <service serviceCategory="Service" serviceName="A" serviceDescription="A Service" class="org.jboss.esb.dispatch.HelloWorldService" />
-    </services>
-
-</jbossesb>
\ No newline at end of file

Copied: labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/02-service-config.xml (from rev 22924, labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/02-service-config.xml)
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/02-service-config.xml	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/02-service-config.xml	2008-09-19 14:32:12 UTC (rev 22925)
@@ -0,0 +1,7 @@
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
+    
+    <services>
+        <service serviceCategory="Service" serviceName="A" serviceDescription="A Service" class="org.jboss.esb.TestService" />
+    </services>
+
+</jbossesb>
\ No newline at end of file

Deleted: labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/03-outrouter-config.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/03-outrouter-config.xml	2008-09-18 19:39:08 UTC (rev 22895)
+++ labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/03-outrouter-config.xml	2008-09-19 14:32:12 UTC (rev 22925)
@@ -1,8 +0,0 @@
-<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd" xmlns:xprot="http://www.jboss.org/jbossesb/xsd/xprot/xprot.xsd">
-    
-    <routing>
-        <outRouters serviceCategory="Service" serviceName="A">
-            <outRouter name="outrouter" class="org.jboss.esb.dispatch.HelloOutboundRouter" />
-        </outRouters>
-    </routing>
-</jbossesb>
\ No newline at end of file

Copied: labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/03-outrouter-config.xml (from rev 22924, labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/03-outrouter-config.xml)
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/03-outrouter-config.xml	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/03-outrouter-config.xml	2008-09-19 14:32:12 UTC (rev 22925)
@@ -0,0 +1,9 @@
+<jbossesb xmlns="http://www.jboss.org/jbossesb/xsd/jbossesb-5.0.xsd">
+    
+    <routing>
+        <outRouters serviceCategory="Service" serviceName="A">
+            <outRouter name="outrouter" class="org.jboss.esb.TestOutboundRouter" />
+        </outRouters>
+    </routing>
+    
+</jbossesb>
\ No newline at end of file

Deleted: labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/BusTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/BusTest.java	2008-09-18 19:39:08 UTC (rev 22895)
+++ labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/BusTest.java	2008-09-19 14:32:12 UTC (rev 22925)
@@ -1,159 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright XXXX, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2005-2008, JBoss Inc.
- */
-package org.jboss.esb.federate.bus.scenario1;
-
-import junit.framework.TestCase;
-import org.jboss.esb.deploy.DeploymentRuntime;
-import org.jboss.esb.deploy.DeploymentUtil;
-import org.jboss.esb.dispatch.HelloInboundRouter;
-import org.jboss.esb.dispatch.HelloOutboundRouter;
-import org.jboss.esb.dispatch.HelloWorldService;
-import org.jboss.esb.jms.JMSTestRunner;
-import org.jboss.esb.service.ServiceName;
-
-/**
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class BusTest extends TestCase
-{
-
-    /*
-     * This is a simple scenario where there are 3 deployments all connected into the same bus:
-     * 1. "inrouterDeployment" defines an inrouter for "Service:A".
-     * 2. "serviceDeployment" defines the service instance for "Service:A".
-     * 3. "outrouterDeployment" defines an outrouter for "Service:A".
-     *
-     * The message should get routed from the inrouter onto the bus, get picked
-     * up by "serviceDeployment", run through "Service:A", sent back onto the bus
-     * for "outrouterDeployment", picked up by "outrouterDeployment" and sent to
-     * outrouter for "Service:A".
-     */
-    public void test() throws Exception
-    {
-        new JMSTestRunner() {
-            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
-                    {
-                        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
-                        {
-                            HelloInboundRouter inrouter = (HelloInboundRouter) DeploymentUtil.getInboundRouter(serviceA, "inrouter", inrouterDeployment).getRouter();
-                            HelloWorldService service = (HelloWorldService) DeploymentUtil.getService(serviceA, serviceDeployment).getService();
-                            HelloOutboundRouter outrouter = (HelloOutboundRouter) DeploymentUtil.getOutboundRouter(serviceA, "outrouter", outrouterDeployment).getRouter();
-
-                            inrouter.sendHello("Hi there!!");
-                            Thread.sleep(300); // Allow the message to be delivered
-
-                            // Check that the message has been routed across deployments, from the inrouter
-                            // to the service instance and then to the outrouter...
-                            assertEquals("Hi there!!", service.getHelloMessage());
-                            assertEquals("Hi there!!", outrouter.getHelloMessage());
-                        }
-                        finally
-                        {
-                            inrouterDeployment.undeploy();
-                        }
-                    }
-                    finally
-                    {
-                        serviceDeployment.undeploy();
-                    }
-                }
-                finally
-                {
-                    outrouterDeployment.undeploy();
-                }
-            }
-        }.run();
-    }
-
-    // Reversing the deployment startup order should be ok... should still work...
-    public void test_reverse_startup_order() throws Exception
-    {
-        new JMSTestRunner() {
-            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
-                    {
-                        DeploymentRuntime outrouterDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("03-outrouter-config.xml"));
-
-                        outrouterDeployment.setDeploymentName("outrouter");
-                        outrouterDeployment.deploy();
-
-                        Thread.sleep(100); // Allow the deployments to exchange deployment details
-                        try
-                        {
-                            HelloInboundRouter inrouter = (HelloInboundRouter) DeploymentUtil.getInboundRouter(serviceA, "inrouter", inrouterDeployment).getRouter();
-                            HelloWorldService service = (HelloWorldService) DeploymentUtil.getService(serviceA, serviceDeployment).getService();
-                            HelloOutboundRouter outrouter = (HelloOutboundRouter) DeploymentUtil.getOutboundRouter(serviceA, "outrouter", outrouterDeployment).getRouter();
-
-                            inrouter.sendHello("Hi there!!");
-                            Thread.sleep(100); // Allow the message to be delivered
-
-                            // Check that the message has been routed across deployments, from the inrouter
-                            // to the service instance and then to the outrouter...
-                            assertEquals("Hi there!!", service.getHelloMessage());
-                            assertEquals("Hi there!!", outrouter.getHelloMessage());
-                        }
-                        finally
-                        {
-                            outrouterDeployment.undeploy();
-                        }
-                    }
-                    finally
-                    {
-                        serviceDeployment.undeploy();
-                    }
-                }
-                finally
-                {
-                    inrouterDeployment.undeploy();
-                }
-            }
-        }.run();
-    }
-}

Added: labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/RoutingTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/RoutingTest.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_001/RoutingTest.java	2008-09-19 14:32:12 UTC (rev 22925)
@@ -0,0 +1,159 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright XXXX, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2005-2008, JBoss Inc.
+ */
+package org.jboss.esb.scenario_001;
+
+import junit.framework.TestCase;
+import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.deploy.DeploymentUtil;
+import org.jboss.esb.TestInboundRouter;
+import org.jboss.esb.TestOutboundRouter;
+import org.jboss.esb.TestService;
+import org.jboss.esb.jms.JMSTestRunner;
+import org.jboss.esb.service.ServiceName;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class RoutingTest extends TestCase
+{
+
+    /*
+     * This is a simple scenario where there are 3 deployments all connected into the same bus:
+     * 1. "inrouterDeployment" defines an inrouter for "Service:A".
+     * 2. "serviceDeployment" defines the service instance for "Service:A".
+     * 3. "outrouterDeployment" defines an outrouter for "Service:A".
+     *
+     * The message should get routed from the inrouter onto the bus, get picked
+     * up by "serviceDeployment", run through "Service:A", sent back onto the bus
+     * for "outrouterDeployment", picked up by "outrouterDeployment" and sent to
+     * outrouter for "Service:A".
+     */
+    public void test() throws Exception
+    {
+        new JMSTestRunner() {
+            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
+                    {
+                        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(serviceA, "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, 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();
+                    }
+                }
+                finally
+                {
+                    outrouterDeployment.undeploy();
+                }
+            }
+        }.run();
+    }
+
+    // Reversing the deployment startup order should be ok... should still work...
+    public void test_reverse_startup_order() throws Exception
+    {
+        new JMSTestRunner() {
+            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
+                    {
+                        DeploymentRuntime outrouterDeployment = DeploymentUtil.createRuntime(getClass().getResourceAsStream("03-outrouter-config.xml"));
+
+                        outrouterDeployment.setDeploymentName("outrouter");
+                        outrouterDeployment.deploy();
+
+                        Thread.sleep(300); // Allow the deployments to exchange deployment details
+                        try
+                        {
+                            TestInboundRouter inrouter = (TestInboundRouter) DeploymentUtil.getInboundRouter(serviceA, "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();
+                    }
+                }
+                finally
+                {
+                    inrouterDeployment.undeploy();
+                }
+            }
+        }.run();
+    }
+}


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

Copied: labs/jbossesb/workspace/skeagh/routing/esb/src/test/java/org/jboss/esb/scenario_002 (from rev 22910, labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario2)

Copied: labs/jbossesb/workspace/skeagh/routing/esb/src/test/resources/META-INF/jbossesb/busconfig/jms/default.properties (from rev 22895, labs/jbossesb/workspace/skeagh/routing/jms/src/test/resources/META-INF/jbossesb/busconfig/jms/default.properties)
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/esb/src/test/resources/META-INF/jbossesb/busconfig/jms/default.properties	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/routing/esb/src/test/resources/META-INF/jbossesb/busconfig/jms/default.properties	2008-09-19 14:32:12 UTC (rev 22925)
@@ -0,0 +1,20 @@
+###########################################################################################
+# Default JMS bus config for testing.
+#
+# Using ActiveMQ because it's so easy to embed.  Apparently JBM v2.0 will also be
+# easy to embed.  We might be able to switch to that then!!
+##########################################################################################
+
+# JNDI Settings...
+# NOTE: The JNDI settings in this config file must be the same as those
+# set in the JMSTestRunner class!!
+java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory
+java.naming.provider.url=tcp://localhost:61717
+
+# Bus Queues and Topics...
+deployment.coordintation.topic=jbossesb.deployment.coordintation.topic
+deployment.bus.queue=jbossesb.jms.bus
+
+# ActiveMQ Queue and Topic deployments...
+topic.jbossesb.deployment.coordintation.topic=jbossesb.deployment.coordintation.topic
+queue.jbossesb.jms.bus=jbossesb.jms.bus


Property changes on: labs/jbossesb/workspace/skeagh/routing/esb/src/test/resources/META-INF/jbossesb/busconfig/jms/default.properties
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:mergeinfo
   + 
Name: svn:eol-style
   + native




More information about the jboss-svn-commits mailing list