Package br.eti.kinoshita.testlinkjavaapi.model

Examples of br.eti.kinoshita.testlinkjavaapi.model.Attachment


     * @param content
     * @return
     */
    protected Attachment uploadTestSuiteAttachment(Integer testSuiteId, String title, String description,
            String fileName, String fileType, String content) throws TestLinkAPIException {
        Attachment attachment = null;

        Integer id = 0;

        attachment = new Attachment(id, testSuiteId, TestLinkTables.NODES_HIERARCHY.toString(), title, description,
                fileName, null, fileType, content);

        try {
            Map<String, Object> executionData = Util.getTestSuiteAttachmentMap(attachment);
            Object response = this.executeXmlRpcCall(TestLinkMethods.UPLOAD_TEST_SUITE_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 suite: " + xmlrpcex.getMessage(),
                    xmlrpcex);
        }

View Full Code Here


     * @throws TestLinkAPIException
     */
    @SuppressWarnings("unchecked")
    protected Attachment uploadAttachment(Integer fkId, String fkTable, String title, String description,
            String fileName, String fileType, String content) throws TestLinkAPIException {
        Attachment attachment = null;

        Integer id = 0;

        attachment = new Attachment(id, fkId, fkTable, title, description, fileName, null, fileType, content);

        try {
            Map<String, Object> executionData = Util.getAttachmentMap(attachment);
            Object response = this.executeXmlRpcCall(TestLinkMethods.UPLOAD_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: " + xmlrpcex.getMessage(), xmlrpcex);
        }

        return attachment;
View Full Code Here

     */
    @SuppressWarnings("unchecked")
    protected Attachment uploadRequirementAttachment(Integer requirementId,
      String title, String description, String fileName, String fileType,
      String content) throws TestLinkAPIException {
  Attachment attachment = null;

  Integer id = 0;

  attachment = new Attachment(id, requirementId,
    TestLinkTables.REQUIREMENTS.toString(), title, description,
    fileName, null, fileType, content);

  try {
      Map<String, Object> executionData = Util
        .getRequirementAttachmentMap(attachment);
      Object response = this.executeXmlRpcCall(
        TestLinkMethods.UPLOAD_REQUIREMENT_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 requirement: "
          + xmlrpcex.getMessage(), xmlrpcex);
  }
View Full Code Here

    /**
     * @param map
     * @return Attachment.
     */
    public static final Attachment getAttachment(Map<String, Object> map) {
        Attachment attachment = null;
        if (map != null && map.size() > 0) {
            Object o = map.get(TestLinkResponseParams.ID.toString());
            if (o != null) {
                Integer id = Integer.parseInt(o.toString());

                if (id > 0) {
                    attachment = new Attachment();
                    attachment.setId(id);

                    attachment.setFileName(getString(map, TestLinkResponseParams.NAME.toString()));
                    attachment.setFileType(getString(map, TestLinkResponseParams.FILE_TYPE.toString()));
                    attachment.setTitle(getString(map, TestLinkResponseParams.TITLE.toString()));
                    // TBD: put the date too...
                    attachment.setContent(getString(map, TestLinkResponseParams.CONTENT.toString()));
                    // TBD: description not beign returned
                    // attachment.setDescription( getString(map,
                    // TestLinkResponseParams.description.toString() ) );
                    // TBD: returning name instead of file_name
                    // TBD: file size not beign returned
View Full Code Here

   * @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);
    }
View Full Code Here

    public void testUploadExecutionAttachment(Integer testExecutionId,
      String title, String description, String fileName, String fileType,
      String content) {
  this.loadXMLRPCMockData("tl.uploadExecutionAttachment.xml");

  Attachment attachment = null;

  try {
      attachment = this.api.uploadExecutionAttachment(testExecutionId,
        title, description, fileName, fileType, content);
  } catch (TestLinkAPIException e) {
View Full Code Here

    @Test(dataProvider = "testCaseAttachmentData")
    public void testUploadTestCaseAttachment(Integer testCaseId, String title,
      String description, String fileName, String fileType, String content) {
  this.loadXMLRPCMockData("tl.uploadTestCaseAttachment.xml");

  Attachment attachment = null;

  try {
      attachment = this.api.uploadTestCaseAttachment(testCaseId, title,
        description, fileName, fileType, content);
  } catch (TestLinkAPIException e) {
View Full Code Here

    public void testUploadRequiremenSpecificationtAttachment(Integer reqSpecId,
      String title, String description, String fileName, String fileType,
      String content) {
  this.loadXMLRPCMockData("tl.uploadRequirementSpecificationAttachment.xml");

  Attachment attachment = null;

  try {
      attachment = this.api.uploadRequirementSpecificationAttachment(
        reqSpecId, title, description, fileName, fileType, content);
  } catch (TestLinkAPIException e) {
View Full Code Here

    @Test(dataProvider = "uploadData")
    public void testUploadAttachment(String fkTable, Integer fkId,
      String title, String description, String fileName, String fileType,
      String content) {
  this.loadXMLRPCMockData("tl.uploadAttachment.xml");
  Attachment attachment = null;

  try {
      attachment = this.api.uploadAttachment(fkId, fkTable, title,
        description, fileName, fileType, content);
  } catch (TestLinkAPIException e) {
View Full Code Here

    public void testUploadTestSuiteAttachment(Integer testSuiteId,
      String title, String description, String fileName, String fileType,
      String content) {
  this.loadXMLRPCMockData("tl.uploadTestSuiteAttachment.xml");

  Attachment attachment = null;

  try {
      attachment = this.api.uploadTestSuiteAttachment(testSuiteId, title,
        description, fileName, fileType, content);
  } catch (TestLinkAPIException e) {
View Full Code Here

TOP

Related Classes of br.eti.kinoshita.testlinkjavaapi.model.Attachment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.