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

com.katalon.testops.api.TestReportApi Maven / Gradle / Ivy

There is a newer version: 1.0.1
Show newest version
package com.katalon.testops.api;

import com.katalon.testops.ApiClient;

import com.katalon.testops.model.ExecutionResource;
import com.katalon.testops.model.TestRunResult;
import com.katalon.testops.model.UploadBatchFileResource;
import com.katalon.testops.model.UploadBatchResource;

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

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;

@Component("com.katalon.testops.api.TestReportApi")
public class TestReportApi {
    private ApiClient apiClient;

    public TestReportApi() {
        this(new ApiClient());
    }

    @Autowired
    public TestReportApi(ApiClient apiClient) {
        this.apiClient = apiClient;
    }

    public ApiClient getApiClient() {
        return apiClient;
    }

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

    /**
     * Saves and processes multiple uploaded Katalon reports.
     * 
     * 

200 - OK * @param body The body parameter * @param projectId The projectId parameter * @param batch The batch parameter * @return List<UploadBatchResource> * @throws RestClientException if an error occurs while attempting to invoke the API */ public List processMultipleS3File(List body, Long projectId, String batch) throws RestClientException { Object postBody = body; // verify the required parameter 'body' is set if (body == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling processMultipleS3File"); } // verify the required parameter 'projectId' is set if (projectId == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'projectId' when calling processMultipleS3File"); } // verify the required parameter 'batch' is set if (batch == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'batch' when calling processMultipleS3File"); } String path = UriComponentsBuilder.fromPath("/api/v1/katalon/test-reports/multiple").build().toUriString(); final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap formParams = new LinkedMultiValueMap(); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "projectId", projectId)); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "batch", batch)); final String[] accepts = { "*/*" }; final List accept = apiClient.selectHeaderAccept(accepts); final String[] contentTypes = { "application/json" }; final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); String[] authNames = new String[] { "basicScheme" }; ParameterizedTypeReference> returnType = new ParameterizedTypeReference>() {}; return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); } /** * Saves and processes the uploaded Katalon reports. * *

200 - OK * @param projectId The projectId parameter * @param batch The batch parameter * @param folderPath The folderPath parameter * @param isEnd The isEnd parameter * @param fileName The fileName parameter * @param uploadedPath The uploadedPath parameter * @return List<UploadBatchResource> * @throws RestClientException if an error occurs while attempting to invoke the API */ public List processS3File(String projectId, String batch, String folderPath, String isEnd, String fileName, String uploadedPath) throws RestClientException { Object postBody = null; // verify the required parameter 'projectId' is set if (projectId == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'projectId' when calling processS3File"); } // verify the required parameter 'batch' is set if (batch == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'batch' when calling processS3File"); } // verify the required parameter 'folderPath' is set if (folderPath == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'folderPath' when calling processS3File"); } // verify the required parameter 'isEnd' is set if (isEnd == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'isEnd' when calling processS3File"); } // verify the required parameter 'fileName' is set if (fileName == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'fileName' when calling processS3File"); } // verify the required parameter 'uploadedPath' is set if (uploadedPath == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'uploadedPath' when calling processS3File"); } String path = UriComponentsBuilder.fromPath("/api/v1/katalon/test-reports").build().toUriString(); final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap formParams = new LinkedMultiValueMap(); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "projectId", projectId)); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "batch", batch)); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "folderPath", folderPath)); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "isEnd", isEnd)); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "fileName", fileName)); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "uploadedPath", uploadedPath)); final String[] accepts = { "*/*" }; final List accept = apiClient.selectHeaderAccept(accepts); final String[] contentTypes = { }; final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); String[] authNames = new String[] { "basicScheme" }; ParameterizedTypeReference> returnType = new ParameterizedTypeReference>() {}; return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); } /** * * *

200 - OK * @param body The body parameter * @param projectId The projectId parameter * @return ExecutionResource * @throws RestClientException if an error occurs while attempting to invoke the API */ public ExecutionResource updateResult(TestRunResult body, Long projectId) throws RestClientException { Object postBody = body; // verify the required parameter 'body' is set if (body == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'body' when calling updateResult"); } // verify the required parameter 'projectId' is set if (projectId == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'projectId' when calling updateResult"); } String path = UriComponentsBuilder.fromPath("/api/v1/katalon/test-reports/update-result").build().toUriString(); final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap formParams = new LinkedMultiValueMap(); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "projectId", projectId)); final String[] accepts = { "*/*" }; final List accept = apiClient.selectHeaderAccept(accepts); final String[] contentTypes = { "application/json" }; final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); String[] authNames = new String[] { "basicScheme" }; ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); } /** * Uploads and processes the JUnit reports to an Execution. * *

204 - No Content * @param projectId The projectId parameter * @param batch The batch parameter * @param folderPath The folderPath parameter * @param isEnd The isEnd parameter * @param fileName The fileName parameter * @param uploadedPath The uploadedPath parameter * @param sessionId The sessionId parameter * @throws RestClientException if an error occurs while attempting to invoke the API */ public void uploadJUnitReports(String projectId, String batch, String folderPath, String isEnd, String fileName, String uploadedPath, String sessionId) throws RestClientException { Object postBody = null; // verify the required parameter 'projectId' is set if (projectId == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'projectId' when calling uploadJUnitReports"); } // verify the required parameter 'batch' is set if (batch == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'batch' when calling uploadJUnitReports"); } // verify the required parameter 'folderPath' is set if (folderPath == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'folderPath' when calling uploadJUnitReports"); } // verify the required parameter 'isEnd' is set if (isEnd == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'isEnd' when calling uploadJUnitReports"); } // verify the required parameter 'fileName' is set if (fileName == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'fileName' when calling uploadJUnitReports"); } // verify the required parameter 'uploadedPath' is set if (uploadedPath == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'uploadedPath' when calling uploadJUnitReports"); } String path = UriComponentsBuilder.fromPath("/api/v1/junit/test-reports").build().toUriString(); final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap formParams = new LinkedMultiValueMap(); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "projectId", projectId)); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "batch", batch)); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "folderPath", folderPath)); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "isEnd", isEnd)); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "fileName", fileName)); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "uploadedPath", uploadedPath)); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "sessionId", sessionId)); final String[] accepts = { }; final List accept = apiClient.selectHeaderAccept(accepts); final String[] contentTypes = { }; final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); String[] authNames = new String[] { "basicScheme" }; ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); } /** * Uploads and processes the TestNG reports to an execution. * *

204 - No Content * @param executionId The executionId parameter * @param projectId The projectId parameter * @param batch The batch parameter * @param folderPath The folderPath parameter * @param isEnd The isEnd parameter * @param fileName The fileName parameter * @param uploadedPath The uploadedPath parameter * @throws RestClientException if an error occurs while attempting to invoke the API */ public void uploadTestNGReports(Long executionId, Long projectId, String batch, String folderPath, Boolean isEnd, String fileName, String uploadedPath) throws RestClientException { Object postBody = null; // verify the required parameter 'executionId' is set if (executionId == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'executionId' when calling uploadTestNGReports"); } // verify the required parameter 'projectId' is set if (projectId == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'projectId' when calling uploadTestNGReports"); } // verify the required parameter 'batch' is set if (batch == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'batch' when calling uploadTestNGReports"); } // verify the required parameter 'folderPath' is set if (folderPath == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'folderPath' when calling uploadTestNGReports"); } // verify the required parameter 'isEnd' is set if (isEnd == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'isEnd' when calling uploadTestNGReports"); } // verify the required parameter 'fileName' is set if (fileName == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'fileName' when calling uploadTestNGReports"); } // verify the required parameter 'uploadedPath' is set if (uploadedPath == null) { throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'uploadedPath' when calling uploadTestNGReports"); } String path = UriComponentsBuilder.fromPath("/api/v1/testng/test-reports").build().toUriString(); final MultiValueMap queryParams = new LinkedMultiValueMap(); final HttpHeaders headerParams = new HttpHeaders(); final MultiValueMap formParams = new LinkedMultiValueMap(); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "executionId", executionId)); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "projectId", projectId)); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "batch", batch)); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "folderPath", folderPath)); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "isEnd", isEnd)); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "fileName", fileName)); queryParams.putAll(apiClient.parameterToMultiValueMap(null, "uploadedPath", uploadedPath)); final String[] accepts = { }; final List accept = apiClient.selectHeaderAccept(accepts); final String[] contentTypes = { }; final MediaType contentType = apiClient.selectHeaderContentType(contentTypes); String[] authNames = new String[] { "basicScheme" }; ParameterizedTypeReference returnType = new ParameterizedTypeReference() {}; apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, formParams, accept, contentType, authNames, returnType); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy