Search in sources :

Example 16 with ModelMBeanInfo

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

the class AbstractMetadataAssemblerTests method testAttributeDescriptionOnGetter.

@Test
public void testAttributeDescriptionOnGetter() throws Exception {
    ModelMBeanInfo inf = getMBeanInfoFromAssembler();
    ModelMBeanAttributeInfo attr = inf.getAttribute(NAME_ATTRIBUTE);
    assertEquals("The description for the name attribute is incorrect", "The Name Attribute", attr.getDescription());
}
Also used : ModelMBeanAttributeInfo(javax.management.modelmbean.ModelMBeanAttributeInfo) ModelMBeanInfo(javax.management.modelmbean.ModelMBeanInfo) Test(org.junit.Test)

Example 17 with ModelMBeanInfo

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

the class AbstractMetadataAssemblerTests method testAttributeDescriptionOnSetter.

@Test
public void testAttributeDescriptionOnSetter() throws Exception {
    ModelMBeanInfo inf = getMBeanInfoFromAssembler();
    ModelMBeanAttributeInfo attr = inf.getAttribute(AGE_ATTRIBUTE);
    assertEquals("The description for the age attribute is incorrect", "The Age Attribute", attr.getDescription());
}
Also used : ModelMBeanAttributeInfo(javax.management.modelmbean.ModelMBeanAttributeInfo) ModelMBeanInfo(javax.management.modelmbean.ModelMBeanInfo) Test(org.junit.Test)

Example 18 with ModelMBeanInfo

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

the class AbstractMetadataAssemblerTests method testWithOnlyGetter.

/**
	 * Tests the situation where the property only has a setter.
	 */
@Test
public void testWithOnlyGetter() throws Exception {
    ModelMBeanInfo info = getMBeanInfoFromAssembler();
    ModelMBeanAttributeInfo attr = info.getAttribute("Superman");
    assertNotNull("Attribute should not be null", attr);
}
Also used : ModelMBeanAttributeInfo(javax.management.modelmbean.ModelMBeanAttributeInfo) ModelMBeanInfo(javax.management.modelmbean.ModelMBeanInfo) Test(org.junit.Test)

Example 19 with ModelMBeanInfo

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

the class AbstractMetadataAssemblerTests method testManagedResourceDescriptor.

@Test
public void testManagedResourceDescriptor() throws Exception {
    ModelMBeanInfo info = getMBeanInfoFromAssembler();
    Descriptor desc = info.getMBeanDescriptor();
    assertEquals("Logging should be set to true", "true", desc.getFieldValue("log"));
    assertEquals("Log file should be jmx.log", "jmx.log", desc.getFieldValue("logFile"));
    assertEquals("Currency Time Limit should be 15", "15", desc.getFieldValue("currencyTimeLimit"));
    assertEquals("Persist Policy should be OnUpdate", "OnUpdate", desc.getFieldValue("persistPolicy"));
    assertEquals("Persist Period should be 200", "200", desc.getFieldValue("persistPeriod"));
    assertEquals("Persist Location should be foo", "./foo", desc.getFieldValue("persistLocation"));
    assertEquals("Persist Name should be bar", "bar.jmx", desc.getFieldValue("persistName"));
}
Also used : Descriptor(javax.management.Descriptor) ModelMBeanInfo(javax.management.modelmbean.ModelMBeanInfo) Test(org.junit.Test)

Example 20 with ModelMBeanInfo

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

the class AbstractMetadataAssemblerTests method testAttributeDescriptor.

@Test
public void testAttributeDescriptor() throws Exception {
    ModelMBeanInfo info = getMBeanInfoFromAssembler();
    Descriptor desc = info.getAttribute(NAME_ATTRIBUTE).getDescriptor();
    assertEquals("Default value should be foo", "foo", desc.getFieldValue("default"));
    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"));
}
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