* @throws TestLinkAPIException
*/
protected Attachment uploadTestProjectAttachment(Integer testProjectId,
String title, String description, String fileName, String fileType,
String content) throws TestLinkAPIException {
Attachment attachment = null;
Integer id = 0;
attachment = new Attachment(id, testProjectId,
TestLinkTables.NODES_HIERARCHY.toString(), title, description,
fileName, null, fileType, content);
try {
Map<String, Object> executionData = Util
.getTestProjectAttachmentMap(attachment);
Object response = this.executeXmlRpcCall(
TestLinkMethods.UPLOAD_TEST_PROJECT_ATTACHMENT.toString(),
executionData);
Map<String, Object> responseMap = (Map<String, Object>) response;
id = Util.getInteger(responseMap,
TestLinkResponseParams.ID.toString());
attachment.setId(id);
} catch (XmlRpcException xmlrpcex) {
throw new TestLinkAPIException(
"Error uploading attachment for test project: "
+ xmlrpcex.getMessage(), xmlrpcex);
}