Search in sources :

Example 16 with ModelMBeanOperationInfo

use of javax.management.modelmbean.ModelMBeanOperationInfo in project spring-framework by spring-projects.

the class AbstractMetadataAssemblerTests method testMetricDescription.

@Test
public void testMetricDescription() throws Exception {
    ModelMBeanInfo inf = getMBeanInfoFromAssembler();
    ModelMBeanAttributeInfo metric = inf.getAttribute(QUEUE_SIZE_METRIC);
    ModelMBeanOperationInfo operation = inf.getOperation("getQueueSize");
    assertEquals("The description for the queue size metric is incorrect", "The QueueSize metric", metric.getDescription());
    assertEquals("The description for the getter operation of the queue size metric is incorrect", "The QueueSize metric", operation.getDescription());
}
Also used : ModelMBeanOperationInfo(javax.management.modelmbean.ModelMBeanOperationInfo) ModelMBeanAttributeInfo(javax.management.modelmbean.ModelMBeanAttributeInfo) ModelMBeanInfo(javax.management.modelmbean.ModelMBeanInfo) Test(org.junit.Test)

Example 17 with ModelMBeanOperationInfo

use of javax.management.modelmbean.ModelMBeanOperationInfo in project spring-framework by spring-projects.

the class AbstractMetadataAssemblerTests method testOperationParameterMetadata.

@Test
public void testOperationParameterMetadata() throws Exception {
    ModelMBeanInfo info = getMBeanInfoFromAssembler();
    ModelMBeanOperationInfo oper = info.getOperation("add");
    MBeanParameterInfo[] params = oper.getSignature();
    assertEquals("Invalid number of params", 2, params.length);
    assertEquals("Incorrect name for x param", "x", params[0].getName());
    assertEquals("Incorrect type for x param", int.class.getName(), params[0].getType());
    assertEquals("Incorrect name for y param", "y", params[1].getName());
    assertEquals("Incorrect type for y param", int.class.getName(), params[1].getType());
}
Also used : ModelMBeanOperationInfo(javax.management.modelmbean.ModelMBeanOperationInfo) ModelMBeanInfo(javax.management.modelmbean.ModelMBeanInfo) MBeanParameterInfo(javax.management.MBeanParameterInfo) Test(org.junit.Test)

Example 18 with ModelMBeanOperationInfo

use of javax.management.modelmbean.ModelMBeanOperationInfo in project Activiti by Activiti.

the class MBeanInfoAssembler method extractMbeanOperations.

private void extractMbeanOperations(Object managedBean, Set<ManagedOperationInfo> operations, Set<ModelMBeanOperationInfo> mBeanOperations) {
    for (ManagedOperationInfo info : operations) {
        ModelMBeanOperationInfo mbean = new ModelMBeanOperationInfo(info.getDescription(), info.getOperation());
        Descriptor opDesc = mbean.getDescriptor();
        mbean.setDescriptor(opDesc);
        mBeanOperations.add(mbean);
        LOG.trace("Assembled operation: {}", mbean);
    }
}
Also used : ModelMBeanOperationInfo(javax.management.modelmbean.ModelMBeanOperationInfo) Descriptor(javax.management.Descriptor)

Aggregations

ModelMBeanOperationInfo (javax.management.modelmbean.ModelMBeanOperationInfo)18 ModelMBeanInfo (javax.management.modelmbean.ModelMBeanInfo)11 Descriptor (javax.management.Descriptor)9 ModelMBeanAttributeInfo (javax.management.modelmbean.ModelMBeanAttributeInfo)9 Test (org.junit.Test)6 ModelMBeanInfoSupport (javax.management.modelmbean.ModelMBeanInfoSupport)5 Method (java.lang.reflect.Method)4 DescriptorSupport (javax.management.modelmbean.DescriptorSupport)3 ModelMBeanNotificationInfo (javax.management.modelmbean.ModelMBeanNotificationInfo)3 ArrayList (java.util.ArrayList)2 LinkedHashMap (java.util.LinkedHashMap)2 LinkedHashSet (java.util.LinkedHashSet)2 MBeanParameterInfo (javax.management.MBeanParameterInfo)2 MBeanServer (javax.management.MBeanServer)2 ObjectName (javax.management.ObjectName)2 ModelMBean (javax.management.modelmbean.ModelMBean)2 RequiredModelMBean (javax.management.modelmbean.RequiredModelMBean)2 PropertyDescriptor (java.beans.PropertyDescriptor)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Hashtable (java.util.Hashtable)1