From 97e4503b8895699c8f799e32e30711d58dccde7a Mon Sep 17 00:00:00 2001 From: Moti Asayag Date: Thu, 4 May 2023 13:32:40 +0300 Subject: [PATCH] Generate SDK files Signed-off-by: Moti Asayag --- .../examples/integration/KubeapiWorkFlow.java | 2 +- .../integration/PrebuiltWorkFlow.java | 6 +++--- .../examples/integration/SimpleWorkFlow.java | 9 +++++---- .../examples/integration/UseSDKExample.java | 19 +++++++++---------- workflow-service-sdk/api/openapi.yaml | 8 +++++--- .../docs/WorkDefinitionResponseDTO.md | 2 +- .../docs/WorkflowDefinitionApi.md | 4 ++-- .../sdk/api/WorkflowDefinitionApi.java | 11 ++++++----- .../sdk/model/WorkDefinitionResponseDTO.java | 9 +++++---- 9 files changed, 37 insertions(+), 33 deletions(-) diff --git a/workflow-examples/src/test/java/com/redhat/parodos/examples/integration/KubeapiWorkFlow.java b/workflow-examples/src/test/java/com/redhat/parodos/examples/integration/KubeapiWorkFlow.java index b801fd536..cd5866297 100644 --- a/workflow-examples/src/test/java/com/redhat/parodos/examples/integration/KubeapiWorkFlow.java +++ b/workflow-examples/src/test/java/com/redhat/parodos/examples/integration/KubeapiWorkFlow.java @@ -53,7 +53,7 @@ public void runFlow() { // GET WORKFLOW DEFINITION BY Id WorkFlowDefinitionResponseDTO simpleSequentialWorkFlowDefinition = workflowDefinitionApi - .getWorkFlowDefinitionById(simpleSequentialWorkFlowDefinitions.get(0).getId().toString()); + .getWorkFlowDefinitionById(simpleSequentialWorkFlowDefinitions.get(0).getId()); // EXECUTE WORKFLOW WorkflowApi workflowApi = new WorkflowApi(); diff --git a/workflow-examples/src/test/java/com/redhat/parodos/examples/integration/PrebuiltWorkFlow.java b/workflow-examples/src/test/java/com/redhat/parodos/examples/integration/PrebuiltWorkFlow.java index 7af09d312..0cc60a566 100644 --- a/workflow-examples/src/test/java/com/redhat/parodos/examples/integration/PrebuiltWorkFlow.java +++ b/workflow-examples/src/test/java/com/redhat/parodos/examples/integration/PrebuiltWorkFlow.java @@ -63,7 +63,7 @@ public void runPreBuiltWorkFlow() throws ApiException, InterruptedException { // GET WORKFLOW DEFINITION BY Id WorkFlowDefinitionResponseDTO prebuiltWorkFlowDefinition = workflowDefinitionApi - .getWorkFlowDefinitionById(prebuiltWorkFlowDefinitions.get(0).getId().toString()); + .getWorkFlowDefinitionById(prebuiltWorkFlowDefinitions.get(0).getId()); assertNotNull(prebuiltWorkFlowDefinition.getId()); assertEquals(workFlowName, prebuiltWorkFlowDefinition.getName()); @@ -72,7 +72,7 @@ public void runPreBuiltWorkFlow() throws ApiException, InterruptedException { assertEquals(WorkFlowType.INFRASTRUCTURE.toString(), prebuiltWorkFlowDefinition.getType()); assertNotNull(prebuiltWorkFlowDefinition.getWorks()); - assertTrue(prebuiltWorkFlowDefinition.getWorks().size() == 1); + assertEquals(1, prebuiltWorkFlowDefinition.getWorks().size()); assertEquals("notificationTask", prebuiltWorkFlowDefinition.getWorks().get(0).getName()); assertEquals(WorkType.TASK.toString(), prebuiltWorkFlowDefinition.getWorks().get(0).getWorkType()); assertTrue(CollectionUtils.isEmpty(prebuiltWorkFlowDefinition.getWorks().get(0).getWorks())); @@ -91,7 +91,7 @@ public void runPreBuiltWorkFlow() throws ApiException, InterruptedException { WorkFlowRequestDTO workFlowRequestDTO = new WorkFlowRequestDTO(); workFlowRequestDTO.setProjectId(testProject.getId()); workFlowRequestDTO.setWorkFlowName(workFlowName); - workFlowRequestDTO.setWorks(Arrays.asList(work1)); + workFlowRequestDTO.setWorks(List.of(work1)); WorkflowApi workflowApi = new WorkflowApi(apiClient); log.info("******** Running The PreBuilt Flow ********"); diff --git a/workflow-examples/src/test/java/com/redhat/parodos/examples/integration/SimpleWorkFlow.java b/workflow-examples/src/test/java/com/redhat/parodos/examples/integration/SimpleWorkFlow.java index b47ff2e80..90f3aa597 100644 --- a/workflow-examples/src/test/java/com/redhat/parodos/examples/integration/SimpleWorkFlow.java +++ b/workflow-examples/src/test/java/com/redhat/parodos/examples/integration/SimpleWorkFlow.java @@ -25,6 +25,7 @@ import java.io.IOException; import java.util.Arrays; +import java.util.Collections; import java.util.List; import static org.junit.Assert.assertEquals; @@ -65,7 +66,7 @@ public void runSimpleWorkFlow() throws ApiException, InterruptedException { // GET WORKFLOW DEFINITION BY Id WorkFlowDefinitionResponseDTO simpleSequentialWorkFlowDefinition = workflowDefinitionApi - .getWorkFlowDefinitionById(simpleSequentialWorkFlowDefinitions.get(0).getId().toString()); + .getWorkFlowDefinitionById(simpleSequentialWorkFlowDefinitions.get(0).getId()); assertNotNull(simpleSequentialWorkFlowDefinition.getId()); assertEquals("simpleSequentialWorkFlow" + WorkFlowConstants.INFRASTRUCTURE_WORKFLOW, @@ -75,7 +76,7 @@ public void runSimpleWorkFlow() throws ApiException, InterruptedException { assertEquals(WorkFlowType.INFRASTRUCTURE.toString(), simpleSequentialWorkFlowDefinition.getType()); assertNotNull(simpleSequentialWorkFlowDefinition.getWorks()); - assertTrue(simpleSequentialWorkFlowDefinition.getWorks().size() == 2); + assertEquals(2, simpleSequentialWorkFlowDefinition.getWorks().size()); assertEquals("restCallTask", simpleSequentialWorkFlowDefinition.getWorks().get(0).getName()); assertEquals(WorkType.TASK.toString(), simpleSequentialWorkFlowDefinition.getWorks().get(0).getWorkType()); assertTrue(CollectionUtils.isEmpty(simpleSequentialWorkFlowDefinition.getWorks().get(0).getWorks())); @@ -91,8 +92,8 @@ public void runSimpleWorkFlow() throws ApiException, InterruptedException { // Define WorkRequests WorkRequestDTO work1 = new WorkRequestDTO(); work1.setWorkName("restCallTask"); - work1.setArguments( - Arrays.asList(new ArgumentRequestDTO().key("url").value("http://localhost:8080/actuator/health"))); + work1.setArguments(Collections + .singletonList(new ArgumentRequestDTO().key("url").value("http://localhost:8080/actuator/health"))); WorkRequestDTO work2 = new WorkRequestDTO(); work2.setWorkName("loggingTask"); diff --git a/workflow-examples/src/test/java/com/redhat/parodos/examples/integration/UseSDKExample.java b/workflow-examples/src/test/java/com/redhat/parodos/examples/integration/UseSDKExample.java index 5fbca844e..2ac09b547 100644 --- a/workflow-examples/src/test/java/com/redhat/parodos/examples/integration/UseSDKExample.java +++ b/workflow-examples/src/test/java/com/redhat/parodos/examples/integration/UseSDKExample.java @@ -1,5 +1,13 @@ package com.redhat.parodos.examples.integration; +import java.util.Arrays; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + import com.redhat.parodos.sdk.api.ProjectApi; import com.redhat.parodos.sdk.api.WorkflowApi; import com.redhat.parodos.sdk.api.WorkflowDefinitionApi; @@ -14,20 +22,11 @@ import com.redhat.parodos.sdk.model.WorkFlowResponseDTO; import com.redhat.parodos.sdk.model.WorkRequestDTO; import com.redhat.parodos.workflow.consts.WorkFlowConstants; -import com.redhat.parodos.workflow.enums.WorkFlowProcessingType; import com.redhat.parodos.workflow.enums.WorkFlowType; import com.redhat.parodos.workflow.utils.CredUtils; import org.junit.Test; import org.springframework.http.HttpHeaders; -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - /** * UseSDKExample is a dummy class to demonstrate very basic usage of @see * workflow-service-sdk. @@ -89,7 +88,7 @@ public void runSimpleFlow() throws ApiException { // GET WORKFLOW DEFINITION BY Id WorkFlowDefinitionResponseDTO simpleSequentialWorkFlowDefinition = workflowDefinitionApi - .getWorkFlowDefinitionById(simpleSequentialWorkFlowDefinitions.get(0).getId().toString()); + .getWorkFlowDefinitionById(simpleSequentialWorkFlowDefinitions.get(0).getId()); assertEquals("simpleSequentialWorkFlow" + WorkFlowConstants.INFRASTRUCTURE_WORKFLOW, simpleSequentialWorkFlowDefinition.getName()); diff --git a/workflow-service-sdk/api/openapi.yaml b/workflow-service-sdk/api/openapi.yaml index 17f0efe1a..bdc51fb04 100644 --- a/workflow-service-sdk/api/openapi.yaml +++ b/workflow-service-sdk/api/openapi.yaml @@ -137,6 +137,7 @@ paths: name: id required: true schema: + format: uuid type: string style: simple responses: @@ -402,7 +403,7 @@ components: author: author name: name workType: workType - id: id + id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 parameters: key: key: "{}" @@ -410,6 +411,7 @@ components: author: type: string id: + format: uuid type: string name: type: string @@ -562,7 +564,7 @@ components: author: author name: name workType: workType - id: id + id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 parameters: key: key: "{}" @@ -576,7 +578,7 @@ components: author: author name: name workType: workType - id: id + id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91 parameters: key: key: "{}" diff --git a/workflow-service-sdk/docs/WorkDefinitionResponseDTO.md b/workflow-service-sdk/docs/WorkDefinitionResponseDTO.md index 937809202..93e1d2eb7 100644 --- a/workflow-service-sdk/docs/WorkDefinitionResponseDTO.md +++ b/workflow-service-sdk/docs/WorkDefinitionResponseDTO.md @@ -8,7 +8,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| |**author** | **String** | | [optional] | -|**id** | **String** | | [optional] | +|**id** | **UUID** | | [optional] | |**name** | **String** | | [optional] | |**outputs** | [**List<OutputsEnum>**](#List<OutputsEnum>) | | [optional] | |**parameters** | **Map<String, Map<String, Object>>** | | [optional] | diff --git a/workflow-service-sdk/docs/WorkflowDefinitionApi.md b/workflow-service-sdk/docs/WorkflowDefinitionApi.md index 815cea847..743466179 100644 --- a/workflow-service-sdk/docs/WorkflowDefinitionApi.md +++ b/workflow-service-sdk/docs/WorkflowDefinitionApi.md @@ -30,7 +30,7 @@ public class Example { defaultClient.setBasePath("http://localhost:8080"); WorkflowDefinitionApi apiInstance = new WorkflowDefinitionApi(defaultClient); - String id = "id_example"; // String | + UUID id = UUID.randomUUID(); // UUID | try { WorkFlowDefinitionResponseDTO result = apiInstance.getWorkFlowDefinitionById(id); System.out.println(result); @@ -49,7 +49,7 @@ public class Example { | Name | Type | Description | Notes | |------------- | ------------- | ------------- | -------------| -| **id** | **String**| | | +| **id** | **UUID**| | | ### Return type diff --git a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/WorkflowDefinitionApi.java b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/WorkflowDefinitionApi.java index e622330b0..6c5f168d9 100644 --- a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/WorkflowDefinitionApi.java +++ b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/api/WorkflowDefinitionApi.java @@ -25,6 +25,7 @@ import java.io.IOException; +import java.util.UUID; import com.redhat.parodos.sdk.model.UpdateParameter200Response; import com.redhat.parodos.sdk.model.WorkFlowDefinitionResponseDTO; import com.redhat.parodos.sdk.model.WorkParameterValueRequestDTO; @@ -106,7 +107,7 @@ public void setCustomBaseUrl(String customBaseUrl) { * * */ - public okhttp3.Call getWorkFlowDefinitionByIdCall(String id, final ApiCallback _callback) throws ApiException { + public okhttp3.Call getWorkFlowDefinitionByIdCall(UUID id, final ApiCallback _callback) throws ApiException { String basePath = null; // Operation Servers String[] localBasePaths = new String[] {}; @@ -153,7 +154,7 @@ else if (localBasePaths.length > 0) { } @SuppressWarnings("rawtypes") - private okhttp3.Call getWorkFlowDefinitionByIdValidateBeforeCall(String id, final ApiCallback _callback) + private okhttp3.Call getWorkFlowDefinitionByIdValidateBeforeCall(UUID id, final ApiCallback _callback) throws ApiException { // verify the required parameter 'id' is set if (id == null) { @@ -194,7 +195,7 @@ private okhttp3.Call getWorkFlowDefinitionByIdValidateBeforeCall(String id, fina * * */ - public WorkFlowDefinitionResponseDTO getWorkFlowDefinitionById(String id) throws ApiException { + public WorkFlowDefinitionResponseDTO getWorkFlowDefinitionById(UUID id) throws ApiException { ApiResponse localVarResp = getWorkFlowDefinitionByIdWithHttpInfo(id); return localVarResp.getData(); } @@ -229,7 +230,7 @@ public WorkFlowDefinitionResponseDTO getWorkFlowDefinitionById(String id) throws * * */ - public ApiResponse getWorkFlowDefinitionByIdWithHttpInfo(String id) + public ApiResponse getWorkFlowDefinitionByIdWithHttpInfo(UUID id) throws ApiException { okhttp3.Call localVarCall = getWorkFlowDefinitionByIdValidateBeforeCall(id, null); Type localVarReturnType = new TypeToken() { @@ -268,7 +269,7 @@ public ApiResponse getWorkFlowDefinitionByIdWithH * * */ - public okhttp3.Call getWorkFlowDefinitionByIdAsync(String id, + public okhttp3.Call getWorkFlowDefinitionByIdAsync(UUID id, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = getWorkFlowDefinitionByIdValidateBeforeCall(id, _callback); diff --git a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/model/WorkDefinitionResponseDTO.java b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/model/WorkDefinitionResponseDTO.java index 70186ef6b..6a6ff0302 100644 --- a/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/model/WorkDefinitionResponseDTO.java +++ b/workflow-service-sdk/src/main/java/com/redhat/parodos/sdk/model/WorkDefinitionResponseDTO.java @@ -24,6 +24,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.UUID; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -60,7 +61,7 @@ public class WorkDefinitionResponseDTO { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private String id; + private UUID id; public static final String SERIALIZED_NAME_NAME = "name"; @@ -223,7 +224,7 @@ public void setAuthor(String author) { this.author = author; } - public WorkDefinitionResponseDTO id(String id) { + public WorkDefinitionResponseDTO id(UUID id) { this.id = id; return this; @@ -235,11 +236,11 @@ public WorkDefinitionResponseDTO id(String id) { **/ @javax.annotation.Nullable - public String getId() { + public UUID getId() { return id; } - public void setId(String id) { + public void setId(UUID id) { this.id = id; }