I've been having trouble with getAuthenticatedContributor(). It query for a id that doens't exist in DB.
Hi,
I have a service that get all work items whose the owner is the user logged in. I've used the getAuthenticatedContributor method, but it returns a contributor that doens't exist in DB that I'm using.
public IWorkItemHandle[] getWorkItemsByContributor()
throws TeamRepositoryException { ...... IQueryService queryService = getService(IQueryService.class); WorkItemQueryModel queryModel = BaseWorkItemQueryModel.WorkItemQueryModel.ROOT; IItemQuery itemQuery = IItemQuery.FACTORY.newInstance(queryModel); IContributorHandle contributor = getAuthenticatedContributor(); itemQuery.filter(queryModel.owner()._eq(itemQuery.newItemHandleArg())); IItemQueryPage itemQueryPage = queryService.queryItems(itemQuery, new Object[]{contributor}, IQueryService.ITEM_QUERY_MAX_PAGE_SIZE) IRepositoryItemService repositoryItemService = getService(IRepositoryItemService.class); IItem[] items = repositoryItemService.fetchItems(itemQueryPage.handlesAsArray(), null); List<IItem> wis = Arrays.asList(items); return (IWorkItemHandle[]) wis.toArray(new IWorkItemHandle[wis.size()]); ... And the unit test class: The class AbstractSaturnoRemoteServiceTestCase extends AbstractRemoteServiceTestCase public class SaturnoServiceTest extends AbstractSaturnoRemoteServiceTestCase{ ...
public void testGetWorkItemsByContributor(){
IContributorHandle contributor = getAuthenticatedContributorHandle();
IWorkItemHandle[] workItems = getSaturnoService().getWorkItemsByContributor();
assertNotNull(workItems);
... }
I can't figure it out what's wrong. Any suggestion?
|
Be the first one to answer this question!
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.