[jboss-cvs] JBossAS SVN: r87924 - in trunk: testsuite/src/main/org/jboss/test/profileservice/test and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Apr 28 03:05:00 EDT 2009
Author: scott.stark at jboss.org
Date: 2009-04-28 03:04:59 -0400 (Tue, 28 Apr 2009)
New Revision: 87924
Modified:
trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
trunk/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java
Log:
JBAS-6618, only overwrite MO name if its equal to the attachment name
Modified: trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java 2009-04-28 06:15:28 UTC (rev 87923)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/ProfileServiceBootstrap.java 2009-04-28 07:04:59 UTC (rev 87924)
@@ -460,13 +460,12 @@
Map<String, Annotation> moAnns = bmdMO.getAnnotations();
ManagementObject mo = (ManagementObject) moAnns.get(ManagementObject.class.getName());
- // Reset the name to the bean name
+ // Reset the name to the bean name rather than the attachment name
if(bmdMO instanceof MutableManagedObject)
{
MutableManagedObject mmo = (MutableManagedObject) bmdMO;
- if(mo != null && mo.name().length() > 0 && mo.name().equals(ManagementConstants.GENERATED) == false)
- mmo.setName(mo.name());
- else
+ // Reset the name to the bean name if its the attachment name
+ if(mmo.getName().equals(mmo.getAttachmentName()))
mmo.setName(bmd.getName());
mmo.setParent(kdMO);
// Add an alias property
Modified: trunk/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java 2009-04-28 06:15:28 UTC (rev 87923)
+++ trunk/testsuite/src/main/org/jboss/test/profileservice/test/ServerManagedObjectsTestCase.java 2009-04-28 07:04:59 UTC (rev 87924)
@@ -39,6 +39,7 @@
import org.jboss.managed.plugins.ManagedOperationMatcher;
import org.jboss.metatype.api.types.EnumMetaType;
import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.types.SimpleMetaType;
import org.jboss.metatype.api.values.EnumValue;
import org.jboss.metatype.api.values.EnumValueSupport;
import org.jboss.metatype.api.values.MetaValue;
@@ -73,6 +74,7 @@
throws Exception
{
ManagementView mgtView = getManagementView();
+ mgtView.reload();
ComponentType type = new ComponentType("MCBean", "ServerInfo");
getLog().debug("MCBeans: "+mgtView.getComponentsForType(type));
ManagedComponent mc = mgtView.getComponent("jboss.system:type=ServerInfo", type);
@@ -110,6 +112,33 @@
long activeThreadGroupCountValue = getLong(activeThreadGroupCount);
assertTrue("activeThreadGroupCount > 0", activeThreadGroupCountValue > 0);
+ // Operations
+ Set<ManagedOperation> ops = mc.getOperations();
+ log.info("ServerInfo.ops: "+ ops);
+ ManagedOperation listThreadCpuUtilization = ManagedOperationMatcher.findOperation(ops, "listThreadCpuUtilization");
+ assertNotNull(listThreadCpuUtilization);
+ MetaValue listThreadCpuUtilizationMV = listThreadCpuUtilization.invoke();
+ // TODO
+ assertNotNull(listThreadCpuUtilizationMV);
+ assertEquals(SimpleMetaType.STRING, listThreadCpuUtilizationMV.getMetaType());
+ SimpleValue listThreadCpuUtilizationSV = (SimpleValue) listThreadCpuUtilizationMV;
+ String cpuUtilization = (String) listThreadCpuUtilizationSV.getValue();
+ log.info(cpuUtilization);
+ assertTrue(cpuUtilization.length() > 100);
+
+
+ // Try invoking listThreadCpuUtilization and checking freeMemory until it changes
+ long currentFreeMemoryValue = freeMemoryValue;
+ for(int n = 0; n < 100; n ++)
+ {
+ listThreadCpuUtilization.invoke();
+ currentFreeMemoryValue = getLong(freeMemory);
+ if(currentFreeMemoryValue != freeMemoryValue)
+ break;
+ }
+ assertTrue("currentFreeMemoryValue != original freeMemoryValue",
+ currentFreeMemoryValue != freeMemoryValue);
+
// The bean state
ManagedProperty state = props.get("state");
assertNotNull("state", state);
More information about the jboss-cvs-commits
mailing list