From 15d13ca663033bd3401e72e10b622a937d81400c Mon Sep 17 00:00:00 2001 From: manan164 <1897158+manan164@users.noreply.github.com> Date: Mon, 11 Sep 2023 17:06:06 +0530 Subject: [PATCH 1/4] Upgrade api changes. --- build.gradle | 2 +- .../conductor/client/WorkflowClient.java | 3 + .../client/http/OrkesWorkflowClient.java | 6 ++ .../client/http/api/WorkflowResourceApi.java | 101 ++++++++++++++++++ 4 files changed, 111 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 64c9a10e..64ac62b5 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ ext { versions = [ awaitility : '4.2.0', commonsLang : '3.12.0', - conductor : '3.9.12-orkes', + conductor : '3.9.19-SNAPSHOT', jackson : '2.11.4!!', junit : '5.9.0', slf4j : '1.7.36', diff --git a/src/main/java/io/orkes/conductor/client/WorkflowClient.java b/src/main/java/io/orkes/conductor/client/WorkflowClient.java index e1cd79f0..a686b9ea 100644 --- a/src/main/java/io/orkes/conductor/client/WorkflowClient.java +++ b/src/main/java/io/orkes/conductor/client/WorkflowClient.java @@ -20,6 +20,7 @@ import java.util.concurrent.TimeoutException; import com.netflix.conductor.common.metadata.workflow.StartWorkflowRequest; +import com.netflix.conductor.common.metadata.workflow.UpgradeWorkflowRequest; import com.netflix.conductor.common.model.BulkResponse; import com.netflix.conductor.common.run.Workflow; import com.netflix.conductor.common.run.WorkflowTestRequest; @@ -92,4 +93,6 @@ public abstract Map> getWorkflowsByNamesAndCorrelationIds public abstract Workflow updateVariables(String workflowId, Map variables); public abstract void jumpToTask(String workflowId, String taskReferenceName, Map input); + + public abstract void upgradeRunningWorkflowToVersion(String workflowId, Integer version, UpgradeWorkflowRequest body); } diff --git a/src/main/java/io/orkes/conductor/client/http/OrkesWorkflowClient.java b/src/main/java/io/orkes/conductor/client/http/OrkesWorkflowClient.java index 0b17dac8..fa3258cb 100644 --- a/src/main/java/io/orkes/conductor/client/http/OrkesWorkflowClient.java +++ b/src/main/java/io/orkes/conductor/client/http/OrkesWorkflowClient.java @@ -19,6 +19,7 @@ import java.util.UUID; import java.util.concurrent.*; +import com.netflix.conductor.common.metadata.workflow.UpgradeWorkflowRequest; import org.apache.commons.lang.StringUtils; import com.netflix.conductor.common.metadata.workflow.RerunWorkflowRequest; @@ -348,6 +349,11 @@ public void jumpToTask(String workflowId, String taskReferenceName, Map upgradeRunningWorkflowToVersionWithHttpInfo(UpgradeWorkflowRequest body, Integer version, String workflowId) throws ApiException { + com.squareup.okhttp.Call call = upgradeRunningWorkflowToVersionValidateBeforeCall(body, version, workflowId, null, null); + return apiClient.execute(call); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call upgradeRunningWorkflowToVersionValidateBeforeCall(UpgradeWorkflowRequest body, Integer version, String workflowId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + // verify the required parameter 'body' is set + if (body == null) { + throw new ApiException("Missing the required parameter 'body' when calling upgradeRunningWorkflowToVersion(Async)"); + } + // verify the required parameter 'version' is set + if (version == null) { + throw new ApiException("Missing the required parameter 'version' when calling upgradeRunningWorkflowToVersion(Async)"); + } + // verify the required parameter 'workflowId' is set + if (workflowId == null) { + throw new ApiException("Missing the required parameter 'workflowId' when calling upgradeRunningWorkflowToVersion(Async)"); + } + + com.squareup.okhttp.Call call = upgradeRunningWorkflowToVersionCall(body, version, workflowId, progressListener, progressRequestListener); + return call; + } + + /** + * Build call for upgradeRunningWorkflowToVersion + * @param body (required) + * @param version (required) + * @param workflowId (required) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + private com.squareup.okhttp.Call upgradeRunningWorkflowToVersionCall(UpgradeWorkflowRequest body, Integer version, String workflowId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/workflow/{workflowId}/upgrade/{version}" + .replaceAll("\\{" + "workflowId" + "\\}", apiClient.escapeString(workflowId.toString())); + + List localVarQueryParams = new ArrayList(); + List localVarCollectionQueryParams = new ArrayList(); + if (version != null) + localVarQueryParams.addAll(apiClient.parameterToPair("version", version)); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + "application/json" + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { "api_key" }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + } From 46cd2b82b7b36b68aff83572a09b2df1c8519f8a Mon Sep 17 00:00:00 2001 From: manan164 <1897158+manan164@users.noreply.github.com> Date: Mon, 18 Sep 2023 17:29:54 +0530 Subject: [PATCH 2/4] contract change --- .../conductor/client/WorkflowClient.java | 2 +- .../client/http/OrkesWorkflowClient.java | 4 +-- .../client/http/api/WorkflowResourceApi.java | 26 ++++++------------- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/main/java/io/orkes/conductor/client/WorkflowClient.java b/src/main/java/io/orkes/conductor/client/WorkflowClient.java index a686b9ea..08761385 100644 --- a/src/main/java/io/orkes/conductor/client/WorkflowClient.java +++ b/src/main/java/io/orkes/conductor/client/WorkflowClient.java @@ -94,5 +94,5 @@ public abstract Map> getWorkflowsByNamesAndCorrelationIds public abstract void jumpToTask(String workflowId, String taskReferenceName, Map input); - public abstract void upgradeRunningWorkflowToVersion(String workflowId, Integer version, UpgradeWorkflowRequest body); + public abstract void upgradeRunningWorkflowToVersion(String workflowId, UpgradeWorkflowRequest body); } diff --git a/src/main/java/io/orkes/conductor/client/http/OrkesWorkflowClient.java b/src/main/java/io/orkes/conductor/client/http/OrkesWorkflowClient.java index fa3258cb..c09aada5 100644 --- a/src/main/java/io/orkes/conductor/client/http/OrkesWorkflowClient.java +++ b/src/main/java/io/orkes/conductor/client/http/OrkesWorkflowClient.java @@ -350,8 +350,8 @@ public void jumpToTask(String workflowId, String taskReferenceName, Map upgradeRunningWorkflowToVersionWithHttpInfo(UpgradeWorkflowRequest body, Integer version, String workflowId) throws ApiException { - com.squareup.okhttp.Call call = upgradeRunningWorkflowToVersionValidateBeforeCall(body, version, workflowId, null, null); + public ApiResponse upgradeRunningWorkflowToVersionWithHttpInfo(UpgradeWorkflowRequest body, String workflowId) throws ApiException { + com.squareup.okhttp.Call call = upgradeRunningWorkflowToVersionValidateBeforeCall(body, workflowId, null, null); return apiClient.execute(call); } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call upgradeRunningWorkflowToVersionValidateBeforeCall(UpgradeWorkflowRequest body, Integer version, String workflowId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call upgradeRunningWorkflowToVersionValidateBeforeCall(UpgradeWorkflowRequest body, String workflowId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { throw new ApiException("Missing the required parameter 'body' when calling upgradeRunningWorkflowToVersion(Async)"); } - // verify the required parameter 'version' is set - if (version == null) { - throw new ApiException("Missing the required parameter 'version' when calling upgradeRunningWorkflowToVersion(Async)"); - } // verify the required parameter 'workflowId' is set if (workflowId == null) { throw new ApiException("Missing the required parameter 'workflowId' when calling upgradeRunningWorkflowToVersion(Async)"); } - com.squareup.okhttp.Call call = upgradeRunningWorkflowToVersionCall(body, version, workflowId, progressListener, progressRequestListener); + com.squareup.okhttp.Call call = upgradeRunningWorkflowToVersionCall(body, workflowId, progressListener, progressRequestListener); return call; } /** * Build call for upgradeRunningWorkflowToVersion * @param body (required) - * @param version (required) * @param workflowId (required) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - private com.squareup.okhttp.Call upgradeRunningWorkflowToVersionCall(UpgradeWorkflowRequest body, Integer version, String workflowId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public com.squareup.okhttp.Call upgradeRunningWorkflowToVersionCall(UpgradeWorkflowRequest body, String workflowId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables - String localVarPath = "/workflow/{workflowId}/upgrade/{version}" + String localVarPath = "/workflow/{workflowId}/upgrade" .replaceAll("\\{" + "workflowId" + "\\}", apiClient.escapeString(workflowId.toString())); List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - if (version != null) - localVarQueryParams.addAll(apiClient.parameterToPair("version", version)); Map localVarHeaderParams = new HashMap(); @@ -4030,5 +4021,4 @@ public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Ch return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); } - } From b11573266c4ac8f7365f85826a009b12dd3a03fc Mon Sep 17 00:00:00 2001 From: manan164 <1897158+manan164@users.noreply.github.com> Date: Mon, 18 Sep 2023 23:39:43 +0530 Subject: [PATCH 3/4] upgraded version --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 64ac62b5..b30bfed4 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ ext { versions = [ awaitility : '4.2.0', commonsLang : '3.12.0', - conductor : '3.9.19-SNAPSHOT', + conductor : '3.9.21-orkes', jackson : '2.11.4!!', junit : '5.9.0', slf4j : '1.7.36', From 53a4ac00cf5b4b121793c263d7625d7eff180bb5 Mon Sep 17 00:00:00 2001 From: manan164 <1897158+manan164@users.noreply.github.com> Date: Wed, 20 Sep 2023 19:19:31 +0530 Subject: [PATCH 4/4] rename method. --- .../conductor/client/WorkflowClient.java | 2 +- .../client/http/OrkesWorkflowClient.java | 4 ++-- .../client/http/api/WorkflowResourceApi.java | 20 +++++++++---------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/io/orkes/conductor/client/WorkflowClient.java b/src/main/java/io/orkes/conductor/client/WorkflowClient.java index 08761385..560d0f03 100644 --- a/src/main/java/io/orkes/conductor/client/WorkflowClient.java +++ b/src/main/java/io/orkes/conductor/client/WorkflowClient.java @@ -94,5 +94,5 @@ public abstract Map> getWorkflowsByNamesAndCorrelationIds public abstract void jumpToTask(String workflowId, String taskReferenceName, Map input); - public abstract void upgradeRunningWorkflowToVersion(String workflowId, UpgradeWorkflowRequest body); + public abstract void upgradeRunningWorkflow(String workflowId, UpgradeWorkflowRequest body); } diff --git a/src/main/java/io/orkes/conductor/client/http/OrkesWorkflowClient.java b/src/main/java/io/orkes/conductor/client/http/OrkesWorkflowClient.java index c09aada5..6db0d59d 100644 --- a/src/main/java/io/orkes/conductor/client/http/OrkesWorkflowClient.java +++ b/src/main/java/io/orkes/conductor/client/http/OrkesWorkflowClient.java @@ -350,8 +350,8 @@ public void jumpToTask(String workflowId, String taskReferenceName, Map upgradeRunningWorkflowToVersionWithHttpInfo(UpgradeWorkflowRequest body, String workflowId) throws ApiException { - com.squareup.okhttp.Call call = upgradeRunningWorkflowToVersionValidateBeforeCall(body, workflowId, null, null); + public ApiResponse upgradeRunningWorkflowWithHttpInfo(UpgradeWorkflowRequest body, String workflowId) throws ApiException { + com.squareup.okhttp.Call call = upgradeRunningWorkflowValidateBeforeCall(body, workflowId, null, null); return apiClient.execute(call); } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call upgradeRunningWorkflowToVersionValidateBeforeCall(UpgradeWorkflowRequest body, String workflowId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call upgradeRunningWorkflowValidateBeforeCall(UpgradeWorkflowRequest body, String workflowId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { // verify the required parameter 'body' is set if (body == null) { - throw new ApiException("Missing the required parameter 'body' when calling upgradeRunningWorkflowToVersion(Async)"); + throw new ApiException("Missing the required parameter 'body' when calling upgradeRunningWorkflow(Async)"); } // verify the required parameter 'workflowId' is set if (workflowId == null) { - throw new ApiException("Missing the required parameter 'workflowId' when calling upgradeRunningWorkflowToVersion(Async)"); + throw new ApiException("Missing the required parameter 'workflowId' when calling upgradeRunningWorkflow(Async)"); } - com.squareup.okhttp.Call call = upgradeRunningWorkflowToVersionCall(body, workflowId, progressListener, progressRequestListener); + com.squareup.okhttp.Call call = upgradeRunningWorkflowCall(body, workflowId, progressListener, progressRequestListener); return call; } /** - * Build call for upgradeRunningWorkflowToVersion + * Build call for upgradeRunningWorkflow * @param body (required) * @param workflowId (required) * @param progressListener Progress listener @@ -3979,7 +3979,7 @@ private com.squareup.okhttp.Call upgradeRunningWorkflowToVersionValidateBeforeCa * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call upgradeRunningWorkflowToVersionCall(UpgradeWorkflowRequest body, String workflowId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public com.squareup.okhttp.Call upgradeRunningWorkflowCall(UpgradeWorkflowRequest body, String workflowId, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = body; // create path and map variables