Search in sources :

Example 11 with ModelMBeanInfo

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

the class AbstractJmxAssemblerTests method testAttributeInfoHasDescriptors.

@Test
public void testAttributeInfoHasDescriptors() throws Exception {
    ModelMBeanInfo info = getMBeanInfoFromAssembler();
    ModelMBeanAttributeInfo attr = info.getAttribute(NAME_ATTRIBUTE);
    Descriptor desc = attr.getDescriptor();
    assertNotNull("getMethod field should not be null", desc.getFieldValue("getMethod"));
    assertNotNull("setMethod field should not be null", desc.getFieldValue("setMethod"));
    assertEquals("getMethod field has incorrect value", "getName", desc.getFieldValue("getMethod"));
    assertEquals("setMethod field has incorrect value", "setName", desc.getFieldValue("setMethod"));
}
Also used : ModelMBeanAttributeInfo(javax.management.modelmbean.ModelMBeanAttributeInfo) Descriptor(javax.management.Descriptor) ModelMBeanInfo(javax.management.modelmbean.ModelMBeanInfo) Test(org.junit.Test)

Example 12 with ModelMBeanInfo

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

the class AbstractJmxAssemblerTests method testGetMBeanAttributeInfo.

@Test
public void testGetMBeanAttributeInfo() throws Exception {
    ModelMBeanInfo info = getMBeanInfoFromAssembler();
    MBeanAttributeInfo[] inf = info.getAttributes();
    assertEquals("Invalid number of Attributes returned", getExpectedAttributeCount(), inf.length);
    for (int x = 0; x < inf.length; x++) {
        assertNotNull("MBeanAttributeInfo should not be null", inf[x]);
        assertNotNull("Description for MBeanAttributeInfo should not be null", inf[x].getDescription());
    }
}
Also used : ModelMBeanInfo(javax.management.modelmbean.ModelMBeanInfo) ModelMBeanAttributeInfo(javax.management.modelmbean.ModelMBeanAttributeInfo) MBeanAttributeInfo(javax.management.MBeanAttributeInfo) Test(org.junit.Test)

Example 13 with ModelMBeanInfo

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

the class AbstractMetadataAssemblerTests method testDescription.

@Test
public void testDescription() throws Exception {
    ModelMBeanInfo info = getMBeanInfoFromAssembler();
    assertEquals("The descriptions are not the same", "My Managed Bean", info.getDescription());
}
Also used : ModelMBeanInfo(javax.management.modelmbean.ModelMBeanInfo) Test(org.junit.Test)

Example 14 with ModelMBeanInfo

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

the class AbstractMetadataAssemblerTests method testReadOnlyAttribute.

/**
	 * Tests the situation where the attribute is only defined on the getter.
	 */
@Test
public void testReadOnlyAttribute() throws Exception {
    ModelMBeanInfo inf = getMBeanInfoFromAssembler();
    ModelMBeanAttributeInfo attr = inf.getAttribute(AGE_ATTRIBUTE);
    assertFalse("The age attribute should not be writable", attr.isWritable());
}
Also used : ModelMBeanAttributeInfo(javax.management.modelmbean.ModelMBeanAttributeInfo) ModelMBeanInfo(javax.management.modelmbean.ModelMBeanInfo) Test(org.junit.Test)

Example 15 with ModelMBeanInfo

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

the class AbstractMetadataAssemblerTests method testMetricDescriptor.

@Test
public void testMetricDescriptor() throws Exception {
    ModelMBeanInfo info = getMBeanInfoFromAssembler();
    Descriptor desc = info.getAttribute(QUEUE_SIZE_METRIC).getDescriptor();
    assertEquals("Currency Time Limit should be 20", "20", desc.getFieldValue("currencyTimeLimit"));
    assertEquals("Persist Policy should be OnUpdate", "OnUpdate", desc.getFieldValue("persistPolicy"));
    assertEquals("Persist Period should be 300", "300", desc.getFieldValue("persistPeriod"));
    assertEquals("Unit should be messages", "messages", desc.getFieldValue("units"));
    assertEquals("Display Name should be Queue Size", "Queue Size", desc.getFieldValue("displayName"));
    assertEquals("Metric Type should be COUNTER", "COUNTER", desc.getFieldValue("metricType"));
    assertEquals("Metric Category should be utilization", "utilization", desc.getFieldValue("metricCategory"));
}
Also used : Descriptor(javax.management.Descriptor) ModelMBeanInfo(javax.management.modelmbean.ModelMBeanInfo) Test(org.junit.Test)

Aggregations

ModelMBeanInfo (javax.management.modelmbean.ModelMBeanInfo)63 Test (org.junit.Test)44 ModelMBeanAttributeInfo (javax.management.modelmbean.ModelMBeanAttributeInfo)33 Descriptor (javax.management.Descriptor)16 ModelMBeanOperationInfo (javax.management.modelmbean.ModelMBeanOperationInfo)12 MBeanAttributeInfo (javax.management.MBeanAttributeInfo)9 ModelMBeanInfoSupport (javax.management.modelmbean.ModelMBeanInfoSupport)9 RequiredModelMBean (javax.management.modelmbean.RequiredModelMBean)8 InvalidTargetObjectTypeException (javax.management.modelmbean.InvalidTargetObjectTypeException)6 MBeanException (javax.management.MBeanException)5 ObjectName (javax.management.ObjectName)5 FileLogger (mx4j.log.FileLogger)5 Logger (mx4j.log.Logger)5 MBeanLogger (mx4j.log.MBeanLogger)5 InstanceNotFoundException (javax.management.InstanceNotFoundException)4 MBeanServer (javax.management.MBeanServer)4 RuntimeOperationsException (javax.management.RuntimeOperationsException)4 DescriptorSupport (javax.management.modelmbean.DescriptorSupport)4 ModelMBean (javax.management.modelmbean.ModelMBean)4 Attribute (javax.management.Attribute)3