How to insert Test Artifact attachments in an ETM report
I have a PUB template in which I manage to insert attachments in the resulting documents.
To do so, I referred to: Generating Word document from Rational Publishing Engine with attachments embedded as objects
By using RQMUrlUtility.jar and use that command in the Include File element:
"cmd /C " + _command
Where _command string is something like:
java -jar "/IBM/JazzTeamServer7.0.2/server/liberty/servers/clm/RQMUrlUtility.jar" -command GET -user <userid> -password <password> -filepath /tmp/ -url https://<host>/qm/service/com.ibm.rqm.integration.service.IIntegrationService/resources/<ProjectUUID>/attachment/urn:com.ibm.rqm:attachment:55
I manage to generate a document with the physically embedded attachment.
At this point I want to use that template (.dta) as a report resource in ETM (RQM).
1) Looking at the qm.log, the command was not run by RRDG, so I added this in the qm JVM server start up script:
-Dcom.ibm.rational.rpe.enable_commands=true
That seem to solve the first step.
2)
Since the server is Linux, the following was not running:
"cmd /C " + _command
Instead, I tried to use this in a JavaScript code element:
Instead, I tried to use this in a JavaScript code element:
java.lang.Runtime.getRuntime().exec("java -jar ...");
Still that does not work
In the qm.log I can read:
2022-04-08 10:31:13,174 [ RRDG_13870:13990-OUTPUT] ERROR com.ibm.rational.rrdg [TID: F42A4D54] - CRRPE3078E The application cannot run command java.lang.UNIXProcess@84ce6b8a. Cannot run program "java.lang.UNIXProcess@84ce6b8a": error=2, No such file or directory
That is the last thing that need to work, running RQMUrlUtility.jar to then insert the resulting file in the document.
One answer
To fixe the issue, I wrote a shell script that in turn call the java application.
The PUB template command calls the shell script and not the java app directly.
In PUB:
_command= "./RQMUrlUtility.sh" + " " + QM_user + " " + QM_password + " " + _attachmentsPath + " " + identifier;
try { java.lang.Runtime.getRuntime().exec(_command);On the ETM Server the RQMUrlUtility.sh simply calls the java app
}
catch (err) {
}
java -jar ./RQMUrlUtility.jar -command GET -user $1 -password $2 -filepath $3 -url $4