[jboss-svn-commits] JBL Code SVN: r22553 - in labs/jbossesb/workspace/skeagh: commons/src/main/java/org/jboss/esb/properties and 10 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Sep 9 17:15:54 EDT 2008


Author: tfennelly
Date: 2008-09-09 17:15:54 -0400 (Tue, 09 Sep 2008)
New Revision: 22553

Added:
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentServiceSets.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/deployment-01.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/deployment-02.xml
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/deployment-03.xml
Modified:
   labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/service/ServiceName.java
   labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/properties/ApplicationProperties.java
   labs/jbossesb/workspace/skeagh/commons/src/test/java/org/jboss/esb/properties/PropertyReplacementTest.java
   labs/jbossesb/workspace/skeagh/commons/src/test/java/org/jboss/esb/properties/props.properties
   labs/jbossesb/workspace/skeagh/routing/jms/src/test/resources/META-INF/jbossesb/busconfig/jms/default.properties
   labs/jbossesb/workspace/skeagh/runtime/pom.xml
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentDetailsNotification.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentHeartbeatNotification.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentUndeployNotification.java
   labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/busconfig/jms/default.properties
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentDetailsNotificationTest.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentHeartbeatNotificationTest.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentUndeployNotificationTest.java
   labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/busconfig/jms/default.properties
Log:
More Deployment Coordintation.

Modified: labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/service/ServiceName.java
===================================================================
--- labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/service/ServiceName.java	2008-09-09 16:25:08 UTC (rev 22552)
+++ labs/jbossesb/workspace/skeagh/api/service/src/main/java/org/jboss/esb/service/ServiceName.java	2008-09-09 21:15:54 UTC (rev 22553)
@@ -22,6 +22,8 @@
 import org.jboss.esb.annotations.Property;
 import org.jboss.esb.util.AssertArgument;
 
+import java.io.Serializable;
+
 /**
  * Service Name.
  *
@@ -30,7 +32,7 @@
  * @author <a href="mailto:dbevenius at redhat.com">Daniel Bevenius</a>
  * @author <a href="mailto:tom.fennelly at jboss.com">Tom Fennelly</a>
  */
-public final class ServiceName
+public final class ServiceName implements Serializable
 {
 
     /**

Modified: labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/properties/ApplicationProperties.java
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/properties/ApplicationProperties.java	2008-09-09 16:25:08 UTC (rev 22552)
+++ labs/jbossesb/workspace/skeagh/commons/src/main/java/org/jboss/esb/properties/ApplicationProperties.java	2008-09-09 21:15:54 UTC (rev 22553)
@@ -114,4 +114,35 @@
             property.setValue(value);
         }
     }
+
+    /**
+     * Get a boolean property value.
+     * @param key Property key.
+     * @param defaultVal Default property value.
+     * @return True if the value of the property is "true", otherwise the defaultVal.
+     */
+    public boolean getBooleanProperty(String key, boolean defaultVal)
+    {
+        String value = getProperty(key, Boolean.toString(defaultVal));
+        return value.trim().equals("true");
+    }
+
+    /**
+     * Get a long property value.
+     * @param key Property key.
+     * @param defaultVal Default property value.
+     * @return The long value of the property if it is a valid long, otherwise the defaultVal.
+     */
+    public long getLongProperty(String key, long defaultVal)
+    {
+        String value = getProperty(key, Long.toString(defaultVal));
+        try
+        {
+            return Long.parseLong(value.trim());
+        }
+        catch (NumberFormatException e)
+        {
+            return defaultVal;
+        }
+    }
 }

Modified: labs/jbossesb/workspace/skeagh/commons/src/test/java/org/jboss/esb/properties/PropertyReplacementTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/src/test/java/org/jboss/esb/properties/PropertyReplacementTest.java	2008-09-09 16:25:08 UTC (rev 22552)
+++ labs/jbossesb/workspace/skeagh/commons/src/test/java/org/jboss/esb/properties/PropertyReplacementTest.java	2008-09-09 21:15:54 UTC (rev 22553)
@@ -19,10 +19,14 @@
  */
 package org.jboss.esb.properties;
 
-import java.io.*;
-
 import junit.framework.TestCase;
 
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
+
 /**
  * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
  */
@@ -44,8 +48,13 @@
 		assertEquals("http://localhost:8080/myapp/index.html", properties.getProperty("index.prop.url"));
 		assertEquals("localhost", properties.getProperty("HOST_NAME"));
 		assertEquals("8080", properties.getProperty("HOST_PORT"));
-		assertEquals("xxxx${x.y}", properties.getProperty("someotherprop"));		
-	}
+        assertEquals(8080L, properties.getLongProperty("HOST_PORT", 2000L));
+        assertEquals(2000L, properties.getLongProperty("X", 2000L));
+		assertEquals("xxxx${x.y}", properties.getProperty("someotherprop"));
+        assertEquals(true, properties.getBooleanProperty("someboolval", false));        
+        assertEquals(true, properties.getBooleanProperty("x", true));        
+        assertEquals(false, properties.getBooleanProperty("x", false));        
+    }
 
     public void test_StreamTokeReplacer() throws IOException {
         StreamTokenReplacer replacer = new StreamTokenReplacer();

Modified: labs/jbossesb/workspace/skeagh/commons/src/test/java/org/jboss/esb/properties/props.properties
===================================================================
--- labs/jbossesb/workspace/skeagh/commons/src/test/java/org/jboss/esb/properties/props.properties	2008-09-09 16:25:08 UTC (rev 22552)
+++ labs/jbossesb/workspace/skeagh/commons/src/test/java/org/jboss/esb/properties/props.properties	2008-09-09 21:15:54 UTC (rev 22553)
@@ -2,4 +2,5 @@
 HOST_NAME=localhost
 index.prop.url=http://${local.HOST_NAME}:${HOST_PORT}/myapp/index.html
 HOST_PORT=8080
-someotherprop=xxxx${x.y}
\ No newline at end of file
+someotherprop=xxxx${x.y}
+someboolval=true
\ No newline at end of file

Modified: labs/jbossesb/workspace/skeagh/routing/jms/src/test/resources/META-INF/jbossesb/busconfig/jms/default.properties
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/jms/src/test/resources/META-INF/jbossesb/busconfig/jms/default.properties	2008-09-09 16:25:08 UTC (rev 22552)
+++ labs/jbossesb/workspace/skeagh/routing/jms/src/test/resources/META-INF/jbossesb/busconfig/jms/default.properties	2008-09-09 21:15:54 UTC (rev 22553)
@@ -15,4 +15,8 @@
 deployment.coordintation.topic=jbossesb.deployment.coordintation.topic
 
 # ActiveMQ Queue and Topic deployments...
-topic.jbossesb.deployment.coordintation.topic=jbossesb.deployment.coordintation.topic
\ No newline at end of file
+topic.jbossesb.deployment.coordintation.topic=jbossesb.deployment.coordintation.topic
+
+# Coordination settings...
+coordinator.heartbeat.frequency=700
+coordinator.monitor.timout=3000

Modified: labs/jbossesb/workspace/skeagh/runtime/pom.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/pom.xml	2008-09-09 16:25:08 UTC (rev 22552)
+++ labs/jbossesb/workspace/skeagh/runtime/pom.xml	2008-09-09 21:15:54 UTC (rev 22553)
@@ -45,6 +45,16 @@
             <artifactId>quartz</artifactId>
             <version>1.5.2</version>
         </dependency>
+
+        <!--
+            Test dependencies...
+        -->
+        <dependency>
+            <groupId>jboss.jbossesb</groupId>
+            <artifactId>jbossesb-testutil</artifactId>
+            <version>${jboss.esb.version}</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <repositories>

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java	2008-09-09 16:25:08 UTC (rev 22552)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/deploy/DeploymentRuntime.java	2008-09-09 21:15:54 UTC (rev 22553)
@@ -37,6 +37,7 @@
 import org.jboss.esb.service.Service;
 import org.jboss.esb.service.ServiceName;
 import org.jboss.esb.util.AssertArgument;
+import org.jboss.esb.properties.ApplicationProperties;
 
 import java.lang.reflect.InvocationTargetException;
 import java.util.ArrayList;
@@ -72,7 +73,7 @@
     /**
      * Unique deployment ID.
      */
-    private String deploymentID = UUID.randomUUID().toString().replace('-', 'x');
+    private String deploymentId = UUID.randomUUID().toString().replace('-', 'x');
     /**
      * The list of configurations associated with this deployment instance.
      */
@@ -99,14 +100,10 @@
      * Undeployed Objects List.
      */
     private List<Object> undeployedObjects = new ArrayList<Object>();
-
     /**
-     * Public default constructor.
+     * The deployment coordintaor for the deployment.
      */
-    public DeploymentRuntime()
-    {
-        this.context = new DeploymentContext();
-    }
+    private DeploymentCoordinator deploymentCoordinator;
 
     /**
      * Get the deployment name.
@@ -132,18 +129,18 @@
      * Get the deployment ID.
      * @return The deployment ID.
      */
-    public final String getDeploymentID()
+    public final String getDeploymentId()
     {
-        return deploymentID;
+        return deploymentId;
     }
 
     /**
      * Set the deployment ID.
-     * @param deploymentID The deployment ID.
+     * @param deploymentId The deployment ID.
      */
-    public final void setDeploymentID(final String deploymentID)
+    public final void setDeploymentId(final String deploymentId)
     {
-        this.deploymentID = deploymentID;
+        this.deploymentId = deploymentId;
     }
 
     /**
@@ -197,6 +194,13 @@
     {
         assertConfigurationsAdded();
 
+        if(context != null)
+        {
+            throw new DeploymentException("Runtime already deployed.");
+        }
+
+        context = new DeploymentContext();
+
         logger.info("Starting JBoss ESB deployment: '" + deploymentName + "'.");
         try
         {
@@ -235,6 +239,8 @@
         // Undeploy all objects that were deployed on ESB Startup...
         undeploy(deployedObjects);
         logger.info("JBoss ESB undeployment completed successfully: '" + deploymentName + "'.");
+
+        context = null;
     }
 
     /**
@@ -442,16 +448,17 @@
      */
     private void deployDeploymentCoordinator() throws DeploymentException
     {
-        DeploymentCoordinator coordinator = new DeploymentCoordinator(this);
+        deploymentCoordinator = new DeploymentCoordinator(this);
         try
         {
-            SimpleSchedule schedule = new SimpleSchedule();
+            SimpleSchedule heartbeatSchedule = new SimpleSchedule();
+            ApplicationProperties localBusProperties = DeploymentCoordinator.getBusConfig("jms", deploymentName);
 
-            schedule.setFrequency(1000);
-            schedule.setExecCount(-1);
-            deployResource(DeploymentCoordinator.DEPLOYMENT_COORDINTATION_SCHEDULE_KEY, schedule, deployedResources);
-            coordinator.setScheduleResourceId(DeploymentCoordinator.DEPLOYMENT_COORDINTATION_SCHEDULE_KEY);
-            deployObject(coordinator, "DeploymentCoordinator", null);
+            heartbeatSchedule.setFrequency(localBusProperties.getLongProperty(DeploymentCoordinator.COORDINATOR_HEARTBEAT_FREQUENCY_KEY, 5000));
+            heartbeatSchedule.setExecCount(-1);
+            deployResource(DeploymentCoordinator.DEPLOYMENT_COORDINTATION_SCHEDULE_KEY, heartbeatSchedule, deployedResources);
+            deploymentCoordinator.setScheduleResourceId(DeploymentCoordinator.DEPLOYMENT_COORDINTATION_SCHEDULE_KEY);
+            deployObject(deploymentCoordinator, "DeploymentCoordinator", null);
         }
         catch (Throwable t)
         {
@@ -460,6 +467,15 @@
     }
 
     /**
+     * Get the deployment coordintaor for the deployment.
+     * @return The deployment coordinator.
+     */
+    public final DeploymentCoordinator getDeploymentCoordinator()
+    {
+        return deploymentCoordinator;
+    }
+
+    /**
      * Get the named Service instance from the specified {@link org.jboss.esb.deploy.config.DeploymentUnit}.
      *
      * @param deploymentUnit The configuration unit.

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-09-09 16:25:08 UTC (rev 22552)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentCoordinator.java	2008-09-09 21:15:54 UTC (rev 22553)
@@ -25,8 +25,10 @@
 import org.jboss.esb.classpath.ClassUtil;
 import org.jboss.esb.deploy.DeploymentException;
 import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.federate.notify.AbstractDeploymentNotification;
 import org.jboss.esb.federate.notify.DeploymentDetailsNotification;
 import org.jboss.esb.federate.notify.DeploymentHeartbeatNotification;
+import org.jboss.esb.federate.notify.DeploymentUndeployNotification;
 import org.jboss.esb.jms.AbstractMessageListener;
 import org.jboss.esb.jms.MessageSender;
 import org.jboss.esb.properties.ApplicationProperties;
@@ -36,17 +38,21 @@
 
 import javax.jms.JMSException;
 import javax.jms.Message;
+import javax.jms.ObjectMessage;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.Map;
 import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * Deployment Coordinator.
  * <p/>
  * Manages relationships between local deployments e.g. deployed in the same
- * container.
+ * container, on the same machine etc.
  *
  * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
  */
@@ -64,6 +70,10 @@
      * Default deployment coordination topic name.
      */
     public static final String DEFAULT_DEPLOYMENT_COORDINTATION_TOPIC_NAME = "jbossesb.deployment.coordintation.topic";
+    /**
+     * Heartbeat frequency config key.
+     */
+    public static final String COORDINATOR_HEARTBEAT_FREQUENCY_KEY = "coordinator.heartbeat.frequency";
 
     /**
      * Logger.
@@ -78,6 +88,10 @@
      */
     private DeploymentHeartbeatNotification heartbeatNotification;
     /**
+     * Flag for turning on/off heartbeat broadcasting.
+     */
+    private boolean broadcastHeartbeat = true;
+    /**
      * Service details notification object.
      */
     private DeploymentDetailsNotification detailsNotification;
@@ -89,6 +103,14 @@
      * Deployment coordination broadcaster.
      */
     private MessageSender coordinationBroadcaster;
+    /**
+     * Deployment monitors.
+     */
+    private Map<String, DeploymentMonitor> deploymentMonitors = new ConcurrentHashMap<String, DeploymentMonitor>();
+    /**
+     * Coordinator monitor timeout.  The number of milliseconds before a deployment is marked as offline.
+     */
+    private long monitorTimeout;
 
     /**
      * Public constructor.
@@ -111,7 +133,7 @@
     @Initialize
     public void initialize() throws DeploymentException
     {
-        Properties localBusProperties = null;
+        ApplicationProperties localBusProperties;
         try
         {
             localBusProperties = DeploymentCoordinator.getBusConfig("jms", runtime.getDeploymentName());
@@ -129,11 +151,17 @@
                 try
                 {
                     connectCoordinationBroadcaster(localBusProperties);
+
+                    // Tell all other deployments we're online, what services we have etc...
+                    sendNotification(detailsNotification);
                 }
                 catch (Throwable t)
                 {
                     throw new DeploymentException("Unable to initialize Deployment Coordinator.", t);
                 }
+
+                // Set the monitoring timeout - 4 heartbeats...
+                monitorTimeout = (localBusProperties.getLongProperty(COORDINATOR_HEARTBEAT_FREQUENCY_KEY, 5000) * 4);
             }
         }
     }
@@ -144,6 +172,16 @@
     @Uninitialize
     public void uninitialize()
     {
+        try
+        {
+            // Tell all other deployments we're no longer online...
+            sendNotification(DeploymentUndeployNotification.toNotification(runtime));
+        }
+        catch (Throwable t)
+        {
+            logger.warn("Error sending undeploy notification'.", t);
+        }
+
         if (coordinationListener != null && coordinationListener.isConnected())
         {
             try
@@ -155,6 +193,7 @@
                 logger.warn("Error closing deployment coordination listener for deployment '" + runtime.getDeploymentName() + "'.", t);
             }
         }
+
         if (coordinationBroadcaster != null && coordinationBroadcaster.isConnected())
         {
             try
@@ -175,24 +214,148 @@
      */
     public final void onSchedule() throws SchedulingException
     {
+        if (coordinationBroadcaster != null)
+        {
+            try
+            {
+                if(broadcastHeartbeat)
+                {
+                    // Tell all other deployments we're alive...
+                    sendNotification(heartbeatNotification);
+                }
+
+                // TODO: Do we need to synchronize this?  The ConcurrentHashMap docs would suggest it's OK to iterate the Map as long as you don't use an Iterator....
+                long currentTime = System.currentTimeMillis();
+                Set<Map.Entry<String, DeploymentMonitor>> deploymentMonitorSet = deploymentMonitors.entrySet();
+                for (Map.Entry<String, DeploymentMonitor> entry : deploymentMonitorSet)
+                {
+                    DeploymentMonitor deploymentMonitor = entry.getValue();
+                    if (currentTime > deploymentMonitor.lastHeartbeat + monitorTimeout)
+                    {
+                        deploymentMonitor.online = false;
+                    }
+                }
+            }
+            catch (Throwable t)
+            {
+                logger.warn("Error sending deployment heartbeat notification'.", t);
+            }
+        }
     }
 
     /**
+     * Turn on/off heartbeat broadcasting.
+     *
+     * @param broadcastHeartbeat True if heartbeat broadcasting is to be turned on, otherwise false.
+     */
+    protected final void setBroadcastHeartbeat(final boolean broadcastHeartbeat)
+    {
+        this.broadcastHeartbeat = broadcastHeartbeat;
+    }
+
+    /**
+     * Get the deployment monitors being managed by this deployment.
+     *
+     * @return The deployment monitors being managed by this deployment.
+     */
+    public final Map<String, DeploymentMonitor> getDeploymentMonitors()
+    {
+        return deploymentMonitors;
+    }
+
+    /**
      * Coordination Event Listener.
      */
     private class CoordinationListener extends AbstractMessageListener
     {
+        /**
+         * Constructor.
+         *
+         * @param destinationName Destination name.
+         * @param jndiProperties  JNDI properties.
+         */
         protected CoordinationListener(final String destinationName, final Properties jndiProperties)
         {
             super(destinationName, jndiProperties);
         }
 
+        /**
+         * Handle a coordination event from other deployments.
+         *
+         * @param message Coordination message.
+         */
         public void onMessage(Message message)
         {
+            if (message instanceof ObjectMessage)
+            {
+                try
+                {
+                    Object objectMessage = ((ObjectMessage) message).getObject();
+
+                    if (objectMessage instanceof AbstractDeploymentNotification)
+                    {
+                        AbstractDeploymentNotification notification = (AbstractDeploymentNotification) objectMessage;
+                        String deploymentId = notification.getId();
+
+                        // If it's not a notification from this deployment...
+                        if (!runtime.getDeploymentId().equals(deploymentId))
+                        {
+                            if (notification instanceof DeploymentHeartbeatNotification)
+                            {
+                                DeploymentMonitor deploymentMonitor = deploymentMonitors.get(deploymentId);
+                                if (deploymentMonitor != null)
+                                {
+                                    deploymentMonitor.lastHeartbeat = System.currentTimeMillis();
+                                    deploymentMonitor.online = true;
+                                }
+                                else
+                                {
+                                    logger.warn("Deployment '" + runtime.getDeploymentName() + ":" + runtime.getDeploymentId() + "' received heartbeat from unknown deployment '" + notification.getName() + ":" + notification.getId() + "'.");
+                                }
+                            }
+                            else if (notification instanceof DeploymentDetailsNotification)
+                            {
+                                if (!deploymentMonitors.containsKey(deploymentId))
+                                {
+                                    DeploymentDetailsNotification deployNotification = (DeploymentDetailsNotification) notification;
+
+                                    // New deployment.  Add a monitor...
+                                    deploymentMonitors.put(deploymentId, new DeploymentMonitor(deployNotification.getServiceSet()));
+                                    // Send out the deployment details of this deployment so the new deployment
+                                    // can register them....
+                                    sendNotification(detailsNotification);
+                                }
+                            }
+                            else if (notification instanceof DeploymentUndeployNotification)
+                            {
+                                deploymentMonitors.remove(notification.getId());
+                            }
+                        }
+                    }
+                }
+                catch (JMSException e)
+                {
+                    logger.warn("Unable to get Object from JMS ObjectMessage.", e);
+                }
+            }
         }
     }
 
     /**
+     * Send a coordination notification.
+     *
+     * @param notification The notification to be sent.
+     * @throws JMSException An error occured while sending notification.
+     */
+    private void sendNotification(AbstractDeploymentNotification notification) throws JMSException
+    {
+        if (coordinationBroadcaster != null)
+        {
+            coordinationBroadcaster.send(coordinationBroadcaster.getSession().createObjectMessage(notification));
+        }
+    }
+
+    /**
      * Get the bus configuration for the specified protocol and deployment name combination.
      * <p/>
      * Checks in the following order:
@@ -211,7 +374,7 @@
      * @return The bus configuration as a {@link Properties} instance.
      * @throws IOException Unable to read configuration.
      */
-    public static Properties getBusConfig(final String protocol, final String deploymentName) throws IOException
+    public static ApplicationProperties getBusConfig(final String protocol, final String deploymentName) throws IOException
     {
         String firstCheckPath = "busconfig/" + protocol + "/" + deploymentName + ".properties";
         String secondCheckPath = "/META-INF/jbossesb/" + firstCheckPath;
@@ -248,10 +411,10 @@
         }
 
         logger.debug("Unable to find JBoss ESB Bus configuration for protocol '" + protocol + "', deployment '" + deploymentName + "'. Tried:\n" +
-                "\t1. File: "       + firstCheckPath + "\n" +
-                "\t2. Classpath: "  + secondCheckPath + "\n" +
-                "\t3. File: "       + thirdCheckPath + "\n" +
-                "\t4. Classpath: "  + fourthCheckPath);
+                "\t1. File: " + firstCheckPath + "\n" +
+                "\t2. Classpath: " + secondCheckPath + "\n" +
+                "\t3. File: " + thirdCheckPath + "\n" +
+                "\t4. Classpath: " + fourthCheckPath);
 
         return null;
     }
@@ -263,7 +426,7 @@
      * @return The {@link Properties} instance.
      * @throws IOException Unable to read the configuration.
      */
-    private static Properties readConfig(InputStream configStream) throws IOException
+    private static ApplicationProperties readConfig(InputStream configStream) throws IOException
     {
         try
         {
@@ -326,4 +489,65 @@
                     "JNDI properties used: " + localBusProperties, e);
         }
     }
+
+    /**
+     * Deployment Monitor.
+     */
+    public static class DeploymentMonitor
+    {
+        /**
+         * Time of last received heartbeat.
+         */
+        private long lastHeartbeat;
+        /**
+         * Deployment Service Sets.
+         */
+        private DeploymentServiceSets serviceSets;
+        /**
+         * Deployment online/offline flag.
+         */
+        private boolean online;
+
+        /**
+         * Constructor.
+         *
+         * @param serviceSets Deployment Service sets.
+         */
+        private DeploymentMonitor(DeploymentServiceSets serviceSets)
+        {
+            this.lastHeartbeat = System.currentTimeMillis();
+            this.serviceSets = serviceSets;
+            this.online = true;
+        }
+
+        /**
+         * Is the deployment online.
+         *
+         * @return True if the deployment is online, otherwise false.
+         */
+        public final boolean isOnline()
+        {
+            return online;
+        }
+
+        /**
+         * Get the DeploymentServiceSets associated with the monitored deployment.
+         *
+         * @return The DeploymentServiceSets.
+         */
+        public final DeploymentServiceSets getServiceSets()
+        {
+            return serviceSets;
+        }
+
+        /**
+         * Monitor toString.
+         *
+         * @return String representation of the monitor.
+         */
+        public String toString()
+        {
+            return "{online=" + online + "} " + serviceSets.toString();
+        }
+    }
 }

Copied: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentServiceSets.java (from rev 22543, labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentDetailsNotification.java)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentServiceSets.java	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/DeploymentServiceSets.java	2008-09-09 21:15:54 UTC (rev 22553)
@@ -0,0 +1,143 @@
+/*
+ * 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;
+
+import org.jboss.esb.service.ServiceName;
+
+import java.io.Serializable;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+/**
+ * Deployment Service Sets.
+ * <p/>
+ * The Services for which a Deployment defines the following:
+ * <ul>
+ * <li>A Service.</li>
+ * <li>One or more {@link org.jboss.esb.routing.OutboundRouter OutboundRouters}.</li>
+ * </ul>
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class DeploymentServiceSets implements Serializable
+{
+    /**
+     * The deployment name.
+     */
+    private String deploymentName;
+    /**
+     * The deployment ID.
+     */
+    private String deploymentId;
+    /**
+     * The list of services contained in the deployment.
+     */
+    private Set<ServiceName> services = new LinkedHashSet<ServiceName>();
+
+    /**
+     * The list of services for which the deployment defines outbound routers.
+     */
+    private Set<ServiceName> outboundRoutedServices = new LinkedHashSet<ServiceName>();
+
+    /**
+     * Get the deployment name.
+     * @return The deployment name.
+     */
+    public final String getDeploymentName()
+    {
+        return deploymentName;
+    }
+
+    /**
+     * Set the deployment name.
+     * @param deploymentName The deployment name.
+     */
+    public final void setDeploymentName(final String deploymentName)
+    {
+        this.deploymentName = deploymentName;
+    }
+
+    /**
+     * Get the deployment ID.
+     * @return The deployment ID.
+     */
+    public final String getDeploymentId()
+    {
+        return deploymentId;
+    }
+
+    /**
+     * Set the deployment ID.
+     * @param deploymentId The deployment ID.
+     */
+    public final void setDeploymentId(final String deploymentId)
+    {
+        this.deploymentId = deploymentId;
+    }
+
+    /**
+     * Get the deployment service list.
+     *
+     * @return The deployment service list.
+     */
+    public final Set<ServiceName> getServices()
+    {
+        return services;
+    }
+
+    /**
+     * Set the deployment service list.
+     *
+     * @param services The deployment service list.
+     */
+    public final void setServices(final Set<ServiceName> services)
+    {
+        this.services = services;
+    }
+
+    /**
+     * Get the list of services for which the deployment defines outbound routers.
+     *
+     * @return The list of services for which the deployment defines outbound routers
+     */
+    public final Set<ServiceName> getOutboundRoutedServices()
+    {
+        return outboundRoutedServices;
+    }
+
+    /**
+     * Set the list of services for which the deployment defines outbound routers.
+     *
+     * @param outboundRoutedServices The list of services for which the deployment defines outbound routers
+     */
+    public final void setOutboundRoutedServices(final Set<ServiceName> outboundRoutedServices)
+    {
+        this.outboundRoutedServices = outboundRoutedServices;
+    }
+
+    /**
+     * Deployment Service Sets toString.
+     * @return String representation of the deployment coordintation info.
+     */
+    public final String toString()
+    {
+        return deploymentName + ":" + deploymentId + "[Services: " + services + "][OutboundRoutedServices: " + outboundRoutedServices + "]";
+    }
+}
\ No newline at end of file


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

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentDetailsNotification.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentDetailsNotification.java	2008-09-09 16:25:08 UTC (rev 22552)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentDetailsNotification.java	2008-09-09 21:15:54 UTC (rev 22553)
@@ -21,11 +21,9 @@
 
 import org.jboss.esb.deploy.DeploymentRuntime;
 import org.jboss.esb.deploy.config.DeploymentUnit;
-import org.jboss.esb.service.ServiceName;
+import org.jboss.esb.federate.DeploymentServiceSets;
 
-import java.util.LinkedHashSet;
 import java.util.List;
-import java.util.Set;
 
 /**
  * Deployment details notification.
@@ -40,49 +38,27 @@
     /**
      * The list of services contained in the deployment.
      */
-    private Set<ServiceName> services;
-    /**
-     * The list of services for which the deployment defines outbound routers.
-     */
-    private Set<ServiceName> outboundRoutedServices;
+    private DeploymentServiceSets serviceSet = new DeploymentServiceSets();
 
     /**
-     * Get the deployment service list.
-     * @return The deployment service list.
+     * Get the Deployment Service Sets.
+     * @return The Deployment Service Sets.
      */
-    public final Set<ServiceName> getServices()
+    public DeploymentServiceSets getServiceSet()
     {
-        return services;
+        return serviceSet;
     }
 
     /**
-     * Set the deployment service list.
-     * @param services The deployment service list.
+     * Set the Deployment Service Sets.
+     * @param serviceSet The Deployment Service Sets.
      */
-    public final void setServices(final Set<ServiceName> services)
+    public void setServiceSet(DeploymentServiceSets serviceSet)
     {
-        this.services = services;
+        this.serviceSet = serviceSet;
     }
 
     /**
-     * Get the list of services for which the deployment defines outbound routers
-     * @return The list of services for which the deployment defines outbound routers
-     */
-    public final Set<ServiceName> getOutboundRoutedServices()
-    {
-        return outboundRoutedServices;
-    }
-
-    /**
-     * Set the list of services for which the deployment defines outbound routers
-     * @param outboundRoutedServices The list of services for which the deployment defines outbound routers
-     */
-    public final void setOutboundRoutedServices(final Set<ServiceName> outboundRoutedServices)
-    {
-        this.outboundRoutedServices = outboundRoutedServices;
-    }
-
-    /**
      * DeploymentRuntime to DeploymentDetailsNotification helper method.
      * @param runtime The DeploymentRuntime instance.
      * @return The DeploymentDetailsNotification instance.
@@ -92,20 +68,20 @@
         DeploymentDetailsNotification notification = new DeploymentDetailsNotification();
 
         notification.setName(runtime.getDeploymentName());
-        notification.setId(runtime.getDeploymentID());
-        notification.services = new LinkedHashSet<ServiceName>();
-        notification.outboundRoutedServices = new LinkedHashSet<ServiceName>();
+        notification.serviceSet.setDeploymentName(runtime.getDeploymentName());
+        notification.setId(runtime.getDeploymentId());
+        notification.serviceSet.setDeploymentId(runtime.getDeploymentId());
 
         List<DeploymentUnit> deploymentUnits = runtime.getDeploymentUnits();
         for (DeploymentUnit deploymentUnit : deploymentUnits)
         {
             if(deploymentUnit.getServices() != null)
             {
-                notification.services.addAll(deploymentUnit.getServices().keySet());
+                notification.serviceSet.getServices().addAll(deploymentUnit.getServices().keySet());
             }
             if(deploymentUnit.getOutboundRouters() != null)
             {
-                notification.outboundRoutedServices.addAll(deploymentUnit.getOutboundRouters().keySet());
+                notification.serviceSet.getOutboundRoutedServices().addAll(deploymentUnit.getOutboundRouters().keySet());
             }
         }
         

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentHeartbeatNotification.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentHeartbeatNotification.java	2008-09-09 16:25:08 UTC (rev 22552)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentHeartbeatNotification.java	2008-09-09 21:15:54 UTC (rev 22553)
@@ -42,7 +42,7 @@
         DeploymentHeartbeatNotification notification = new DeploymentHeartbeatNotification();
 
         notification.setName(runtime.getDeploymentName());
-        notification.setId(runtime.getDeploymentID());
+        notification.setId(runtime.getDeploymentId());
 
         return notification;
     }

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentUndeployNotification.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentUndeployNotification.java	2008-09-09 16:25:08 UTC (rev 22552)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/java/org/jboss/esb/federate/notify/DeploymentUndeployNotification.java	2008-09-09 21:15:54 UTC (rev 22553)
@@ -42,7 +42,7 @@
         DeploymentUndeployNotification notification = new DeploymentUndeployNotification();
 
         notification.setName(runtime.getDeploymentName());
-        notification.setId(runtime.getDeploymentID());
+        notification.setId(runtime.getDeploymentId());
 
         return notification;
     }

Modified: labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/busconfig/jms/default.properties
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/busconfig/jms/default.properties	2008-09-09 16:25:08 UTC (rev 22552)
+++ labs/jbossesb/workspace/skeagh/runtime/src/main/resources/META-INF/jbossesb/busconfig/jms/default.properties	2008-09-09 21:15:54 UTC (rev 22553)
@@ -13,3 +13,6 @@
 
 # Bus Queues and Topics...
 deployment.coordintation.topic=jbossesb.deployment.coordintation.topic
+
+# Coordination settings...
+coordinator.heartbeat.frequency=5000
\ No newline at end of file

Added: 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	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/DeploymentCoordinatorTest.java	2008-09-09 21:15:54 UTC (rev 22553)
@@ -0,0 +1,189 @@
+/*
+ * 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;
+
+import junit.framework.TestCase;
+import org.jboss.esb.deploy.DeploymentRuntime;
+import org.jboss.esb.deploy.config.digest.DigestUtil;
+import org.jboss.esb.jms.JMSTestRunner;
+
+/**
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class DeploymentCoordinatorTest extends TestCase
+{
+    public void test_normal() throws Exception
+    {
+        new JMSTestRunner() {
+            public void test() throws Exception
+            {
+                DeploymentRuntime deployment1 = DigestUtil.digestConfig(getClass().getResourceAsStream("deployment-01.xml"));
+                deployment1.setDeploymentName("deployment1");
+                deployment1.deploy();
+                try {
+                    DeploymentCoordinator coordinator1 = deployment1.getDeploymentCoordinator();
+                    DeploymentRuntime deployment2 = DigestUtil.digestConfig(getClass().getResourceAsStream("deployment-02.xml"));
+
+                    deployment2.setDeploymentName("deployment2");
+                    deployment2.deploy();
+                    try {
+                        Thread.sleep(500);
+                        DeploymentCoordinator coordinator2 = deployment2.getDeploymentCoordinator();
+                        DeploymentCoordinator.DeploymentMonitor monitor;
+
+                        assertEquals(1, coordinator1.getDeploymentMonitors().size());
+                        assertEquals(1, coordinator2.getDeploymentMonitors().size());
+
+                        // So deployment1 should be monitoring deployment2...
+                        monitor = (DeploymentCoordinator.DeploymentMonitor) coordinator1.getDeploymentMonitors().values().toArray()[0];
+                        monitor.getServiceSets().setDeploymentId("x");
+                        assertEquals("{online=true} deployment2:x[Services: [hello:goodbye]][OutboundRoutedServices: [hello:hello]]", monitor.toString());
+
+                        // And deployment2 should be monitoring deployment1...
+                        monitor = (DeploymentCoordinator.DeploymentMonitor) coordinator2.getDeploymentMonitors().values().toArray()[0];
+                        monitor.getServiceSets().setDeploymentId("x");
+                        assertEquals("{online=true} deployment1:x[Services: [hello:hello]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
+
+                        // Now lets deploy another services
+                        DeploymentRuntime deployment3 = DigestUtil.digestConfig(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.getDeploymentMonitors().size());
+                            assertEquals(2, coordinator2.getDeploymentMonitors().size());
+                            assertEquals(2, coordinator3.getDeploymentMonitors().size());
+
+                            // 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.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.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.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.getDeploymentMonitors().size());
+                        assertEquals(1, coordinator2.getDeploymentMonitors().size());
+
+                        // So deployment1 should be monitoring deployment2...
+                        monitor = (DeploymentCoordinator.DeploymentMonitor) coordinator1.getDeploymentMonitors().values().toArray()[0];
+                        monitor.getServiceSets().setDeploymentId("x");
+                        assertEquals("{online=true} deployment2:x[Services: [hello:goodbye]][OutboundRoutedServices: [hello:hello]]", monitor.toString());
+
+                        // And deployment2 should be monitoring deployment1...
+                        monitor = (DeploymentCoordinator.DeploymentMonitor) coordinator2.getDeploymentMonitors().values().toArray()[0];
+                        monitor.getServiceSets().setDeploymentId("x");
+                        assertEquals("{online=true} deployment1:x[Services: [hello:hello]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
+                    } finally {
+                        deployment2.undeploy();
+                    }
+                    Thread.sleep(500);
+
+                    // deployment1 should no longer be be monitoring deployment2...
+                    assertEquals(0, coordinator1.getDeploymentMonitors().size());
+                } finally {
+                    deployment1.undeploy();
+                }
+            }
+        }.run();
+    }
+
+    public void test_online_offline() throws Exception
+    {
+        new JMSTestRunner() {
+            public void test() throws Exception
+            {
+                DeploymentRuntime deployment1 = DigestUtil.digestConfig(getClass().getResourceAsStream("deployment-01.xml"));
+                deployment1.setDeploymentName("deployment1");
+                deployment1.deploy();
+                try {
+                    DeploymentCoordinator coordinator1 = deployment1.getDeploymentCoordinator();
+                    DeploymentRuntime deployment2 = DigestUtil.digestConfig(getClass().getResourceAsStream("deployment-02.xml"));
+
+                    deployment2.setDeploymentName("deployment2");
+                    deployment2.deploy();
+                    try {
+                        Thread.sleep(100);
+                        DeploymentCoordinator coordinator2 = deployment2.getDeploymentCoordinator();
+                        DeploymentCoordinator.DeploymentMonitor monitor;
+
+                        assertEquals(1, coordinator1.getDeploymentMonitors().size());
+                        assertEquals(1, coordinator2.getDeploymentMonitors().size());
+
+                        // So deployment1 should be monitoring deployment2...
+                        monitor = (DeploymentCoordinator.DeploymentMonitor) coordinator1.getDeploymentMonitors().values().toArray()[0];
+                        monitor.getServiceSets().setDeploymentId("x");
+                        assertEquals("{online=true} deployment2:x[Services: [hello:goodbye]][OutboundRoutedServices: [hello:hello]]", monitor.toString());
+
+                        // And deployment2 should be monitoring deployment1...
+                        monitor = (DeploymentCoordinator.DeploymentMonitor) coordinator2.getDeploymentMonitors().values().toArray()[0];
+                        monitor.getServiceSets().setDeploymentId("x");
+                        assertEquals("{online=true} deployment1:x[Services: [hello:hello]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
+
+                        // Now lets switch off the heartbeat broadcast on deployment1...
+                        coordinator1.setBroadcastHeartbeat(false);
+                        Thread.sleep(6000);
+
+                        // deployment2 should see deployment1 as being offline now...
+                        monitor = (DeploymentCoordinator.DeploymentMonitor) coordinator2.getDeploymentMonitors().values().toArray()[0];
+                        monitor.getServiceSets().setDeploymentId("x");
+                        assertEquals("{online=false} deployment1:x[Services: [hello:hello]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
+
+                        // Switch the heartbeat broadcast on deployment1 back on again...
+                        coordinator1.setBroadcastHeartbeat(true);
+                        Thread.sleep(6000);
+
+                        // deployment2 should see deployment1 as being online again...
+                        monitor = (DeploymentCoordinator.DeploymentMonitor) coordinator2.getDeploymentMonitors().values().toArray()[0];
+                        monitor.getServiceSets().setDeploymentId("x");
+                        assertEquals("{online=true} deployment1:x[Services: [hello:hello]][OutboundRoutedServices: [hello:hello, hello:goodbye]]", monitor.toString());
+
+                    } finally {
+                        deployment2.undeploy();
+                    }
+                    Thread.sleep(100);
+
+                    // deployment1 should no longer be be monitoring deployment2...
+                    assertEquals(0, coordinator1.getDeploymentMonitors().size());
+                } finally {
+                    deployment1.undeploy();
+                }
+            }
+        }.run();
+    }
+}
+


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

Copied: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/deployment-01.xml (from rev 22543, labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/dispatch/jbossesb-dispatch-with-service.xml)
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/deployment-01.xml	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/deployment-01.xml	2008-09-09 21:15:54 UTC (rev 22553)
@@ -0,0 +1,18 @@
+<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="hello" serviceName="hello" serviceDescription="A Service" class="org.jboss.esb.dispatch.HelloWorldService" />
+    </services>
+
+    <routing>
+        <inRouters serviceCategory="hello" serviceName="hello">
+            <inRouter name="inrouter1" class="org.jboss.esb.dispatch.HelloInboundRouter" />
+        </inRouters>
+        <outRouters serviceCategory="hello" serviceName="hello">
+            <outRouter name="outrouter1" class="org.jboss.esb.dispatch.HelloOutboundRouter" />
+        </outRouters>
+        <outRouters serviceCategory="hello" serviceName="goodbye">
+            <outRouter name="outrouter2" class="org.jboss.esb.dispatch.HelloOutboundRouter" />
+        </outRouters>
+    </routing>
+</jbossesb>
\ No newline at end of file


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

Added: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/deployment-02.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/deployment-02.xml	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/deployment-02.xml	2008-09-09 21:15:54 UTC (rev 22553)
@@ -0,0 +1,15 @@
+<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="hello" serviceName="goodbye" serviceDescription="A Service" class="org.jboss.esb.dispatch.HelloWorldService" />
+    </services>
+
+    <routing>
+        <inRouters serviceCategory="hello" serviceName="goodbye">
+            <inRouter name="inrouter1" class="org.jboss.esb.dispatch.HelloInboundRouter" />
+        </inRouters>
+        <outRouters serviceCategory="hello" serviceName="hello">
+            <outRouter name="outrouter1" class="org.jboss.esb.dispatch.HelloOutboundRouter" />
+        </outRouters>
+    </routing>
+</jbossesb>
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/deployment-02.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Added: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/deployment-03.xml
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/deployment-03.xml	                        (rev 0)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/deployment-03.xml	2008-09-09 21:15:54 UTC (rev 22553)
@@ -0,0 +1,17 @@
+<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="hello" serviceName="goodbye">
+            <inRouter name="inrouter1" class="org.jboss.esb.dispatch.HelloInboundRouter" />
+        </inRouters>
+        <outRouters serviceCategory="hello" serviceName="hello">
+            <outRouter name="outrouter1" class="org.jboss.esb.dispatch.HelloOutboundRouter" />
+        </outRouters>
+        <outRouters serviceCategory="hello" serviceName="goodbye">
+            <outRouter name="outrouter2" class="org.jboss.esb.dispatch.HelloOutboundRouter" />
+        </outRouters>
+        <outRouters serviceCategory="hello" serviceName="randomservice">
+            <outRouter name="outrouter3" class="org.jboss.esb.dispatch.HelloOutboundRouter" />
+        </outRouters>
+    </routing>
+</jbossesb>
\ No newline at end of file


Property changes on: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/deployment-03.xml
___________________________________________________________________
Name: svn:mime-type
   + text/xml
Name: svn:eol-style
   + native

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentDetailsNotificationTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentDetailsNotificationTest.java	2008-09-09 16:25:08 UTC (rev 22552)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentDetailsNotificationTest.java	2008-09-09 21:15:54 UTC (rev 22553)
@@ -22,7 +22,7 @@
         assertEquals("$UNKNOWN$", notification.getName());
         assertNotNull(notification.getId());
         assertEquals(36, notification.getId().length());
-        assertEquals("[a:a, c:c]", notification.getServices().toString());
-        assertEquals("[a:a, b:b]", notification.getOutboundRoutedServices().toString());
+        assertEquals("[a:a, c:c]", notification.getServiceSet().getServices().toString());
+        assertEquals("[a:a, b:b]", notification.getServiceSet().getOutboundRoutedServices().toString());
     }
 }

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentHeartbeatNotificationTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentHeartbeatNotificationTest.java	2008-09-09 16:25:08 UTC (rev 22552)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentHeartbeatNotificationTest.java	2008-09-09 21:15:54 UTC (rev 22553)
@@ -33,7 +33,7 @@
         DeploymentRuntime rt = new DeploymentRuntime();
 
         rt.setDeploymentName("name");
-        rt.setDeploymentID("XXX");
+        rt.setDeploymentId("XXX");
 
         DeploymentHeartbeatNotification notification = DeploymentHeartbeatNotification.toNotification(rt);
 

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentUndeployNotificationTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentUndeployNotificationTest.java	2008-09-09 16:25:08 UTC (rev 22552)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/java/org/jboss/esb/federate/notify/DeploymentUndeployNotificationTest.java	2008-09-09 21:15:54 UTC (rev 22553)
@@ -33,7 +33,7 @@
         DeploymentRuntime rt = new DeploymentRuntime();
 
         rt.setDeploymentName("name");
-        rt.setDeploymentID("XXX");
+        rt.setDeploymentId("XXX");
 
         DeploymentUndeployNotification notification = DeploymentUndeployNotification.toNotification(rt);
 

Modified: labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/busconfig/jms/default.properties
===================================================================
--- labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/busconfig/jms/default.properties	2008-09-09 16:25:08 UTC (rev 22552)
+++ labs/jbossesb/workspace/skeagh/runtime/src/test/resources/META-INF/jbossesb/busconfig/jms/default.properties	2008-09-09 21:15:54 UTC (rev 22553)
@@ -15,4 +15,7 @@
 deployment.coordintation.topic=jbossesb.deployment.coordintation.topic
 
 # ActiveMQ Queue and Topic deployments...
-topic.jbossesb.deployment.coordintation.topic=jbossesb.deployment.coordintation.topic
\ No newline at end of file
+topic.jbossesb.deployment.coordintation.topic=jbossesb.deployment.coordintation.topic
+
+# Coordination settings...
+coordinator.heartbeat.frequency=700




More information about the jboss-svn-commits mailing list