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
Anurag Patel
commented Dec 08 '17, 2:41 a.m.
Thanks Elohim Arranaga for your valuable efforts. Now I am able to update custom attributes but single attribute is updates at single time. I want to update all custom attribute at single time. Can you please suggest way Hi Anurag, you can send multiple entries, one for each custom attribute you need to update in a single put request for a resource (in this scenario, your test case). If they are not updating please follow up with support to open up a defect because that is not the expected behavior.
Anurag Patel
commented Jan 10 '18, 1:00 a.m.
Thanks @Elohim Arranaga ...my requirement is I need to update custom attribute of custom test case template which I created. There are multiple custom attributes but when I am trying to update all only one attribute is updated. I create multiple one put request for each custom attribute. Can you tell me please what is wrong? |
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. Comments
Anurag Patel
commented Jan 12 '18, 8:31 a.m.
Hi @Elohim Arranga Now problem is quite solved. i can update 2 custom attributes at a time. But when I tried two to update third custom attribute, third value can updated in RQM successfully, but it deletes my first two values only third value is updated. |
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");
|
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.