use of com.zimbra.cs.mailbox.MetadataList in project zm-mailbox by Zimbra.
the class LocalImapMailboxStore method saveSubscriptions.
@Override
public void saveSubscriptions(OperationContext octxt, Set<String> subs) throws ServiceException {
MetadataList slist = new MetadataList();
if (subs != null && !subs.isEmpty()) {
for (String sub : subs) slist.add(sub);
}
mailbox.setConfig(octxt, AccountUtil.SN_IMAP, new Metadata().put(AccountUtil.FN_SUBSCRIPTIONS, slist));
}
use of com.zimbra.cs.mailbox.MetadataList in project zm-mailbox by Zimbra.
the class CalList method encodeMetadata.
Metadata encodeMetadata() {
Metadata meta = new Metadata();
List<Integer> list = new ArrayList<Integer>(mCalendars);
MetadataList calsMetaList = new MetadataList(list);
meta.put(FN_CALS, calsMetaList);
meta.put(FN_VERSION_PREFIX, mVerPrefix);
meta.put(FN_VERSION_SEQ, mVerSeq);
return meta;
}
use of com.zimbra.cs.mailbox.MetadataList in project zm-mailbox by Zimbra.
the class LocalImapMailboxStoreTest method testListSubscriptions.
@Test
public void testListSubscriptions() throws Exception {
String path = "testPath";
MetadataList slist = new MetadataList();
slist.add(path);
// imitate subscription
mbox.setConfig(null, "imap", new Metadata().put("subs", slist));
// check that subscription was saved in mailbox configuration
Metadata config = mbox.getConfig(null, "imap");
Assert.assertNotNull(config);
MetadataList rlist = config.getList("subs", true);
Assert.assertNotNull(rlist);
Assert.assertNotNull(rlist.get(0));
Assert.assertTrue(rlist.get(0).equalsIgnoreCase(path));
// test listSubscriptions method
LocalImapMailboxStore localStore = new LocalImapMailboxStore(mbox);
Set<String> subs = localStore.listSubscriptions(null);
Assert.assertNotNull(subs);
Assert.assertEquals(1, subs.size());
String sub = subs.iterator().next();
Assert.assertTrue(sub.equalsIgnoreCase(path));
}
use of com.zimbra.cs.mailbox.MetadataList in project zm-mailbox by Zimbra.
the class TestRemoteImapMailboxStore method testListIMAPSubscriptions.
@Test
public void testListIMAPSubscriptions() throws Exception {
String path = NAME_PREFIX + "_testPath";
MetadataList slist = new MetadataList();
slist.add(path);
// imitate subscription
Mailbox mbox = TestUtil.getMailbox(USER_NAME);
mbox.setConfig(null, "imap", new Metadata().put("subs", slist));
// check that subscription was saved in mailbox configuration
Metadata config = mbox.getConfig(null, "imap");
Assert.assertNotNull(config);
MetadataList rlist = config.getList("subs", true);
Assert.assertNotNull(rlist);
Assert.assertNotNull(rlist.get(0));
Assert.assertTrue(rlist.get(0).equalsIgnoreCase(path));
// test listSubscriptions method
ZMailbox zmbox = TestUtil.getZMailbox(USER_NAME);
RemoteImapMailboxStore remoteStore = new RemoteImapMailboxStore(zmbox, TestUtil.getAccount(USER_NAME).getId());
Set<String> subs = remoteStore.listSubscriptions(null);
Assert.assertNotNull(subs);
Assert.assertEquals(1, subs.size());
String sub = subs.iterator().next();
Assert.assertTrue(sub.equalsIgnoreCase(path));
}
Aggregations