javax.management.modelmbean.ModelMBeanInfo#getAttributes ( )源码实例Demo

下面列出了javax.management.modelmbean.ModelMBeanInfo#getAttributes ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@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());
	}
}
 
@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());
	}
}
 
源代码3 项目: activiti6-boot2   文件: MBeanInfoAssemblerTest.java
@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);
}
 
@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());
	}
}
 
源代码5 项目: flowable-engine   文件: MBeanInfoAssemblerTest.java
@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);
}
 
源代码6 项目: cxf   文件: ModelMBeanAssemblerTest.java
@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());
    }
}