use of com.zimbra.client.ZSearchResult 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());
}
use of com.zimbra.client.ZSearchResult in project zm-mailbox by Zimbra.
the class TestSearchJunkTrash method testTrashOrNotJunk.
@Test
public void testTrashOrNotJunk() throws ServiceException {
//resolves to trash only
ZSearchParams params = new ZSearchParams(String.format("(in:trash OR NOT in:junk) (inid:%s OR is:local)", folder.getId()));
ZSearchResult results = mbox.search(params);
assertEquals(1, results.getHits().size());
}
use of com.zimbra.client.ZSearchResult in project zm-mailbox by Zimbra.
the class TestSearchJunkTrash method testJunk.
@Test
public void testJunk() throws ServiceException {
ZSearchParams params = new ZSearchParams(String.format("(in:junk) (inid:%s OR is:local)", folder.getId()));
ZSearchResult results = mbox.search(params);
assertEquals(2, results.getHits().size());
}
use of com.zimbra.client.ZSearchResult in project zm-mailbox by Zimbra.
the class TestMinusOperator method testExcludeText.
@Test
public void testExcludeText() throws ServiceException {
ZSearchResult search1 = mbox.search(new ZSearchParams("in:sent test"));
//control
assertEquals(search1.getHits().size(), 1);
ZSearchResult search2 = mbox.search(new ZSearchParams("in:sent -test"));
assertEquals(search2.getHits().size(), 0);
}
Aggregations