Skip to content

Commit

Permalink
Update SDK to support Java SDK v1.26.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Quinn-With-Two-Ns committed Oct 25, 2024
1 parent a7698ed commit ce5bbd4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
11 changes: 6 additions & 5 deletions features/update/async_accepted/feature.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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<Integer> handle =
WorkflowUpdateHandle<Integer> handle =
untypedStub.startUpdate(
UpdateOptions.newBuilder(Integer.class)
.setUpdateName("update")
Expand All @@ -82,7 +82,8 @@ public Run execute(Runner runner) throws Exception {
true);

// Create a separate handle to the same update
UpdateHandle<Integer> otherHandle = untypedStub.getUpdateHandle(updateId, Integer.class);
WorkflowUpdateHandle<Integer> 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());
Expand All @@ -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<Integer> errorHandle =
WorkflowUpdateHandle<Integer> errorHandle =
untypedStub.startUpdate(
UpdateOptions.newBuilder(Integer.class)
.setUpdateName("update")
Expand All @@ -118,7 +119,7 @@ public Run execute(Runner runner) throws Exception {
}
// issue an update that will succeed after `requestedSleep`
updateId = UUID.randomUUID().toString();
UpdateHandle<Integer> timeoutHandle =
WorkflowUpdateHandle<Integer> timeoutHandle =
untypedStub.startUpdate(
UpdateOptions.newBuilder(Integer.class)
.setUpdateName("update")
Expand Down
4 changes: 2 additions & 2 deletions features/update/client_interceptor/feature.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -54,7 +54,7 @@ public WorkflowClientCallsInterceptor workflowClientCallsInterceptor(
WorkflowClientCallsInterceptor next) {
return new WorkflowClientCallsInterceptorBase(next) {
@Override
public <R> UpdateHandle<R> startUpdate(StartUpdateInput<R> input) {
public <R> WorkflowUpdateHandle<R> startUpdate(StartUpdateInput<R> input) {
if (input.getUpdateName() == "update") {
input.getArguments()[0] = ((int) input.getArguments()[0]) + 1;
}
Expand Down
5 changes: 2 additions & 3 deletions features/update/deduplication/feature.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -76,8 +75,8 @@ public Run execute(Runner runner) throws Exception {
.setFirstExecutionRunId(run.execution.getRunId())
.build();

UpdateHandle<Integer> handle1 = untypedStub.startUpdate(updateOptions);
UpdateHandle<Integer> handle2 = untypedStub.startUpdate(updateOptions);
WorkflowUpdateHandle<Integer> handle1 = untypedStub.startUpdate(updateOptions);
WorkflowUpdateHandle<Integer> handle2 = untypedStub.startUpdate(updateOptions);

Assertions.assertEquals(1, handle1.getResultAsync().get());
Assertions.assertEquals(1, handle2.getResultAsync().get());
Expand Down

0 comments on commit ce5bbd4

Please sign in to comment.