use of com.zimbra.soap.mail.type.MessageHitInfo in project zm-mailbox by Zimbra.
the class TestExpandGroupInfo method searchConversation.
@Test
public void searchConversation() throws Exception {
// send a to acct, recipient is a group
String SUBJECT = getTestName();
sendMsg(acct, group.getName(), SUBJECT, "blah");
SoapTransport transport = authUser(acct.getName());
SearchRequest searchReq = new SearchRequest();
searchReq.setSearchTypes(MailItem.Type.CONVERSATION.toString());
searchReq.setQuery(String.format("in:inbox and subject:%s", SUBJECT));
SearchResponse searchResp = invokeJaxb(transport, searchReq);
List<SearchHit> searchHits = searchResp.getSearchHits();
assertEquals(1, searchHits.size());
SearchHit searchHit = searchHits.get(0);
String convId = searchHit.getId();
SearchConvRequest searchConvReq = new SearchConvRequest(convId);
searchConvReq.setNeedCanExpand(Boolean.TRUE);
searchConvReq.setFetch(SearchParams.ExpandResults.ALL.toString());
SearchConvResponse searchConvResp = invokeJaxb(transport, searchConvReq);
List<MessageHitInfo> hits = searchConvResp.getMessages();
// 2 - one in inbox, one in sent folder
assertEquals(2, hits.size());
verifyGroupInfo(hits.get(0), Boolean.TRUE, Boolean.TRUE);
verifyGroupInfo(hits.get(1), Boolean.TRUE, Boolean.TRUE);
}
Aggregations