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

Commit

Permalink
Return Checkers in WorkFlowDefinitions
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-farache committed Jun 30, 2023
1 parent 6a7a4e6 commit 62d27dc
Show file tree
Hide file tree
Showing 55 changed files with 304 additions and 278 deletions.
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

}
5 changes: 3 additions & 2 deletions workflow-service-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,11 @@ Class | Method | HTTP request | Description
- [WorkStatusResponseDTO](docs/WorkStatusResponseDTO.md)


<a id="documentation-for-authorization"></a>
## Documentation for Authorization

All endpoints do not require authorization.
Authentication schemes defined for the API:
Endpoints do not require authorization.


## Recommendation

Expand Down
8 changes: 8 additions & 0 deletions workflow-service-sdk/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1133,11 +1133,13 @@ components:
enum:
- TASK
- WORKFLOW
- CHECKER
type: string
works:
items:
$ref: '#/components/schemas/WorkDefinitionResponseDTO'
type: array
uniqueItems: true
type: object
WorkFlowCheckerTaskRequestDTO:
example:
Expand Down Expand Up @@ -1248,6 +1250,7 @@ components:
type: object
WorkFlowDefinitionResponseDTO:
example:
cronExpression: cronExpression
processingType: SEQUENTIAL
rollbackWorkflow: rollbackWorkflow
works:
Expand Down Expand Up @@ -1296,6 +1299,8 @@ components:
createDate:
format: date-time
type: string
cronExpression:
type: string
id:
format: uuid
type: string
Expand Down Expand Up @@ -1331,6 +1336,7 @@ components:
items:
$ref: '#/components/schemas/WorkDefinitionResponseDTO'
type: array
uniqueItems: true
type: object
WorkFlowExecutionResponseDTO:
example:
Expand Down Expand Up @@ -1670,6 +1676,7 @@ components:
enum:
- TASK
- WORKFLOW
- CHECKER
type: string
workName:
type: string
Expand Down Expand Up @@ -1703,6 +1710,7 @@ components:
enum:
- TASK
- WORKFLOW
- CHECKER
type: string
works:
items:
Expand Down
2 changes: 1 addition & 1 deletion workflow-service-sdk/docs/LoginApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ All URIs are relative to *http://localhost:8080*
| [**login**](LoginApi.md#login) | **GET** /api/v1/login | Login |


<a name="login"></a>
<a id="login"></a>
# **login**
> login()
Expand Down
4 changes: 2 additions & 2 deletions workflow-service-sdk/docs/ProjectAccessApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ All URIs are relative to *http://localhost:8080*
| [**updateProjectAccessStatus**](ProjectAccessApi.md#updateProjectAccessStatus) | **POST** /api/v1/projects/access/{id}/status | Update status of a specified project access request |


<a name="getProjectAccessStatus"></a>
<a id="getProjectAccessStatus"></a>
# **getProjectAccessStatus**
> AccessStatusResponseDTO getProjectAccessStatus(id)
Expand Down Expand Up @@ -72,7 +72,7 @@ No authorization required
| **404** | Not found | - |
| **409** | Conflict | - |

<a name="updateProjectAccessStatus"></a>
<a id="updateProjectAccessStatus"></a>
# **updateProjectAccessStatus**
> updateProjectAccessStatus(id, accessStatusRequestDTO)
Expand Down
12 changes: 6 additions & 6 deletions workflow-service-sdk/docs/ProjectApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ All URIs are relative to *http://localhost:8080*
| [**updateUserRolesToProject**](ProjectApi.md#updateUserRolesToProject) | **POST** /api/v1/projects/{id}/users | Update user roles in project |


<a name="createAccessRequestToProject"></a>
<a id="createAccessRequestToProject"></a>
# **createAccessRequestToProject**
> AccessResponseDTO createAccessRequestToProject(id, accessRequestDTO)
Expand Down Expand Up @@ -78,7 +78,7 @@ No authorization required
| **404** | Not found | - |
| **409** | Conflict | - |

<a name="createProject"></a>
<a id="createProject"></a>
# **createProject**
> ProjectResponseDTO createProject(projectRequestDTO)
Expand Down Expand Up @@ -142,7 +142,7 @@ No authorization required
| **404** | Not Found | - |
| **409** | Conflict | - |

<a name="getProjectById"></a>
<a id="getProjectById"></a>
# **getProjectById**
> ProjectResponseDTO getProjectById(id)
Expand Down Expand Up @@ -207,7 +207,7 @@ No authorization required
| **404** | Not found | - |
| **409** | Conflict | - |

<a name="getProjects"></a>
<a id="getProjects"></a>
# **getProjects**
> List&lt;ProjectResponseDTO&gt; getProjects()
Expand Down Expand Up @@ -269,7 +269,7 @@ No authorization required
| **404** | Not Found | - |
| **409** | Conflict | - |

<a name="removeUsersFromProject"></a>
<a id="removeUsersFromProject"></a>
# **removeUsersFromProject**
> ProjectUserRoleResponseDTO removeUsersFromProject(id, requestBody)
Expand Down Expand Up @@ -335,7 +335,7 @@ No authorization required
| **404** | Not found | - |
| **409** | Conflict | - |

<a name="updateUserRolesToProject"></a>
<a id="updateUserRolesToProject"></a>
# **updateUserRolesToProject**
> ProjectUserRoleResponseDTO updateUserRolesToProject(id, userRoleRequestDTO)
Expand Down
3 changes: 2 additions & 1 deletion workflow-service-sdk/docs/WorkDefinitionResponseDTO.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
|**parameters** | **Map&lt;String, Map&lt;String, Object&gt;&gt;** | | [optional] |
|**processingType** | [**ProcessingTypeEnum**](#ProcessingTypeEnum) | | [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 +45,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] |
|**id** | **UUID** | | [optional] |
|**modifyDate** | **Date** | | [optional] |
|**name** | **String** | | [optional] |
Expand All @@ -17,7 +18,7 @@
|**properties** | [**WorkFlowPropertiesDefinitionDTO**](WorkFlowPropertiesDefinitionDTO.md) | | [optional] |
|**rollbackWorkflow** | **String** | | [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 @@ -19,6 +19,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

0 comments on commit 62d27dc

Please sign in to comment.