It's all about the answers!

Ask a question

Using Plain Java API to link RTC story to RQM test case problem


Bob Wang (482119) | asked Sep 04 '12, 11:54 a.m.
I have the following code to link the RQM test case to an existing RTC story. When I run the program, I noticed that the RQM test case link was added to RTC story, but it shows the full URL instead of the test case name. when I go to RQM test case, I couldn't see the RTC story link in development item section. 

However,  if I link them manually, it shows the test case name in RTC story, and the RTC story link shows up in the RQM test case in development item section. 

Is there a way to resolve the test case name automatically and do bi-direction link?

URI uri = new URI(tcURL);
IEndPointDescriptor endpoint = ILinkTypeRegistry.INSTANCE
.getLinkType(WorkItemLinkTypes.TESTED_BY_TEST_CASE)
.getTargetEndPointDescriptor();

IWorkItemClient service = (IWorkItemClient) repo
.getClientLibrary(IWorkItemClient.class);

IWorkItem workItem = service.findWorkItemById(storyId,
IWorkItem.FULL_PROFILE, monitor);

IReference reference = IReferenceFactory.INSTANCE
.createReferenceFromURI(uri);

IWorkItemWorkingCopyManager wcm = service
.getWorkItemWorkingCopyManager();
wcm.connect(workItem, IWorkItem.FULL_PROFILE, monitor);

try {
WorkItemWorkingCopy wc = wcm.getWorkingCopy(workItem);
wc.getReferences().add(endpoint, reference);
IDetailedStatus s = wc.save(null);

if (!s.isOK()) {

throw new TeamRepositoryException("Error saving work item",

s.getException());

}

} finally {
wcm.disconnect(workItem);
}



One answer



permanent link
Paul Slauenwhite (8.4k12) | answered Sep 05 '12, 9:51 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
edited Sep 05 '12, 10:21 a.m.
I am not an expert on the RTC API, but your work item reference does not have a title.

For the backlink in RQM, you need to use the OSLC QM API (see http://open-services.net/bin/view/Main/QmSpecificationV2?sortcol=table;up=#Resource_TestCase).  Note, https://jazz.net/wiki/bin/view/Main/RqmApi#ResourcesFootnote8 for the RQM Reportable REST API.

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.