use of com.zimbra.cs.mailclient.imap.ListData in project zm-mailbox by Zimbra.
the class ImapTestBase method verifyFolderList.
public static void verifyFolderList(List<ListData> listResult, boolean mailOnly) {
boolean hasContacts = false;
boolean hasChats = false;
boolean hasEmailedContacts = false;
boolean hasTrash = false;
boolean hasDrafts = false;
boolean hasInbox = false;
boolean hasJunk = false;
boolean hasSent = false;
for (ListData ld : listResult) {
if ((ld.getMailbox().equalsIgnoreCase("Contacts"))) {
hasContacts = true;
} else if ((ld.getMailbox().equalsIgnoreCase("Chats"))) {
hasChats = true;
} else if ((ld.getMailbox().equalsIgnoreCase("Emailed Contacts"))) {
hasEmailedContacts = true;
} else if ((ld.getMailbox().equalsIgnoreCase("Trash"))) {
hasTrash = true;
} else if ((ld.getMailbox().equalsIgnoreCase("Drafts"))) {
hasDrafts = true;
} else if ((ld.getMailbox().equalsIgnoreCase("Inbox"))) {
hasInbox = true;
} else if ((ld.getMailbox().equalsIgnoreCase("Sent"))) {
hasSent = true;
} else if ((ld.getMailbox().equalsIgnoreCase("Junk"))) {
hasJunk = true;
}
}
if (mailOnly) {
assertFalse("mail-only folderList contains Chats", hasChats);
assertFalse("mail-only folderList contains Contacts", hasContacts);
assertFalse("mail-only folderList contains Emailed Contacts", hasEmailedContacts);
} else {
assertTrue("folderList * does not contain Chats", hasChats);
assertTrue("folderList * does not contain Contacts", hasContacts);
assertTrue("folderList * does not contain Emailed Contacts", hasEmailedContacts);
}
assertTrue("folderList * does not contain Trash", hasTrash);
assertTrue("folderList * does not contain Drafts ", hasDrafts);
assertTrue("folderList * does not contain Inbox", hasInbox);
assertTrue("folderList * does not contain Sent", hasSent);
assertTrue("folderList * does not contain Junk", hasJunk);
}
use of com.zimbra.cs.mailclient.imap.ListData in project zm-mailbox by Zimbra.
the class SharedImapTests method listMountpointForAllApplicationsShare.
/**
* Simulate how LIST handles the situation where a user has shared their whole mailbox with a sharee
* and the sharee has used ZWC to add a shared folder for "All applications".
* "CreateMountpointRequest": [{
* "link": {
* "l": 1, "name": "owner's", "view": "unknown", "zid": "028fdbd8-d5de-483a-a545-11e421b8bd12", "rid": 1
* },
* "_jsns": "urn:zimbraMail"
* }], "_jsns": "urn:zimbra"
*/
@Test(timeout = 100000)
public void listMountpointForAllApplicationsShare() throws ServiceException, IOException {
TestUtil.createAccount(SHAREE);
ZMailbox shareeZmbox = TestUtil.getZMailbox(SHAREE);
ZMailbox mbox = TestUtil.getZMailbox(USER);
String sharedFolderName = String.format("%s-shared", testId);
String remoteFolderPath = "/" + sharedFolderName;
TestUtil.createFolder(mbox, remoteFolderPath);
String mountpointName = String.format("%s's", USER, testId);
ZGetInfoResult remoteInfo = mbox.getAccountInfo(true);
String folderUserRoot = Integer.toString(Mailbox.ID_FOLDER_USER_ROOT);
otherConnection = connectAndLogin(SHAREE);
List<ListData> beforeListResult = otherConnection.list("", "*");
assertNotNull("list result 'list \"\" \"*\"' should not be null (before share)", beforeListResult);
mbox.modifyFolderGrant(folderUserRoot, GranteeType.all, null, "rwidx", null);
shareeZmbox.createMountpoint(folderUserRoot, mountpointName, null, null, null, OwnerBy.BY_ID, remoteInfo.getId(), SharedItemBy.BY_ID, folderUserRoot, false);
List<ListData> listResult;
listResult = otherConnection.list("", "*");
assertNotNull("list result 'list \"\" \"*\"' should not be null", listResult);
boolean seenIt = false;
for (ListData listEnt : listResult) {
ZimbraLog.test.info("LIST result has entry '%s'", listEnt.getMailbox());
if (mountpointName.equals(listEnt.getMailbox())) {
seenIt = true;
break;
}
}
assertTrue(String.format("'%s' mountpoint not in result of 'list \"\" \"*\"'", mountpointName), seenIt);
int extras = listResult.size() - beforeListResult.size();
/* Extra entries should look something like these - i.e. a top level container and the sharer user's folders
* under there.
* LIST (\NoSelect \HasChildren) "/" "testimapviaembeddedlocal-listmountpointforallapplicationsshare-61-user's"
* LIST (\HasNoChildren) "/" "testimapviaembeddedlocal-listmountpointforallapplicationsshare-61-user's/Chats"
* LIST (\HasNoChildren) "/" "testimapviaembeddedlocal-listmountpointforallapplicationsshare-61-user's/Contacts"
* LIST (\HasNoChildren \Drafts) "/" "testimapviaembeddedlocal-listmountpointforallapplicationsshare-61-user's/Drafts"
* LIST (\HasNoChildren) "/" "testimapviaembeddedlocal-listmountpointforallapplicationsshare-61-user's/Emailed Contacts"
* LIST (\HasNoChildren) "/" "testimapviaembeddedlocal-listmountpointforallapplicationsshare-61-user's/Inbox"
* LIST (\NoInferiors \Junk) "/" "testimapviaembeddedlocal-listmountpointforallapplicationsshare-61-user's/Junk"
* LIST (\HasNoChildren \Sent) "/" "testimapviaembeddedlocal-listmountpointforallapplicationsshare-61-user's/Sent"
* LIST (\HasNoChildren) "/" "testimapviaembeddedlocal-listmountpointforallapplicationsshare-61-user's/TestImapViaEmbeddedLocal-listMountpointForAllApplicationsShare-61-shared"
* LIST (\HasNoChildren \Trash) "/" "testimapviaembeddedlocal-listmountpointforallapplicationsshare-61-user's/Trash"
*/
assertTrue(String.format("'list \"\" \"*\"' response before share had %s entries, after %s entries (diff %s) expected >= 10 new", beforeListResult.size(), listResult.size(), extras), extras >= 10);
otherConnection.logout();
otherConnection = null;
}
use of com.zimbra.cs.mailclient.imap.ListData in project zm-mailbox by Zimbra.
the class TestImapUtil method parseFolders.
private List<ListData> parseFolders(String[] folders) throws IOException {
List<ListData> lds = new ArrayList<ListData>();
ImapInputStream is = getImapInputStream(folders);
while (!is.isEOF()) {
is.skipChar('*');
is.skipChar(' ');
is.readAtom();
is.skipChar(' ');
lds.add(ListData.read(is));
is.skipCRLF();
}
return lds;
}
use of com.zimbra.cs.mailclient.imap.ListData in project zm-mailbox by Zimbra.
the class TestImapClient method testList.
@Test
public void testList() throws Exception {
login();
List<ListData> lds = connection.list("", "*");
for (ListData ld : lds) {
assertEquals('/', ld.getDelimiter());
assertNotNull(ld.getMailbox());
assertTrue(ld.getFlags().size() > 0);
}
}
Aggregations