use of com.zimbra.client.ZSearchResult in project zm-mailbox by Zimbra.
the class TestMinusOperator method testExcludeRecipient.
@Test
public void testExcludeRecipient() throws ServiceException {
ZSearchResult search1 = mbox.search(new ZSearchParams("in:sent to:" + REMOTE_USER_NAME));
assertEquals(search1.getHits().size(), 1);
ZSearchResult search2 = mbox.search(new ZSearchParams("in:sent -to:" + REMOTE_USER_NAME));
assertEquals(search2.getHits().size(), 0);
}
use of com.zimbra.client.ZSearchResult in project zm-mailbox by Zimbra.
the class TestDataSource method testPop3.
@Test
public void testPop3() throws Exception {
Account pop3acct = TestUtil.getAccount(TEST_USER_NAME);
ZMailbox pop3mbox = TestUtil.getZMailbox(TEST_USER_NAME);
ZMailbox mbox = TestUtil.getZMailbox(USER_NAME);
String pop3DSFolder = NAME_PREFIX + " testPop3 source";
String pop3DSFolderId = createFolderForDataSource(mbox, pop3DSFolder);
String dsId = createPop3DataSource(mbox, pop3acct.getName(), pop3DSFolderId);
String subj = NAME_PREFIX + " testtrashpop3";
addMessage(pop3mbox, subj, "test");
refreshPop3DatasourceData(mbox, dsId);
ZSearchParams params = new ZSearchParams(String.format("subject:\"%s\"", subj));
params.setTypes("MESSAGE");
ZSearchResult result = mbox.search(params);
ZSearchHit hit = result.getHits().get(0);
String id = hit.getId();
try {
mbox.trashMessage(id);
} catch (SoapFaultException sfe) {
fail("SoapFaultException caught when deleting item from Pop3 datasource folder - " + sfe.getMessage());
}
params = new ZSearchParams("in:Trash");
params.setTypes("MESSAGE");
result = mbox.search(params);
List<ZSearchHit> hits = result.getHits();
assertEquals(1, hits.size());
assertEquals(id, hits.get(0).getId());
}
use of com.zimbra.client.ZSearchResult in project zm-mailbox by Zimbra.
the class TestUtil method searchMessageIds.
public static List<String> searchMessageIds(ZMailbox mbox, ZSearchParams params) throws ServiceException {
List<String> msgsIds = new ArrayList<String>();
ZSearchResult results = mbox.search(params);
for (ZSearchHit hit : results.getHits()) {
msgsIds.add(hit.getId());
}
return msgsIds;
}
use of com.zimbra.client.ZSearchResult in project zm-mailbox by Zimbra.
the class ZMailboxUtil method doSearchConvRedisplay.
private void doSearchConvRedisplay() {
ZSearchResult sr = mConvSearchResult;
if (sr == null)
return;
dumpConvSearch(mConvSearchResult, verboseOpt());
}
use of com.zimbra.client.ZSearchResult in project zm-mailbox by Zimbra.
the class TestPurgeDataSource method doSearch.
private List<ZSearchHit> doSearch(String query) throws ServiceException {
ZSearchParams params = new ZSearchParams(query);
params.setFetch(Fetch.all);
params.setSortBy(SearchSortBy.dateDesc);
ZSearchResult result = mbox.search(params);
List<ZSearchHit> hits = result.getHits();
return hits;
}
Aggregations