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

[FLPATH-294] Return Checkers in WorkFlowDefinitions #463

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.function.Consumer;

import com.redhat.parodos.flows.common.WorkFlowTestBuilder;
Expand Down Expand Up @@ -79,12 +80,13 @@ private Consumer<WorkFlowDefinitionResponseDTO> getWorkFlowDefinitionResponseCon

assertNotNull(workFlowDefinition.getWorks());
assertEquals(1, workFlowDefinition.getWorks().size());
assertEquals("notificationTask", workFlowDefinition.getWorks().get(0).getName());
assertEquals(WorkDefinitionResponseDTO.WorkTypeEnum.TASK,
workFlowDefinition.getWorks().get(0).getWorkType());
assertTrue(CollectionUtils.isEmpty(workFlowDefinition.getWorks().get(0).getWorks()));
assertNull(workFlowDefinition.getWorks().get(0).getProcessingType());
assertNotNull(workFlowDefinition.getWorks().get(0).getParameters());
Optional<WorkDefinitionResponseDTO> firstWork = workFlowDefinition.getWorks().stream().findFirst();
assertTrue(firstWork.isPresent());
assertEquals("notificationTask", firstWork.get().getName());
assertEquals(WorkDefinitionResponseDTO.WorkTypeEnum.TASK, firstWork.get().getWorkType());
assertTrue(CollectionUtils.isEmpty(firstWork.get().getWorks()));
assertNull(firstWork.get().getProcessingType());
assertNotNull(firstWork.get().getParameters());
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,19 +90,18 @@ private static Consumer<WorkFlowDefinitionResponseDTO> getWorkFlowDefinitionResp

assertNotNull(workFlowDefinition.getWorks());
assertEquals(2, workFlowDefinition.getWorks().size());
assertEquals("restCallTask", workFlowDefinition.getWorks().get(0).getName());
assertEquals(WorkDefinitionResponseDTO.WorkTypeEnum.TASK,
workFlowDefinition.getWorks().get(0).getWorkType());
assertTrue(CollectionUtils.isEmpty(workFlowDefinition.getWorks().get(0).getWorks()));
assertNull(workFlowDefinition.getWorks().get(0).getProcessingType());
assertNotNull(workFlowDefinition.getWorks().get(0).getParameters());

assertEquals("loggingTask", workFlowDefinition.getWorks().get(1).getName());
assertEquals(WorkDefinitionResponseDTO.WorkTypeEnum.TASK,
workFlowDefinition.getWorks().get(1).getWorkType());
assertTrue(CollectionUtils.isEmpty(workFlowDefinition.getWorks().get(1).getWorks()));
assertNull(workFlowDefinition.getWorks().get(1).getProcessingType());
assertNotNull(workFlowDefinition.getWorks().get(1).getParameters());
List<WorkDefinitionResponseDTO> works = workFlowDefinition.getWorks().stream().toList();
assertEquals("restCallTask", works.get(0).getName());
assertEquals(WorkDefinitionResponseDTO.WorkTypeEnum.TASK, works.get(0).getWorkType());
assertTrue(CollectionUtils.isEmpty(works.get(0).getWorks()));
assertNull(works.get(0).getProcessingType());
assertNotNull(works.get(0).getParameters());

assertEquals("loggingTask", works.get(1).getName());
assertEquals(WorkDefinitionResponseDTO.WorkTypeEnum.TASK, works.get(1).getWorkType());
assertTrue(CollectionUtils.isEmpty(works.get(1).getWorks()));
assertNull(works.get(1).getProcessingType());
assertNotNull(works.get(1).getParameters());
};
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.redhat.parodos.flows.negative;

import java.util.List;
import java.util.function.Consumer;

import com.redhat.parodos.flows.common.WorkFlowTestBuilder;
Expand Down Expand Up @@ -86,13 +87,13 @@ private static Consumer<WorkFlowDefinitionResponseDTO> getWorkFlowDefinitionResp

assertThat(workFlowDefinition.getWorks()).isNotNull();
assertThat(workFlowDefinition.getWorks()).hasSize(2);
assertThat(workFlowDefinition.getWorks().get(1).getName()).isEqualTo("doNothingAgainWorkFlowTask");
assertThat(workFlowDefinition.getWorks().get(1).getWorkType())
.isEqualTo(WorkDefinitionResponseDTO.WorkTypeEnum.TASK);
assertThat(workFlowDefinition.getWorks().get(1).getWorks()).isNullOrEmpty();
assertThat(workFlowDefinition.getWorks().get(1).getProcessingType()).isNull();
assertThat(workFlowDefinition.getWorks().get(1).getParameters()).isNotNull();
assertThat(workFlowDefinition.getWorks().get(0).getName()).isEqualTo("failedWithAlertMessageWorkFlowTask");
List<WorkDefinitionResponseDTO> works = workFlowDefinition.getWorks().stream().toList();
assertThat(works.get(1).getName()).isEqualTo("doNothingAgainWorkFlowTask");
assertThat(works.get(1).getWorkType()).isEqualTo(WorkDefinitionResponseDTO.WorkTypeEnum.TASK);
assertThat(works.get(1).getWorks()).isNullOrEmpty();
assertThat(works.get(1).getProcessingType()).isNull();
assertThat(works.get(1).getParameters()).isNotNull();
assertThat(works.get(0).getName()).isEqualTo("failedWithAlertMessageWorkFlowTask");
};
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.redhat.parodos.flows.negative;

import java.util.List;
import java.util.function.Consumer;

import com.redhat.parodos.flows.common.WorkFlowTestBuilder;
Expand Down Expand Up @@ -86,13 +87,13 @@ private static Consumer<WorkFlowDefinitionResponseDTO> getWorkFlowDefinitionResp

assertThat(workFlowDefinition.getWorks()).isNotNull();
assertThat(workFlowDefinition.getWorks()).hasSize(2);
assertThat(workFlowDefinition.getWorks().get(1).getName()).isEqualTo("doNothingWorkFlowTask");
assertThat(workFlowDefinition.getWorks().get(1).getWorkType())
.isEqualTo(WorkDefinitionResponseDTO.WorkTypeEnum.TASK);
assertThat(workFlowDefinition.getWorks().get(1).getWorks()).isNullOrEmpty();
assertThat(workFlowDefinition.getWorks().get(1).getProcessingType()).isNull();
assertThat(workFlowDefinition.getWorks().get(1).getParameters()).isNotNull();
assertThat(workFlowDefinition.getWorks().get(0).getName()).isEqualTo("pendingWithAlertMessageWorkFlowTask");
List<WorkDefinitionResponseDTO> works = workFlowDefinition.getWorks().stream().toList();
assertThat(works.get(1).getName()).isEqualTo("doNothingWorkFlowTask");
assertThat(works.get(1).getWorkType()).isEqualTo(WorkDefinitionResponseDTO.WorkTypeEnum.TASK);
assertThat(works.get(1).getWorks()).isNullOrEmpty();
assertThat(works.get(1).getProcessingType()).isNull();
assertThat(works.get(1).getParameters()).isNotNull();
assertThat(works.get(0).getName()).isEqualTo("pendingWithAlertMessageWorkFlowTask");
};
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.redhat.parodos.flows.negative;

import java.util.Optional;
import java.util.function.Consumer;

import com.redhat.parodos.flows.common.WorkFlowTestBuilder;
Expand All @@ -21,6 +22,7 @@
import org.junit.Test;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertTrue;

@Slf4j
public class SequentialFailedWithExceptionWorkFlowTest {
Expand Down Expand Up @@ -77,12 +79,13 @@ private static Consumer<WorkFlowDefinitionResponseDTO> getWorkFlowDefinitionResp

assertThat(workFlowDefinition.getWorks()).isNotNull();
assertThat(workFlowDefinition.getWorks()).hasSize(1);
assertThat(workFlowDefinition.getWorks().get(0).getName()).isEqualTo("failedWithExceptionWorkFlowTask");
assertThat(workFlowDefinition.getWorks().get(0).getWorkType())
.isEqualTo(WorkDefinitionResponseDTO.WorkTypeEnum.TASK);
assertThat(workFlowDefinition.getWorks().get(0).getWorks()).isNullOrEmpty();
assertThat(workFlowDefinition.getWorks().get(0).getProcessingType()).isNull();
assertThat(workFlowDefinition.getWorks().get(0).getParameters()).isNotNull();
Optional<WorkDefinitionResponseDTO> firstWork = workFlowDefinition.getWorks().stream().findFirst();
assertTrue(firstWork.isPresent());
assertThat(firstWork.get().getName()).isEqualTo("failedWithExceptionWorkFlowTask");
assertThat(firstWork.get().getWorkType()).isEqualTo(WorkDefinitionResponseDTO.WorkTypeEnum.TASK);
assertThat(firstWork.get().getWorks()).isNullOrEmpty();
assertThat(firstWork.get().getProcessingType()).isNull();
assertThat(firstWork.get().getParameters()).isNotNull();
};
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.redhat.parodos.flows.negative;

import java.util.Optional;
import java.util.function.Consumer;

import com.redhat.parodos.flows.common.WorkFlowTestBuilder;
Expand All @@ -21,6 +22,7 @@
import org.junit.Test;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertTrue;

@Slf4j
public class SequentialFailedWorkFlowTest {
Expand Down Expand Up @@ -74,12 +76,13 @@ private static Consumer<WorkFlowDefinitionResponseDTO> getWorkFlowDefinitionResp

assertThat(workFlowDefinition.getWorks()).isNotNull();
assertThat(workFlowDefinition.getWorks()).hasSize(1);
assertThat(workFlowDefinition.getWorks().get(0).getName()).isEqualTo("failedWorkFlowTask");
assertThat(workFlowDefinition.getWorks().get(0).getWorkType())
.isEqualTo(WorkDefinitionResponseDTO.WorkTypeEnum.TASK);
assertThat(workFlowDefinition.getWorks().get(0).getWorks()).isNullOrEmpty();
assertThat(workFlowDefinition.getWorks().get(0).getProcessingType()).isNull();
assertThat(workFlowDefinition.getWorks().get(0).getParameters()).isNotNull();
Optional<WorkDefinitionResponseDTO> firstWork = workFlowDefinition.getWorks().stream().findFirst();
assertTrue(firstWork.isPresent());
assertThat(firstWork.get().getName()).isEqualTo("failedWorkFlowTask");
assertThat(firstWork.get().getWorkType()).isEqualTo(WorkDefinitionResponseDTO.WorkTypeEnum.TASK);
assertThat(firstWork.get().getWorks()).isNullOrEmpty();
assertThat(firstWork.get().getProcessingType()).isNull();
assertThat(firstWork.get().getParameters()).isNotNull();
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
*/
public enum WorkType {

TASK, WORKFLOW
TASK, WORKFLOW, CHECKER

}
23 changes: 21 additions & 2 deletions workflow-service-sdk/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1242,10 +1242,12 @@ components:
type: object
WorkDefinitionResponseDTO:
example:
cronExpression: cronExpression
outputs:
- EXCEPTION
- EXCEPTION
processingType: SEQUENTIAL
workFlowCheckerMappingDefinitionId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
works:
- null
- null
Expand All @@ -1259,6 +1261,8 @@ components:
properties:
author:
type: string
cronExpression:
type: string
id:
format: uuid
type: string
Expand All @@ -1285,15 +1289,20 @@ components:
- PARALLEL
- OTHER
type: string
workFlowCheckerMappingDefinitionId:
format: uuid
type: string
workType:
enum:
- TASK
- WORKFLOW
- CHECKER
type: string
works:
items:
$ref: '#/components/schemas/WorkDefinitionResponseDTO'
type: array
uniqueItems: true
type: object
WorkFlowCheckerTaskRequestDTO:
example:
Expand Down Expand Up @@ -1415,12 +1424,15 @@ components:
type: object
WorkFlowDefinitionResponseDTO:
example:
cronExpression: cronExpression
processingType: SEQUENTIAL
works:
- outputs:
- cronExpression: cronExpression
outputs:
- EXCEPTION
- EXCEPTION
processingType: SEQUENTIAL
workFlowCheckerMappingDefinitionId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
works:
- null
- null
Expand All @@ -1431,10 +1443,12 @@ components:
parameters:
key:
key: "{}"
- outputs:
- cronExpression: cronExpression
outputs:
- EXCEPTION
- EXCEPTION
processingType: SEQUENTIAL
workFlowCheckerMappingDefinitionId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
works:
- null
- null
Expand Down Expand Up @@ -1463,6 +1477,8 @@ components:
createDate:
format: date-time
type: string
cronExpression:
type: string
fallbackWorkflow:
type: string
id:
Expand Down Expand Up @@ -1498,6 +1514,7 @@ components:
items:
$ref: '#/components/schemas/WorkDefinitionResponseDTO'
type: array
uniqueItems: true
type: object
WorkFlowExecutionResponseDTO:
example:
Expand Down Expand Up @@ -1880,6 +1897,7 @@ components:
enum:
- TASK
- WORKFLOW
- CHECKER
type: string
workName:
type: string
Expand Down Expand Up @@ -1917,6 +1935,7 @@ components:
enum:
- TASK
- WORKFLOW
- CHECKER
type: string
works:
items:
Expand Down
5 changes: 4 additions & 1 deletion workflow-service-sdk/docs/WorkDefinitionResponseDTO.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**author** | **String** | | [optional] |
|**cronExpression** | **String** | | [optional] |
|**id** | **UUID** | | [optional] |
|**name** | **String** | | [optional] |
|**outputs** | [**List&lt;OutputsEnum&gt;**](#List&lt;OutputsEnum&gt;) | | [optional] |
|**parameters** | **Map&lt;String, Map&lt;String, Object&gt;&gt;** | | [optional] |
|**processingType** | [**ProcessingTypeEnum**](#ProcessingTypeEnum) | | [optional] |
|**workFlowCheckerMappingDefinitionId** | **UUID** | | [optional] |
|**workType** | [**WorkTypeEnum**](#WorkTypeEnum) | | [optional] |
|**works** | [**List&lt;WorkDefinitionResponseDTO&gt;**](WorkDefinitionResponseDTO.md) | | [optional] |
|**works** | [**Set&lt;WorkDefinitionResponseDTO&gt;**](WorkDefinitionResponseDTO.md) | | [optional] |



Expand Down Expand Up @@ -45,6 +47,7 @@
|---- | -----|
| TASK | &quot;TASK&quot; |
| WORKFLOW | &quot;WORKFLOW&quot; |
| CHECKER | &quot;CHECKER&quot; |



3 changes: 2 additions & 1 deletion workflow-service-sdk/docs/WorkFlowDefinitionResponseDTO.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
|------------ | ------------- | ------------- | -------------|
|**author** | **String** | | [optional] |
|**createDate** | **Date** | | [optional] |
|**cronExpression** | **String** | | [optional] |
|**fallbackWorkflow** | **String** | | [optional] |
|**id** | **UUID** | | [optional] |
|**modifyDate** | **Date** | | [optional] |
Expand All @@ -17,7 +18,7 @@
|**processingType** | [**ProcessingTypeEnum**](#ProcessingTypeEnum) | | [optional] |
|**properties** | [**WorkFlowPropertiesDefinitionDTO**](WorkFlowPropertiesDefinitionDTO.md) | | [optional] |
|**type** | [**TypeEnum**](#TypeEnum) | | [optional] |
|**works** | [**List&lt;WorkDefinitionResponseDTO&gt;**](WorkDefinitionResponseDTO.md) | | [optional] |
|**works** | [**Set&lt;WorkDefinitionResponseDTO&gt;**](WorkDefinitionResponseDTO.md) | | [optional] |



Expand Down
1 change: 1 addition & 0 deletions workflow-service-sdk/docs/WorkRequestDTO.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
|---- | -----|
| TASK | &quot;TASK&quot; |
| WORKFLOW | &quot;WORKFLOW&quot; |
| CHECKER | &quot;CHECKER&quot; |



1 change: 1 addition & 0 deletions workflow-service-sdk/docs/WorkStatusResponseDTO.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
|---- | -----|
| TASK | &quot;TASK&quot; |
| WORKFLOW | &quot;WORKFLOW&quot; |
| CHECKER | &quot;CHECKER&quot; |



Loading
Loading