[jboss-cvs] JBoss Messaging SVN: r6127 - in trunk: src/main/org/jboss/messaging/core/management/impl and 7 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Mar 20 13:51:15 EDT 2009
Author: jmesnil
Date: 2009-03-20 13:51:15 -0400 (Fri, 20 Mar 2009)
New Revision: 6127
Added:
trunk/src/main/org/jboss/messaging/core/management/ClusterConnectionControlMBean.java
trunk/src/main/org/jboss/messaging/core/management/DivertControlMBean.java
trunk/src/main/org/jboss/messaging/core/management/impl/ClusterConnectionControl.java
trunk/src/main/org/jboss/messaging/core/management/impl/DivertControl.java
trunk/tests/src/org/jboss/messaging/tests/integration/management/ClusterConnectionControlTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/management/DivertControlTest.java
Removed:
trunk/tests/src/org/jboss/messaging/tests/unit/core/management/impl/
trunk/tests/src/org/jboss/messaging/tests/unit/jms/server/management/impl/JMSManagementServiceImplTest.java
Modified:
trunk/src/main/org/jboss/messaging/core/management/BroadcastGroupControlMBean.java
trunk/src/main/org/jboss/messaging/core/management/DayCounterInfo.java
trunk/src/main/org/jboss/messaging/core/management/ManagementService.java
trunk/src/main/org/jboss/messaging/core/management/ObjectNames.java
trunk/src/main/org/jboss/messaging/core/management/impl/BridgeControl.java
trunk/src/main/org/jboss/messaging/core/management/impl/BroadcastGroupControl.java
trunk/src/main/org/jboss/messaging/core/management/impl/DiscoveryGroupControl.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/impl/ClusterManagerImpl.java
trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
trunk/src/main/org/jboss/messaging/jms/bridge/impl/BridgeImpl.java
trunk/tests/src/org/jboss/messaging/tests/integration/management/BroadcastGroupControlTest.java
trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementControlHelper.java
Log:
management integration tests
* added tests for ClusterConnection and Divert management
Modified: trunk/src/main/org/jboss/messaging/core/management/BroadcastGroupControlMBean.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/BroadcastGroupControlMBean.java 2009-03-20 14:33:02 UTC (rev 6126)
+++ trunk/src/main/org/jboss/messaging/core/management/BroadcastGroupControlMBean.java 2009-03-20 17:51:15 UTC (rev 6127)
@@ -25,7 +25,7 @@
import javax.management.openmbean.TabularData;
/**
- * A DiscoveryGroupControlMBean
+ * A BroadcastGroupControlMBean
*
* @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
*
@@ -42,5 +42,5 @@
long getBroadcastPeriod();
- TabularData getConnectorInfos();
+ TabularData getConnectorPairs();
}
Added: trunk/src/main/org/jboss/messaging/core/management/ClusterConnectionControlMBean.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/ClusterConnectionControlMBean.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/management/ClusterConnectionControlMBean.java 2009-03-20 17:51:15 UTC (rev 6127)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, 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.core.management;
+
+import javax.management.openmbean.TabularData;
+
+/**
+ * A ClusterConnectionControlMBean
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ */
+public interface ClusterConnectionControlMBean extends MessagingComponentControlMBean
+{
+ String getName();
+
+ String getAddress();
+
+ boolean isDuplicateDetection();
+
+ boolean isForwardWhenNoConsumers();
+
+ int getMaxHops();
+
+ TabularData getStaticConnectorNamePairs();
+
+ String getDiscoveryGroupName();
+
+ long getRetryInterval();
+
+ double getRetryIntervalMultiplier();
+
+ int getMaxRetriesBeforeFailover();
+
+ int getMaxRetriesAfterFailover();
+}
Modified: trunk/src/main/org/jboss/messaging/core/management/DayCounterInfo.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/DayCounterInfo.java 2009-03-20 14:33:02 UTC (rev 6126)
+++ trunk/src/main/org/jboss/messaging/core/management/DayCounterInfo.java 2009-03-20 17:51:15 UTC (rev 6127)
@@ -22,15 +22,13 @@
package org.jboss.messaging.core.management;
+import static javax.management.openmbean.SimpleType.INTEGER;
+import static javax.management.openmbean.SimpleType.STRING;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import org.jboss.messaging.core.logging.Logger;
-
-import static javax.management.openmbean.SimpleType.INTEGER;
-import static javax.management.openmbean.SimpleType.STRING;
-
import javax.management.openmbean.CompositeData;
import javax.management.openmbean.CompositeDataSupport;
import javax.management.openmbean.CompositeType;
@@ -40,7 +38,9 @@
import javax.management.openmbean.TabularDataSupport;
import javax.management.openmbean.TabularType;
+import org.jboss.messaging.core.logging.Logger;
+
/**
* @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
*
Added: trunk/src/main/org/jboss/messaging/core/management/DivertControlMBean.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/DivertControlMBean.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/management/DivertControlMBean.java 2009-03-20 17:51:15 UTC (rev 6127)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, 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.core.management;
+
+
+/**
+ * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * @version <tt>$Revision$</tt>
+ *
+ */
+public interface DivertControlMBean
+{
+ String getFilter();
+
+ boolean isExclusive();
+
+ String getUniqueName();
+
+ String getRoutingName();
+
+ String getAddress();
+
+ String getForwardingAddress();
+
+ String getTransformerClassName();
+}
Modified: trunk/src/main/org/jboss/messaging/core/management/ManagementService.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/ManagementService.java 2009-03-20 14:33:02 UTC (rev 6126)
+++ trunk/src/main/org/jboss/messaging/core/management/ManagementService.java 2009-03-20 17:51:15 UTC (rev 6127)
@@ -34,14 +34,14 @@
import org.jboss.messaging.core.config.cluster.BroadcastGroupConfiguration;
import org.jboss.messaging.core.config.cluster.ClusterConnectionConfiguration;
import org.jboss.messaging.core.config.cluster.DiscoveryGroupConfiguration;
-import org.jboss.messaging.core.management.impl.AddressControl;
-import org.jboss.messaging.core.management.jmx.impl.ReplicationAwareAddressControlWrapper;
+import org.jboss.messaging.core.config.cluster.DivertConfiguration;
import org.jboss.messaging.core.messagecounter.MessageCounterManager;
import org.jboss.messaging.core.persistence.StorageManager;
import org.jboss.messaging.core.postoffice.PostOffice;
import org.jboss.messaging.core.remoting.server.RemotingService;
import org.jboss.messaging.core.remoting.spi.Acceptor;
import org.jboss.messaging.core.security.Role;
+import org.jboss.messaging.core.server.Divert;
import org.jboss.messaging.core.server.MessagingComponent;
import org.jboss.messaging.core.server.MessagingServer;
import org.jboss.messaging.core.server.Queue;
@@ -113,6 +113,10 @@
void unregisterAcceptor(String name) throws Exception;
+ void registerDivert(Divert divert, DivertConfiguration config) throws Exception;
+
+ void unregisterDivert(SimpleString name) throws Exception;
+
void registerBroadcastGroup(BroadcastGroup broadcastGroup, BroadcastGroupConfiguration configuration) throws Exception;
void unregisterBroadcastGroup(String name) throws Exception;
@@ -159,4 +163,5 @@
void removeNotificationListener(NotificationListener listener);
+
}
Modified: trunk/src/main/org/jboss/messaging/core/management/ObjectNames.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/ObjectNames.java 2009-03-20 14:33:02 UTC (rev 6126)
+++ trunk/src/main/org/jboss/messaging/core/management/ObjectNames.java 2009-03-20 17:51:15 UTC (rev 6127)
@@ -76,6 +76,11 @@
quote(name.toString())));
}
+ public static ObjectName getDivertObjectName(final SimpleString name) throws Exception
+ {
+ return createObjectName(CORE_MODULE, "Divert", name.toString());
+ }
+
public static ObjectName getAcceptorObjectName(final String name) throws Exception
{
return createObjectName(CORE_MODULE, "Acceptor", name);
@@ -90,6 +95,11 @@
{
return createObjectName(CORE_MODULE, "Bridge", name);
}
+
+ public static ObjectName getClusterConnectionObjectName(String name) throws Exception
+ {
+ return createObjectName(CORE_MODULE, "ClusterConnection", name);
+ }
public static ObjectName getDiscoveryGroupObjectName(final String name) throws Exception
{
Modified: trunk/src/main/org/jboss/messaging/core/management/impl/BridgeControl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/BridgeControl.java 2009-03-20 14:33:02 UTC (rev 6126)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/BridgeControl.java 2009-03-20 17:51:15 UTC (rev 6127)
@@ -23,8 +23,6 @@
package org.jboss.messaging.core.management.impl;
import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.OpenDataException;
-import javax.management.openmbean.TabularData;
import org.jboss.messaging.core.config.cluster.BridgeConfiguration;
import org.jboss.messaging.core.management.BridgeControlMBean;
Modified: trunk/src/main/org/jboss/messaging/core/management/impl/BroadcastGroupControl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/BroadcastGroupControl.java 2009-03-20 14:33:02 UTC (rev 6126)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/BroadcastGroupControl.java 2009-03-20 17:51:15 UTC (rev 6127)
@@ -69,7 +69,7 @@
return configuration.getBroadcastPeriod();
}
- public TabularData getConnectorInfos()
+ public TabularData getConnectorPairs()
{
return PairsInfo.toTabularData(configuration.getConnectorInfos());
}
Added: trunk/src/main/org/jboss/messaging/core/management/impl/ClusterConnectionControl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/ClusterConnectionControl.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/ClusterConnectionControl.java 2009-03-20 17:51:15 UTC (rev 6127)
@@ -0,0 +1,141 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, 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.core.management.impl;
+
+import javax.management.openmbean.TabularData;
+
+import org.jboss.messaging.core.config.cluster.ClusterConnectionConfiguration;
+import org.jboss.messaging.core.management.ClusterConnectionControlMBean;
+import org.jboss.messaging.core.management.PairsInfo;
+import org.jboss.messaging.core.server.cluster.ClusterConnection;
+
+/**
+ * A ClusterConnectionControl
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ */
+public class ClusterConnectionControl implements ClusterConnectionControlMBean
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private final ClusterConnection clusterConnection;
+
+ private final ClusterConnectionConfiguration configuration;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ public ClusterConnectionControl(final ClusterConnection clusterConnection,
+ ClusterConnectionConfiguration configuration)
+ {
+ this.clusterConnection = clusterConnection;
+ this.configuration = configuration;
+ }
+
+ // ClusterConnectionControlMBean implementation ---------------------------
+
+ public String getAddress()
+ {
+ return configuration.getAddress();
+ }
+
+ public String getDiscoveryGroupName()
+ {
+ return configuration.getDiscoveryGroupName();
+ }
+
+ public int getMaxHops()
+ {
+ return configuration.getMaxHops();
+ }
+
+ public int getMaxRetriesBeforeFailover()
+ {
+ return configuration.getMaxRetriesBeforeFailover();
+ }
+
+ public int getMaxRetriesAfterFailover()
+ {
+ return configuration.getMaxRetriesAfterFailover();
+ }
+
+ public String getName()
+ {
+ return configuration.getName();
+ }
+
+ public long getRetryInterval()
+ {
+ return configuration.getRetryInterval();
+ }
+
+ public double getRetryIntervalMultiplier()
+ {
+ return configuration.getRetryIntervalMultiplier();
+ }
+
+ public TabularData getStaticConnectorNamePairs()
+ {
+ return PairsInfo.toTabularData(configuration.getStaticConnectorNamePairs());
+ }
+
+ public boolean isDuplicateDetection()
+ {
+ return configuration.isDuplicateDetection();
+ }
+
+ public boolean isForwardWhenNoConsumers()
+ {
+ return configuration.isForwardWhenNoConsumers();
+ }
+
+ public boolean isStarted()
+ {
+ return clusterConnection.isStarted();
+ }
+
+ public void start() throws Exception
+ {
+ clusterConnection.start();
+ }
+
+ public void stop() throws Exception
+ {
+ clusterConnection.stop();
+ }
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Modified: trunk/src/main/org/jboss/messaging/core/management/impl/DiscoveryGroupControl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/DiscoveryGroupControl.java 2009-03-20 14:33:02 UTC (rev 6126)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/DiscoveryGroupControl.java 2009-03-20 17:51:15 UTC (rev 6127)
@@ -22,15 +22,9 @@
package org.jboss.messaging.core.management.impl;
-import javax.management.openmbean.TabularData;
-
import org.jboss.messaging.core.cluster.DiscoveryGroup;
-import org.jboss.messaging.core.config.TransportConfiguration;
import org.jboss.messaging.core.config.cluster.DiscoveryGroupConfiguration;
-import org.jboss.messaging.core.management.AcceptorControlMBean;
import org.jboss.messaging.core.management.DiscoveryGroupControlMBean;
-import org.jboss.messaging.core.management.PropertiesInfo;
-import org.jboss.messaging.core.remoting.spi.Acceptor;
/**
* A AcceptorControl
Added: trunk/src/main/org/jboss/messaging/core/management/impl/DivertControl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/DivertControl.java (rev 0)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/DivertControl.java 2009-03-20 17:51:15 UTC (rev 6127)
@@ -0,0 +1,104 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, 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.core.management.impl;
+
+import org.jboss.messaging.core.config.cluster.DivertConfiguration;
+import org.jboss.messaging.core.management.DivertControlMBean;
+import org.jboss.messaging.core.server.Divert;
+
+/**
+ * A DivertControl
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * Created 11 dec. 2008 17:09:04
+ */
+public class DivertControl implements DivertControlMBean
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private final Divert divert;
+
+ private final DivertConfiguration configuration;
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // DivertControlMBean implementation ---------------------------
+
+ public DivertControl(final Divert divert, final DivertConfiguration configuration)
+ {
+ this.divert = divert;
+ this.configuration = configuration;
+ }
+
+ public String getAddress()
+ {
+ return configuration.getAddress();
+ }
+
+ public String getFilter()
+ {
+ return configuration.getFilterString();
+ }
+
+ public String getForwardingAddress()
+ {
+ return configuration.getForwardingAddress();
+ }
+
+ public String getRoutingName()
+ {
+ return divert.getRoutingName().toString();
+ }
+
+ public String getTransformerClassName()
+ {
+ return configuration.getTransformerClassName();
+ }
+
+ public String getUniqueName()
+ {
+ return divert.getUniqueName().toString();
+ }
+
+ public boolean isExclusive()
+ {
+ return divert.isExclusive();
+ }
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Modified: trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java 2009-03-20 14:33:02 UTC (rev 6126)
+++ trunk/src/main/org/jboss/messaging/core/management/impl/ManagementServiceImpl.java 2009-03-20 17:51:15 UTC (rev 6127)
@@ -47,12 +47,15 @@
import org.jboss.messaging.core.config.cluster.BroadcastGroupConfiguration;
import org.jboss.messaging.core.config.cluster.ClusterConnectionConfiguration;
import org.jboss.messaging.core.config.cluster.DiscoveryGroupConfiguration;
+import org.jboss.messaging.core.config.cluster.DivertConfiguration;
import org.jboss.messaging.core.config.impl.ConfigurationImpl;
import org.jboss.messaging.core.logging.Logger;
import org.jboss.messaging.core.management.AcceptorControlMBean;
import org.jboss.messaging.core.management.BridgeControlMBean;
import org.jboss.messaging.core.management.BroadcastGroupControlMBean;
+import org.jboss.messaging.core.management.ClusterConnectionControlMBean;
import org.jboss.messaging.core.management.DiscoveryGroupControlMBean;
+import org.jboss.messaging.core.management.DivertControlMBean;
import org.jboss.messaging.core.management.ManagementService;
import org.jboss.messaging.core.management.MessagingServerControlMBean;
import org.jboss.messaging.core.management.Notification;
@@ -71,6 +74,7 @@
import org.jboss.messaging.core.remoting.server.RemotingService;
import org.jboss.messaging.core.remoting.spi.Acceptor;
import org.jboss.messaging.core.security.Role;
+import org.jboss.messaging.core.server.Divert;
import org.jboss.messaging.core.server.MessagingServer;
import org.jboss.messaging.core.server.Queue;
import org.jboss.messaging.core.server.QueueFactory;
@@ -241,7 +245,26 @@
unregisterResource(objectName);
messageCounterManager.unregisterMessageCounter(name.toString());
}
+
+ public void registerDivert(Divert divert, DivertConfiguration config) throws Exception
+ {
+ ObjectName objectName = ObjectNames.getDivertObjectName(divert.getUniqueName());
+ DivertControlMBean divertControl = new DivertControl(divert, config);
+ registerInJMX(objectName, new StandardMBean(divertControl, DivertControlMBean.class));
+ registerInRegistry(objectName, divertControl);
+ if (log.isDebugEnabled())
+ {
+ log.debug("registered divert " + objectName);
+ }
+ }
+
+ public void unregisterDivert(final SimpleString name) throws Exception
+ {
+ ObjectName objectName = ObjectNames.getDivertObjectName(name);
+ unregisterResource(objectName);
+ }
+
public void registerAcceptor(final Acceptor acceptor, final TransportConfiguration configuration) throws Exception
{
ObjectName objectName = ObjectNames.getAcceptorObjectName(configuration.getName());
@@ -297,7 +320,21 @@
ObjectName objectName = ObjectNames.getBridgeObjectName(name);
unregisterResource(objectName);
}
+
+ public void registerCluster(final ClusterConnection cluster, final ClusterConnectionConfiguration configuration) throws Exception
+ {
+ ObjectName objectName = ObjectNames.getClusterConnectionObjectName(configuration.getName());
+ ClusterConnectionControlMBean control = new ClusterConnectionControl(cluster, configuration);
+ registerInJMX(objectName, new StandardMBean(control, ClusterConnectionControlMBean.class));
+ registerInRegistry(objectName, control);
+ }
+ public void unregisterCluster(final String name) throws Exception
+ {
+ ObjectName objectName = ObjectNames.getClusterConnectionObjectName(name);
+ unregisterResource(objectName);
+ }
+
public ServerMessage handleMessage(final ServerMessage message)
{
// a reply message is sent with the result stored in the message body.
@@ -377,16 +414,6 @@
unregisterFromJMX(objectName);
}
- public void registerCluster(final ClusterConnection cluster, final ClusterConnectionConfiguration configuration) throws Exception
- {
- // TODO
- }
-
- public void unregisterCluster(final String name) throws Exception
- {
- // TODO
- }
-
public Object getResource(final ObjectName objectName)
{
return registry.get(objectName);
Modified: trunk/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java 2009-03-20 14:33:02 UTC (rev 6126)
+++ trunk/src/main/org/jboss/messaging/core/postoffice/impl/PostOfficeImpl.java 2009-03-20 17:51:15 UTC (rev 6127)
@@ -526,6 +526,14 @@
{
managementService.unregisterAddress(binding.getAddress());
}
+ } else if (binding.getType() == BindingType.DIVERT)
+ {
+ managementService.unregisterDivert(uniqueName);
+
+ if (addressManager.getBindings(binding.getAddress()) == null)
+ {
+ managementService.unregisterAddress(binding.getAddress());
+ }
}
TypedProperties props = new TypedProperties();
Modified: trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterManagerImpl.java 2009-03-20 14:33:02 UTC (rev 6126)
+++ trunk/src/main/org/jboss/messaging/core/server/cluster/impl/ClusterManagerImpl.java 2009-03-20 17:51:15 UTC (rev 6127)
@@ -476,7 +476,7 @@
if (connector == null)
{
log.warn("No connector defined with name '" + connectorNamePair.a +
- "'. The bridge will not be deployed.");
+ "'. The cluster connection will not be deployed.");
return;
}
@@ -490,7 +490,7 @@
if (backupConnector == null)
{
log.warn("No connector defined with name '" + connectorNamePair.b +
- "'. The bridge will not be deployed.");
+ "'. The cluster connection will not be deployed.");
return;
}
@@ -529,7 +529,7 @@
if (dg == null)
{
log.warn("No discovery group with name '" + config.getDiscoveryGroupName() +
- "'. The bridge will not be deployed.");
+ "'. The cluster connection will not be deployed.");
}
clusterConnection = new ClusterConnectionImpl(new SimpleString(config.getName()),
Modified: trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java 2009-03-20 14:33:02 UTC (rev 6126)
+++ trunk/src/main/org/jboss/messaging/core/server/impl/MessagingServerImpl.java 2009-03-20 17:51:15 UTC (rev 6127)
@@ -944,6 +944,8 @@
Binding binding = new DivertBinding(sAddress, divert);
postOffice.addBinding(binding);
+
+ managementService.registerDivert(divert, config);
}
}
Modified: trunk/src/main/org/jboss/messaging/jms/bridge/impl/BridgeImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/jms/bridge/impl/BridgeImpl.java 2009-03-20 14:33:02 UTC (rev 6126)
+++ trunk/src/main/org/jboss/messaging/jms/bridge/impl/BridgeImpl.java 2009-03-20 17:51:15 UTC (rev 6127)
@@ -695,17 +695,32 @@
if (trace) { log.trace("Enlisted resources in tx"); }
}
- private void delistResources(Transaction tx) throws Exception
+ private void delistResources(Transaction tx)
{
if (trace) { log.trace("Delisting resources from tx"); }
XAResource resSource = ((XASession)sourceSession).getXAResource();
+
+ try
+ {
+ tx.delistResource(resSource, XAResource.TMSUCCESS);
+ }
+ catch (Exception e)
+ {
+ if (trace) { log.trace("Failed to delist source resource", e); }
+ }
+
- tx.delistResource(resSource, XAResource.TMSUCCESS);
-
XAResource resDest = ((XASession)targetSession).getXAResource();
- tx.delistResource(resDest, XAResource.TMSUCCESS);
+ try
+ {
+ tx.delistResource(resDest, XAResource.TMSUCCESS);
+ }
+ catch (Exception e)
+ {
+ if (trace) { log.trace("Failed to delist target resource", e); }
+ }
if (trace) { log.trace("Delisted resources from tx"); }
}
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/BroadcastGroupControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/BroadcastGroupControlTest.java 2009-03-20 14:33:02 UTC (rev 6126)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/BroadcastGroupControlTest.java 2009-03-20 17:51:15 UTC (rev 6127)
@@ -30,8 +30,8 @@
import java.util.ArrayList;
import java.util.List;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.TabularData;
import org.jboss.messaging.core.config.Configuration;
import org.jboss.messaging.core.config.TransportConfiguration;
@@ -41,7 +41,6 @@
import org.jboss.messaging.core.server.Messaging;
import org.jboss.messaging.core.server.MessagingService;
import org.jboss.messaging.integration.transports.netty.NettyConnectorFactory;
-import org.jboss.messaging.tests.util.UnitTestCase;
import org.jboss.messaging.utils.Pair;
/**
@@ -105,6 +104,15 @@
assertEquals(broadcastGroupConfig.getGroupAddress(), broadcastGroupControl.getGroupAddress());
assertEquals(broadcastGroupConfig.getGroupPort(), broadcastGroupControl.getGroupPort());
assertEquals(broadcastGroupConfig.getLocalBindPort(), broadcastGroupControl.getLocalBindPort());
+ assertEquals(broadcastGroupConfig.getBroadcastPeriod(), broadcastGroupControl.getBroadcastPeriod());
+
+ TabularData connectorPairs = broadcastGroupControl.getConnectorPairs();
+ assertEquals(1, connectorPairs.size());
+ CompositeData connectorPairData = (CompositeData)connectorPairs.values().iterator().next();
+ assertEquals(broadcastGroupConfig.getConnectorInfos().get(0).a, connectorPairData.get("a"));
+ assertEquals(broadcastGroupConfig.getConnectorInfos().get(0).b, connectorPairData.get("b"));
+
+ assertTrue(broadcastGroupControl.isStarted());
}
public void testStartStop() throws Exception
Added: trunk/tests/src/org/jboss/messaging/tests/integration/management/ClusterConnectionControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/ClusterConnectionControlTest.java (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/ClusterConnectionControlTest.java 2009-03-20 17:51:15 UTC (rev 6127)
@@ -0,0 +1,197 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, 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.management;
+
+import static org.jboss.messaging.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME;
+import static org.jboss.messaging.tests.util.RandomUtil.randomBoolean;
+import static org.jboss.messaging.tests.util.RandomUtil.randomDouble;
+import static org.jboss.messaging.tests.util.RandomUtil.randomPositiveInt;
+import static org.jboss.messaging.tests.util.RandomUtil.randomPositiveLong;
+import static org.jboss.messaging.tests.util.RandomUtil.randomString;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.MBeanServerFactory;
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.TabularData;
+
+import org.jboss.messaging.core.config.Configuration;
+import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.config.cluster.ClusterConnectionConfiguration;
+import org.jboss.messaging.core.config.cluster.QueueConfiguration;
+import org.jboss.messaging.core.config.impl.ConfigurationImpl;
+import org.jboss.messaging.core.management.ClusterConnectionControlMBean;
+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.MessagingService;
+import org.jboss.messaging.core.server.impl.MessagingServiceImpl;
+import org.jboss.messaging.utils.Pair;
+
+/**
+ * A BridgeControlTest
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * Created 11 dec. 2008 17:38:58
+ *
+ */
+public class ClusterConnectionControlTest extends ManagementTestBase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private MessagingService service_0;
+
+ private ClusterConnectionConfiguration clusterConnectionConfig;
+
+ private MessagingServiceImpl service_1;
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testAttributes() throws Exception
+ {
+ checkResource(ObjectNames.getClusterConnectionObjectName(clusterConnectionConfig.getName()));
+ ClusterConnectionControlMBean clusterConnectionControl = ManagementControlHelper.createClusterConnectionControl(clusterConnectionConfig.getName(),
+ mbeanServer);
+
+ assertEquals(clusterConnectionConfig.getName(), clusterConnectionControl.getName());
+ assertEquals(clusterConnectionConfig.getAddress(), clusterConnectionControl.getAddress());
+ assertEquals(clusterConnectionConfig.getDiscoveryGroupName(), clusterConnectionControl.getDiscoveryGroupName());
+ assertEquals(clusterConnectionConfig.getRetryInterval(), clusterConnectionControl.getRetryInterval());
+ assertEquals(clusterConnectionConfig.getRetryIntervalMultiplier(),
+ clusterConnectionControl.getRetryIntervalMultiplier());
+ assertEquals(clusterConnectionConfig.getMaxRetriesBeforeFailover(),
+ clusterConnectionControl.getMaxRetriesBeforeFailover());
+ assertEquals(clusterConnectionConfig.getMaxRetriesAfterFailover(),
+ clusterConnectionControl.getMaxRetriesAfterFailover());
+ assertEquals(clusterConnectionConfig.isDuplicateDetection(), clusterConnectionControl.isDuplicateDetection());
+ assertEquals(clusterConnectionConfig.isForwardWhenNoConsumers(),
+ clusterConnectionControl.isForwardWhenNoConsumers());
+ assertEquals(clusterConnectionConfig.getMaxHops(), clusterConnectionControl.getMaxHops());
+
+ TabularData connectorPairs = clusterConnectionControl.getStaticConnectorNamePairs();
+ assertEquals(1, connectorPairs.size());
+ CompositeData connectorPairData = (CompositeData)connectorPairs.values().iterator().next();
+ assertEquals(clusterConnectionConfig.getStaticConnectorNamePairs().get(0).a, connectorPairData.get("a"));
+ assertEquals(clusterConnectionConfig.getStaticConnectorNamePairs().get(0).b, connectorPairData.get("b"));
+
+ assertTrue(clusterConnectionControl.isStarted());
+ }
+
+ public void testStartStop() throws Exception
+ {
+ checkResource(ObjectNames.getClusterConnectionObjectName(clusterConnectionConfig.getName()));
+ ClusterConnectionControlMBean clusterConnectionControl = ManagementControlHelper.createClusterConnectionControl(clusterConnectionConfig.getName(),
+ mbeanServer);
+
+ // started by the service
+ assertTrue(clusterConnectionControl.isStarted());
+
+ clusterConnectionControl.stop();
+ assertFalse(clusterConnectionControl.isStarted());
+
+ clusterConnectionControl.start();
+ assertTrue(clusterConnectionControl.isStarted());
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ Map<String, Object> acceptorParams = new HashMap<String, Object>();
+ acceptorParams.put(SERVER_ID_PROP_NAME, 1);
+ TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(),
+ acceptorParams,
+ randomString());
+
+ TransportConfiguration connectorConfig = new TransportConfiguration(InVMConnectorFactory.class.getName(),
+ acceptorParams,
+ randomString());
+
+ QueueConfiguration queueConfig = new QueueConfiguration(randomString(), randomString(), null, false);
+
+ Pair<String, String> connectorPair = new Pair<String, String>(connectorConfig.getName(), null);
+ List<Pair<String, String>> pairs = new ArrayList<Pair<String, String>>();
+ pairs.add(connectorPair);
+
+ clusterConnectionConfig = new ClusterConnectionConfiguration(randomString(),
+ queueConfig.getAddress(),
+ randomPositiveLong(),
+ randomDouble(),
+ randomPositiveInt(),
+ randomPositiveInt(),
+ randomBoolean(),
+ randomBoolean(),
+ randomPositiveInt(),
+ pairs);
+
+ Configuration conf_1 = new ConfigurationImpl();
+ conf_1.setSecurityEnabled(false);
+ conf_1.setJMXManagementEnabled(true);
+ conf_1.setClustered(true);
+ conf_1.getAcceptorConfigurations().add(acceptorConfig);
+ conf_1.getQueueConfigurations().add(queueConfig);
+
+ Configuration conf_0 = new ConfigurationImpl();
+ conf_0.setSecurityEnabled(false);
+ conf_0.setJMXManagementEnabled(true);
+ conf_0.setClustered(true);
+ conf_0.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
+ conf_0.getConnectorConfigurations().put(connectorConfig.getName(), connectorConfig);
+ conf_0.getClusterConfigurations().add(clusterConnectionConfig);
+
+ service_1 = Messaging.newNullStorageMessagingService(conf_1, MBeanServerFactory.createMBeanServer());
+ service_1.start();
+
+ service_0 = Messaging.newNullStorageMessagingService(conf_0, mbeanServer);
+ service_0.start();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ service_0.stop();
+ service_1.stop();
+
+ super.tearDown();
+ }
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: trunk/tests/src/org/jboss/messaging/tests/integration/management/DivertControlTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/DivertControlTest.java (rev 0)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/DivertControlTest.java 2009-03-20 17:51:15 UTC (rev 6127)
@@ -0,0 +1,133 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2008, 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.management;
+
+import static org.jboss.messaging.tests.util.RandomUtil.randomBoolean;
+import static org.jboss.messaging.tests.util.RandomUtil.randomString;
+
+import org.jboss.messaging.core.config.Configuration;
+import org.jboss.messaging.core.config.TransportConfiguration;
+import org.jboss.messaging.core.config.cluster.DivertConfiguration;
+import org.jboss.messaging.core.config.cluster.QueueConfiguration;
+import org.jboss.messaging.core.config.impl.ConfigurationImpl;
+import org.jboss.messaging.core.management.DivertControlMBean;
+import org.jboss.messaging.core.management.ObjectNames;
+import org.jboss.messaging.core.remoting.impl.invm.InVMConnectorFactory;
+import org.jboss.messaging.core.server.Messaging;
+import org.jboss.messaging.core.server.MessagingService;
+import org.jboss.messaging.utils.SimpleString;
+
+/**
+ * A BridgeControlTest
+ *
+ * @author <a href="jmesnil at redhat.com">Jeff Mesnil</a>
+ *
+ * Created 11 dec. 2008 17:38:58
+ *
+ */
+public class DivertControlTest extends ManagementTestBase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ private MessagingService service;
+
+ private DivertConfiguration divertConfig;
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void testAttributes() throws Exception
+ {
+ checkResource(ObjectNames.getDivertObjectName(new SimpleString(divertConfig.getName())));
+ DivertControlMBean divertControl = ManagementControlHelper.createDivertControl(divertConfig.getName(),
+ mbeanServer);
+
+ assertEquals(divertConfig.getFilterString(), divertControl.getFilter());
+
+ assertEquals(divertConfig.isExclusive(), divertControl.isExclusive());
+
+ assertEquals(divertConfig.getName(), divertControl.getUniqueName());
+
+ assertEquals(divertConfig.getRoutingName(), divertControl.getRoutingName());
+
+ assertEquals(divertConfig.getAddress(), divertControl.getAddress());
+
+ assertEquals(divertConfig.getForwardingAddress(), divertControl.getForwardingAddress());
+
+ assertEquals(divertConfig.getTransformerClassName(), divertControl.getTransformerClassName());
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ TransportConfiguration connectorConfig = new TransportConfiguration(InVMConnectorFactory.class.getName());
+
+ QueueConfiguration queueConfig = new QueueConfiguration(randomString(), randomString(), null, false);
+ QueueConfiguration fowardQueueConfig = new QueueConfiguration(randomString(), randomString(), null, false);
+
+ divertConfig = new DivertConfiguration(randomString(),
+ randomString(),
+ queueConfig.getAddress(),
+ fowardQueueConfig.getAddress(),
+ randomBoolean(),
+ null,
+ null);
+ Configuration conf = new ConfigurationImpl();
+ conf.setSecurityEnabled(false);
+ conf.setJMXManagementEnabled(true);
+ conf.setClustered(true);
+ conf.getQueueConfigurations().add(queueConfig);
+ conf.getQueueConfigurations().add(fowardQueueConfig);
+ conf.getDivertConfigurations().add(divertConfig);
+
+ conf.getConnectorConfigurations().put(connectorConfig.getName(), connectorConfig);
+
+ service = Messaging.newNullStorageMessagingService(conf, mbeanServer);
+ service.start();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ service.stop();
+
+ checkNoResource(ObjectNames.getDivertObjectName(new SimpleString(divertConfig.getName())));
+
+ super.tearDown();
+ }
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Modified: trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementControlHelper.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementControlHelper.java 2009-03-20 14:33:02 UTC (rev 6126)
+++ trunk/tests/src/org/jboss/messaging/tests/integration/management/ManagementControlHelper.java 2009-03-20 17:51:15 UTC (rev 6127)
@@ -32,7 +32,9 @@
import org.jboss.messaging.core.management.AddressControlMBean;
import org.jboss.messaging.core.management.BridgeControlMBean;
import org.jboss.messaging.core.management.BroadcastGroupControlMBean;
+import org.jboss.messaging.core.management.ClusterConnectionControlMBean;
import org.jboss.messaging.core.management.DiscoveryGroupControlMBean;
+import org.jboss.messaging.core.management.DivertControlMBean;
import org.jboss.messaging.core.management.MessagingServerControlMBean;
import org.jboss.messaging.core.management.ObjectNames;
import org.jboss.messaging.core.management.QueueControlMBean;
@@ -85,6 +87,20 @@
mbeanServer);
}
+ public static DivertControlMBean createDivertControl(String name, MBeanServer mbeanServer) throws Exception
+ {
+ return (DivertControlMBean)createProxy(ObjectNames.getDivertObjectName(new SimpleString(name)),
+ DivertControlMBean.class,
+ mbeanServer);
+ }
+
+ public static ClusterConnectionControlMBean createClusterConnectionControl(String name, MBeanServer mbeanServer) throws Exception
+ {
+ return (ClusterConnectionControlMBean)createProxy(ObjectNames.getClusterConnectionObjectName(name),
+ ClusterConnectionControlMBean.class,
+ mbeanServer);
+ }
+
public static MessagingServerControlMBean createMessagingServerControl(MBeanServer mbeanServer) throws Exception
{
return (MessagingServerControlMBean)createProxy(ObjectNames.getMessagingServerObjectName(),
Deleted: trunk/tests/src/org/jboss/messaging/tests/unit/jms/server/management/impl/JMSManagementServiceImplTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/unit/jms/server/management/impl/JMSManagementServiceImplTest.java 2009-03-20 14:33:02 UTC (rev 6126)
+++ trunk/tests/src/org/jboss/messaging/tests/unit/jms/server/management/impl/JMSManagementServiceImplTest.java 2009-03-20 17:51:15 UTC (rev 6127)
@@ -1,184 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source Copyright 2008, 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.unit.jms.server.management.impl;
-
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.isA;
-import static org.easymock.classextension.EasyMock.createMock;
-import static org.easymock.classextension.EasyMock.replay;
-import static org.easymock.classextension.EasyMock.verify;
-import static org.jboss.messaging.tests.util.RandomUtil.randomPositiveInt;
-import static org.jboss.messaging.tests.util.RandomUtil.randomString;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.management.ObjectName;
-import javax.management.StandardMBean;
-
-import org.jboss.messaging.core.management.ManagementService;
-import org.jboss.messaging.core.management.ObjectNames;
-import org.jboss.messaging.core.management.ReplicationOperationInvoker;
-import org.jboss.messaging.core.messagecounter.MessageCounter;
-import org.jboss.messaging.core.messagecounter.MessageCounterManager;
-import org.jboss.messaging.core.persistence.StorageManager;
-import org.jboss.messaging.core.postoffice.PostOffice;
-import org.jboss.messaging.core.server.Queue;
-import org.jboss.messaging.core.settings.HierarchicalRepository;
-import org.jboss.messaging.core.settings.impl.AddressSettings;
-import org.jboss.messaging.jms.JBossQueue;
-import org.jboss.messaging.jms.JBossTopic;
-import org.jboss.messaging.jms.client.JBossConnectionFactory;
-import org.jboss.messaging.jms.server.JMSServerManager;
-import org.jboss.messaging.jms.server.management.JMSManagementService;
-import org.jboss.messaging.jms.server.management.JMSServerControlMBean;
-import org.jboss.messaging.jms.server.management.impl.ConnectionFactoryControl;
-import org.jboss.messaging.jms.server.management.impl.JMSManagementServiceImpl;
-import org.jboss.messaging.jms.server.management.impl.JMSQueueControl;
-import org.jboss.messaging.jms.server.management.impl.TopicControl;
-import org.jboss.messaging.tests.util.UnitTestCase;
-
-/*
- * @author <a href="mailto:jmesnil at redhat.com">Jeff Mesnil</a>
- *
- * @version <tt>$Revision$</tt>
- */
-public class JMSManagementServiceImplTest extends UnitTestCase
-{
- // Constants -----------------------------------------------------
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- public void testRegisterJMSServer() throws Exception
- {
- ObjectName objectName = ObjectNames.getJMSServerObjectName();
-
- JMSServerManager server = createMock(JMSServerManager.class);
-
- ManagementService managementService = createMock(ManagementService.class);
- ReplicationOperationInvoker invoker = createMock(ReplicationOperationInvoker.class);
- expect(managementService.getReplicationOperationInvoker()).andStubReturn(invoker);
- managementService.registerInJMX(eq(objectName), isA(StandardMBean.class));
- managementService.registerInRegistry(eq(objectName), isA(JMSServerControlMBean.class));
- replay(managementService, server, invoker);
-
- JMSManagementService service = new JMSManagementServiceImpl(managementService);
- service.registerJMSServer(server);
-
- verify(managementService, server, invoker);
- }
-
- public void testRegisterQueue() throws Exception
- {
- String name = randomString();
- String jndiBinding = randomString();
- ObjectName objectName = ObjectNames.getJMSQueueObjectName(name);
-
- JBossQueue queue = new JBossQueue(name);
- Queue coreQueue = createMock(Queue.class);
- expect(coreQueue.isDurable()).andReturn(true);
- PostOffice postOffice = createMock(PostOffice.class);
- StorageManager storageManager = createMock(StorageManager.class);
- HierarchicalRepository<AddressSettings> addressSettingsRepository = createMock(HierarchicalRepository.class);
-
- ManagementService managementService = createMock(ManagementService.class);
- MessageCounterManager messageCounterManager = createMock(MessageCounterManager.class);
- expect(managementService.getMessageCounterManager()).andReturn(messageCounterManager );
- expect(messageCounterManager.getMaxDayCount()).andReturn(randomPositiveInt());
- ReplicationOperationInvoker invoker = createMock(ReplicationOperationInvoker.class);
- expect(managementService.getReplicationOperationInvoker()).andStubReturn(invoker);
- messageCounterManager.registerMessageCounter(eq(name), isA(MessageCounter.class));
- managementService.registerInJMX(eq(objectName), isA(StandardMBean.class));
- managementService.registerInRegistry(eq(objectName), isA(JMSQueueControl.class));
-
- replay(managementService, invoker, messageCounterManager, coreQueue, postOffice, storageManager, addressSettingsRepository);
-
- JMSManagementService service = new JMSManagementServiceImpl(managementService);
- service.registerQueue(queue, coreQueue, jndiBinding, postOffice, storageManager, addressSettingsRepository);
-
- verify(managementService, invoker, messageCounterManager, coreQueue, postOffice, storageManager, addressSettingsRepository);
- }
-
- public void testRegisterTopic() throws Exception
- {
- String name = randomString();
- String jndiBinding = randomString();
- ObjectName objectName = ObjectNames.getJMSTopicObjectName(name);
-
- JBossTopic topic = new JBossTopic(name);
- PostOffice postOffice = createMock(PostOffice.class);
- StorageManager storageManager = createMock(StorageManager.class);
- HierarchicalRepository<AddressSettings> addressSettingsRepository = createMock(HierarchicalRepository.class);
-
- ManagementService managementService = createMock(ManagementService.class);
- ReplicationOperationInvoker invoker = createMock(ReplicationOperationInvoker.class);
- expect(managementService.getReplicationOperationInvoker()).andStubReturn(invoker);
- managementService.registerInJMX(eq(objectName), isA(StandardMBean.class));
- managementService.registerInRegistry(eq(objectName), isA(TopicControl.class));
-
- replay(managementService, invoker, postOffice, storageManager);
-
- JMSManagementService service = new JMSManagementServiceImpl(managementService);
- service.registerTopic(topic, jndiBinding, postOffice, storageManager, addressSettingsRepository);
-
- verify(managementService, invoker, postOffice, storageManager);
- }
-
- public void testRegisterConnectionFactory() throws Exception
- {
- String name = randomString();
- String jndiBinding = randomString();
- List<String> bindings = new ArrayList<String>();
- bindings.add(jndiBinding);
-
- ObjectName objectName = ObjectNames.getConnectionFactoryObjectName(name);
-
- JBossConnectionFactory connectionFactory = createMock(JBossConnectionFactory.class);
- ManagementService managementService = createMock(ManagementService.class);
- ReplicationOperationInvoker invoker = createMock(ReplicationOperationInvoker.class);
- expect(managementService.getReplicationOperationInvoker()).andStubReturn(invoker);
- managementService.registerInJMX(eq(objectName), isA(StandardMBean.class));
- managementService.registerInRegistry(eq(objectName), isA(ConnectionFactoryControl.class));
-
- replay(managementService, invoker, connectionFactory);
-
- JMSManagementService service = new JMSManagementServiceImpl(managementService);
- service.registerConnectionFactory(name, connectionFactory, bindings);
-
- verify(managementService, invoker, connectionFactory);
- }
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- // Inner classes -------------------------------------------------
-}
More information about the jboss-cvs-commits
mailing list