use of com.zimbra.soap.mail.message.SearchResponse in project zm-mailbox by Zimbra.
the class TestJaxb method findMatchingAppointment.
private AppointmentHitInfo findMatchingAppointment(ZMailbox mbox, Date startDate, Date endDate, String subject) throws ServiceException {
SearchRequest searchRequest = new SearchRequest();
searchRequest.setSortBy("none");
searchRequest.setLimit(500);
searchRequest.setLocale("en_US");
searchRequest.setCalItemExpandStart(startDate.getTime() - 1000);
searchRequest.setCalItemExpandEnd(endDate.getTime() + 1000);
searchRequest.setSearchTypes("appointment");
searchRequest.setOffset(0);
searchRequest.setQuery(subject);
SearchResponse searchResp = mbox.invokeJaxb(searchRequest);
Assert.assertNotNull("JAXB SearchResponse object", searchResp);
List<SearchHit> hits = searchResp.getSearchHits();
Assert.assertNotNull("JAXB SearchResponse hits", hits);
Assert.assertEquals("JAXB SearchResponse hits", 1, hits.size());
return (AppointmentHitInfo) hits.get(0);
}
Aggregations