It's all about the answers!

Ask a question

How to create Service test cases to schedule a task


Meghana Pandey (15111514) | asked Sep 25 '09, 7:00 a.m.
Hi,

I have implemented a scheduled task which extends AbstractAutoScheduledTask.
I want to create a service junit test case to programmatically schedule this task.
Iam referring to the following tutorial on WIKI:
http://jazz.net/wiki/bin/view/Main/QueryDevGuide, which says for that you will have to get the handle of
IAsynchronousTaskSchedulerService in your testcase.

Can you please share with me how to do this. Also, If you can share with me any RTC service test cases, it will be an immense help.

Regards,
Meghana

36 answers



permanent link
Nick Edgar (6.5k711) | answered Feb 04 '10, 10:50 a.m.
JAZZ DEVELOPER
I don't think the Links section of the Work Item editor, or its Add dropdown, are extensible. So far, the UI for links that show up here (other than the ones directly supported by the Work Items component) are provided by other components. For example, work items reported against a build are added via the build editor. Associating work items with a change set is typically done via the Pending Changes view.

It looks like extensibility here was discussed in the 2.0 timeframe, but general extensibility was not added. See comment 9 in 67191: Add extensibility to add links menu in WorkItem.

I suggest filing a work item against the Work Items component describing your scenario.

permanent link
Meghana Pandey (15111514) | answered Mar 23 '10, 12:38 p.m.
Hi,

Iam trying to add user configuration for custom mail settings for each user, as how you had suggested the way the Work Items component contributes the Mail Configuration tab in the user editor.

Iam able to contribute my editor and add my custom check box there. But Iam not getting how to fetch this value in my rest service for each contributor.

Thanks & Regards,
Meghana

permanent link
Nick Edgar (6.5k711) | answered Mar 23 '10, 2:01 p.m.
JAZZ DEVELOPER
It depends on how you're storing the per-user info. The work item email section in the user editor uses a string extension on the IContributorDetails item referenced by the IContributor item representing the user.

If you're using the same approach, then on the server side, you can use IRepositoryItemService to fetch the IContributor, then fetch its IContributorDetails, then look up the extension(s) you stored previously.

See also AbstractService.getAuthenticatedContributor() to get the current user of your service, and IContributorService.fetchContributorByUserId to look up users by id.

Here's the code that Work Items' ChangeEventMailNotifier uses to get the info. Note that the info is stored as a serialized memento, so the code deserializes it here.

private IMemento getConfiguration(IContributor contributor) throws TeamRepositoryException {
IContributorDetailsHandle detailsHandle= contributor.getDetails();
if (detailsHandle != null) {
IContributorDetails details= (IContributorDetails) fItemService.fetchItem(detailsHandle, CONTRIBUTOR_DETAILS_FULLPROFILE);
String configVal= details.getLargeStringExtension(CONFIG_KEY);
if (configVal != null && configVal.length() > 0)
try {
return XMLMemento.createReadRoot(new StringReader(configVal));
} catch (CoreException e) {
fLog.warn(Messages.getServerString("ChangeEventMailNotifier.ERROR_ON_READING_MAIL_CONFIG_MEMENTO"), e); //$NON-NLS-1$
}
}

return null;
}

where fItemService = getService(IRepositoryItemService.class);

permanent link
Meghana Pandey (15111514) | answered Mar 25 '10, 1:50 a.m.
Hi,

Thanks a ton again for responding. Iam able to progress now.

I have one more question, which is regarding XML REST API for RPC(Project Conductor).
I want to update some of the date attributes of a WI using this REST API. Can you point me to some examples/ tutorials which explain how to call HTTP Put using this.

I have gone through this link on WIKI:
https://jazz.net/wiki/bin/view/Main/RPC-ReportsAndRestAPI

But still not able to figure out.

Thanks & Regards,
Meghana

permanent link
Nick Edgar (6.5k711) | answered Mar 25 '10, 12:03 p.m.
JAZZ DEVELOPER
Sorry, I'm not familiar with RPC's REST API. I suggest posting in the RPC forum to see if they have suggestions on how best to consume it. Also, be warned that their wiki page does say it's not intended for use outside RPC and Insight.

In general, you can drive REST APIs using an HTTP library like Java's built-in HttpURLConnection, or Apache HTTPClient 3 or 4 (aka HTTP Components Client):
http://hc.apache.org/httpclient-3.x/
http://hc.apache.org/httpcomponents-client/
They're all very different from each other.

RTC was originally implemented using Apache HTTPClient 3, but JFS is moving to HTTP Components Client, and provides an extension of it for Jazz specifics like our form-based authentication. See the mention of com.ibm.team.http at:
https://jazz.net/wiki/bin/view/Main/ServerSDKOverview

and the last few questions at:
https://jazz.net/wiki/bin/view/Main/ServerSDKQnA

permanent link
Meghana Pandey (15111514) | answered Apr 05 '10, 11:02 a.m.
Hi,

Need one help .

I have created an operation and have added an advisor to this.
Here is my code to how I call advise and execute on my operation:

IOperationReport report = serverProcess
.adviseAndExecute(calculateEffortOperation);

I can make out that the advisors if configured, get executed.
But after this Iam adding:
IAdvisorDeclaration[] advisors= serverProcess.getAdvisorDeclarations(projectAreaWhole, OPERATION_ID_MAIL_NOTIFICATION);
where OPERATION_ID_MAIL_NOTIFICATION is the operation Id.
But advisors returned are null eve though they are configured

Can you help me identify what could be the problem, or any other way I should be fetching advisors.?

permanent link
Nick Edgar (6.5k711) | answered Apr 05 '10, 3:44 p.m.
JAZZ DEVELOPER
A few questions to help narrow this down:
For which process area did you obtain the serverProcess? Is it the project area or a team area? Where did you configure the advisor, in the project area or team area? What is projectAreaWhole?

permanent link
Meghana Pandey (15111514) | answered Apr 07 '10, 12:48 p.m.
Hi,

1)Iam obtaining the serverProcess for the project area(IProjectArea) like follows:
IServerProcess serverProcess = processServerService
.getServerProcess(projectAreaWhole);

2)The AdvisableOperation's contructor is as follows:

MailNotificationOperation(IProjectArea projectArea,
IDevelopmentLine devLine) {
super(OPERATION_ID_MAIL_NOTIFICATION, null, projectArea, null);
this.projectArea = projectArea;
this.devLine = devLine;
}


3)And the advisor has been configured in the team area.

Thanks & Regards,
Meghana

permanent link
Nick Edgar (6.5k711) | answered Apr 07 '10, 2:29 p.m.
JAZZ DEVELOPER
So since the operation and server process are for the project area, it doesn't see the process customization in the team area. If the team area is the natural process area to use for the operation, it should be the one passed to the operation, and the one used to obtain the server process for looking up the advisors.

permanent link
Meghana Pandey (15111514) | answered Feb 17 '11, 6:48 a.m.
Hi,
I have developed two follow up actions. One follow up action, rolls up its children's state to the parent. For ex, if all its children have moved to Review state from DRAFT then its parent would also be changed to Review state.

The other follow up does the opposite, it propagates a field like say owner/estimate to all its children .

I have both this configured in my project area operations on WI save.
Now, I open a plan which has a parent WI and two children. I change the state of the tasks and hit save on plan itself. This is giving me a stale data exception in my team advisor window. I had put stale data exception handlers in both the follow ups but still getting this stale data exception from repository.

Please help what is wrong here and how to fix this. Also the problem persists only if both the children are saved concurrently.(like saving a plan after editing both children)

Your answer


Register or 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.