From 390e10efacd9996deb59bcaae798488e30b40c26 Mon Sep 17 00:00:00 2001 From: Moti Asayag Date: Mon, 8 May 2023 09:03:43 +0300 Subject: [PATCH] Add generated SDK files Signed-off-by: Moti Asayag --- workflow-service-sdk/api/openapi.yaml | 8 +- .../docs/GetStatusByProjectId200Response.md | 14 ++- .../docs/WorkFlowStatusResponseDTO.md | 14 ++- .../GetStatusByProjectId200Response.java | 66 +++++++++++++- .../sdk/model/WorkFlowStatusResponseDTO.java | 66 +++++++++++++- .../parodos/sdk/api/WorkflowApiTest.java | 83 ----------------- .../sdk/model/ProjectResponseDTOTest.java | 88 ------------------- .../model/WorkFlowContextResponseDTOTest.java | 48 ---------- 8 files changed, 157 insertions(+), 230 deletions(-) delete mode 100644 workflow-service-sdk/src/test/java/com/redhat/parodos/sdk/api/WorkflowApiTest.java delete mode 100644 workflow-service-sdk/src/test/java/com/redhat/parodos/sdk/model/ProjectResponseDTOTest.java delete mode 100644 workflow-service-sdk/src/test/java/com/redhat/parodos/sdk/model/WorkFlowContextResponseDTOTest.java diff --git a/workflow-service-sdk/api/openapi.yaml b/workflow-service-sdk/api/openapi.yaml index 7402802f5..4b3ea1914 100644 --- a/workflow-service-sdk/api/openapi.yaml +++ b/workflow-service-sdk/api/openapi.yaml @@ -1075,9 +1075,15 @@ components: type: TASK status: FAILED workFlowExecutionId: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 - status: status + status: FAILED properties: status: + enum: + - FAILED + - COMPLETED + - IN_PROGRESS + - REJECTED + - PENDING type: string workFlowExecutionId: format: uuid diff --git a/workflow-service-sdk/docs/GetStatusByProjectId200Response.md b/workflow-service-sdk/docs/GetStatusByProjectId200Response.md index 314714cb5..1df9cb3b2 100644 --- a/workflow-service-sdk/docs/GetStatusByProjectId200Response.md +++ b/workflow-service-sdk/docs/GetStatusByProjectId200Response.md @@ -7,10 +7,22 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**status** | **String** | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | | [optional] | |**workFlowExecutionId** | **UUID** | | [optional] | |**workFlowName** | **String** | | [optional] | |**works** | [**List<WorkStatusResponseDTO>**](WorkStatusResponseDTO.md) | | [optional] | +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| FAILED | "FAILED" | +| COMPLETED | "COMPLETED" | +| IN_PROGRESS | "IN_PROGRESS" | +| REJECTED | "REJECTED" | +| PENDING | "PENDING" | + + + diff --git a/workflow-service-sdk/docs/WorkFlowStatusResponseDTO.md b/workflow-service-sdk/docs/WorkFlowStatusResponseDTO.md index 69ec476e5..9cb5f3ca9 100644 --- a/workflow-service-sdk/docs/WorkFlowStatusResponseDTO.md +++ b/workflow-service-sdk/docs/WorkFlowStatusResponseDTO.md @@ -7,10 +7,22 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| -|**status** | **String** | | [optional] | +|**status** | [**StatusEnum**](#StatusEnum) | | [optional] | |**workFlowExecutionId** | **UUID** | | [optional] | |**workFlowName** | **String** | | [optional] | |**works** | [**List<WorkStatusResponseDTO>**](WorkStatusResponseDTO.md) | | [optional] | +## Enum: StatusEnum + +| Name | Value | +|---- | -----| +| FAILED | "FAILED" | +| COMPLETED | "COMPLETED" | +| IN_PROGRESS | "IN_PROGRESS" | +| REJECTED | "REJECTED" | +| PENDING | "PENDING" | + + + diff --git a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/model/GetStatusByProjectId200Response.java b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/model/GetStatusByProjectId200Response.java index eb688c9b2..5003351bf 100644 --- a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/model/GetStatusByProjectId200Response.java +++ b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/model/GetStatusByProjectId200Response.java @@ -27,6 +27,7 @@ import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; @@ -39,10 +40,67 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class GetStatusByProjectId200Response { + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + + FAILED("FAILED"), + + COMPLETED("COMPLETED"), + + IN_PROGRESS("IN_PROGRESS"), + + REJECTED("REJECTED"), + + PENDING("PENDING"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + + } + + } + public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) - private String status; + private StatusEnum status; public static final String SERIALIZED_NAME_WORK_FLOW_EXECUTION_ID = "workFlowExecutionId"; @@ -62,7 +120,7 @@ public class GetStatusByProjectId200Response { public GetStatusByProjectId200Response() { } - public GetStatusByProjectId200Response status(String status) { + public GetStatusByProjectId200Response status(StatusEnum status) { this.status = status; return this; @@ -74,11 +132,11 @@ public GetStatusByProjectId200Response status(String status) { **/ @javax.annotation.Nullable - public String getStatus() { + public StatusEnum getStatus() { return status; } - public void setStatus(String status) { + public void setStatus(StatusEnum status) { this.status = status; } diff --git a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/model/WorkFlowStatusResponseDTO.java b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/model/WorkFlowStatusResponseDTO.java index 10a384d57..034b253fe 100644 --- a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/model/WorkFlowStatusResponseDTO.java +++ b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/model/WorkFlowStatusResponseDTO.java @@ -27,6 +27,7 @@ import com.google.gson.JsonObject; import com.google.gson.TypeAdapter; import com.google.gson.TypeAdapterFactory; +import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonReader; @@ -39,10 +40,67 @@ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen") public class WorkFlowStatusResponseDTO { + /** + * Gets or Sets status + */ + @JsonAdapter(StatusEnum.Adapter.class) + public enum StatusEnum { + + FAILED("FAILED"), + + COMPLETED("COMPLETED"), + + IN_PROGRESS("IN_PROGRESS"), + + REJECTED("REJECTED"), + + PENDING("PENDING"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static StatusEnum fromValue(String value) { + for (StatusEnum b : StatusEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + + @Override + public void write(final JsonWriter jsonWriter, final StatusEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public StatusEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return StatusEnum.fromValue(value); + } + + } + + } + public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) - private String status; + private StatusEnum status; public static final String SERIALIZED_NAME_WORK_FLOW_EXECUTION_ID = "workFlowExecutionId"; @@ -62,7 +120,7 @@ public class WorkFlowStatusResponseDTO { public WorkFlowStatusResponseDTO() { } - public WorkFlowStatusResponseDTO status(String status) { + public WorkFlowStatusResponseDTO status(StatusEnum status) { this.status = status; return this; @@ -74,11 +132,11 @@ public WorkFlowStatusResponseDTO status(String status) { **/ @javax.annotation.Nullable - public String getStatus() { + public StatusEnum getStatus() { return status; } - public void setStatus(String status) { + public void setStatus(StatusEnum status) { this.status = status; } diff --git a/workflow-service-sdk/src/test/java/com/redhat/parodos/sdk/api/WorkflowApiTest.java b/workflow-service-sdk/src/test/java/com/redhat/parodos/sdk/api/WorkflowApiTest.java deleted file mode 100644 index 6e98509f6..000000000 --- a/workflow-service-sdk/src/test/java/com/redhat/parodos/sdk/api/WorkflowApiTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Parodos Workflow Service API - * This is the API documentation for the Parodos Workflow Service. It provides operations to execute assessments to determine infrastructure options (tooling + environments). Also executes infrastructure task workflows to call downstream systems to stand-up an infrastructure option. - * - * The version of the OpenAPI document: v1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.redhat.parodos.sdk.api; - -import java.util.List; -import java.util.UUID; - -import com.redhat.parodos.sdk.invoker.ApiException; -import com.redhat.parodos.sdk.model.WorkFlowCheckerTaskRequestDTO; -import com.redhat.parodos.sdk.model.WorkFlowContextResponseDTO; -import com.redhat.parodos.sdk.model.WorkFlowRequestDTO; -import com.redhat.parodos.sdk.model.WorkFlowResponseDTO; -import com.redhat.parodos.sdk.model.WorkFlowStatusResponseDTO; -import org.junit.Ignore; -import org.junit.Test; - -/** - * API tests for WorkflowApi - */ -@Ignore -public class WorkflowApiTest { - - private final WorkflowApi api = new WorkflowApi(); - - /** - * Executes a workflow - * @throws ApiException if the Api call fails - */ - @Test - public void executeTest() throws ApiException { - WorkFlowRequestDTO workFlowRequestDTO = null; - WorkFlowResponseDTO response = api.execute(workFlowRequestDTO); - // TODO: test validations - } - - /** - * Returns a workflow status - * @throws ApiException if the Api call fails - */ - @Test - public void getStatusTest() throws ApiException { - UUID workFlowExecutionId = null; - WorkFlowStatusResponseDTO response = api.getStatus(workFlowExecutionId); - // TODO: test validations - } - - /** - * Returns workflow context parameters - * @throws ApiException if the Api call fails - */ - @Test - public void getWorkflowParametersTest() throws ApiException { - UUID workFlowExecutionId = null; - List param = null; - WorkFlowContextResponseDTO response = api.getWorkflowParameters(workFlowExecutionId, param); - // TODO: test validations - } - - /** - * Updates a workflow checker task status - * @throws ApiException if the Api call fails - */ - @Test - public void updateWorkFlowCheckerTaskStatusTest() throws ApiException { - UUID workFlowExecutionId = null; - String workFlowCheckerTaskName = null; - WorkFlowCheckerTaskRequestDTO workFlowCheckerTaskRequestDTO = null; - String response = api.updateWorkFlowCheckerTaskStatus(workFlowExecutionId, workFlowCheckerTaskName, - workFlowCheckerTaskRequestDTO); - // TODO: test validations - } - -} diff --git a/workflow-service-sdk/src/test/java/com/redhat/parodos/sdk/model/ProjectResponseDTOTest.java b/workflow-service-sdk/src/test/java/com/redhat/parodos/sdk/model/ProjectResponseDTOTest.java deleted file mode 100644 index c3be48bf5..000000000 --- a/workflow-service-sdk/src/test/java/com/redhat/parodos/sdk/model/ProjectResponseDTOTest.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Parodos Workflow Service API - * This is the API documentation for the Parodos Workflow Service. It provides operations to execute assessments to determine infrastructure options (tooling + environments). Also executes infrastructure task workflows to call downstream systems to stand-up an infrastructure option. - * - * The version of the OpenAPI document: v1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.redhat.parodos.sdk.model; - -import org.junit.Test; - -/** - * Model tests for ProjectResponseDTO - */ -public class ProjectResponseDTOTest { - - private final ProjectResponseDTO model = new ProjectResponseDTO(); - - /** - * Model tests for ProjectResponseDTO - */ - @Test - public void testProjectResponseDTO() { - // TODO: test ProjectResponseDTO - } - - /** - * Test the property 'createDate' - */ - @Test - public void createDateTest() { - // TODO: test createDate - } - - /** - * Test the property 'description' - */ - @Test - public void descriptionTest() { - // TODO: test description - } - - /** - * Test the property 'id' - */ - @Test - public void idTest() { - // TODO: test id - } - - /** - * Test the property 'modifyDate' - */ - @Test - public void modifyDateTest() { - // TODO: test modifyDate - } - - /** - * Test the property 'name' - */ - @Test - public void nameTest() { - // TODO: test name - } - - /** - * Test the property 'status' - */ - @Test - public void statusTest() { - // TODO: test status - } - - /** - * Test the property 'username' - */ - @Test - public void usernameTest() { - // TODO: test username - } - -} diff --git a/workflow-service-sdk/src/test/java/com/redhat/parodos/sdk/model/WorkFlowContextResponseDTOTest.java b/workflow-service-sdk/src/test/java/com/redhat/parodos/sdk/model/WorkFlowContextResponseDTOTest.java deleted file mode 100644 index afee4a5ec..000000000 --- a/workflow-service-sdk/src/test/java/com/redhat/parodos/sdk/model/WorkFlowContextResponseDTOTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Parodos Workflow Service API - * This is the API documentation for the Parodos Workflow Service. It provides operations to execute assessments to determine infrastructure options (tooling + environments). Also executes infrastructure task workflows to call downstream systems to stand-up an infrastructure option. - * - * The version of the OpenAPI document: v1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.redhat.parodos.sdk.model; - -import org.junit.Test; - -/** - * Model tests for WorkFlowContextResponseDTO - */ -public class WorkFlowContextResponseDTOTest { - - private final WorkFlowContextResponseDTO model = new WorkFlowContextResponseDTO(); - - /** - * Model tests for WorkFlowContextResponseDTO - */ - @Test - public void testWorkFlowContextResponseDTO() { - // TODO: test WorkFlowContextResponseDTO - } - - /** - * Test the property 'workFlowExecutionId' - */ - @Test - public void workFlowExecutionIdTest() { - // TODO: test workFlowExecutionId - } - - /** - * Test the property 'workFlowOptions' - */ - @Test - public void workFlowOptionsTest() { - // TODO: test workFlowOptions - } - -}