It's all about the answers!

Ask a question

Uploading Attachments for RQM Automation Result through OSLC


Elliot Morrison-Reed (2059) | asked Dec 04 '13, 9:58 a.m.
Hello,

I have written a few questions along my journey creating an RQM Automation Adapter from scratch. I have finally created an adapter that is able to handle Automation Requests and post the result back to the system.  I now have to attach the actual test system results to the object as explained in Step 30 in the API Reference.

https://jazz.net/wiki/bin/view/Main/RQMTestAutomationAdapterAPI

The uploadAttachmentUrl property is clearly there in the Automation Request object.  If I run a GET request on the URI, I receive a list of attachments in the system:
<?xml version="1.0" encoding="UTF-8"?>
<feed 
    xmlns="http://www.w3.org/2005/Atom">
    <title type="text">attachment ATOM feed for project area ...</title>
    <id>https://server:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/Project/attachment</id>
<link href="https://server:9443/qm/web/console/" rel="alternate"/>
<link rel="self" href="https://server:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/Project/attachment"/>
<entry
xmlns="http://www.w3.org/2005/Atom">
<id>https://server:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/Project/attachment/urn:com.ibm.rqm:attachment:1</id>
<updated>2013-02-11T09:40:29.794Z</updated>
<title type="text">SW-List.csv</title>
<summary type="text">Attachments Section</summary>
<link href="https://server.com:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/Project/attachment/urn:com.ibm.rqm:attachment:1" rel="alternate" type="application/xml" title=""/>
</entry>
...
</feed>
I can also send a POST request to the address with a multipart/form-data request with my file included.

Headers:
  Content-Type: multipart/form-data
  Accept: */*

Body:
--6c0ebc3aea8b406a8f9aa9955227b52c
Content-Disposition: form-data; name="test_result_report.txt"; filename="test_result_report.txt"
Content-Type: application/octet-stream; name="test_result_report.txt"

<... file-data ...>

--6c0ebc3aea8b406a8f9aa9955227b52c--
This appears to work at first glance:  I receive a 201: Created HTTP response with a 'location' header ('https://server:9443/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/Project/attachment/slug__yAG_tVzpEeOFGtOkGKTDbw').  However, the new attachment does not appear in the list of attachments if I run another GET on the base address.

I thought that perhaps it is a special class of attachment that wouldn't show up in the base query, so I have tried adding an rqm_auto:attachment triple to the URI provided by the in the location header anyways.  This does not cause an error in the Automation Result Creation Factory POST, but when I run a GET on the created Automation Result, there is no attachment property included.

There are no 3xx or 4xx Responses in the entire sequence, however the attachment does not end up in the attachment list or in the desired Automation Result.

How can I get my test results attached to the final Automation Result Resource?

Regards,
Elliot


Accepted answer


permanent link
Paul Slauenwhite (8.4k12) | answered Dec 05 '13, 9:20 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
Hi Elliot,

It appears the attachment is not being created correctly.  You need to following the conditions in https://jazz.net/wiki/bin/view/Main/RqmApi#ResourcesFootnote6.
Elliot Morrison-Reed selected this answer as the correct answer

Comments
Elliot Morrison-Reed commented Dec 09 '13, 10:32 a.m.

Hi Paul,

I was able to figure it out eventually.  Seems like it had to do with tagging the Content-Transfer-Encoding in the request body as "binary". Now I can see the attachment tag is saved in the OSLC representation, and I can access the attachment through the OSLC resources link.  However, I can't find any mention of the attachment in the web interface.  It seems like all the other pieces of information (verdict, startTime, endTime, other links, etc.) are there, but not attachment.  Any idea where I should look for it?



Regards,
Elliot


Paul Slauenwhite commented Dec 09 '13, 1:52 p.m.
FORUM MODERATOR / JAZZ DEVELOPER

Hi Elliot,

Attachments are not exposed in the Request and Execution Result editors.


Elliot Morrison-Reed commented Dec 10 '13, 9:04 a.m.

Is this by design? How is the end user supposed to access the results of the test?

2 other answers



permanent link
Vaibhav Srivastava (2861) | answered May 20 '14, 4:52 a.m.
JAZZ DEVELOPER
 Hi Elliot,
By any chance have you looked at how the Eclipse Lyo sample adapter works to upload the attachments?
http://wiki.eclipse.org/Lyo/BuildClient#RQMAutomationSample

The sample adapter runs a test and at the end uploads a sample file to the result. This sample file is visible in the RQM's result UI. Here is a UI screenshot on how the attachment appears here
In eclipse Lyo sample, look for the comment 
// Upload an attachment for the result in RQMAutomationSample.java

Hope this helps
Vaibhav

permanent link
Paul Slauenwhite (8.4k12) | answered Dec 10 '13, 9:15 a.m.
FORUM MODERATOR / JAZZ DEVELOPER
Not all OSLC properties are exposed in the RQM UI since OSLC is an open standard that defines resources and their properties that are not required/supported by RQM. 

Your answer


Register or to post your answer.