use of javax.management.MBeanNotificationInfo in project jdk8u_jdk by JetBrains.
the class MBeanInfoHashCodeNPETest method main.
public static void main(String[] args) throws Exception {
System.out.println("---MBeanInfoHashCodeNPETest-main ...");
// ----
System.out.println("\n---Testing on MBeanAttributeInfo...");
MBeanAttributeInfo mbeanAttributeInfo = new MBeanAttributeInfo(null, SimpleType.INTEGER.getClassName(), "description", true, true, false);
test(mbeanAttributeInfo, "class name");
mbeanAttributeInfo = new MBeanAttributeInfo("name", null, "description", true, true, false);
test(mbeanAttributeInfo, "type");
mbeanAttributeInfo = new MBeanAttributeInfo("name", SimpleType.INTEGER.getClassName(), null, true, true, false);
test(mbeanAttributeInfo, "description");
// ----
System.out.println("\n---Testing on MBeanConstructorInfo...");
MBeanConstructorInfo mbeanConstructorInfo = new MBeanConstructorInfo(null, "", new MBeanParameterInfo[] {}, new DescriptorSupport());
test(mbeanConstructorInfo, "name");
mbeanConstructorInfo = new MBeanConstructorInfo("", null, new MBeanParameterInfo[] {}, new DescriptorSupport());
test(mbeanConstructorInfo, "description");
mbeanConstructorInfo = new MBeanConstructorInfo("", "", null, new DescriptorSupport());
test(mbeanConstructorInfo, "MBeanParameterInfo");
mbeanConstructorInfo = new MBeanConstructorInfo("", "", new MBeanParameterInfo[] {}, null);
test(mbeanConstructorInfo, "descriptor");
// ----
System.out.println("\n---Testing on MBeanOperationInfo...");
MBeanOperationInfo mbeanOperationInfo = new MBeanOperationInfo(null, "description", new MBeanParameterInfo[] {}, "type", 1, new DescriptorSupport());
test(mbeanOperationInfo, "name");
mbeanOperationInfo = new MBeanOperationInfo("name", null, new MBeanParameterInfo[] {}, "type", 1, new DescriptorSupport());
test(mbeanOperationInfo, "description");
mbeanOperationInfo = new MBeanOperationInfo("name", "description", null, "type", 1, new DescriptorSupport());
test(mbeanOperationInfo, "MBeanParameterInfo");
mbeanOperationInfo = new MBeanOperationInfo("name", "description", new MBeanParameterInfo[] {}, null, 1, new DescriptorSupport());
test(mbeanOperationInfo, "type");
mbeanOperationInfo = new MBeanOperationInfo("name", "description", new MBeanParameterInfo[] {}, "type", -1, new DescriptorSupport());
test(mbeanOperationInfo, "native impact");
mbeanOperationInfo = new MBeanOperationInfo("name", "description", new MBeanParameterInfo[] {}, "type", 1, null);
test(mbeanOperationInfo, "Descriptor");
// ----
System.out.println("\n---Testing on MBeanParameterInfo...");
MBeanParameterInfo mbeanParameterInfo = new MBeanParameterInfo(null, "type", "description", new DescriptorSupport());
test(mbeanParameterInfo, "name");
mbeanParameterInfo = new MBeanParameterInfo("name", null, "description", new DescriptorSupport());
test(mbeanParameterInfo, "description");
mbeanParameterInfo = new MBeanParameterInfo("name", "type", null, new DescriptorSupport());
test(mbeanParameterInfo, "description");
mbeanParameterInfo = new MBeanParameterInfo("name", "type", "description", null);
test(mbeanParameterInfo, "Descriptor");
// ----
System.out.println("\n---Testing on MBeanInfo...");
String className = "toto";
String description = "titi";
MBeanAttributeInfo[] attrInfos = new MBeanAttributeInfo[] {};
MBeanConstructorInfo[] constrInfos = new MBeanConstructorInfo[] {};
MBeanOperationInfo[] operaInfos = new MBeanOperationInfo[] {};
MBeanNotificationInfo[] notifInfos = new MBeanNotificationInfo[] {};
MBeanInfo minfo = new MBeanInfo(null, description, attrInfos, constrInfos, operaInfos, notifInfos);
test(minfo, "class name");
minfo = new MBeanInfo(className, description, attrInfos, constrInfos, operaInfos, notifInfos);
test(minfo, "name");
minfo = new MBeanInfo(className, null, attrInfos, constrInfos, operaInfos, notifInfos);
test(minfo, "description");
minfo = new MBeanInfo(className, description, null, constrInfos, operaInfos, notifInfos);
test(minfo, "attrInfos");
minfo = new MBeanInfo(className, description, attrInfos, constrInfos, null, notifInfos);
test(minfo, "operaInfos");
minfo = new MBeanInfo(className, description, attrInfos, constrInfos, operaInfos, null);
test(minfo, "notifInfos");
Thread.sleep(100);
if (failed > 0) {
throw new RuntimeException("Test failed: " + failed);
} else {
System.out.println("---Test: PASSED");
}
}
use of javax.management.MBeanNotificationInfo in project jdk8u_jdk by JetBrains.
the class OpenMBeanInfoEqualsNPETest method main.
public static void main(String[] args) throws Exception {
System.out.println("---OpenMBeanInfoEqualsNPETest-main ...");
// ----
System.out.println("\n---Testing on OpenMBeanAttributeInfoSupport...");
OpenMBeanAttributeInfo openMBeanAttributeInfo0 = new OpenMBeanAttributeInfoSupport("name", "description", SimpleType.INTEGER, true, true, false, 1, new Integer[] { 1, 2, 3 });
OpenMBeanAttributeInfo openMBeanAttributeInfo = new OpenMBeanAttributeInfoSupport("name", "description", SimpleType.INTEGER, true, true, false, null, new Integer[] { 1, 2, 3 });
test(openMBeanAttributeInfo0, openMBeanAttributeInfo, "defaultValue");
openMBeanAttributeInfo = new OpenMBeanAttributeInfoSupport("name", "description", SimpleType.INTEGER, true, true, false, 1, null);
test(openMBeanAttributeInfo0, openMBeanAttributeInfo, "legalValues");
// ----
System.out.println("\n---Testing on OpenMBeanConstructorInfoSupport...");
OpenMBeanConstructorInfo openMBeanConstructorInfo0 = new OpenMBeanConstructorInfoSupport("name", "description", new OpenMBeanParameterInfo[] {}, new DescriptorSupport());
OpenMBeanConstructorInfo openMBeanConstructorInfo;
openMBeanConstructorInfo = new OpenMBeanConstructorInfoSupport("name", "description", null, new DescriptorSupport());
test(openMBeanConstructorInfo0, openMBeanConstructorInfo, "sigs");
openMBeanConstructorInfo = new OpenMBeanConstructorInfoSupport("name", "description", new OpenMBeanParameterInfo[] {}, null);
test(openMBeanConstructorInfo0, openMBeanConstructorInfo, "Descriptor");
// ----
System.out.println("\n---Testing on OpenMBeanOperationInfoSupport...");
OpenMBeanOperationInfo openMBeanOperationInfo0 = new OpenMBeanOperationInfoSupport("name", "description", new OpenMBeanParameterInfo[] {}, SimpleType.INTEGER, 1, new DescriptorSupport());
OpenMBeanOperationInfo openMBeanOperationInfo;
openMBeanOperationInfo = new OpenMBeanOperationInfoSupport("name", "description", null, SimpleType.INTEGER, 1, new DescriptorSupport());
test(openMBeanOperationInfo0, openMBeanOperationInfo, "sigs");
openMBeanOperationInfo = new OpenMBeanOperationInfoSupport("name", "description", new OpenMBeanParameterInfo[] {}, SimpleType.INTEGER, MBeanOperationInfo.UNKNOWN, null);
test(openMBeanOperationInfo0, openMBeanOperationInfo, "Descriptor");
// ----
System.out.println("\n---Testing on OpenMBeanParameterInfoSupport 1...");
OpenMBeanParameterInfo openMBeanParameterInfo0 = new OpenMBeanParameterInfoSupport("name", "description", SimpleType.INTEGER, 0, -1, 1);
OpenMBeanParameterInfo openMBeanParameterInfo;
openMBeanParameterInfo = new OpenMBeanParameterInfoSupport("name", "description", SimpleType.INTEGER, null, -1, 1);
test(openMBeanParameterInfo0, openMBeanParameterInfo, "default value");
openMBeanParameterInfo = new OpenMBeanParameterInfoSupport("name", "description", SimpleType.INTEGER, 0, null, 1);
test(openMBeanParameterInfo0, openMBeanParameterInfo, "min value");
openMBeanParameterInfo = new OpenMBeanParameterInfoSupport("name", "description", SimpleType.INTEGER, 0, -1, null);
test(openMBeanParameterInfo0, openMBeanParameterInfo, "max value");
// ----
System.out.println("\n---Testing on OpenMBeanParameterInfoSupport 2...");
openMBeanParameterInfo0 = new OpenMBeanParameterInfoSupport("name", "description", SimpleType.INTEGER, 1, new Integer[] { -1, 1, 2 });
openMBeanParameterInfo = new OpenMBeanParameterInfoSupport("name", "description", SimpleType.INTEGER, null, new Integer[] { -1, 1, 2 });
test(openMBeanParameterInfo0, openMBeanParameterInfo, "default value");
openMBeanParameterInfo = new OpenMBeanParameterInfoSupport("name", "description", SimpleType.INTEGER, 1, null);
test(openMBeanParameterInfo0, openMBeanParameterInfo, "legal values");
// ----
System.out.println("\n---Testing on OpenMBeanInfoSupport...");
String className = "toto";
String description = "titi";
OpenMBeanAttributeInfo[] attrInfos = new OpenMBeanAttributeInfo[] {};
OpenMBeanConstructorInfo[] constrInfos = new OpenMBeanConstructorInfo[] {};
OpenMBeanOperationInfo[] operaInfos = new OpenMBeanOperationInfo[] {};
MBeanNotificationInfo[] notifInfos = new MBeanNotificationInfo[] {};
OpenMBeanInfo ominfo0 = new OpenMBeanInfoSupport("toto", description, attrInfos, constrInfos, operaInfos, notifInfos);
OpenMBeanInfo ominfo = new OpenMBeanInfoSupport(null, description, attrInfos, constrInfos, operaInfos, notifInfos);
test(ominfo0, ominfo, "class name");
ominfo = new OpenMBeanInfoSupport(className, null, attrInfos, constrInfos, operaInfos, notifInfos);
test(ominfo0, ominfo, "description");
ominfo = new OpenMBeanInfoSupport(className, description, null, constrInfos, operaInfos, notifInfos);
test(ominfo0, ominfo, "attrInfos");
ominfo = new OpenMBeanInfoSupport(className, description, attrInfos, null, operaInfos, notifInfos);
test(ominfo0, ominfo, "constructor infos");
ominfo = new OpenMBeanInfoSupport(className, description, attrInfos, constrInfos, null, notifInfos);
test(ominfo0, ominfo, "operation infos");
ominfo = new OpenMBeanInfoSupport(className, description, attrInfos, constrInfos, operaInfos, null);
test(ominfo0, ominfo, "notif infos");
if (failed > 0) {
throw new RuntimeException("Test failed: " + failed);
} else {
System.out.println("---Test: PASSED");
}
}
use of javax.management.MBeanNotificationInfo in project tdi-studio-se by Talend.
the class MBeanNotification method isSupported.
/*
* @see IMBeanNotification#isSupported(javax.management.ObjectName)
*/
@Override
public boolean isSupported(ObjectName objectName) {
MBeanInfo info = null;
try {
info = activeJvm.getMBeanServer().getMBeanInfo(objectName);
} catch (JvmCoreException e) {
return false;
}
if (info == null) {
return false;
}
MBeanNotificationInfo[] notificationInfoArray = info.getNotifications();
if (notificationInfoArray == null || notificationInfoArray.length == 0) {
return false;
}
return true;
}
Aggregations