Updating custom attribute deletes values from the other custom attributes

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

Hi @anamr

updatedTestResult2 is the response you are getting from the server. Correct?

That means it’s the server that is deleting (or not including the expected values of releaseGlobalAttributeQName & swVersionAttributeQName.

A first step is to identify where the problem is. On Client or Server side? Maybe you can debug and try to work out exactly what the server returns first.

Hi @jad

The attributes releaseGlobalAttributeQName & swVersionAttributeQName are included in the object sent to oslcClient.updateResource method (updatedTestResult1).

updatedTestResult2 is obtained by re-querying the the resource by URL from the server, after the update was done:

this.getOslcResource(getUriWithContext(url,configurationContext),artifact.getClass());

Maybe another important mention: my workaround for this issue is using raw OSLC requests and parsing the raw XML then making a PUT - this method works, server does not delete the other attributes, that’s why my guess was that this is a bug in the lyo library.

Hi @anamr

If the raw XML includes the expected content, then of course it’s a problem on the Lyo side.

Could you possibly share that XML so we can try to reproduce the problem?

(please remove sensitive data of course, but try to keep as much of important structure as possible)