use of org.uberfire.ext.widgets.common.client.dropdown.LiveSearchEntry in project kie-wb-common by kiegroup.
the class AssigneeLiveSearchServiceTest method testSearchSingleUser.
@Test
public void testSearchSingleUser() {
assigneeLiveSearchService.init(AssigneeType.USER);
assigneeLiveSearchService.searchEntry("user", callback);
ArgumentCaptor<SearchRequestImpl> requestArgumentCaptor = ArgumentCaptor.forClass(SearchRequestImpl.class);
verify(userManager).search(requestArgumentCaptor.capture());
SearchRequestImpl request = requestArgumentCaptor.getValue();
assertEquals("user", request.getSearchPattern());
assertEquals(1, request.getPageSize());
ArgumentCaptor<RemoteCallback> callbackArgumentCaptor = ArgumentCaptor.forClass(RemoteCallback.class);
verify(userSystemManager).users(callbackArgumentCaptor.capture(), any());
RemoteCallback<AbstractEntityManager.SearchResponse<?>> successCallback = callbackArgumentCaptor.getValue();
successCallback.callback(prepareSingleUserResponse());
ArgumentCaptor<LiveSearchResults> resultsArgumentCaptor = ArgumentCaptor.forClass(LiveSearchResults.class);
verify(callback).afterSearch(resultsArgumentCaptor.capture());
LiveSearchResults<LiveSearchEntry<String>> result = resultsArgumentCaptor.getValue();
assertEquals(1, result.size());
assertEquals("user", result.get(0).getValue());
}
use of org.uberfire.ext.widgets.common.client.dropdown.LiveSearchEntry in project kie-wb-common by kiegroup.
the class AssigneeLiveSearchServiceTest method testSearchSingleGroup.
@Test
public void testSearchSingleGroup() {
assigneeLiveSearchService.init(AssigneeType.GROUP);
assigneeLiveSearchService.searchEntry("it", callback);
ArgumentCaptor<SearchRequestImpl> requestArgumentCaptor = ArgumentCaptor.forClass(SearchRequestImpl.class);
verify(groupManager).search(requestArgumentCaptor.capture());
SearchRequestImpl request = requestArgumentCaptor.getValue();
assertEquals("it", request.getSearchPattern());
assertEquals(1, request.getPageSize());
ArgumentCaptor<RemoteCallback> callbackArgumentCaptor = ArgumentCaptor.forClass(RemoteCallback.class);
verify(userSystemManager).groups(callbackArgumentCaptor.capture(), any());
RemoteCallback<AbstractEntityManager.SearchResponse<?>> successCallback = callbackArgumentCaptor.getValue();
successCallback.callback(prepareSingleGroupResponse());
ArgumentCaptor<LiveSearchResults> resultsArgumentCaptor = ArgumentCaptor.forClass(LiveSearchResults.class);
verify(callback).afterSearch(resultsArgumentCaptor.capture());
LiveSearchResults<LiveSearchEntry<String>> result = resultsArgumentCaptor.getValue();
assertEquals(1, result.size());
assertEquals("it", result.get(0).getValue());
}
Aggregations