use of com.zimbra.soap.mail.type.RetentionPolicy in project zm-mailbox by Zimbra.
the class PurgeTest method multipleUserPolicy.
@Test
public void multipleUserPolicy() throws Exception {
Mailbox mbox = MailboxManager.getInstance().getMailboxByAccountId(MockProvisioning.DEFAULT_ACCOUNT_ID);
Folder folder = mbox.createFolder(null, "/multipleUserPolicy", new Folder.FolderOptions().setDefaultView(MailItem.Type.MESSAGE));
List<Policy> list = Arrays.asList(Policy.newUserPolicy("45d"), Policy.newUserPolicy("60d"));
RetentionPolicy purgePolicy = new RetentionPolicy(null, list);
try {
mbox.setRetentionPolicy(null, folder.getId(), MailItem.Type.FOLDER, purgePolicy);
fail("Multiple purge policies.");
} catch (ServiceException e) {
}
purgePolicy = new RetentionPolicy(list, null);
try {
mbox.setRetentionPolicy(null, folder.getId(), MailItem.Type.FOLDER, purgePolicy);
fail("Multiple keep policies.");
} catch (ServiceException e) {
}
}
use of com.zimbra.soap.mail.type.RetentionPolicy in project zm-mailbox by Zimbra.
the class JaxbToElementTest method standalonElementToJaxbTest.
@Test
public void standalonElementToJaxbTest() throws Exception {
InputStream is = getClass().getResourceAsStream("retentionPolicy.xml");
Element elem = Element.parseXML(is);
String eXml = elem.toString();
ZimbraLog.test.debug("retentionPolicy.xml from Element:\n%s", eXml);
RetentionPolicy rp = JaxbUtil.elementToJaxb(elem, RetentionPolicy.class);
Assert.assertNotNull("elementToJaxb RetentionPolicy returned object", rp);
Element elem2 = JaxbUtil.jaxbToElement(rp, XMLElement.mFactory);
String eXml2 = elem2.toString();
ZimbraLog.test.debug("Round tripped retentionPolicy.xml from Element:\n%s", eXml2);
XMLAssert.assertXMLEqual(eXml, eXml2);
}
Aggregations