use of javax.management.MBeanConstructorInfo in project openj9 by eclipse.
the class MyTestListener method testGetMBeanInfo.
@Test
public final void testGetMBeanInfo() {
MBeanInfo mbi = null;
try {
mbi = mbs.getMBeanInfo(objName);
} catch (InstanceNotFoundException e) {
Assert.fail("Unexpected InstanceNotFoundException : " + e.getMessage());
} catch (ReflectionException e) {
Assert.fail("Unexpected ReflectionException : " + e.getMessage());
return;
} catch (IntrospectionException e) {
Assert.fail("Unexpected IntrospectionException : " + e.getMessage());
}
AssertJUnit.assertNotNull(mbi);
// Now make sure that what we got back is what we expected.
// Class name
AssertJUnit.assertTrue(mbi.getClassName().equals(mb.getClass().getName()));
// No public constructors
MBeanConstructorInfo[] constructors = mbi.getConstructors();
AssertJUnit.assertNotNull(constructors);
AssertJUnit.assertTrue(constructors.length == 0);
// One public operation (JLM) + five from CILM.
MBeanOperationInfo[] operations = mbi.getOperations();
AssertJUnit.assertNotNull(operations);
AssertJUnit.assertTrue(operations.length == 6);
// One notification
MBeanNotificationInfo[] notifications = mbi.getNotifications();
AssertJUnit.assertNotNull(notifications);
AssertJUnit.assertTrue(notifications.length == 1);
// Print description and the class name (not necessarily identical).
logger.debug("MBean description for " + mb.getClass().getName() + ": " + mbi.getDescription());
// Eight attributes - some writable.
MBeanAttributeInfo[] attributes = mbi.getAttributes();
AssertJUnit.assertNotNull(attributes);
if (javaVersion >= 16) {
AssertJUnit.assertTrue(attributes.length == 24);
} else {
AssertJUnit.assertTrue(attributes.length == 26);
}
for (int i = 0; i < attributes.length; i++) {
MBeanAttributeInfo info = attributes[i];
AssertJUnit.assertNotNull(info);
AllManagementTests.validateAttributeInfo(info, TestMemoryMXBean.ignoredAttributes, attribs);
}
// end for
}
use of javax.management.MBeanConstructorInfo in project openj9 by eclipse.
the class TestCompilationMXBean method testGetMBeanInfo.
@Test
public final void testGetMBeanInfo() {
MBeanInfo mbi = null;
try {
mbi = mbs.getMBeanInfo(objName);
} catch (InstanceNotFoundException e) {
Assert.fail("Unexpected InstanceNotFoundException : " + e.getMessage());
} catch (ReflectionException e) {
Assert.fail("Unexpected ReflectionException : " + e.getMessage());
} catch (IntrospectionException e) {
Assert.fail("Unexpected IntrospectionException : " + e.getMessage());
}
AssertJUnit.assertNotNull(mbi);
// Now make sure that what we got back is what we expected.
/* Check the class name. Test substring match (not equals()) since cb.getClass().getName()
* typically returns a fully qualified name (prefixing package name). This should have always
* been prefixed by package name, and not being changed as an aftermath of current changes
*/
AssertJUnit.assertTrue(cb.getClass().getName().endsWith(mbi.getClassName()));
// No public constructors
MBeanConstructorInfo[] constructors = mbi.getConstructors();
AssertJUnit.assertNotNull(constructors);
AssertJUnit.assertTrue(constructors.length == 0);
// No public operations
MBeanOperationInfo[] operations = mbi.getOperations();
AssertJUnit.assertNotNull(operations);
AssertJUnit.assertTrue(operations.length == 0);
// No notifications
MBeanNotificationInfo[] notifications = mbi.getNotifications();
AssertJUnit.assertNotNull(notifications);
AssertJUnit.assertTrue(notifications.length == 0);
// Print out the description here.
logger.debug("MBean description for " + cb.getClass().getName() + ": " + mbi.getDescription());
// Three attributes - none writable.
MBeanAttributeInfo[] attributes = mbi.getAttributes();
AssertJUnit.assertNotNull(attributes);
AssertJUnit.assertTrue(attributes.length == 4);
logger.debug("TestCompilationMXBean.java: testGetMBeanInfo: attributes.length: " + attributes.length);
for (int i = 0; i < attributes.length; i++) {
MBeanAttributeInfo info = attributes[i];
AssertJUnit.assertNotNull(info);
AllManagementTests.validateAttributeInfo(info, TestCompilationMXBean.ignoredAttributes, attribs);
}
// end for
}
use of javax.management.MBeanConstructorInfo in project openj9 by eclipse.
the class TestGarbageCollectorMXBean method testGetMBeanInfo.
@Test
public final void testGetMBeanInfo() {
MBeanInfo mbi = null;
try {
mbi = mbs.getMBeanInfo(objName);
} catch (InstanceNotFoundException e) {
Assert.fail("Unexpected InstanceNotFoundException : " + e.getMessage());
} catch (ReflectionException e) {
Assert.fail("Unexpected ReflectionException : " + e.getMessage());
} catch (IntrospectionException e) {
Assert.fail("Unexpected IntrospectionException : " + e.getMessage());
}
AssertJUnit.assertNotNull(mbi);
// Now make sure that what we got back is what we expected.
/* Check the class name. Test substring match (not equals()) since gcb.getClass().getName()
* typically returns a fully qualified name (prefixing package name). This should have always
* been prefixed by package name, and not being changed as an aftermath of current changes
*/
AssertJUnit.assertTrue(gcb.getClass().getName().endsWith(mbi.getClassName()));
// No public constructors
MBeanConstructorInfo[] constructors = mbi.getConstructors();
AssertJUnit.assertNotNull(constructors);
AssertJUnit.assertEquals(0, constructors.length);
// No public operations
MBeanOperationInfo[] operations = mbi.getOperations();
AssertJUnit.assertNotNull(operations);
AssertJUnit.assertEquals(0, operations.length);
// No notifications
MBeanNotificationInfo[] notifications = mbi.getNotifications();
AssertJUnit.assertNotNull(notifications);
AssertJUnit.assertEquals(1, notifications.length);
// Print out both, the description as well as the class name.
logger.debug("MBean description for " + gcb.getClass().getName() + ": " + mbi.getDescription());
// 10 attributes (5 standard, 6 IBM) - none is writable.
MBeanAttributeInfo[] attributes = mbi.getAttributes();
AssertJUnit.assertNotNull(attributes);
AssertJUnit.assertEquals(12, attributes.length);
for (int i = 0; i < attributes.length; i++) {
MBeanAttributeInfo info = attributes[i];
AssertJUnit.assertNotNull(info);
AllManagementTests.validateAttributeInfo(info, TestGarbageCollectorMXBean.ignoredAttributes, attribs);
}
// end for
}
use of javax.management.MBeanConstructorInfo in project openj9 by eclipse.
the class AttributeData method testGetMBeanInfo.
@Test
public final void testGetMBeanInfo() {
MBeanInfo mbi = null;
try {
mbi = mbs.getMBeanInfo(objName);
} catch (InstanceNotFoundException e) {
// An unlikely exception - if this occurs, we can't proceed with the test.
Assert.fail("Unexpected InstanceNotFoundException : " + e.getMessage());
} catch (ReflectionException e) {
// An unlikely exception - if this occurs, we can't proceed with the test.
Assert.fail("Unexpected ReflectionException : " + e.getMessage());
} catch (IntrospectionException e) {
// An unlikely exception - if this occurs, we can't proceed with the test.
Assert.fail("Unexpected IntrospectionException : " + e.getMessage());
}
AssertJUnit.assertNotNull(mbi);
// Now make sure that what we got back is what we expected.
/* Check the class name. Test substring match (not equals()) since clb.getClass().getName()
* typically returns a fully qualified name (prefixing package name). This should have always
* been prefixed by package name, and not being changed as an aftermath of current changes
*/
AssertJUnit.assertTrue(clb.getClass().getName().endsWith(mbi.getClassName()));
// No public constructors
MBeanConstructorInfo[] constructors = mbi.getConstructors();
AssertJUnit.assertNotNull(constructors);
AssertJUnit.assertTrue(constructors.length == 0);
// No public operations
MBeanOperationInfo[] operations = mbi.getOperations();
AssertJUnit.assertNotNull(operations);
AssertJUnit.assertTrue(operations.length == 0);
// No notifications
MBeanNotificationInfo[] notifications = mbi.getNotifications();
AssertJUnit.assertNotNull(notifications);
AssertJUnit.assertTrue(notifications.length == 0);
/* Print out the description and class name as they are not bound to be
* the same.
*/
logger.debug("MBean description for " + clb.getClass().getName() + ": " + mbi.getDescription());
// Four attributes - only Verbose is writable.
MBeanAttributeInfo[] attributes = mbi.getAttributes();
AssertJUnit.assertNotNull(attributes);
AssertJUnit.assertTrue(attributes.length == 5);
for (int i = 0; i < attributes.length; i++) {
MBeanAttributeInfo info = attributes[i];
AssertJUnit.assertNotNull(info);
AllManagementTests.validateAttributeInfo(info, TestClassLoadingMXBean.ignoredAttributes, attribs);
}
// end for
}
use of javax.management.MBeanConstructorInfo in project openj9 by eclipse.
the class TestOperatingSystemMXBean method testGetMBeanInfo.
@Test
public final void testGetMBeanInfo() {
MBeanInfo mbi = null;
try {
mbi = mbs.getMBeanInfo(objName);
} catch (InstanceNotFoundException e) {
Assert.fail("Unexpected InstanceNotFoundException : " + e.getMessage());
} catch (ReflectionException e) {
Assert.fail("Unexpected ReflectionException : " + e.getMessage());
} catch (IntrospectionException e) {
Assert.fail("Unexpected IntrospectionException : " + e.getMessage());
}
AssertJUnit.assertNotNull(mbi);
// Now make sure that what we got back is what we expected.
// Class name
AssertJUnit.assertEquals(mbi.getClassName(), osb.getClass().getName());
// No public constructors
MBeanConstructorInfo[] constructors = mbi.getConstructors();
AssertJUnit.assertNotNull(constructors);
AssertJUnit.assertEquals(0, constructors.length);
// No public notifications but 3 in IBM extension
MBeanNotificationInfo[] notifications = mbi.getNotifications();
AssertJUnit.assertNotNull(notifications);
AssertJUnit.assertEquals(3, notifications.length);
// 12 attributes - 5 standard and 14 from IBM.
MBeanAttributeInfo[] attributes = mbi.getAttributes();
AssertJUnit.assertNotNull(attributes);
/* Under UNIX, we expect a couple more APIs, since the instance would be
* that of UnixExtendedOperatingSystem.
*/
int attrNbr;
if (verMajor >= 14) {
if (TestUtil.isRunningOnUnix()) {
attrNbr = 27;
} else {
attrNbr = 25;
}
} else {
// Java 8 - 13
if (TestUtil.isRunningOnUnix()) {
attrNbr = 24;
} else {
attrNbr = 22;
}
}
AssertJUnit.assertEquals(attrNbr, attributes.length);
for (int i = 0; i < attributes.length; i++) {
MBeanAttributeInfo info = attributes[i];
AssertJUnit.assertNotNull(info);
AllManagementTests.validateAttributeInfo(info, TestOperatingSystemMXBean.ignoredAttributes, attribs);
}
// end for
}
Aggregations