[jboss-svn-commits] JBL Code SVN: r22884 - labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Sep 18 10:50:52 EDT 2008


Author: tfennelly
Date: 2008-09-18 10:50:52 -0400 (Thu, 18 Sep 2008)
New Revision: 22884

Modified:
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/BusTest.java
Log:
added test that reversed the startup order

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/BusTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/BusTest.java	2008-09-18 14:45:44 UTC (rev 22883)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/bus/scenario1/BusTest.java	2008-09-18 14:50:52 UTC (rev 22884)
@@ -35,7 +35,7 @@
 {
 
     /*
-     * This is a simple scenario where there are 3 deployments all connected into the same bus.
+     * 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".
@@ -99,4 +99,61 @@
             }
         }.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();
+    }
 }




More information about the jboss-svn-commits mailing list