Class WorkFlowServiceUtils

java.lang.Object
com.redhat.parodos.sdkutils.WorkFlowServiceUtils

public abstract class WorkFlowServiceUtils extends Object
A utility class to ease the writing of new examples.
  • Method Details

    • getParodosAPiClient

      public static ApiClient getParodosAPiClient() throws ApiException, org.springframework.core.env.MissingRequiredPropertiesException
      Creates and configures the APIClient using the configuration properties available in environment variables.
      Returns:
      the ApiClient
      Throws:
      ApiException
      org.springframework.core.env.MissingRequiredPropertiesException
    • waitProjectStart

      public static void waitProjectStart(ProjectApi projectApi)
      Invokes @see com.redhat.parodos.sdk.api.ProjectAPI#getProjectsAsync(ApiCallback<List>) and retries for 60 seconds.
      Parameters:
      projectApi - the Project API
    • waitWorkflowStatusAsync

      public static WorkFlowStatusResponseDTO waitWorkflowStatusAsync(WorkflowApi workflowApi, UUID workFlowExecutionId)
      Invokes @see com.redhat.parodos.sdk.api.WorkflowApi#getStatusAsync(String, ApiCallback) and retries for 60 seconds.
      Parameters:
      workflowApi - the WorkflowAPI
      workFlowExecutionId - the workflow execution ID to monitor, as {String}
      Returns:
      the workflow status if it's equal to @see com.redhat.parodos.workflows.work.WorkStatus#COMPLETED
    • waitWorkflowStatusAsync

      public static WorkFlowStatusResponseDTO waitWorkflowStatusAsync(WorkflowApi workflowApi, UUID workFlowExecutionId, WorkFlowStatusResponseDTO.StatusEnum expectedStatus)
      Invokes @see com.redhat.parodos.sdk.api.WorkflowApi#getStatusAsync(String, ApiCallback) and retries for 60 seconds.
      Parameters:
      workflowApi - the WorkflowAPI
      workFlowExecutionId - the workflow execution ID to monitor, as {String}
      expectedStatus - the expectedStatus to wait for
      Returns:
      the workflow expectedStatus if it's equal to @see com.redhat.parodos.workflows.work.WorkStatus#COMPLETED
    • getProjectByNameAndDescription

      @Nullable public static ProjectResponseDTO getProjectByNameAndDescription(List<ProjectResponseDTO> projects, String projectName, String projectDescription)
      Finds a project with @see #projectName and @see #projectDescription
      Parameters:
      projects - List to of project to analyze
      projectName - the {String} project name to find
      projectDescription - the {String} project decription to find
      Returns:
      the {ProjectResponse} if the project exists, {null} otherwise
    • getProjectAsync

      public static ProjectResponseDTO getProjectAsync(ApiClient apiClient, String projectName, String projectDescription) throws ApiException
      Checks if a project with {projectName} and {projectDescription} exists. Creates a new project, if it doesn't exist and asserts that it has been successfully created.

      Returns the {ProjectAPI} response for the project with {projectName} and {projectDescription}.

      Parameters:
      apiClient - the API client
      projectName - the project name
      projectDescription - the project description
      Returns:
      The ProjectApiResponse
      Throws:
      ApiException - If the API methods invocations fail