All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.main.java.com.smartbear.readyapi.client.api.ReadyapiApi Maven / Gradle / Ivy

Go to download

Java client library for creating and executing test recipes against Ready!API TestServer

The newest version!
package com.smartbear.readyapi.client.api;

import com.sun.jersey.api.client.GenericType;

import io.swagger.client.ApiException;
import io.swagger.client.ApiClient;
import io.swagger.client.Configuration;
import io.swagger.client.Pair;

import com.smartbear.readyapi.client.model.FormDataMultiPart;
import com.smartbear.readyapi.client.model.ProjectResultReport;
import com.smartbear.readyapi.client.model.ProjectResultReports;
import com.smartbear.readyapi.client.model.HarLogRoot;
import com.smartbear.readyapi.client.model.InputStream;
import com.smartbear.readyapi.client.model.TestCase;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-07-29T13:25:49.703+02:00")
public class ReadyapiApi {
  private ApiClient apiClient;

  public ReadyapiApi() {
    this(Configuration.getDefaultApiClient());
  }

  public ReadyapiApi(ApiClient apiClient) {
    this.apiClient = apiClient;
  }

  public ApiClient getApiClient() {
    return apiClient;
  }

  public void setApiClient(ApiClient apiClient) {
    this.apiClient = apiClient;
  }

  
  /**
   * Posts a file for the specified test run
   * Use this operation to send additional files required by the executed test recipes. For example, you may need to send an Excel file for your test recipe that uses an Excel data source. The test recipe will be in the \"PENDING\" status until it receives the required file. Use the <code>multipart/form-data</code> media type for this request.
   * @param body Required file as `form-data`. (required)
   * @param executionId The id of the test run that waits for the files. [See how you can get it](http://readyapi.smartbear.com/testserver/tutorials/your_first_recipe/results). (required)
   * @param async Specifies when the TestServer replies:<br/>`true` - Immediately.<br/>`false` - After the execution is over. (optional, default to true)
   * @return ProjectResultReport
   * @throws ApiException if fails to make API call
   */
  public ProjectResultReport addFile(FormDataMultiPart body, String executionId, Boolean async) throws ApiException {
    Object localVarPostBody = body;
    
    // verify the required parameter 'body' is set
    if (body == null) {
      throw new ApiException(400, "Missing the required parameter 'body' when calling addFile");
    }
    
    // verify the required parameter 'executionId' is set
    if (executionId == null) {
      throw new ApiException(400, "Missing the required parameter 'executionId' when calling addFile");
    }
    
    // create path and map variables
    String localVarPath = "/readyapi/executions/{executionId}/files".replaceAll("\\{format\\}","json")
      .replaceAll("\\{" + "executionId" + "\\}", apiClient.escapeString(executionId.toString()));

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();

    
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "async", async));
    

    

    

    final String[] localVarAccepts = {
      "application/json"
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {
      "multipart/form-data"
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] { "basicAuth" };

    
    GenericType localVarReturnType = new GenericType() {};
    return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
    
  }
  
  /**
   * Cancels the specified recipe execution
   * Use this operation to stop the run specified by <i>executionID</i>. You can find in the response to your execution request ([see how](http://readyapi.smartbear.com/testserver/tutorials/your_first_recipe/results)), or you can send a GET <code>/readyapi/executions</code> request to the TestServer.
   * @param executionID The id of the test run to stop. (required)
   * @throws ApiException if fails to make API call
   */
  public void cancelExecution(String executionID) throws ApiException {
    Object localVarPostBody = null;
    
    // verify the required parameter 'executionID' is set
    if (executionID == null) {
      throw new ApiException(400, "Missing the required parameter 'executionID' when calling cancelExecution");
    }
    
    // create path and map variables
    String localVarPath = "/readyapi/executions/{executionID}".replaceAll("\\{format\\}","json")
      .replaceAll("\\{" + "executionID" + "\\}", apiClient.escapeString(executionID.toString()));

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();

    

    

    

    final String[] localVarAccepts = {
      
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {
      
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] { "basicAuth" };

    
    apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
    
  }
  
  /**
   * Returns the status of the specified recipe execution.
   * Use this operation to get information on the recipe execution specified by <i>executionID</i>.  You can find in the response to your execution request ([see how](http://readyapi.smartbear.com/testserver/tutorials/your_first_recipe/results)), or you can send a GET <code>/readyapi/executions</code> request to the TestServer.
   * @param executionID The id of the desired test run. (required)
   * @return ProjectResultReport
   * @throws ApiException if fails to make API call
   */
  public ProjectResultReport getExecutionStatus(String executionID) throws ApiException {
    Object localVarPostBody = null;
    
    // verify the required parameter 'executionID' is set
    if (executionID == null) {
      throw new ApiException(400, "Missing the required parameter 'executionID' when calling getExecutionStatus");
    }
    
    // create path and map variables
    String localVarPath = "/readyapi/executions/{executionID}/status".replaceAll("\\{format\\}","json")
      .replaceAll("\\{" + "executionID" + "\\}", apiClient.escapeString(executionID.toString()));

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();

    

    

    

    final String[] localVarAccepts = {
      "application/json"
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {
      
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] { "basicAuth" };

    
    GenericType localVarReturnType = new GenericType() {};
    return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
    
  }
  
  /**
   * Returns test run results stored on the TestServer.
   * Use this operation to get results of the latest test runs stored on the TestServer.<br/> The number of stored results is [configurable](http://readyapi.smartbear.com/testserver/reference/server_properties).
   * @return ProjectResultReports
   * @throws ApiException if fails to make API call
   */
  public ProjectResultReports getExecutions() throws ApiException {
    Object localVarPostBody = null;
    
    // create path and map variables
    String localVarPath = "/readyapi/executions".replaceAll("\\{format\\}","json");

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();

    

    

    

    final String[] localVarAccepts = {
      "application/json"
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {
      
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] { "basicAuth" };

    
    GenericType localVarReturnType = new GenericType() {};
    return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
    
  }
  
  /**
   * Gets message exchange for a test step execution transaction
   * A particular execution of a test step is referred as transaction. Use this operation to get the request and response for a transaction in HAR format.
   * @param executionID The id of the test run to get the logs for. (required)
   * @param transactionId The id of the transaction (test step execution) to get the message exchange (request and response) for. (required)
   * @return HarLogRoot
   * @throws ApiException if fails to make API call
   */
  public HarLogRoot getMessageExchange(String executionID, String transactionId) throws ApiException {
    Object localVarPostBody = null;
    
    // verify the required parameter 'executionID' is set
    if (executionID == null) {
      throw new ApiException(400, "Missing the required parameter 'executionID' when calling getMessageExchange");
    }
    
    // verify the required parameter 'transactionId' is set
    if (transactionId == null) {
      throw new ApiException(400, "Missing the required parameter 'transactionId' when calling getMessageExchange");
    }
    
    // create path and map variables
    String localVarPath = "/readyapi/executions/{executionID}/transactions/{transactionId}".replaceAll("\\{format\\}","json")
      .replaceAll("\\{" + "executionID" + "\\}", apiClient.escapeString(executionID.toString()))
      .replaceAll("\\{" + "transactionId" + "\\}", apiClient.escapeString(transactionId.toString()));

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();

    

    

    

    final String[] localVarAccepts = {
      "application/json"
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {
      
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] { "basicAuth" };

    
    GenericType localVarReturnType = new GenericType() {};
    return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
    
  }
  
  /**
   * Returns the transaction logs for the specified recipe execution.
   * Use this operation to get transaction logs (individual request and recponse of executed test steps) of the recipe execution specified by <i>executionID</i>.  You can find it in the response of your execution request ([see how](http://readyapi.smartbear.com/testserver/tutorials/your_first_recipe/results)), or you can send a GET <code>/readyapi/executions/{executionID}/logs</code> request to the TestServer.
   * @param executionID The id of the desired test run. (required)
   * @return HarLogRoot
   * @throws ApiException if fails to make API call
   */
  public HarLogRoot getMessageExchanges(String executionID) throws ApiException {
    Object localVarPostBody = null;
    
    // verify the required parameter 'executionID' is set
    if (executionID == null) {
      throw new ApiException(400, "Missing the required parameter 'executionID' when calling getMessageExchanges");
    }
    
    // create path and map variables
    String localVarPath = "/readyapi/executions/{executionID}/logs".replaceAll("\\{format\\}","json")
      .replaceAll("\\{" + "executionID" + "\\}", apiClient.escapeString(executionID.toString()));

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();

    

    

    

    final String[] localVarAccepts = {
      "application/json"
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {
      
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] { "basicAuth" };

    
    GenericType localVarReturnType = new GenericType() {};
    return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
    
  }
  
  /**
   * Executes a zipped Ready! API composite project.
   * Use this operation to send a zipped Ready! API composite project to the TestServer. You command the TestServer to execute the entire project, or an individual test suite or test case in it. The recipe request should have a Ready! API project file (.xml) attached to it.
   * @param body Ready! API XML project. (optional)
   * @param testCaseName The name of the test case to run. (optional)
   * @param testSuiteName The name of the test suite to run. (optional)
   * @param environment The target environment for tests execution. (optional)
   * @param async Specifies when TestServer replies:<br/>`true` - Immediately.<br/>`false` - After the execution is over. (optional, default to true)
   * @param callback The URL, to which the results will be posted. (optional)
   * @param clientCertFileName The name of the separately provided client certificate file. (optional)
   * @param clientCertPassword The password for the separately provided client certificate file.. (optional)
   * @return ProjectResultReport
   * @throws ApiException if fails to make API call
   */
  public ProjectResultReport postCompositeProjectExecution(InputStream body, String testCaseName, String testSuiteName, String environment, Boolean async, String callback, String clientCertFileName, String clientCertPassword) throws ApiException {
    Object localVarPostBody = body;
    
    // create path and map variables
    String localVarPath = "/readyapi/executions/composite".replaceAll("\\{format\\}","json");

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();

    
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "testCaseName", testCaseName));
    
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "testSuiteName", testSuiteName));
    
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "environment", environment));
    
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "async", async));
    
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "callback", callback));
    
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "clientCertFileName", clientCertFileName));
    
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "clientCertPassword", clientCertPassword));
    

    

    

    final String[] localVarAccepts = {
      "application/json"
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {
      "application/zip"
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] { "basicAuth" };

    
    GenericType localVarReturnType = new GenericType() {};
    return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
    
  }
  
  /**
   * Executes a Ready! API project.
   * Use this operation to send a Ready! API test project to the TestServer. You command the TestServer to execute the entire project, or an individual test suite or test case in it. The recipe request should have a Ready! API project file (.xml) attached to it.
   * @param body Ready! API XML project. (optional)
   * @param testCaseName The name of the test case to run. (optional)
   * @param testSuiteName The name of the test suite to run. (optional)
   * @param environment The target environment for tests execution. (optional)
   * @param async Specifies when TestServer replies:<br/>`true` - Immediately.<br/>`false` - After the execution is over. (optional, default to true)
   * @param callback The URL, to which the results will be posted. (optional)
   * @param clientCertFileName The name of the separately provided client certificate file. (optional)
   * @param clientCertPassword The password for the separately provided client certificate file.. (optional)
   * @return ProjectResultReport
   * @throws ApiException if fails to make API call
   */
  public ProjectResultReport postProjectExecution(InputStream body, String testCaseName, String testSuiteName, String environment, Boolean async, String callback, String clientCertFileName, String clientCertPassword) throws ApiException {
    Object localVarPostBody = body;
    
    // create path and map variables
    String localVarPath = "/readyapi/executions/xml".replaceAll("\\{format\\}","json");

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();

    
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "testCaseName", testCaseName));
    
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "testSuiteName", testSuiteName));
    
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "environment", environment));
    
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "async", async));
    
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "callback", callback));
    
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "clientCertFileName", clientCertFileName));
    
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "clientCertPassword", clientCertPassword));
    

    

    

    final String[] localVarAccepts = {
      "application/json"
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {
      "application/xml"
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] { "basicAuth" };

    
    GenericType localVarReturnType = new GenericType() {};
    return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
    
  }
  
  /**
   * Runs a test recipe.
   * Use this operation to send a test recipe to the TestServer. The recipe contents is passed in the request body (should be valid JSON contents).
   * @param body JSON-based test recipe contents. (optional)
   * @param async Specifies when the TestServer replies:<br/>`true` - Immediately.<br/>`false` - After the execution is over. (optional, default to true)
   * @param callback The URL, to which the results will be posted. (optional)
   * @return ProjectResultReport
   * @throws ApiException if fails to make API call
   */
  public ProjectResultReport postRecipe(TestCase body, Boolean async, String callback) throws ApiException {
    Object localVarPostBody = body;
    
    // create path and map variables
    String localVarPath = "/readyapi/executions".replaceAll("\\{format\\}","json");

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();

    
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "async", async));
    
    localVarQueryParams.addAll(apiClient.parameterToPairs("", "callback", callback));
    

    

    

    final String[] localVarAccepts = {
      "application/json"
    };
    final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

    final String[] localVarContentTypes = {
      "application/json"
    };
    final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

    String[] localVarAuthNames = new String[] { "basicAuth" };

    
    GenericType localVarReturnType = new GenericType() {};
    return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
    
  }
  
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy