How to update custom attribute value of test case in RQM through OSLC?
Hi all,
I am trying to update RQM test case custom attribute value through OSLC code but does not work. Please guide me. I pasted source code in following section
QName testRecordIdQname = new QName("https://xyz.com/qm/oslc_qm/contexts/_x3L0gk6ZEeSTjIlfgxRM-Q/shape/resource/com.ibm.rqm.planning.VersionedTestCase#","ecu", "code");
QName vstRecordIdQname = new QName("https://prssetst.intra.chrysler.com/qm/oslc_qm/contexts/_x3L0gk6ZEeSTjIlfgxRM-Q/shape/resource/com.ibm.rqm.execution.Testcase#","Custom_Attribute", "Custom_Attribute");
Map<QName, Object> vstIdExtended = new HashMap<QName, Object>();
vstIdExtended.put(testRecordIdQname, "56");
vstIdExtended.put(vstRecordIdQname, "55");
testCase.setExtendedProperties(vstIdExtended);
//update test record
ClientResponse updateResourceResponse = null;
ClientResponse response = null;
response = client.getResource(testCase.getAbout().toString(), OslcMediaType.APPLICATION_RDF_XML);
String etag = response.getHeaders().getFirst(OSLCConstants.ETAG);
updateResourceResponse = client.updateResource(testCase.getAbout().toString(), testCase,OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_RDF_XML, etag);
updateResourceResponse.consumeContent();
int status = updateResourceResponse.getStatusCode();
System.out.println("Status Code="+status);
It gives me response code 200 but in RQM attribute value is not updated
3 answers
Hi Anurag, I think it would be easier if you post the final xml that you are sending. Also include if you can the version are you using (6.0, 6.0.1, etc).
In general terms the gold rule is, send the same xml formatting that you receive when do a get when you send the data, for example:
In QM 6.0.5:
I am receiving for a custom attribute called priority with current value of 2:
.....
<projectnaUbYZE_EeeSX84ET4iniA_testPlan:priority rdf:datatype="http://www.w3.org/2001/XMLSchema#string">value 2 </projectnaUbYZE_EeeSX84ET4iniA_testPlan:priority>
.....
And I am doing a put with the same format but value changed with:
...
<projectnaUbYZE_EeeSX84ET4iniA_testPlan:priority rdf:datatype="http://www.w3.org/2001/XMLSchema#string">My new value for priority </projectnaUbYZE_EeeSX84ET4iniA_testPlan:priority>
...
Note: The namespace "projectnaUbYZE_EeeSX84ET4iniA_testPlan" translates to:
xmlns:projectnaUbYZE_EeeSX84ET4iniA_testPlan="https://<server>:<port>/qm/oslc_qm/contexts/<project_area_item_id>/shape/resource/com.ibm.rqm.planning.VersionedTestPlan#"
And the data is updated successfully.
Hope this helps.
Comments
Hi Anurag, you can follow up with support on this problem, if you are sending updates for all the attributes in the http request and only one is being updated then we have a potential defect, you need to open up a ticket for support so we can investigate the problem more thoroughly.
Hi @Elohim Arranga Thanks for your reply I pasted my code below for custom attribute, note "ecu" is my custom attribute: See I put two custom attribute in map and then update it in single operation, Can you please see the code and guide me whats's wrong in code?
QName testRecordIdQname = new QName("https://d-9376:9443/qm/oslc_qm/contexts/_KrqUoMkQEeeeX6RO5KtLzA/shape/resource/com.ibm.rqm.planning.VersionedTestCase#","ecu", "ecu");
QName testCaseSymptom = new QName("https://d-9376:9443/qm/oslc_qm/contexts/_KrqUoMkQEeeeX6RO5KtLzA/shape/resource/com.ibm.rqm.planning.VersionedTestCase#","Name", "Name");
Map<QName, Object> customAttribute = new HashMap<QName, Object>();customAttribute.put(testCaseSymptom, "Rishi");customAttribute.put(testRecordIdQname ,"xyz");testCase.setExtendedProperties(customAttribute);ClientResponse updateResourceResponse = null;ClientResponse response = null;response = client.getResource(testCase.getAbout().toString(), OslcMediaType.APPLICATION_RDF_XML);String etag = response.getHeaders().getFirst(OSLCConstants.ETAG);System.out.println("Etag :"+etag);updateResourceResponse = client.updateResource(testCase.getAbout().toString(), testCase,OslcMediaType.APPLICATION_RDF_XML, OslcMediaType.APPLICATION_RDF_XML, etag);