new MBeanAttributeInfo(
"name", "type", "description", true, true, false)
};
MBeanConstructorInfo[] constructors = new MBeanConstructorInfo[]
{
new MBeanConstructorInfo(
"name", "description", parms)
};
MBeanOperationInfo[] operations = new MBeanOperationInfo[]
{
new MBeanOperationInfo(
"name", "description", parms,
"type", MBeanOperationInfo.ACTION_INFO)
};
MBeanNotificationInfo[] notifications = new MBeanNotificationInfo[]
{
new MBeanNotificationInfo(new String[] { "type1", "type" }, "name", "description")
};
MBeanInfo info = new MBeanInfo(
"name", "description", attributes, constructors,
operations, notifications);
assertTrue("Null is not equal to any instance", info.equals(null) == false);
assertTrue("Instance is only equal another MBeanInfo instance", info.equals(new Object()) == false);
assertTrue("Instance should equal itself", info.equals(info));
MBeanInfo info2 = new MBeanInfo(
"name", "description", attributes, constructors,
operations, notifications);
assertTrue("Instances with same values should be equal", info.equals(info2));
assertTrue("Instances with same values should be equal", info2.equals(info));
info2 = new MBeanInfo(
"name2", "description", attributes, constructors,
operations, notifications);
assertTrue("Instances with different class names are not equal", info.equals(info2) == false);
assertTrue("Instances with different class names are not equal", info2.equals(info) == false);
info2 = new MBeanInfo(
"name", "description2", attributes, constructors,
operations, notifications);
assertTrue("Instances with different descriptions are not equal", info.equals(info2) == false);
assertTrue("Instances with different descriptions are not equal", info2.equals(info) == false);
MBeanAttributeInfo[] attributes2 = new MBeanAttributeInfo[]
{
new MBeanAttributeInfo(
"name2", "type", "description", true, true, false)
};
info2 = new MBeanInfo(
"name", "description", attributes2, constructors,
operations, notifications);
assertTrue("Instances with different attributes are not equal", info.equals(info2) == false);
assertTrue("Instances with different attributes are not equal", info2.equals(info) == false);
attributes2 = new MBeanAttributeInfo[]
{
new MBeanAttributeInfo(
"name2", "type", "description", true, true, false),
new MBeanAttributeInfo(
"name3", "type", "description", true, true, false)
};
info2 = new MBeanInfo(
"name", "description", attributes2, constructors,
operations, notifications);
assertTrue("Instances with different numbers of attributes are not equal", info.equals(info2) == false);
assertTrue("Instances with different numbers of attributes are not equal", info2.equals(info) == false);
info2 = new MBeanInfo(
"name", "description", null, constructors,
operations, notifications);
assertTrue("Instances with and without attributes are not equal", info.equals(info2) == false);
assertTrue("Instances with and without attributes are not equal", info2.equals(info) == false);
MBeanConstructorInfo[] constructors2 = new MBeanConstructorInfo[]
{
new MBeanConstructorInfo(
"name2", "description", parms)
};
info2 = new MBeanInfo(
"name", "description", attributes, constructors2,
operations, notifications);
assertTrue("Instances with different constructors are not equal", info.equals(info2) == false);
assertTrue("Instances with different constructors are not equal", info2.equals(info) == false);
constructors2 = new MBeanConstructorInfo[]
{
new MBeanConstructorInfo(
"name2", "description", parms),
new MBeanConstructorInfo(
"name3", "description", parms)
};
info2 = new MBeanInfo(
"name", "description", attributes, constructors2,