use of com.zimbra.soap.admin.type.AutoProvDirectoryEntry in project zm-mailbox by Zimbra.
the class JaxbToElementTest method searchAutoProvDirectoryResponse.
// AutoProvDirectoryEntry contains 2 lists - one via extending AdminKeyValuePairs
// No order is specified for elements via XmlType propOrder. Checking how well this works.
@Test
public void searchAutoProvDirectoryResponse() throws Exception {
Element resp = Element.XMLElement.mFactory.createElement(AdminConstants.SEARCH_AUTO_PROV_DIRECTORY_RESPONSE);
resp.addAttribute(AdminConstants.A_MORE, false);
resp.addAttribute(AdminConstants.A_SEARCH_TOTAL, 1);
Element entryE = resp.addNonUniqueElement(AdminConstants.E_ENTRY);
entryE.addAttribute(AdminConstants.A_DN, "displayNam");
entryE.addNonUniqueElement(AdminConstants.E_KEY).setText("keyValue1");
entryE.addNonUniqueElement(AdminConstants.E_KEY).setText("keyValue2");
entryE.addNonUniqueElement(AdminConstants.E_A).addAttribute(AdminConstants.A_N, "nVal1").setText("attr1Txt");
entryE.addNonUniqueElement(AdminConstants.E_A).addAttribute(AdminConstants.A_N, "nVal2").setText("attr2Txt");
SearchAutoProvDirectoryResponse jaxb = JaxbUtil.elementToJaxb(resp);
Assert.assertNotNull("Unmarshal soap object", jaxb);
List<AutoProvDirectoryEntry> entries = jaxb.getEntries();
Assert.assertNotNull("entries list", entries);
Assert.assertEquals("Number of entries", 1, entries.size());
AutoProvDirectoryEntry entry = entries.get(0);
List<KeyValuePair> kvps = entry.getKeyValuePairs();
Assert.assertNotNull("entry - attrs list", kvps);
Assert.assertEquals("entry - Number of attrs", 2, kvps.size());
List<String> keys = entry.getKeys();
Assert.assertNotNull("entry - keys list", keys);
Assert.assertEquals("entry - Number of keys", 2, keys.size());
}
Aggregations