[jboss-cvs] JBossAS SVN: r86135 - in trunk: testsuite/src/main/org/jboss/test/cluster/defaultcfg/test and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Mar 19 18:10:58 EDT 2009
Author: bstansberry at jboss.com
Date: 2009-03-19 18:10:58 -0400 (Thu, 19 Mar 2009)
New Revision: 86135
Modified:
trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedReplicantManagerImpl.java
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/ClusterPartitionManagedObjectsTestCase.java
Log:
[JBAS-6094] Merge DRM managed object changes from Branch_5_x
Modified: trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedReplicantManagerImpl.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedReplicantManagerImpl.java 2009-03-19 22:10:06 UTC (rev 86134)
+++ trunk/cluster/src/main/org/jboss/ha/framework/server/DistributedReplicantManagerImpl.java 2009-03-19 22:10:58 UTC (rev 86135)
@@ -65,8 +65,7 @@
* @author <a href="mailto:pferraro at redhat.com">Paul Ferraro</a>
* @version $Revision$
*/
- at ManagementObject(componentType=@ManagementComponent(type="MCBean", subtype="DistributedReplicantManager"),
- properties=ManagementProperties.EXPLICIT)
+ at ManagementObject(isRuntime=true, properties=ManagementProperties.EXPLICIT)
public class DistributedReplicantManagerImpl
implements DistributedReplicantManagerImplMBean,
HAPartition.HAMembershipExtendedListener,
@@ -199,7 +198,7 @@
}
@ManagementProperty(use={ViewUse.STATISTIC}, description="The partition's name")
- @ManagementObjectID(type="DistributedReplicantManager")
+ @ManagementObjectID(type="HAPartition")
public String getPartitionName()
{
return this.partition.getPartitionName();
@@ -210,8 +209,9 @@
// this.partition = clusterPartition;
// }
- @ManagementOperation(description="List all known keys and the nodes that have registered bindings",
- impact=Impact.ReadOnly)
+ @ManagementOperation(name="listDRMContent",
+ description="List all known keys and the nodes that have registered bindings",
+ impact=Impact.ReadOnly)
public String listContent() throws Exception
{
StringBuilder result = new StringBuilder();
@@ -255,7 +255,8 @@
return result.toString();
}
- @ManagementOperation(description="List in XML format all known services and the nodes that have registered bindings",
+ @ManagementOperation(name="listDRMContentAsXml",
+ description="List in XML format all known services and the nodes that have registered bindings",
impact=Impact.ReadOnly)
public String listXmlContent() throws Exception
{
@@ -349,9 +350,9 @@
new MembersPublisher().start();
}
- @ManagementOperation(description="Get a collection of the names of all keys" +
- " for which we have bindings",
- impact=Impact.ReadOnly)
+ @ManagementOperation(name="getAllDRMServices",
+ description="Get a collection of the names of all keys for which we have bindings",
+ impact=Impact.ReadOnly)
public Collection<String> getAllServices()
{
Set<String> services = new HashSet<String>();
@@ -525,8 +526,8 @@
}
@Deprecated
- @ManagementOperation(description="Returns the names of the nodes that have " +
- " registered objects under the given key",
+ @ManagementOperation(name="lookupDRMNodeNames",
+ description="Returns the names of the nodes that have registered objects under the given key",
impact=Impact.ReadOnly,
params={@ManagementParameter(name="key",
description="The name of the service")})
@@ -598,7 +599,8 @@
}
}
- @ManagementOperation(description="Returns a hash of the list of nodes that " +
+ @ManagementOperation(name="getDRMServiceViewId",
+ description="Returns a hash of the list of nodes that " +
"have registered an object for the given key",
impact=Impact.ReadOnly,
params={@ManagementParameter(name="key",
@@ -610,6 +612,10 @@
return (result != null) ? result.intValue() : 0;
}
+ @ManagementOperation(name="isDRMMasterForService",
+ description="Returns whether the DRM considers this node to be the master for the given service",
+ impact=Impact.ReadOnly,
+ params={@ManagementParameter(name="key", description="The name of the service")})
public boolean isMasterReplica(String key)
{
if (this.log.isTraceEnabled())
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/ClusterPartitionManagedObjectsTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/ClusterPartitionManagedObjectsTestCase.java 2009-03-19 22:10:06 UTC (rev 86134)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/test/ClusterPartitionManagedObjectsTestCase.java 2009-03-19 22:10:58 UTC (rev 86135)
@@ -21,8 +21,10 @@
*/
package org.jboss.test.cluster.defaultcfg.test;
+import java.util.HashSet;
import java.util.Map;
import java.util.Properties;
+import java.util.Set;
import javax.naming.Context;
import javax.naming.InitialContext;
@@ -78,9 +80,26 @@
assertEquals("HAPartition", mc.getNameType());
assertEquals("DefaultPartition", mc.getName());
+ Set<String> operationNames = new HashSet<String>();
+ getLog().debug(mc);
for (ManagedOperation mo : mc.getOperations())
- getLog().debug(mo);
+ {
+ getLog().debug("name="+mo.getName()+",description="+mo.getDescription()+",impact="+mo.getImpact());
+ operationNames.add(mo.getName());
+ }
+ assertTrue("HAPartition has showHistoryAsXML", operationNames.contains("showHistoryAsXML"));
+ assertTrue("HAPartition has showHistory", operationNames.contains("showHistory"));
+ // FIXME test for service lifecycle
+ // FIXME test for DRM operations pseudo-name defined via @ManagementProperty.name
+// assertTrue("HAPartition has getAllDRMServices", operationNames.contains("getAllDRMServices"));
+// assertTrue("HAPartition has listDRMContentAsXml", operationNames.contains("listDRMContentAsXml"));
+// assertTrue("HAPartition has getDRMServiceViewId", operationNames.contains("getDRMServiceViewId"));
+// assertTrue("HAPartition has lookupDRMNodeNames", operationNames.contains("lookupDRMNodeNames"));
+// assertTrue("HAPartition has listDRMContent", operationNames.contains("listDRMContent"));
+// assertTrue("HAPartition has isDRMMasterForService", operationNames.contains("isDRMMasterForService"));
+ assertEquals("Correct number of operations", 8, operationNames.size());
+
for (Map.Entry<String, ManagedProperty> entry : mc.getProperties().entrySet())
{
getLog().debug(entry.getKey() + " == " + entry.getValue());
@@ -90,27 +109,10 @@
getLog().debug(entry.getKey() + " -- ManagedObject == " + mo);
}
}
+ // FIXME validate the properties
}
/**
- * Look at the DistributedReplicantManager ManagedComponent
- * @throws Exception
- */
- public void testDistributedReplicantManager()
- throws Exception
- {
- ManagementView mgtView = getManagementView();
-// ComponentType type = new ComponentType("MCBean", "Clustering");
-// Set<ManagedComponent> mcs = mgtView.getMatchingComponents(this.partitionName, type,
-// new NameTypeQualifiedNameMatcher("DistributedReplicantManager"));
-// assertEquals("There is just one DistributedReplicantManager component", 1, mcs.size());
-// ManagedComponent mc = mcs.iterator().next();
- ComponentType type = new ComponentType("MCBean", "DistributedReplicantManager");
- ManagedComponent mc = mgtView.getComponent(this.partitionName, type);
- validateDRMManagedComponent(mc);
- }
-
- /**
* Obtain the ProfileService.ManagementView
* @return
* @throws Exception
@@ -138,13 +140,6 @@
return activeView;
}
- private void validateDRMManagedComponent(ManagedComponent mc)
- {
- assertNotNull(mc);
- assertEquals("DistributedReplicantManager", mc.getNameType());
- assertEquals("DefaultPartition", mc.getName());
- }
-
protected String getProfileName()
{
return "cluster-udp-0";
More information about the jboss-cvs-commits
mailing list