ds);
}
public void testGetMBeanDescriptorDefault() throws Exception
{
ModelMBeanInfoSupport info =
new ModelMBeanInfoSupport("TestMetadata",
"An empty model mbean info instance",
new ModelMBeanAttributeInfo[0],
new ModelMBeanConstructorInfo[0],
new ModelMBeanOperationInfo[0],
new ModelMBeanNotificationInfo[0]);
Descriptor dd = info.getMBeanDescriptor();
assertFalse("default descriptor is null", dd == null);
assertTrue("Expecting 7 fields", dd.getFieldNames().length == 7);
String[] deffields =
{
"name",
"descriptorType",
"displayName",
"persistPolicy",
"log",
"export",
"visibility"};
String[] fields = dd.getFieldNames();
assertTrue("Expected field names not present",
Arrays.asList(fields).containsAll(Arrays.asList(deffields)));
assertTrue("Unexpected name",
((String)dd.getFieldValue("name")).compareTo("TestMetadata") == 0);
assertTrue("Unexpected descriptorType",
((String)dd.getFieldValue("descriptortype")).compareToIgnoreCase("mbean")
== 0);
assertTrue("Unexpected displayName: " + dd.getFieldValue("displayname"),
((String)dd.getFieldValue("displayname")).compareTo("TestMetadata")
== 0);
assertTrue("Unexpected persistpolicy",
((String)dd.getFieldValue("persistpolicy")).compareToIgnoreCase("never")
== 0);
assertTrue("Unexpected log",
((String)dd.getFieldValue("log")).compareToIgnoreCase("F") == 0);
assertTrue("Unexpected export",
((String)dd.getFieldValue("export")).compareTo("F") == 0);
assertTrue("Unexpected visibility",
((String)dd.getFieldValue("visibility")).compareTo("1") == 0);
info =
new ModelMBeanInfoSupport("TestMetadata",
"An empty model mbean info instance",
new ModelMBeanAttributeInfo[0],
new ModelMBeanConstructorInfo[0],
new ModelMBeanOperationInfo[0],
new ModelMBeanNotificationInfo[0],
null);
dd = info.getMBeanDescriptor();
assertFalse("default descriptor is null", dd == null);
assertTrue("Expecting 7 fields", dd.getFieldNames().length == 7);
assertTrue("Expected field names not present",
Arrays.asList(fields).containsAll(Arrays.asList(deffields)));
assertTrue("Unexpected name",