Search in sources :

Example 61 with ModelMBeanInfo

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

the class AbstractMetadataAssemblerTests method testReadWriteAttribute.

@Test
public void testReadWriteAttribute() throws Exception {
    ModelMBeanInfo inf = getMBeanInfoFromAssembler();
    ModelMBeanAttributeInfo attr = inf.getAttribute(NAME_ATTRIBUTE);
    assertThat(attr.isWritable()).as("The name attribute should be writable").isTrue();
    assertThat(attr.isReadable()).as("The name attribute should be readable").isTrue();
}
Also used : ModelMBeanAttributeInfo(javax.management.modelmbean.ModelMBeanAttributeInfo) ModelMBeanInfo(javax.management.modelmbean.ModelMBeanInfo) Test(org.junit.jupiter.api.Test)

Example 62 with ModelMBeanInfo

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

the class AbstractMetadataAssemblerTests method testWithOnlySetter.

/**
 * Tests the situation where the property only has a getter.
 */
@Test
public void testWithOnlySetter() throws Exception {
    ModelMBeanInfo inf = getMBeanInfoFromAssembler();
    ModelMBeanAttributeInfo attr = inf.getAttribute("NickName");
    assertThat(attr).as("Attribute should not be null").isNotNull();
}
Also used : ModelMBeanAttributeInfo(javax.management.modelmbean.ModelMBeanAttributeInfo) ModelMBeanInfo(javax.management.modelmbean.ModelMBeanInfo) Test(org.junit.jupiter.api.Test)

Example 63 with ModelMBeanInfo

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

the class AbstractMetadataAssemblerTests method testMetricDescriptorDefaults.

@Test
public void testMetricDescriptorDefaults() throws Exception {
    ModelMBeanInfo info = getMBeanInfoFromAssembler();
    Descriptor desc = info.getAttribute(CACHE_ENTRIES_METRIC).getDescriptor();
    assertThat(desc.getFieldValue("currencyTimeLimit")).as("Currency Time Limit should not be populated").isNull();
    assertThat(desc.getFieldValue("persistPolicy")).as("Persist Policy should not be populated").isNull();
    assertThat(desc.getFieldValue("persistPeriod")).as("Persist Period should not be populated").isNull();
    assertThat(desc.getFieldValue("units")).as("Unit should not be populated").isNull();
    assertThat(desc.getFieldValue("displayName")).as("Display Name should be populated by default via JMX").isEqualTo(CACHE_ENTRIES_METRIC);
    assertThat(desc.getFieldValue("metricType")).as("Metric Type should be GAUGE").isEqualTo("GAUGE");
    assertThat(desc.getFieldValue("metricCategory")).as("Metric Category should not be populated").isNull();
}
Also used : Descriptor(javax.management.Descriptor) ModelMBeanInfo(javax.management.modelmbean.ModelMBeanInfo) Test(org.junit.jupiter.api.Test)

Example 64 with ModelMBeanInfo

use of javax.management.modelmbean.ModelMBeanInfo 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");
    assertThat(metric.getDescription()).as("The description for the queue size metric is incorrect").isEqualTo("The QueueSize metric");
    assertThat(operation.getDescription()).as("The description for the getter operation of the queue size metric is incorrect").isEqualTo("The QueueSize metric");
}
Also used : ModelMBeanOperationInfo(javax.management.modelmbean.ModelMBeanOperationInfo) ModelMBeanAttributeInfo(javax.management.modelmbean.ModelMBeanAttributeInfo) ModelMBeanInfo(javax.management.modelmbean.ModelMBeanInfo) Test(org.junit.jupiter.api.Test)

Example 65 with ModelMBeanInfo

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

the class MethodExclusionMBeanInfoAssemblerNotMappedTests method testNickNameIsExposed.

@Test
public void testNickNameIsExposed() throws Exception {
    ModelMBeanInfo inf = (ModelMBeanInfo) getMBeanInfo();
    MBeanAttributeInfo attr = inf.getAttribute("NickName");
    assertThat(attr).as("Nick Name should not be null").isNotNull();
    assertThat(attr.isWritable()).as("Nick Name should be writable").isTrue();
    assertThat(attr.isReadable()).as("Nick Name should be readable").isTrue();
}
Also used : ModelMBeanInfo(javax.management.modelmbean.ModelMBeanInfo) ModelMBeanAttributeInfo(javax.management.modelmbean.ModelMBeanAttributeInfo) MBeanAttributeInfo(javax.management.MBeanAttributeInfo) Test(org.junit.jupiter.api.Test)

Aggregations

ModelMBeanInfo (javax.management.modelmbean.ModelMBeanInfo)74 Test (org.junit.jupiter.api.Test)42 ModelMBeanAttributeInfo (javax.management.modelmbean.ModelMBeanAttributeInfo)33 Descriptor (javax.management.Descriptor)16 ModelMBeanOperationInfo (javax.management.modelmbean.ModelMBeanOperationInfo)14 RequiredModelMBean (javax.management.modelmbean.RequiredModelMBean)11 MBeanAttributeInfo (javax.management.MBeanAttributeInfo)10 ObjectName (javax.management.ObjectName)9 ModelMBeanInfoSupport (javax.management.modelmbean.ModelMBeanInfoSupport)9 Test (org.junit.Test)9 InvalidTargetObjectTypeException (javax.management.modelmbean.InvalidTargetObjectTypeException)8 MBeanException (javax.management.MBeanException)6 InstanceNotFoundException (javax.management.InstanceNotFoundException)5 MBeanServer (javax.management.MBeanServer)5 MalformedObjectNameException (javax.management.MalformedObjectNameException)5 RuntimeOperationsException (javax.management.RuntimeOperationsException)5 FileLogger (mx4j.log.FileLogger)5 Logger (mx4j.log.Logger)5 MBeanLogger (mx4j.log.MBeanLogger)5 JMException (javax.management.JMException)4