[jboss-cvs] JBoss Messaging SVN: r7646 - in trunk: src/main/org/jboss/messaging/core/cluster/impl and 10 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jul 30 12:23:27 EDT 2009
Author: jmesnil
Date: 2009-07-30 12:23:26 -0400 (Thu, 30 Jul 2009)
New Revision: 7646
Added:
trunk/tests/src/org/jboss/messaging/tests/integration/SimpleNotificationService.java
Modified:
trunk/src/main/org/jboss/messaging/core/cluster/DiscoveryGroup.java
trunk/src/main/org/jboss/messaging/core/cluster/impl/DiscoveryGroupImpl.java
trunk/src/main/org/jboss/messaging/core/management/Notification.java
trunk/src/main/org/jboss/messaging/core/management/NotificationType.java
trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java
trunk/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java
trunk/src/main/org/jboss/messaging/core/server/cluster/Bridge.java
trunk/src/main/org/jboss/messaging/core/server/cluster/BroadcastGroup.java
trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BridgeImpl.java
trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BroadcastGroupImpl.java
trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSServerControlWrapper.java
trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareTestBase.java
trunk/tests/src/org/jboss/messaging/tests/integration/discovery/DiscoveryTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/management/BridgeControlTest.java
Log:
JBMESSAGING-1556: Add additional core management notifications
* added notifications for start/stop of bridge/broadcast group/discovery group
Modified: trunk/src/main/org/jboss/messaging/core/cluster/DiscoveryGroup.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/cluster/DiscoveryGroup.java 2009-07-30 14:22:22 UTC (rev 7645)
+++ trunk/src/main/org/jboss/messaging/core/cluster/DiscoveryGroup.java 2009-07-30 16:23:26 UTC (rev 7646)
@@ -25,6 +25,7 @@
import java.util.Map;
+import org.jboss.messaging.core.management.NotificationService;
import org.jboss.messaging.core.server.MessagingComponent;
/**
@@ -38,6 +39,8 @@
*/
public interface DiscoveryGroup extends MessagingComponent
{
+ void setNotificationService(NotificationService notificationService);
+
String getName();
Map<String, DiscoveryEntry> getDiscoveryEntryMap();
Modified: trunk/src/main/org/jboss/messaging/core/cluster/impl/DiscoveryGroupImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/cluster/impl/DiscoveryGroupImpl.java 2009-07-30 14:22:22 UTC (rev 7645)
+++ trunk/src/main/org/jboss/messaging/core/cluster/impl/DiscoveryGroupImpl.java 2009-07-30 16:23:26 UTC (rev 7646)
@@ -38,8 +38,13 @@
import org.jboss.messaging.core.cluster.DiscoveryListener;
import org.jboss.messaging.core.config.TransportConfiguration;
import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.management.Notification;
+import org.jboss.messaging.core.management.NotificationService;
+import org.jboss.messaging.core.management.NotificationType;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
import org.jboss.messaging.utils.Pair;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.TypedProperties;
/**
* A DiscoveryGroupImpl
@@ -80,6 +85,8 @@
private final int groupPort;
private Map<String, UniqueIDEntry> uniqueIDMap = new HashMap<String, UniqueIDEntry>();
+
+ private NotificationService notificationService;
public DiscoveryGroupImpl(final String nodeID,
final String name,
@@ -98,6 +105,11 @@
this.groupPort = groupPort;
}
+ public void setNotificationService(final NotificationService notificationService)
+ {
+ this.notificationService = notificationService;
+ }
+
public synchronized void start() throws Exception
{
if (started)
@@ -118,6 +130,14 @@
thread.setDaemon(true);
thread.start();
+
+ if (notificationService != null)
+ {
+ TypedProperties props = new TypedProperties();
+ props.putStringProperty(new SimpleString("name"), new SimpleString(name));
+ Notification notification = new Notification(nodeID, NotificationType.DISCOVERY_GROUP_STARTED, props );
+ notificationService.sendNotification(notification );
+ }
}
public void stop()
@@ -145,6 +165,21 @@
socket = null;
thread = null;
+
+ if (notificationService != null)
+ {
+ TypedProperties props = new TypedProperties();
+ props.putStringProperty(new SimpleString("name"), new SimpleString(name));
+ Notification notification = new Notification(nodeID, NotificationType.DISCOVERY_GROUP_STOPPED, props );
+ try
+ {
+ notificationService.sendNotification(notification );
+ }
+ catch (Exception e)
+ {
+ log.warn("unable to send notification when discovery group is stopped", e);
+ }
+ }
}
public boolean isStarted()
Modified: trunk/src/main/org/jboss/messaging/core/management/Notification.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/Notification.java 2009-07-30 14:22:22 UTC (rev 7645)
+++ trunk/src/main/org/jboss/messaging/core/management/Notification.java 2009-07-30 16:23:26 UTC (rev 7646)
@@ -62,4 +62,10 @@
{
return uid;
}
+
+ @Override
+ public String toString()
+ {
+ return "Notification[uid=" + uid + ", type=" + type + ", properties=" + properties + "]";
+ }
}
Modified: trunk/src/main/org/jboss/messaging/core/management/NotificationType.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/NotificationType.java 2009-07-30 14:22:22 UTC (rev 7645)
+++ trunk/src/main/org/jboss/messaging/core/management/NotificationType.java 2009-07-30 16:23:26 UTC (rev 7646)
@@ -33,7 +33,13 @@
CONSUMER_CREATED(2),
CONSUMER_CLOSED(3),
SECURITY_AUTHENTICATION_VIOLATION(6),
- SECURITY_PERMISSION_VIOLATION(7);
+ SECURITY_PERMISSION_VIOLATION(7),
+ DISCOVERY_GROUP_STARTED(8),
+ DISCOVERY_GROUP_STOPPED(9),
+ BROADCAST_GROUP_STARTED(10),
+ BROADCAST_GROUP_STOPPED(11),
+ BRIDGE_STARTED(12),
+ BRIDGE_STOPPED(13);
private final int value;
Modified: trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java 2009-07-30 14:22:22 UTC (rev 7645)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java 2009-07-30 16:23:26 UTC (rev 7646)
@@ -326,6 +326,7 @@
public synchronized void registerBroadcastGroup(BroadcastGroup broadcastGroup,
BroadcastGroupConfiguration configuration) throws Exception
{
+ broadcastGroup.setNotificationService(this);
ObjectName objectName = ObjectNames.getBroadcastGroupObjectName(configuration.getName());
BroadcastGroupControl control = new BroadcastGroupControlImpl(broadcastGroup, configuration);
registerInJMX(objectName, new StandardMBean(control, BroadcastGroupControl.class));
@@ -342,6 +343,7 @@
public synchronized void registerDiscoveryGroup(DiscoveryGroup discoveryGroup,
DiscoveryGroupConfiguration configuration) throws Exception
{
+ discoveryGroup.setNotificationService(this);
ObjectName objectName = ObjectNames.getDiscoveryGroupObjectName(configuration.getName());
DiscoveryGroupControl control = new DiscoveryGroupControlImpl(discoveryGroup, configuration);
registerInJMX(objectName, new StandardMBean(control, DiscoveryGroupControl.class));
@@ -357,6 +359,7 @@
public synchronized void registerBridge(Bridge bridge, BridgeConfiguration configuration) throws Exception
{
+ bridge.setNotificationService(this);
ObjectName objectName = ObjectNames.getBridgeObjectName(configuration.getName());
BridgeControl control = new BridgeControlImpl(bridge, configuration);
registerInJMX(objectName, new StandardMBean(control, BridgeControl.class));
@@ -629,8 +632,8 @@
}
}
- // start sending notification *messages* only when the server if fully started
- if (messagingServer != null && !messagingServer.isStarted())
+ // start sending notification *messages* only when the *remoting service* if started
+ if (messagingServer == null || !messagingServer.isStarted() || !messagingServer.getRemotingService().isStarted())
{
return;
}
Modified: trunk/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java 2009-07-30 14:22:22 UTC (rev 7645)
+++ trunk/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java 2009-07-30 16:23:26 UTC (rev 7646)
@@ -438,14 +438,10 @@
break;
}
- case SECURITY_AUTHENTICATION_VIOLATION:
- case SECURITY_PERMISSION_VIOLATION:
- break;
default:
{
- throw new IllegalArgumentException("Invalid type " + type);
+ break;
}
-
}
}
}
Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/Bridge.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/Bridge.java 2009-07-30 14:22:22 UTC (rev 7645)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/Bridge.java 2009-07-30 16:23:26 UTC (rev 7646)
@@ -23,6 +23,7 @@
package org.jboss.messaging.core.server.cluster;
+import org.jboss.messaging.core.management.NotificationService;
import org.jboss.messaging.core.server.Consumer;
import org.jboss.messaging.core.server.MessagingComponent;
import org.jboss.messaging.core.server.Queue;
@@ -30,9 +31,10 @@
/**
- * A JMSBridge
+ * A Core Bridge
*
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
*
* Created 15 Nov 2008 09:42:31
*
@@ -53,4 +55,6 @@
void activate();
void setQueue(Queue queue);
+
+ void setNotificationService(NotificationService notificationService);
}
Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/BroadcastGroup.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/BroadcastGroup.java 2009-07-30 14:22:22 UTC (rev 7645)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/BroadcastGroup.java 2009-07-30 16:23:26 UTC (rev 7646)
@@ -24,6 +24,7 @@
package org.jboss.messaging.core.server.cluster;
import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.management.NotificationService;
import org.jboss.messaging.core.server.MessagingComponent;
import org.jboss.messaging.utils.Pair;
@@ -31,6 +32,7 @@
* A BroadcastGroup
*
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
*
* Created 18 Nov 2008 09:29:45
*
@@ -38,6 +40,8 @@
*/
public interface BroadcastGroup extends MessagingComponent
{
+ void setNotificationService(NotificationService notificationService);
+
String getName();
void addConnectorPair(Pair<TransportConfiguration, TransportConfiguration> connectorPair);
Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BridgeImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BridgeImpl.java 2009-07-30 14:22:22 UTC (rev 7645)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BridgeImpl.java 2009-07-30 16:23:26 UTC (rev 7646)
@@ -43,6 +43,8 @@
import org.jboss.messaging.core.filter.Filter;
import org.jboss.messaging.core.filter.impl.FilterImpl;
import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.management.Notification;
+import org.jboss.messaging.core.management.NotificationService;
import org.jboss.messaging.core.management.NotificationType;
import org.jboss.messaging.core.management.ResourceNames;
import org.jboss.messaging.core.message.Message;
@@ -64,12 +66,14 @@
import org.jboss.messaging.utils.Future;
import org.jboss.messaging.utils.Pair;
import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.TypedProperties;
import org.jboss.messaging.utils.UUID;
/**
- * A JMSBridgeImpl
+ * A Core BridgeImpl
*
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
*
* Created 12 Nov 2008 11:37:35
*
@@ -140,6 +144,8 @@
private Channel replicatingChannel;
private boolean activated;
+
+ private NotificationService notificationService;
// Static --------------------------------------------------------
@@ -224,6 +230,11 @@
this.activated = activated;
}
+ public void setNotificationService(final NotificationService notificationService)
+ {
+ this.notificationService = notificationService;
+ }
+
public synchronized void start() throws Exception
{
if (started)
@@ -236,7 +247,15 @@
if (activated)
{
executor.execute(new CreateObjectsRunnable());
- }
+ }
+
+ if (notificationService != null)
+ {
+ TypedProperties props = new TypedProperties();
+ props.putStringProperty(new SimpleString("name"), name);
+ Notification notification = new Notification(nodeUUID.toString(), NotificationType.BRIDGE_STARTED, props);
+ notificationService.sendNotification(notification );
+ }
}
private void cancelRefs() throws Exception
@@ -271,7 +290,22 @@
executor.execute(new StopRunnable());
- waitForRunnablesToComplete();
+ waitForRunnablesToComplete();
+
+ if (notificationService != null)
+ {
+ TypedProperties props = new TypedProperties();
+ props.putStringProperty(new SimpleString("name"), name);
+ Notification notification = new Notification(nodeUUID.toString(), NotificationType.BRIDGE_STOPPED, props);
+ try
+ {
+ notificationService.sendNotification(notification );
+ }
+ catch (Exception e)
+ {
+ log.warn("unable to send notification when broadcast group is stopped", e);
+ }
+ }
}
public boolean isStarted()
Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BroadcastGroupImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BroadcastGroupImpl.java 2009-07-30 14:22:22 UTC (rev 7645)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/impl/BroadcastGroupImpl.java 2009-07-30 16:23:26 UTC (rev 7646)
@@ -30,11 +30,17 @@
import java.util.concurrent.ScheduledFuture;
import org.jboss.messaging.core.buffers.ChannelBuffers;
+import org.jboss.messaging.core.client.management.impl.ManagementHelper;
import org.jboss.messaging.core.config.TransportConfiguration;
import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.management.Notification;
+import org.jboss.messaging.core.management.NotificationService;
+import org.jboss.messaging.core.management.NotificationType;
import org.jboss.messaging.core.remoting.spi.MessagingBuffer;
import org.jboss.messaging.core.server.cluster.BroadcastGroup;
import org.jboss.messaging.utils.Pair;
+import org.jboss.messaging.utils.SimpleString;
+import org.jboss.messaging.utils.TypedProperties;
import org.jboss.messaging.utils.UUIDGenerator;
/**
@@ -75,6 +81,8 @@
//on the network which would be an error
private final String uniqueID;
+ private NotificationService notificationService;
+
/**
* Broadcast group is bound locally to the wildcard address
*/
@@ -103,6 +111,11 @@
this.uniqueID = UUIDGenerator.getInstance().generateStringUUID();
}
+ public void setNotificationService(final NotificationService notificationService)
+ {
+ this.notificationService = notificationService;
+ }
+
public synchronized void start() throws Exception
{
if (started)
@@ -120,6 +133,14 @@
}
started = true;
+
+ if (notificationService != null)
+ {
+ TypedProperties props = new TypedProperties();
+ props.putStringProperty(new SimpleString("name"), new SimpleString(name));
+ Notification notification = new Notification(nodeID, NotificationType.BROADCAST_GROUP_STARTED, props);
+ notificationService.sendNotification(notification );
+ }
}
public synchronized void stop()
@@ -137,6 +158,22 @@
socket.close();
started = false;
+
+ if (notificationService != null)
+ {
+ TypedProperties props = new TypedProperties();
+ props.putStringProperty(new SimpleString("name"), new SimpleString(name));
+ Notification notification = new Notification(nodeID, NotificationType.BROADCAST_GROUP_STOPPED, props);
+ try
+ {
+ notificationService.sendNotification(notification );
+ }
+ catch (Exception e)
+ {
+ log.warn("unable to send notification when broadcast group is stopped", e);
+ }
+ }
+
}
public synchronized boolean isStarted()
Modified: trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSServerControlWrapper.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSServerControlWrapper.java 2009-07-30 14:22:22 UTC (rev 7645)
+++ trunk/src/main/org/jboss/messaging/jms/server/management/jmx/impl/ReplicationAwareJMSServerControlWrapper.java 2009-07-30 16:23:26 UTC (rev 7646)
@@ -24,7 +24,12 @@
import java.util.Map;
+import javax.management.ListenerNotFoundException;
import javax.management.MBeanInfo;
+import javax.management.MBeanNotificationInfo;
+import javax.management.NotificationEmitter;
+import javax.management.NotificationFilter;
+import javax.management.NotificationListener;
import org.jboss.messaging.core.management.ReplicationOperationInvoker;
import org.jboss.messaging.core.management.ResourceNames;
@@ -40,7 +45,7 @@
* @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
*/
public class ReplicationAwareJMSServerControlWrapper extends ReplicationAwareStandardMBeanWrapper implements
- JMSServerControl
+ JMSServerControl, NotificationEmitter
{
// Constants -----------------------------------------------------
@@ -556,7 +561,29 @@
{
return localControl.listSessions(connectionID);
}
+
+ // NotificationEmitter implementation ----------------------------
+ public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException
+ {
+ localControl.addNotificationListener(listener, filter, handback);
+ }
+
+ public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException
+ {
+ localControl.removeNotificationListener(listener);
+ }
+
+ public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException
+ {
+ localControl.removeNotificationListener(listener, filter, handback);
+ }
+
+ public MBeanNotificationInfo[] getNotificationInfo()
+ {
+ return localControl.getNotificationInfo();
+ }
+
// StandardMBean overrides ---------------------------------------
@Override
@@ -568,7 +595,7 @@
info.getAttributes(),
info.getConstructors(),
MBeanInfoHelper.getMBeanOperationsInfo(JMSServerControl.class),
- info.getNotifications());
+ localControl.getNotificationInfo());
}
// Public --------------------------------------------------------
Added: trunk/tests/src/org/jboss/messaging/tests/integration/SimpleNotificationService.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/SimpleNotificationService.java (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/SimpleNotificationService.java 2009-07-30 16:23:26 UTC (rev 7646)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY 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 along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.messaging.tests.integration;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jboss.messaging.core.management.Notification;
+import org.jboss.messaging.core.management.NotificationListener;
+import org.jboss.messaging.core.management.NotificationService;
+
+/**
+ * A SimpleNotificationService
+ *
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil
+ *
+ *
+ */
+public class SimpleNotificationService implements NotificationService
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private final List<NotificationListener> listeners = new ArrayList<NotificationListener>();
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // NotificationService implementation ----------------------------
+
+ public void addNotificationListener(NotificationListener listener)
+ {
+ listeners.add(listener);
+ }
+
+ public void enableNotifications(boolean enable)
+ {
+ }
+
+ public void removeNotificationListener(NotificationListener listener)
+ {
+ listeners.remove(listener);
+ }
+
+ public void sendNotification(Notification notification) throws Exception
+ {
+ for (NotificationListener listener : listeners)
+ {
+ listener.onNotification(notification);
+ }
+ }
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+ public static class Listener implements NotificationListener
+ {
+
+ private final List<Notification> notifications = new ArrayList<Notification>();
+
+ public void onNotification(Notification notification)
+ {
+ System.out.println(">>>>>>>>" + notification);
+ notifications.add(notification);
+ }
+
+ public List<Notification> getNotifications()
+ {
+ return notifications;
+ }
+
+ }
+}
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareTestBase.java 2009-07-30 14:22:22 UTC (rev 7645)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/cluster/management/ReplicationAwareTestBase.java 2009-07-30 16:23:26 UTC (rev 7646)
@@ -106,7 +106,7 @@
assertTrue(backupMBeanServer != liveMBeanServer);
Configuration backupConf = new ConfigurationImpl();
- backupConf.setJournalMinFiles(2);
+ backupConf.setPersistenceEnabled(false);
backupConf.setSecurityEnabled(false);
backupParams.put(TransportConstants.SERVER_ID_PROP_NAME, 1);
backupConf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName(),
@@ -120,7 +120,7 @@
}
Configuration liveConf = new ConfigurationImpl();
- liveConf.setJournalMinFiles(2);
+ liveConf.setPersistenceEnabled(false);
liveConf.setSecurityEnabled(false);
liveConf.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
Map<String, TransportConfiguration> connectors = new HashMap<String, TransportConfiguration>();
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/discovery/DiscoveryTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/discovery/DiscoveryTest.java 2009-07-30 14:22:22 UTC (rev 7645)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/discovery/DiscoveryTest.java 2009-07-30 16:23:26 UTC (rev 7646)
@@ -34,10 +34,14 @@
import org.jboss.messaging.core.cluster.impl.DiscoveryGroupImpl;
import org.jboss.messaging.core.config.TransportConfiguration;
import org.jboss.messaging.core.logging.Logger;
+import org.jboss.messaging.core.management.Notification;
+import org.jboss.messaging.core.management.NotificationType;
import org.jboss.messaging.core.server.cluster.BroadcastGroup;
import org.jboss.messaging.core.server.cluster.impl.BroadcastGroupImpl;
+import org.jboss.messaging.tests.integration.SimpleNotificationService;
import org.jboss.messaging.tests.util.UnitTestCase;
import org.jboss.messaging.utils.Pair;
+import org.jboss.messaging.utils.SimpleString;
import org.jboss.messaging.utils.UUIDGenerator;
/**
@@ -854,6 +858,65 @@
dg3.stop();
}
+ public void testDiscoveryGroupNotifications() throws Exception
+ {
+ SimpleNotificationService notifService = new SimpleNotificationService();
+ SimpleNotificationService.Listener notifListener = new SimpleNotificationService.Listener();
+ notifService.addNotificationListener(notifListener);
+
+ final InetAddress groupAddress = InetAddress.getByName(address1);
+ final int groupPort = 6745;
+ final int timeout = 500;
+
+ DiscoveryGroup dg = new DiscoveryGroupImpl(randomString(), randomString(), groupAddress, groupPort, timeout);
+ dg.setNotificationService(notifService);
+
+ assertEquals(0, notifListener.getNotifications().size());
+
+ dg.start();
+
+ assertEquals(1, notifListener.getNotifications().size());
+ Notification notif = notifListener.getNotifications().get(0);
+ assertEquals(NotificationType.DISCOVERY_GROUP_STARTED, notif.getType());
+ assertEquals(dg.getName(), (notif.getProperties().getProperty(new SimpleString("name")).toString()));
+
+ dg.stop();
+
+ assertEquals(2, notifListener.getNotifications().size());
+ notif = notifListener.getNotifications().get(1);
+ assertEquals(NotificationType.DISCOVERY_GROUP_STOPPED, notif.getType());
+ assertEquals(dg.getName(), (notif.getProperties().getProperty(new SimpleString("name")).toString()));
+ }
+
+ public void testBroadcastGroupNotifications() throws Exception
+ {
+ SimpleNotificationService notifService = new SimpleNotificationService();
+ SimpleNotificationService.Listener notifListener = new SimpleNotificationService.Listener();
+ notifService.addNotificationListener(notifListener);
+
+ final InetAddress groupAddress = InetAddress.getByName(address1);
+ final int groupPort = 6745;
+
+ BroadcastGroup bg = new BroadcastGroupImpl(randomString(), randomString(), null, -1, groupAddress, groupPort, true);
+ bg.setNotificationService(notifService);
+
+ assertEquals(0, notifListener.getNotifications().size());
+
+ bg.start();
+
+ assertEquals(1, notifListener.getNotifications().size());
+ Notification notif = notifListener.getNotifications().get(0);
+ assertEquals(NotificationType.BROADCAST_GROUP_STARTED, notif.getType());
+ assertEquals(bg.getName(), (notif.getProperties().getProperty(new SimpleString("name")).toString()));
+
+ bg.stop();
+
+ assertEquals(2, notifListener.getNotifications().size());
+ notif = notifListener.getNotifications().get(1);
+ assertEquals(NotificationType.BROADCAST_GROUP_STOPPED, notif.getType());
+ assertEquals(bg.getName(), (notif.getProperties().getProperty(new SimpleString("name")).toString()));
+ }
+
private TransportConfiguration generateTC()
{
String className = "org.foo.bar." + UUIDGenerator.getInstance().generateStringUUID();
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/BridgeControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/BridgeControlTest.java 2009-07-30 14:22:22 UTC (rev 7645)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/BridgeControlTest.java 2009-07-30 16:23:26 UTC (rev 7646)
@@ -41,12 +41,16 @@
import org.jboss.messaging.core.config.cluster.QueueConfiguration;
import org.jboss.messaging.core.config.impl.ConfigurationImpl;
import org.jboss.messaging.core.management.BridgeControl;
+import org.jboss.messaging.core.management.Notification;
+import org.jboss.messaging.core.management.NotificationType;
import org.jboss.messaging.core.management.ObjectNames;
import org.jboss.messaging.core.remoting.impl.invm.InVMAcceptorFactory;
import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
import org.jboss.messaging.core.server.Messaging;
import org.jboss.messaging.core.server.MessagingServer;
+import org.jboss.messaging.tests.integration.SimpleNotificationService;
import org.jboss.messaging.utils.Pair;
+import org.jboss.messaging.utils.SimpleString;
/**
* A BridgeControlTest
@@ -111,6 +115,30 @@
assertTrue(bridgeControl.isStarted());
}
+ public void testNotifications() throws Exception
+ {
+ SimpleNotificationService.Listener notifListener = new SimpleNotificationService.Listener();
+ BridgeControl bridgeControl = createBridgeControl(bridgeConfig.getName(), mbeanServer);
+
+ server_0.getManagementService().addNotificationListener(notifListener);
+
+ assertEquals(0, notifListener.getNotifications().size());
+
+ bridgeControl.stop();
+
+ assertEquals(1, notifListener.getNotifications().size());
+ Notification notif = notifListener.getNotifications().get(0);
+ assertEquals(NotificationType.BRIDGE_STOPPED, notif.getType());
+ assertEquals(bridgeControl.getName(), (notif.getProperties().getProperty(new SimpleString("name")).toString()));
+
+ bridgeControl.start();
+
+ assertEquals(2, notifListener.getNotifications().size());
+ notif = notifListener.getNotifications().get(1);
+ assertEquals(NotificationType.BRIDGE_STARTED, notif.getType());
+ assertEquals(bridgeControl.getName(), (notif.getProperties().getProperty(new SimpleString("name")).toString()));
+ }
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
More information about the jboss-cvs-commits
mailing list