Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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


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

0 votes



3 answers

Permanent link

 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. 

0 votes

Comments

 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. 

 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?


Permanent link

 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.

0 votes

Comments

 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.


Permanent link

  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?


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);

0 votes

Your answer

Register or log in to post 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 1,221

Question asked: Dec 06 '17, 1:49 a.m.

Question was seen: 3,239 times

Last updated: Jan 12 '18, 8:31 a.m.

Confirmation Cancel Confirm