Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Update WorkFlowStatusResponseDTO status type to WorkStatus
Browse files Browse the repository at this point in the history
Signed-off-by: Moti Asayag <[email protected]>
  • Loading branch information
masayag authored and openshift-merge-robot committed May 8, 2023
1 parent b16397f commit 797b799
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
3 changes: 2 additions & 1 deletion workflow-service/generated/openapi/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,8 @@
"type" : "object",
"properties" : {
"status" : {
"type" : "string"
"type" : "string",
"enum" : [ "FAILED", "COMPLETED", "IN_PROGRESS", "REJECTED", "PENDING" ]
},
"workFlowExecutionId" : {
"type" : "string",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.UUID;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.redhat.parodos.workflows.work.WorkStatus;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
Expand All @@ -41,7 +42,7 @@ public class WorkFlowStatusResponseDTO {

private String workFlowName;

private String status;
private WorkStatus status;

@JsonInclude(JsonInclude.Include.NON_NULL)
private List<WorkStatusResponseDTO> works;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public WorkFlowStatusResponseDTO getWorkFlowStatus(UUID workFlowExecutionId) {
.getWorkFlowAndWorksStatus(workFlowExecution, workFlowDefinition);

return WorkFlowStatusResponseDTO.builder().workFlowExecutionId(workFlowExecution.getId())
.workFlowName(workFlowDefinition.getName()).status(workFlowExecution.getStatus().name())
.workFlowName(workFlowDefinition.getName()).status(workFlowExecution.getStatus())
.works(workFlowWorksStatusResponseDTOs).build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public void testGetStatus() throws Exception {
String testWorkFlowTask1 = "testWorkFlowTask1";

WorkFlowStatusResponseDTO workFlowStatusResponseDTO = WorkFlowStatusResponseDTO.builder()
.workFlowExecutionId(mainWorkFlowExecutionId).status(WorkStatus.IN_PROGRESS.name())
.workFlowExecutionId(mainWorkFlowExecutionId).status(WorkStatus.IN_PROGRESS)
.workFlowName(testMainWorkFlow)
.works(List.of(
WorkStatusResponseDTO.builder().name(testSubWorkFlow1).status(WorkStatus.PENDING)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -556,28 +556,26 @@ void testGetWorkStatusWithValidData() {
assertNotNull(workFlowStatusResponseDTO);
assertEquals(workFlowExecution.getId(), workFlowStatusResponseDTO.getWorkFlowExecutionId());
assertEquals(workFlowStatusResponseDTO.getWorkFlowName(), workFlowDefinition.getName());
assertEquals(workFlowStatusResponseDTO.getStatus(), WorkStatus.IN_PROGRESS.name());
assertEquals(workFlowStatusResponseDTO.getStatus(), WorkStatus.IN_PROGRESS);
assertEquals(workFlowStatusResponseDTO.getWorks().size(), 2);

// subWorkflow1
assertEquals(workFlowStatusResponseDTO.getWorks().get(0).getType(), WorkType.WORKFLOW);
assertEquals(workFlowStatusResponseDTO.getWorks().get(0).getName(), subWorkFlow1Definition.getName());
assertEquals(workFlowStatusResponseDTO.getWorks().get(0).getStatus().name(), WorkStatus.PENDING.name());
assertEquals(workFlowStatusResponseDTO.getWorks().get(0).getStatus(), WorkStatus.PENDING);
assertEquals(workFlowStatusResponseDTO.getWorks().get(0).getWorks().size(), 1);

// subWorkflow1Task1
assertEquals(workFlowStatusResponseDTO.getWorks().get(0).getWorks().get(0).getType(), WorkType.TASK);
assertEquals(workFlowStatusResponseDTO.getWorks().get(0).getWorks().get(0).getName(),
subWorkFlow1Task1Definition.getName());
assertEquals(workFlowStatusResponseDTO.getWorks().get(0).getWorks().get(0).getStatus().name(),
WorkStatus.PENDING.name());
assertEquals(workFlowStatusResponseDTO.getWorks().get(0).getWorks().get(0).getStatus(), WorkStatus.PENDING);
assertNull(workFlowStatusResponseDTO.getWorks().get(0).getWorks().get(0).getWorks());

// workflowTask1
assertEquals(workFlowStatusResponseDTO.getWorks().get(1).getType(), WorkType.TASK);
assertEquals(workFlowStatusResponseDTO.getWorks().get(1).getName(), workFlowTask1Definition.getName());
assertEquals(workFlowStatusResponseDTO.getWorks().get(1).getStatus().name(),
WorkFlowTaskStatus.COMPLETED.name());
assertEquals(workFlowStatusResponseDTO.getWorks().get(1).getStatus(), WorkStatus.COMPLETED);
assertNull(workFlowStatusResponseDTO.getWorks().get(1).getWorks());
}

Expand Down Expand Up @@ -732,7 +730,7 @@ void testGetWorkFlowStatusWhenSubWorkflowNotExecutedWithValidData() {
assertNotNull(workFlowStatusResponseDTO);
assertEquals(workFlowExecution.getId(), workFlowStatusResponseDTO.getWorkFlowExecutionId());
assertEquals(workFlowStatusResponseDTO.getWorkFlowName(), workFlowDefinition.getName());
assertEquals(workFlowStatusResponseDTO.getStatus(), WorkStatus.IN_PROGRESS.name());
assertEquals(workFlowStatusResponseDTO.getStatus(), WorkStatus.IN_PROGRESS);
assertEquals(workFlowStatusResponseDTO.getWorks().size(), 2);

// sub workflow 1
Expand Down

0 comments on commit 797b799

Please sign in to comment.