Search in sources :

Example 66 with ModelMBeanInfo

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

the class MethodExclusionMBeanInfoAssemblerNotMappedTests method testGetAgeIsReadOnly.

@Test
public void testGetAgeIsReadOnly() throws Exception {
    ModelMBeanInfo info = getMBeanInfoFromAssembler();
    ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE);
    assertThat(attr.isReadable()).as("Age is not readable").isTrue();
    assertThat(attr.isWritable()).as("Age is not writable").isTrue();
}
Also used : ModelMBeanAttributeInfo(javax.management.modelmbean.ModelMBeanAttributeInfo) ModelMBeanInfo(javax.management.modelmbean.ModelMBeanInfo) Test(org.junit.jupiter.api.Test)

Example 67 with ModelMBeanInfo

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

the class AbstractJmxAssemblerTests method testGetMBeanOperationInfo.

@Test
public void testGetMBeanOperationInfo() throws Exception {
    ModelMBeanInfo info = getMBeanInfoFromAssembler();
    MBeanOperationInfo[] inf = info.getOperations();
    assertThat(inf).as("Invalid number of Operations returned").hasSize(getExpectedOperationCount());
    for (MBeanOperationInfo element : inf) {
        assertThat(element).as("MBeanOperationInfo should not be null").isNotNull();
        assertThat(element.getDescription()).as("Description for MBeanOperationInfo should not be null").isNotNull();
    }
}
Also used : MBeanOperationInfo(javax.management.MBeanOperationInfo) ModelMBeanOperationInfo(javax.management.modelmbean.ModelMBeanOperationInfo) ModelMBeanInfo(javax.management.modelmbean.ModelMBeanInfo) Test(org.junit.jupiter.api.Test)

Example 68 with ModelMBeanInfo

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

the class AbstractJmxAssemblerTests method getMBeanInfoFromAssembler.

protected ModelMBeanInfo getMBeanInfoFromAssembler() throws Exception {
    IJmxTestBean bean = getBean();
    ModelMBeanInfo info = getAssembler().getMBeanInfo(bean, getObjectName());
    return info;
}
Also used : IJmxTestBean(org.springframework.jmx.IJmxTestBean) ModelMBeanInfo(javax.management.modelmbean.ModelMBeanInfo)

Example 69 with ModelMBeanInfo

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

the class AbstractJmxAssemblerTests method testNotificationMetadata.

@Test
public void testNotificationMetadata() throws Exception {
    ModelMBeanInfo info = (ModelMBeanInfo) getMBeanInfo();
    MBeanNotificationInfo[] notifications = info.getNotifications();
    assertThat(notifications).as("Incorrect number of notifications").hasSize(1);
    assertThat(notifications[0].getName()).as("Incorrect notification name").isEqualTo("My Notification");
    String[] notifTypes = notifications[0].getNotifTypes();
    assertThat(notifTypes).as("Incorrect number of notification types").hasSize(2);
    assertThat(notifTypes[0]).as("Notification type.foo not found").isEqualTo("type.foo");
    assertThat(notifTypes[1]).as("Notification type.bar not found").isEqualTo("type.bar");
}
Also used : MBeanNotificationInfo(javax.management.MBeanNotificationInfo) ModelMBeanInfo(javax.management.modelmbean.ModelMBeanInfo) Test(org.junit.jupiter.api.Test)

Example 70 with ModelMBeanInfo

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

the class AbstractJmxAssemblerTests method testAttributeHasCorrespondingOperations.

@Test
public void testAttributeHasCorrespondingOperations() throws Exception {
    ModelMBeanInfo info = getMBeanInfoFromAssembler();
    ModelMBeanOperationInfo get = info.getOperation("getName");
    assertThat(get).as("get operation should not be null").isNotNull();
    assertThat(Integer.valueOf(4)).as("get operation should have visibility of four").isEqualTo(get.getDescriptor().getFieldValue("visibility"));
    assertThat(get.getDescriptor().getFieldValue("role")).as("get operation should have role \"getter\"").isEqualTo("getter");
    ModelMBeanOperationInfo set = info.getOperation("setName");
    assertThat(set).as("set operation should not be null").isNotNull();
    assertThat(Integer.valueOf(4)).as("set operation should have visibility of four").isEqualTo(set.getDescriptor().getFieldValue("visibility"));
    assertThat(set.getDescriptor().getFieldValue("role")).as("set operation should have role \"setter\"").isEqualTo("setter");
}
Also used : ModelMBeanOperationInfo(javax.management.modelmbean.ModelMBeanOperationInfo) ModelMBeanInfo(javax.management.modelmbean.ModelMBeanInfo) 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