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

The following examples show how to use javax.management.modelmbean.ModelMBeanInfo#getAttributes() . 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: AbstractJmxAssemblerTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@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());
	}
}
 
Example 2
Source File: AbstractJmxAssemblerTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@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());
	}
}
 
Example 3
Source File: MBeanInfoAssemblerTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Test
public void testReadAtributeInfoHappyPath() throws JMException {
  ModelMBeanInfo beanInfo = mbeanInfoAssembler.getMBeanInfo(testMbean, null, "someName");
  assertNotNull(beanInfo);

  assertEquals("test description", beanInfo.getDescription());
  MBeanAttributeInfo[] testAttributes = beanInfo.getAttributes();
  assertNotNull(testAttributes);
  assertEquals(2, testAttributes.length);

  int counter = 0;
  for (MBeanAttributeInfo info : testAttributes) {
    if (info.getName().equals("TestAttributeBoolean")) {
      counter++;
      assertEquals("test attribute Boolean description", info.getDescription());
      assertEquals("java.lang.Boolean", info.getType());
      assertTrue(info.isReadable());
      assertFalse(info.isWritable());
    } else if (info.getName().equals("TestAttributeString")) {
      counter++;
      assertEquals("test attribute String description", info.getDescription());
      assertEquals("java.lang.String", info.getType());
      assertTrue(info.isReadable());
      assertFalse(info.isWritable());
    }
  }
  assertEquals(2, counter);

  // check the single operation

  assertNotNull(beanInfo.getOperations());
  assertEquals(3, beanInfo.getOperations().length);
}
 
Example 4
Source File: AbstractJmxAssemblerTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@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());
	}
}
 
Example 5
Source File: MBeanInfoAssemblerTest.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Test
public void testReadAttributeInfoHappyPath() throws JMException {
    ModelMBeanInfo beanInfo = mbeanInfoAssembler.getMBeanInfo(testMbean, null, "someName");
    assertNotNull(beanInfo);

    assertEquals("test description", beanInfo.getDescription());
    MBeanAttributeInfo[] testAttributes = beanInfo.getAttributes();
    assertNotNull(testAttributes);
    assertEquals(2, testAttributes.length);

    int counter = 0;
    for (MBeanAttributeInfo info : testAttributes) {
        if (info.getName().equals("TestAttributeBoolean")) {
            counter++;
            assertEquals("test attribute Boolean description", info.getDescription());
            assertEquals("java.lang.Boolean", info.getType());
            assertTrue(info.isReadable());
            assertFalse(info.isWritable());
        } else if (info.getName().equals("TestAttributeString")) {
            counter++;
            assertEquals("test attribute String description", info.getDescription());
            assertEquals("java.lang.String", info.getType());
            assertTrue(info.isReadable());
            assertFalse(info.isWritable());
        }
    }
    assertEquals(2, counter);

    // check the single operation

    assertNotNull(beanInfo.getOperations());
    assertEquals(3, beanInfo.getOperations().length);
}
 
Example 6
Source File: ModelMBeanAssemblerTest.java    From cxf with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetMBeanAttributeInfo() throws Exception {
    ModelMBeanInfo info = getMBeanInfoFromAssembler();
    MBeanAttributeInfo[] inf = info.getAttributes();
    assertEquals("Invalid number of Attributes returned",
                   4, 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());
    }
}