Java Code Examples for javax.management.modelmbean.ModelMBeanInfo#getAttribute()

The following examples show how to use javax.management.modelmbean.ModelMBeanInfo#getAttribute() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnnotationMetadataAssemblerTests.java    From spring-analysis-note with MIT License 6 votes vote down vote up
@Test
public void testRegistrationOnInterface() throws Exception {
	Object bean = getContext().getBean("testInterfaceBean");
	ModelMBeanInfo inf = getAssembler().getMBeanInfo(bean, "bean:name=interfaceTestBean");
	assertNotNull(inf);
	assertEquals("My Managed Bean", inf.getDescription());

	ModelMBeanOperationInfo op = inf.getOperation("foo");
	assertNotNull("foo operation not exposed", op);
	assertEquals("invoke foo", op.getDescription());

	assertNull("doNotExpose operation should not be exposed", inf.getOperation("doNotExpose"));

	ModelMBeanAttributeInfo attr = inf.getAttribute("Bar");
	assertNotNull("bar attribute not exposed", attr);
	assertEquals("Bar description", attr.getDescription());

	ModelMBeanAttributeInfo attr2 = inf.getAttribute("CacheEntries");
	assertNotNull("cacheEntries attribute not exposed", attr2);
	assertEquals("Metric Type should be COUNTER", "COUNTER",
			attr2.getDescriptor().getFieldValue("metricType"));
}
 
Example 2
Source File: MethodExclusionMBeanInfoAssemblerNotMappedTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testGetAgeIsReadOnly() throws Exception {
	ModelMBeanInfo info = getMBeanInfoFromAssembler();
	ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE);
	assertTrue("Age is not readable", attr.isReadable());
	assertTrue("Age is not writable", attr.isWritable());
}
 
Example 3
Source File: MethodExclusionMBeanInfoAssemblerMappedTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetAgeIsReadOnly() throws Exception {
	ModelMBeanInfo info = getMBeanInfoFromAssembler();
	ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE);
	assertTrue("Age is not readable", attr.isReadable());
	assertFalse("Age is not writable", attr.isWritable());
}
 
Example 4
Source File: InterfaceBasedMBeanInfoAssemblerMappedTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testNickNameIsExposed() throws Exception {
	ModelMBeanInfo inf = (ModelMBeanInfo) getMBeanInfo();
	MBeanAttributeInfo attr = inf.getAttribute("NickName");

	assertNickName(attr);
}
 
Example 5
Source File: AbstractMetadataAssemblerTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Tests the situation where the property only has a getter.
 */
@Test
public void testWithOnlySetter() throws Exception {
	ModelMBeanInfo inf = getMBeanInfoFromAssembler();
	ModelMBeanAttributeInfo attr = inf.getAttribute("NickName");
	assertNotNull("Attribute should not be null", attr);
}
 
Example 6
Source File: InterfaceBasedMBeanInfoAssemblerMappedTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testNickNameIsExposed() throws Exception {
	ModelMBeanInfo inf = (ModelMBeanInfo) getMBeanInfo();
	MBeanAttributeInfo attr = inf.getAttribute("NickName");

	assertNickName(attr);
}
 
Example 7
Source File: AbstractJmxAssemblerTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@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"));
}
 
Example 8
Source File: AbstractMetadataAssemblerTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example 9
Source File: MethodNameBasedMBeanInfoAssemblerMappedTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testNickNameIsExposed() throws Exception {
	ModelMBeanInfo inf = (ModelMBeanInfo) getMBeanInfo();
	MBeanAttributeInfo attr = inf.getAttribute("NickName");

	assertNickName(attr);
}
 
Example 10
Source File: MethodExclusionMBeanInfoAssemblerNotMappedTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testGetAgeIsReadOnly() throws Exception {
	ModelMBeanInfo info = getMBeanInfoFromAssembler();
	ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE);
	assertTrue("Age is not readable", attr.isReadable());
	assertTrue("Age is not writable", attr.isWritable());
}
 
Example 11
Source File: MethodNameBasedMBeanInfoAssemblerMappedTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testGetAgeIsReadOnly() throws Exception {
	ModelMBeanInfo info = getMBeanInfoFromAssembler();
	ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE);

	assertTrue("Age is not readable", attr.isReadable());
	assertFalse("Age is not writable", attr.isWritable());
}
 
Example 12
Source File: InterfaceBasedMBeanInfoAssemblerCustomTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetAgeIsReadOnly() throws Exception {
	ModelMBeanInfo info = getMBeanInfoFromAssembler();
	ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE);

	assertTrue(attr.isReadable());
	assertFalse(attr.isWritable());
}
 
Example 13
Source File: InterfaceBasedMBeanInfoAssemblerCustomTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Test
public void testGetAgeIsReadOnly() throws Exception {
	ModelMBeanInfo info = getMBeanInfoFromAssembler();
	ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE);

	assertTrue(attr.isReadable());
	assertFalse(attr.isWritable());
}
 
Example 14
Source File: AbstractMetadataAssemblerTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@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());
}
 
Example 15
Source File: MethodExclusionMBeanInfoAssemblerTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testSupermanIsReadOnly() throws Exception {
	ModelMBeanInfo info = getMBeanInfoFromAssembler();
	ModelMBeanAttributeInfo attr = info.getAttribute("Superman");

	assertTrue(attr.isReadable());
	assertFalse(attr.isWritable());
}
 
Example 16
Source File: InterfaceBasedMBeanInfoAssemblerMappedTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Test
public void testGetAgeIsReadOnly() throws Exception {
	ModelMBeanInfo info = getMBeanInfoFromAssembler();
	ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE);

	assertTrue("Age is not readable", attr.isReadable());
	assertFalse("Age is not writable", attr.isWritable());
}
 
Example 17
Source File: AbstractMetadataAssemblerTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@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());
}
 
Example 18
Source File: InterfaceBasedMBeanInfoAssemblerMappedTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetAgeIsReadOnly() throws Exception {
	ModelMBeanInfo info = getMBeanInfoFromAssembler();
	ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE);

	assertTrue("Age is not readable", attr.isReadable());
	assertFalse("Age is not writable", attr.isWritable());
}
 
Example 19
Source File: AbstractMetadataAssemblerTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@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());
}
 
Example 20
Source File: MethodExclusionMBeanInfoAssemblerComboTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetAgeIsReadOnly() throws Exception {
	ModelMBeanInfo info = getMBeanInfoFromAssembler();
	ModelMBeanAttributeInfo attr = info.getAttribute(AGE_ATTRIBUTE);
	assertTrue("Age is not readable", attr.isReadable());
	assertFalse("Age is not writable", attr.isWritable());
}