use of org.eclipse.ecf.presence.search.ICriterion in project ecf by eclipse.
the class XMPPSearchTest method testRetrieveBuddiesNameFieldSync.
/**
* Try to locate buddies on the XMPP server in a call block way
*
* @throws ContainerConnectException
*/
public void testRetrieveBuddiesNameFieldSync() throws Exception {
assertNotNull(searchManager);
IRestriction selection = searchManager.createRestriction();
assertNotNull(selection);
// fields to consider on XMPP server side search
// search field for XMPP, criterion to match the search
ICriterion name = selection.eq(NAME, "marcelo*");
// create a specific criteria
try {
ICriteria criteria = searchManager.createCriteria();
assertNotNull(criteria);
// criteria.add(searchCriterion);
criteria.add(name);
// call the block search
ISearch search = searchManager.search(criteria);
// the collection of IResult
IResultList resultList = search.getResultList();
int resultListSize = resultList.getResults().size();
if (resultListSize == 0)
System.out.println("XMPPSearchTest.testRetrieveBuddiesNameFieldSync...no email field retrieved");
else
assertTrue(1 == resultListSize);
} catch (UserSearchException e) {
e.printStackTrace();
}
}
Aggregations