use of com.zimbra.client.ZSearchParams in project zm-mailbox by Zimbra.
the class ZMailboxUtil method doSearchConvPrevious.
private void doSearchConvPrevious() throws ServiceException {
ZSearchParams sp = mConvSearchParams;
ZSearchResult sr = mConvSearchResult;
if (sp == null || sr == null || sp.getOffset() == 0)
return;
sp.setOffset(sp.getOffset() - sr.getHits().size());
dumpConvSearch(mMbox.searchConversation(mConvSearchConvId, sp), verboseOpt());
}
use of com.zimbra.client.ZSearchParams in project zm-mailbox by Zimbra.
the class TestDraftCount method checkMessageCount.
private void checkMessageCount(String query, int expected) throws Exception {
ZSearchParams params = new ZSearchParams(query);
params.setTypes("message");
params.setOffset(0);
params.setSortBy(SearchSortBy.rcptAsc);
ZSearchResult results = mbox.search(params);
assertEquals(expected, results.getHits().size());
params.setSortBy(SearchSortBy.rcptDesc);
results = mbox.search(params);
assertEquals(expected, results.getHits().size());
}
use of com.zimbra.client.ZSearchParams in project zm-mailbox by Zimbra.
the class TestDraftCount method deleteFromQuery.
private void deleteFromQuery(String query) throws Exception {
//delete all messages currently in drafts folder
ZSearchParams params = new ZSearchParams(query);
params.setTypes("message");
params.setOffset(0);
ZSearchResult results = mbox.search(params);
for (ZSearchHit hit : results.getHits()) {
ZMessageHit msg = (ZMessageHit) hit;
mbox.deleteMessage(hit.getId());
}
}
use of com.zimbra.client.ZSearchParams in project zm-mailbox by Zimbra.
the class TestTrashImapMessage method testTrashImapMessage.
@Test
public void testTrashImapMessage() throws Exception {
String subj = "testtrashimap";
addMessage(imapDsMbox1, subj, "test");
refreshImapData();
ZSearchParams params = new ZSearchParams("subject:" + subj);
params.setTypes("MESSAGE");
ZSearchResult result = mbox.search(params);
ZSearchHit hit = result.getHits().get(0);
String id = hit.getId();
msgIds.add(id);
mbox.trashMessage(id);
params = new ZSearchParams("in:\"" + IMAP_DS_1_FOLDER_NAME + "/Trash\"");
params.setTypes("MESSAGE");
result = mbox.search(params);
List<ZSearchHit> hits = result.getHits();
Assert.assertEquals(1, hits.size());
Assert.assertEquals(id, hits.get(0).getId());
}
use of com.zimbra.client.ZSearchParams in project zm-mailbox by Zimbra.
the class TestSearchConv method searchConversation.
@Test
public void searchConversation() throws Exception {
ZimbraLog.search.debug("test %s", toString());
markMessagesUnreadByIndex(unread);
ZSearchParams params = new ZSearchParams(query);
params.setFetch(fetch);
ZSearchResult result = mbox.searchConversation(convId, params);
List<ZSearchHit> hits = result.getHits();
List<String> expandedList = new ArrayList<String>();
for (Integer idx : expected) {
expandedList.add(msgIds.get(idx));
}
for (ZSearchHit hit : hits) {
boolean expanded = isExpanded(hit);
if (expandedList.contains(hit.getId())) {
assertTrue(String.format("%s expanded should be true for msgId=%s", toString(), hit.getId()), expanded);
expandedList.remove(hit.getId());
} else {
assertFalse(String.format("%s expanded should be false for msgId=%s", toString(), hit.getId()), expanded);
}
}
assertEquals(String.format("%s expandedList size", toString()), 0, expandedList.size());
}
Aggregations