Using Plain Java API to link RTC story to RQM test case problem
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
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.
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.