Package br.eti.kinoshita.testlinkjavaapi.model

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


    public void testUploadRequirementAttachment(Integer requirementId,
      String title, String description, String fileName, String fileType,
      String content) {
  this.loadXMLRPCMockData("tl.uploadRequirementAttachment.xml");

  Attachment attachment = null;

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


    public void testUploadTestProjectAttachment(Integer testProjectId,
      String title, String description, String fileName, String fileType,
      String content) {
  this.loadXMLRPCMockData("tl.uploadTestProjectAttachment.xml");

  Attachment attachment = null;

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

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

        Integer id = 0;

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

        try {
            Map<String, Object> executionData = Util.getTestCaseAttachmentMap(attachment);
            Object response = this.executeXmlRpcCall(TestLinkMethods.UPLOAD_TEST_CASE_ATTACHMENT.toString(),
                    executionData);
            Map<String, Object> responseMap = Util.castToMap(response);
            id = Util.getInteger(responseMap, TestLinkResponseParams.ID.toString());
            attachment.setId(id);
        } catch (XmlRpcException xmlrpcex) {
            throw new TestLinkAPIException("Error uploading attachment for test case: " + xmlrpcex.getMessage(),
                    xmlrpcex);
        }

View Full Code Here

        return attachments;
    }

    protected Attachment uploadExecutionAttachment(Integer executionId, String title, String description,
            String fileName, String fileType, String content) throws TestLinkAPIException {
        Attachment attachment = null;

        Integer id = 0;

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

        try {
            Map<String, Object> executionData = Util.getExecutionAttachmentMap(attachment);

            Object response = this.executeXmlRpcCall(TestLinkMethods.UPLOAD_EXECUTION_ATTACHMENT.toString(),
                    executionData);
            Map<String, Object> responseMap = Util.castToMap(response);
            id = Util.getInteger(responseMap, TestLinkResponseParams.ID.toString());
            attachment.setId(id);
        } catch (XmlRpcException xmlrpcex) {
            throw new TestLinkAPIException("Error uploading attachment for execution: " + 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
View Full Code Here

     * @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

     */
    @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);
  }

View Full Code Here

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

  Integer id = 0;

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

  try {
      Map<String, Object> executionData = Util
        .getTestCaseAttachmentMap(attachment);
      Object response = this.executeXmlRpcCall(
        TestLinkMethods.UPLOAD_TEST_CASE_ATTACHMENT.toString(),
        executionData);
      Map<String, Object> responseMap = Util.castToMap(response);
      id = Util.getInteger(responseMap,
        TestLinkResponseParams.ID.toString());
      attachment.setId(id);
  } catch (XmlRpcException xmlrpcex) {
      throw new TestLinkAPIException(
        "Error uploading attachment for test case: "
          + xmlrpcex.getMessage(), xmlrpcex);
  }
View Full Code Here

    }

    protected Attachment uploadExecutionAttachment(Integer executionId,
      String title, String description, String fileName, String fileType,
      String content) throws TestLinkAPIException {
  Attachment attachment = null;

  Integer id = 0;

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

  try {
      Map<String, Object> executionData = Util
        .getExecutionAttachmentMap(attachment);

      Object response = this.executeXmlRpcCall(
        TestLinkMethods.UPLOAD_EXECUTION_ATTACHMENT.toString(),
        executionData);
      Map<String, Object> responseMap = Util.castToMap(response);
      id = Util.getInteger(responseMap,
        TestLinkResponseParams.ID.toString());
      attachment.setId(id);
  } catch (XmlRpcException xmlrpcex) {
      throw new TestLinkAPIException(
        "Error uploading attachment for execution: "
          + xmlrpcex.getMessage(), xmlrpcex);
  }
View Full Code Here

   * @param map
   * @return
   */
  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.fileType.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

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.