Hi colleagues,
I noticed some strange behavior when trying to update the Extended Properties of Test Management Artifacts and I want to share with you:
String testPlanShortId = "1234567";
String configContext = JAZZ_QM_CONNECTION.getHost() + "/gc/configuration/17496";
String projectAreaItemId = "_projectAreaItemId";
QName plannedForAttributeQName = RQM_OSLC_UTILS.getCustomAttributeQName("Planned For", "com.ibm.rqm.execution.ExecutionResult", projectAreaItemId);
QName releaseGlobalAttributeQName = RQM_OSLC_UTILS.getCustomAttributeQName("Release / Global Context", "com.ibm.rqm.execution.ExecutionResult", projectAreaItemId);
QName swVersionAttributeQName = RQM_OSLC_UTILS.getCustomAttributeQName("SW Version", "com.ibm.rqm.execution.ExecutionResult", projectAreaItemId);
//modify 3 custom attributes
TestResult testResultToUpdate = RQM_OSLC_UTILS.getTestResultByShortId(testPlanShortId, configContext, projectAreaItemId);
testResultToUpdate.getExtendedProperties().put(plannedForAttributeQName, "plannedFor1");
testResultToUpdate.getExtendedProperties().put(releaseGlobalAttributeQName, "releaseGC1");
testResultToUpdate.getExtendedProperties().put(swVersionAttributeQName, "swVersion1");
TestResult updatedTestResult1 = RQM_OSLC_UTILS.updateTestResult(testResultToUpdate, configContext);
assertEquals(testResultToUpdate.getExtendedProperties().get(plannedForAttributeQName), updatedTestResult1.getExtendedProperties().get(plannedForAttributeQName));
assertEquals(testResultToUpdate.getExtendedProperties().get(releaseGlobalAttributeQName), updatedTestResult1.getExtendedProperties().get(releaseGlobalAttributeQName));
assertEquals(testResultToUpdate.getExtendedProperties().get(swVersionAttributeQName), updatedTestResult1.getExtendedProperties().get(swVersionAttributeQName));
//modify again just one of the custom attributes
updatedTestResult1.getExtendedProperties().put(plannedForAttributeQName, "plannedFor1;plannedFor2");
TestResult updatedTestResult2 = RQM_OSLC_UTILS.updateTestResult(updatedTestResult1, configContext);
//planned for is updated but the other custom attributes are deleted
assertEquals(updatedTestResult1.getExtendedProperties().get(plannedForAttributeQName), updatedTestResult2.getExtendedProperties().get(plannedForAttributeQName));
assertNull(updatedTestResult2.getExtendedProperties().get(releaseGlobalAttributeQName));
assertNull(updatedTestResult2.getExtendedProperties().get(swVersionAttributeQName));
Note: “updateTestResult” method uses “updateResource” method from OslcClient class:
Response response = oslcClient.updateResource(url,artifact,mediaType,acceptType,ifMatch,configurationContext);
Basically, updating attributes deletes values from the other attributes.
I would say issues happen for all TM artifacts for text Custom Attributes (XMLLiteral): I tested for Test Result and Test Case, same behavior.
I also tested for Custom Attributes of ccm Workitems and the update does not remove other attributes, so this seems to be a bug.
Let me know what you think.
Thanks,
Ana