From ce5bbd4deccb9e8d6ef0b02446ec58fd9240a8df Mon Sep 17 00:00:00 2001 From: Quinn Klassen Date: Fri, 25 Oct 2024 12:26:03 -0700 Subject: [PATCH] Update SDK to support Java SDK v1.26.0 --- features/update/async_accepted/feature.java | 11 ++++++----- features/update/client_interceptor/feature.java | 4 ++-- features/update/deduplication/feature.java | 5 ++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/features/update/async_accepted/feature.java b/features/update/async_accepted/feature.java index e86d4fbd..d814569a 100644 --- a/features/update/async_accepted/feature.java +++ b/features/update/async_accepted/feature.java @@ -1,9 +1,9 @@ package update.async_accepted; import io.temporal.activity.ActivityInterface; -import io.temporal.client.UpdateHandle; import io.temporal.client.UpdateOptions; import io.temporal.client.WorkflowUpdateException; +import io.temporal.client.WorkflowUpdateHandle; import io.temporal.client.WorkflowUpdateStage; import io.temporal.client.WorkflowUpdateTimeoutOrCancelledException; import io.temporal.failure.ApplicationFailure; @@ -71,7 +71,7 @@ public Run execute(Runner runner) throws Exception { // Issue an async update that should succeed after SLEEP_TIMEOUT var updateId = UUID.randomUUID().toString(); - UpdateHandle handle = + WorkflowUpdateHandle handle = untypedStub.startUpdate( UpdateOptions.newBuilder(Integer.class) .setUpdateName("update") @@ -82,7 +82,8 @@ public Run execute(Runner runner) throws Exception { true); // Create a separate handle to the same update - UpdateHandle otherHandle = untypedStub.getUpdateHandle(updateId, Integer.class); + WorkflowUpdateHandle otherHandle = + untypedStub.getUpdateHandle(updateId, Integer.class); // should block on in-flight update Assertions.assertEquals(UPDATE_RESULT, otherHandle.getResultAsync().get()); Assertions.assertEquals(UPDATE_RESULT, handle.getResultAsync().get()); @@ -93,7 +94,7 @@ public Run execute(Runner runner) throws Exception { // the update will be marked as failed and the exception may be thrown // from startUpdate. This is not consistent with the behavior of the // other SDKs. - UpdateHandle errorHandle = + WorkflowUpdateHandle errorHandle = untypedStub.startUpdate( UpdateOptions.newBuilder(Integer.class) .setUpdateName("update") @@ -118,7 +119,7 @@ public Run execute(Runner runner) throws Exception { } // issue an update that will succeed after `requestedSleep` updateId = UUID.randomUUID().toString(); - UpdateHandle timeoutHandle = + WorkflowUpdateHandle timeoutHandle = untypedStub.startUpdate( UpdateOptions.newBuilder(Integer.class) .setUpdateName("update") diff --git a/features/update/client_interceptor/feature.java b/features/update/client_interceptor/feature.java index a9062e6c..132bcea5 100644 --- a/features/update/client_interceptor/feature.java +++ b/features/update/client_interceptor/feature.java @@ -1,7 +1,7 @@ package update.client_interceptor; -import io.temporal.client.UpdateHandle; import io.temporal.client.WorkflowClientOptions; +import io.temporal.client.WorkflowUpdateHandle; import io.temporal.common.interceptors.WorkflowClientCallsInterceptor; import io.temporal.common.interceptors.WorkflowClientCallsInterceptorBase; import io.temporal.common.interceptors.WorkflowClientInterceptorBase; @@ -54,7 +54,7 @@ public WorkflowClientCallsInterceptor workflowClientCallsInterceptor( WorkflowClientCallsInterceptor next) { return new WorkflowClientCallsInterceptorBase(next) { @Override - public UpdateHandle startUpdate(StartUpdateInput input) { + public WorkflowUpdateHandle startUpdate(StartUpdateInput input) { if (input.getUpdateName() == "update") { input.getArguments()[0] = ((int) input.getArguments()[0]) + 1; } diff --git a/features/update/deduplication/feature.java b/features/update/deduplication/feature.java index 3c8ecbc9..3a11cf31 100644 --- a/features/update/deduplication/feature.java +++ b/features/update/deduplication/feature.java @@ -1,6 +1,5 @@ package update.deduplication; -import io.temporal.client.UpdateHandle; import io.temporal.client.UpdateOptions; import io.temporal.client.WorkflowUpdateStage; import io.temporal.sdkfeatures.Feature; @@ -76,8 +75,8 @@ public Run execute(Runner runner) throws Exception { .setFirstExecutionRunId(run.execution.getRunId()) .build(); - UpdateHandle handle1 = untypedStub.startUpdate(updateOptions); - UpdateHandle handle2 = untypedStub.startUpdate(updateOptions); + WorkflowUpdateHandle handle1 = untypedStub.startUpdate(updateOptions); + WorkflowUpdateHandle handle2 = untypedStub.startUpdate(updateOptions); Assertions.assertEquals(1, handle1.getResultAsync().get()); Assertions.assertEquals(1, handle2.getResultAsync().get());