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

Commit

Permalink
Generate SDK files
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 4, 2023
1 parent 7c9181c commit 97e4503
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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()));
Expand All @@ -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 ********");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -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()));
Expand All @@ -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");
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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.
Expand Down Expand Up @@ -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());
Expand Down
8 changes: 5 additions & 3 deletions workflow-service-sdk/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ paths:
name: id
required: true
schema:
format: uuid
type: string
style: simple
responses:
Expand Down Expand Up @@ -402,14 +403,15 @@ components:
author: author
name: name
workType: workType
id: id
id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
parameters:
key:
key: "{}"
properties:
author:
type: string
id:
format: uuid
type: string
name:
type: string
Expand Down Expand Up @@ -562,7 +564,7 @@ components:
author: author
name: name
workType: workType
id: id
id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
parameters:
key:
key: "{}"
Expand All @@ -576,7 +578,7 @@ components:
author: author
name: name
workType: workType
id: id
id: 046b6c7f-0b8a-43b9-b35d-6489e6daee91
parameters:
key:
key: "{}"
Expand Down
2 changes: 1 addition & 1 deletion workflow-service-sdk/docs/WorkDefinitionResponseDTO.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| Name | Type | Description | Notes |
|------------ | ------------- | ------------- | -------------|
|**author** | **String** | | [optional] |
|**id** | **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] |
Expand Down
4 changes: 2 additions & 2 deletions workflow-service-sdk/docs/WorkflowDefinitionApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -49,7 +49,7 @@ public class Example {

| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **id** | **String**| | |
| **id** | **UUID**| | |

### Return type

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -106,7 +107,7 @@ public void setCustomBaseUrl(String customBaseUrl) {
* </tr>
* </table>
*/
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[] {};
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -194,7 +195,7 @@ private okhttp3.Call getWorkFlowDefinitionByIdValidateBeforeCall(String id, fina
* </tr>
* </table>
*/
public WorkFlowDefinitionResponseDTO getWorkFlowDefinitionById(String id) throws ApiException {
public WorkFlowDefinitionResponseDTO getWorkFlowDefinitionById(UUID id) throws ApiException {
ApiResponse<WorkFlowDefinitionResponseDTO> localVarResp = getWorkFlowDefinitionByIdWithHttpInfo(id);
return localVarResp.getData();
}
Expand Down Expand Up @@ -229,7 +230,7 @@ public WorkFlowDefinitionResponseDTO getWorkFlowDefinitionById(String id) throws
* </tr>
* </table>
*/
public ApiResponse<WorkFlowDefinitionResponseDTO> getWorkFlowDefinitionByIdWithHttpInfo(String id)
public ApiResponse<WorkFlowDefinitionResponseDTO> getWorkFlowDefinitionByIdWithHttpInfo(UUID id)
throws ApiException {
okhttp3.Call localVarCall = getWorkFlowDefinitionByIdValidateBeforeCall(id, null);
Type localVarReturnType = new TypeToken<WorkFlowDefinitionResponseDTO>() {
Expand Down Expand Up @@ -268,7 +269,7 @@ public ApiResponse<WorkFlowDefinitionResponseDTO> getWorkFlowDefinitionByIdWithH
* </tr>
* </table>
*/
public okhttp3.Call getWorkFlowDefinitionByIdAsync(String id,
public okhttp3.Call getWorkFlowDefinitionByIdAsync(UUID id,
final ApiCallback<WorkFlowDefinitionResponseDTO> _callback) throws ApiException {

okhttp3.Call localVarCall = getWorkFlowDefinitionByIdValidateBeforeCall(id, _callback);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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";

Expand Down Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down

0 comments on commit 97e4503

Please sign in to comment.