Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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?

0 votes


Be the first one to answer this question!

Register or log in to post your answer.

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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Sep 06 '12, 12:46 p.m.

Question was seen: 4,949 times

Last updated: Sep 06 '12, 12:51 p.m.

Confirmation Cancel Confirm