diff --git a/durabletask-client/src/main/java/io/dapr/durabletask/DurableTaskGrpcWorker.java b/durabletask-client/src/main/java/io/dapr/durabletask/DurableTaskGrpcWorker.java index cf3a57869..12f89bd72 100644 --- a/durabletask-client/src/main/java/io/dapr/durabletask/DurableTaskGrpcWorker.java +++ b/durabletask-client/src/main/java/io/dapr/durabletask/DurableTaskGrpcWorker.java @@ -180,8 +180,8 @@ public void startAndBlock() { OrchestratorService.WorkItem workItem = workItemStream.next(); OrchestratorService.WorkItem.RequestCase requestType = workItem.getRequestCase(); - if (requestType == OrchestratorService.WorkItem.RequestCase.ORCHESTRATORREQUEST) { - OrchestratorService.OrchestratorRequest orchestratorRequest = workItem.getOrchestratorRequest(); + if (requestType == OrchestratorService.WorkItem.RequestCase.WORKFLOWREQUEST) { + OrchestratorService.WorkflowRequest orchestratorRequest = workItem.getWorkflowRequest(); logger.log(Level.FINEST, String.format("Processing orchestrator request for instance: {0}", orchestratorRequest.getInstanceId())); @@ -193,7 +193,7 @@ public void startAndBlock() { logger.log(Level.INFO, String.format("Processing activity request: %s for instance: %s, gRPC thread context: %s", activityRequest.getName(), - activityRequest.getOrchestrationInstance().getInstanceId(), + activityRequest.getWorkflowInstance().getInstanceId(), Context.current())); this.workerPool.submit(new ActivityRunner(workItem, taskActivityExecutor, sidecarClient, tracer)); diff --git a/durabletask-client/src/main/java/io/dapr/durabletask/OrchestrationMetadata.java b/durabletask-client/src/main/java/io/dapr/durabletask/OrchestrationMetadata.java index 13b0fdcd1..477b31995 100644 --- a/durabletask-client/src/main/java/io/dapr/durabletask/OrchestrationMetadata.java +++ b/durabletask-client/src/main/java/io/dapr/durabletask/OrchestrationMetadata.java @@ -13,7 +13,7 @@ package io.dapr.durabletask; -import io.dapr.durabletask.implementation.protobuf.Orchestration.OrchestrationState; +import io.dapr.durabletask.implementation.protobuf.Orchestration.WorkflowState; import io.dapr.durabletask.implementation.protobuf.OrchestratorService; import java.time.Instant; @@ -45,11 +45,11 @@ public final class OrchestrationMetadata { OrchestratorService.GetInstanceResponse fetchResponse, DataConverter dataConverter, boolean requestedInputsAndOutputs) { - this(fetchResponse.getOrchestrationState(), dataConverter, requestedInputsAndOutputs); + this(fetchResponse.getWorkflowState(), dataConverter, requestedInputsAndOutputs); } OrchestrationMetadata( - OrchestrationState state, + WorkflowState state, DataConverter dataConverter, boolean requestedInputsAndOutputs) { this.dataConverter = dataConverter; @@ -57,7 +57,7 @@ public final class OrchestrationMetadata { this.name = state.getName(); this.instanceId = state.getInstanceId(); - this.runtimeStatus = OrchestrationRuntimeStatus.fromProtobuf(state.getOrchestrationStatus()); + this.runtimeStatus = OrchestrationRuntimeStatus.fromProtobuf(state.getWorkflowStatus()); this.createdAt = DataConverter.getInstantFromTimestamp(state.getCreatedTimestamp()); this.lastUpdatedAt = DataConverter.getInstantFromTimestamp(state.getLastUpdatedTimestamp()); this.serializedInput = state.getInput().getValue(); diff --git a/durabletask-client/src/main/java/io/dapr/durabletask/OrchestrationRunner.java b/durabletask-client/src/main/java/io/dapr/durabletask/OrchestrationRunner.java index bbb9814a8..fe31b1fd3 100644 --- a/durabletask-client/src/main/java/io/dapr/durabletask/OrchestrationRunner.java +++ b/durabletask-client/src/main/java/io/dapr/durabletask/OrchestrationRunner.java @@ -127,9 +127,9 @@ public static byte[] loadAndRun(byte[] orchestratorRequestBytes, TaskOrchestrati throw new IllegalArgumentException("orchestration must not be null"); } - OrchestratorService.OrchestratorRequest orchestratorRequest; + OrchestratorService.WorkflowRequest orchestratorRequest; try { - orchestratorRequest = OrchestratorService.OrchestratorRequest.parseFrom(orchestratorRequestBytes); + orchestratorRequest = OrchestratorService.WorkflowRequest.parseFrom(orchestratorRequestBytes); } catch (InvalidProtocolBufferException e) { throw new IllegalArgumentException("triggerStateProtoBytes was not valid protobuf", e); } @@ -170,7 +170,7 @@ public Boolean isLatestVersion() { orchestratorRequest.getPastEventsList(), orchestratorRequest.getNewEventsList()); - OrchestratorService.OrchestratorResponse response = OrchestratorService.OrchestratorResponse.newBuilder() + OrchestratorService.WorkflowResponse response = OrchestratorService.WorkflowResponse.newBuilder() .setInstanceId(orchestratorRequest.getInstanceId()) .addAllActions(taskOrchestratorResult.getActions()) .setCustomStatus(StringValue.of(taskOrchestratorResult.getCustomStatus())) diff --git a/durabletask-client/src/main/java/io/dapr/durabletask/TaskOrchestrationExecutor.java b/durabletask-client/src/main/java/io/dapr/durabletask/TaskOrchestrationExecutor.java index 2cf29a61d..185a56450 100644 --- a/durabletask-client/src/main/java/io/dapr/durabletask/TaskOrchestrationExecutor.java +++ b/durabletask-client/src/main/java/io/dapr/durabletask/TaskOrchestrationExecutor.java @@ -142,7 +142,7 @@ private class ContextImplTask implements TaskOrchestrationContext { private String appId; // LinkedHashMap to maintain insertion order when returning the list of pending actions - private final Map pendingActions = new LinkedHashMap<>(); + private final Map pendingActions = new LinkedHashMap<>(); private final Map> openTasks = new HashMap<>(); private final Map>> outstandingEvents = new LinkedHashMap<>(); private final List unprocessedEvents = new LinkedList<>(); @@ -368,7 +368,7 @@ public Task callActivity( TaskFactory taskFactory = () -> { int id = this.sequenceNumber++; - OrchestratorActions.OrchestratorAction.Builder actionBuilder = OrchestratorActions.OrchestratorAction + OrchestratorActions.WorkflowAction.Builder actionBuilder = OrchestratorActions.WorkflowAction .newBuilder() .setId(id) .setScheduleTask(scheduleTaskBuilder); @@ -463,8 +463,8 @@ public void sendEvent(String instanceId, String eventName, Object eventData) { int id = this.sequenceNumber++; String serializedEventData = this.dataConverter.serialize(eventData); - Orchestration.OrchestrationInstance.Builder orchestrationInstanceBuilder = - Orchestration.OrchestrationInstance.newBuilder() + Orchestration.WorkflowInstance.Builder orchestrationInstanceBuilder = + Orchestration.WorkflowInstance.newBuilder() .setInstanceId(instanceId); OrchestratorActions.SendEventAction.Builder builder = OrchestratorActions .SendEventAction.newBuilder().setInstance(orchestrationInstanceBuilder) @@ -472,7 +472,7 @@ public void sendEvent(String instanceId, String eventName, Object eventData) { if (serializedEventData != null) { builder.setData(StringValue.of(serializedEventData)); } - OrchestratorActions.OrchestratorAction.Builder actionBuilder = OrchestratorActions.OrchestratorAction.newBuilder() + OrchestratorActions.WorkflowAction.Builder actionBuilder = OrchestratorActions.WorkflowAction.newBuilder() .setId(id) .setSendEvent(builder); @@ -505,8 +505,8 @@ public Task callSubOrchestrator( } String serializedInput = this.dataConverter.serialize(input); - OrchestratorActions.CreateSubOrchestrationAction.Builder createSubOrchestrationActionBuilder = - OrchestratorActions.CreateSubOrchestrationAction + OrchestratorActions.CreateChildWorkflowAction.Builder createSubOrchestrationActionBuilder = + OrchestratorActions.CreateChildWorkflowAction .newBuilder().setName(name); if (serializedInput != null) { createSubOrchestrationActionBuilder.setInput(StringValue.of(serializedInput)); @@ -535,10 +535,10 @@ public Task callSubOrchestrator( TaskFactory taskFactory = () -> { int id = this.sequenceNumber++; - OrchestratorActions.OrchestratorAction.Builder actionBuilder = OrchestratorActions.OrchestratorAction + OrchestratorActions.WorkflowAction.Builder actionBuilder = OrchestratorActions.WorkflowAction .newBuilder() .setId(id) - .setCreateSubOrchestration(createSubOrchestrationActionBuilder); + .setCreateChildWorkflow(createSubOrchestrationActionBuilder); // Set router on the OrchestratorAction for cross-app routing if (hasSourceAppId()) { @@ -641,7 +641,7 @@ private void handleTaskScheduled(HistoryEvents.HistoryEvent e) { // The history shows that this orchestrator created a durable task in a previous execution. // We can therefore remove it from the map of pending actions. If we can't find the pending // action, then we assume a non-deterministic code violation in the orchestrator. - OrchestratorActions.OrchestratorAction taskAction = this.pendingActions.remove(taskId); + OrchestratorActions.WorkflowAction taskAction = this.pendingActions.remove(taskId); if (taskAction == null) { String message = String.format( "Non-deterministic orchestrator detected: a history event scheduling an activity task with sequence " @@ -797,7 +797,7 @@ private Task createTimer(String name, Instant finalFireAt) { private CompletableTask createInstantTimer(String name, int id, Instant fireAt) { Timestamp ts = DataConverter.getTimestampFromInstant(fireAt); - this.pendingActions.put(id, OrchestratorActions.OrchestratorAction.newBuilder() + this.pendingActions.put(id, OrchestratorActions.WorkflowAction.newBuilder() .setId(id) .setCreateTimer(OrchestratorActions.CreateTimerAction.newBuilder() .setName(name).setFireAt(ts)) @@ -825,7 +825,7 @@ private void handleTimerCreated(HistoryEvents.HistoryEvent e) { // The history shows that this orchestrator created a durable timer in a previous execution. // We can therefore remove it from the map of pending actions. If we can't find the pending // action, then we assume a non-deterministic code violation in the orchestrator. - OrchestratorActions.OrchestratorAction timerAction = this.pendingActions.remove(timerEventId); + OrchestratorActions.WorkflowAction timerAction = this.pendingActions.remove(timerEventId); if (timerAction == null) { String message = String.format( "Non-deterministic orchestrator detected: a history event creating a timer with ID %d and " @@ -860,9 +860,9 @@ public void handleTimerFired(HistoryEvents.HistoryEvent e) { private void handleSubOrchestrationCreated(HistoryEvents.HistoryEvent e) { int taskId = e.getEventId(); - HistoryEvents.SubOrchestrationInstanceCreatedEvent subOrchestrationInstanceCreated = - e.getSubOrchestrationInstanceCreated(); - OrchestratorActions.OrchestratorAction taskAction = this.pendingActions.remove(taskId); + HistoryEvents.ChildWorkflowInstanceCreatedEvent subOrchestrationInstanceCreated = + e.getChildWorkflowInstanceCreated(); + OrchestratorActions.WorkflowAction taskAction = this.pendingActions.remove(taskId); if (taskAction == null) { String message = String.format( "Non-deterministic orchestrator detected: a history event scheduling an sub-orchestration task " @@ -876,8 +876,8 @@ private void handleSubOrchestrationCreated(HistoryEvents.HistoryEvent e) { } private void handleSubOrchestrationCompleted(HistoryEvents.HistoryEvent e) { - HistoryEvents.SubOrchestrationInstanceCompletedEvent subOrchestrationInstanceCompletedEvent = - e.getSubOrchestrationInstanceCompleted(); + HistoryEvents.ChildWorkflowInstanceCompletedEvent subOrchestrationInstanceCompletedEvent = + e.getChildWorkflowInstanceCompleted(); int taskId = subOrchestrationInstanceCompletedEvent.getTaskScheduledId(); TaskRecord record = this.openTasks.remove(taskId); if (record == null) { @@ -908,8 +908,8 @@ private void handleSubOrchestrationCompleted(HistoryEvents.HistoryEvent e) { } private void handleSubOrchestrationFailed(HistoryEvents.HistoryEvent e) { - HistoryEvents.SubOrchestrationInstanceFailedEvent subOrchestrationInstanceFailedEvent = - e.getSubOrchestrationInstanceFailed(); + HistoryEvents.ChildWorkflowInstanceFailedEvent subOrchestrationInstanceFailedEvent = + e.getChildWorkflowInstanceFailed(); int taskId = subOrchestrationInstanceFailedEvent.getTaskScheduledId(); TaskRecord record = this.openTasks.remove(taskId); if (record == null) { @@ -965,9 +965,9 @@ private void completeInternal( Helpers.throwIfOrchestratorComplete(this.isComplete); - OrchestratorActions.CompleteOrchestrationAction.Builder builder = OrchestratorActions.CompleteOrchestrationAction + OrchestratorActions.CompleteWorkflowAction.Builder builder = OrchestratorActions.CompleteWorkflowAction .newBuilder(); - builder.setOrchestrationStatus(runtimeStatus); + builder.setWorkflowStatus(runtimeStatus); if (rawOutput != null) { builder.setResult(StringValue.of(rawOutput)); @@ -986,10 +986,10 @@ private void completeInternal( } int id = this.sequenceNumber++; - OrchestratorActions.OrchestratorAction.Builder actionBuilder = OrchestratorActions.OrchestratorAction + OrchestratorActions.WorkflowAction.Builder actionBuilder = OrchestratorActions.WorkflowAction .newBuilder() .setId(id) - .setCompleteOrchestration(builder.build()); + .setCompleteWorkflow(builder.build()); // Add router to completion action for cross-app routing back to parent if (hasSourceAppId()) { @@ -1003,7 +1003,7 @@ private void completeInternal( this.isComplete = true; } - private void addCarryoverEvents(OrchestratorActions.CompleteOrchestrationAction.Builder builder) { + private void addCarryoverEvents(OrchestratorActions.CompleteWorkflowAction.Builder builder) { // Add historyEvent in the unprocessedEvents buffer // Add historyEvent in the new event list that haven't been added to the buffer. // We don't check the event in the pass event list to avoid duplicated events. @@ -1040,20 +1040,20 @@ private void processEvent(HistoryEvents.HistoryEvent e) { } else { this.logger.fine(() -> this.instanceId + ": Processing event: " + e.getEventTypeCase()); switch (e.getEventTypeCase()) { - case ORCHESTRATORSTARTED: + case WORKFLOWSTARTED: Instant instant = DataConverter.getInstantFromTimestamp(e.getTimestamp()); this.setCurrentInstant(instant); - if (StringUtils.isNotEmpty(e.getOrchestratorStarted().getVersion().getName())) { - this.orchestratorVersionName = e.getOrchestratorStarted().getVersion().getName(); + if (StringUtils.isNotEmpty(e.getWorkflowStarted().getVersion().getName())) { + this.orchestratorVersionName = e.getWorkflowStarted().getVersion().getName(); } - for (var patch : e.getOrchestratorStarted().getVersion().getPatchesList()) { + for (var patch : e.getWorkflowStarted().getVersion().getPatchesList()) { this.historyPatches.put(patch, true); } this.logger.fine(() -> this.instanceId + ": Workflow orchestrator started"); break; - case ORCHESTRATORCOMPLETED: + case WORKFLOWCOMPLETED: // No action needed this.logger.fine(() -> this.instanceId + ": Workflow orchestrator completed"); break; @@ -1061,7 +1061,7 @@ private void processEvent(HistoryEvents.HistoryEvent e) { HistoryEvents.ExecutionStartedEvent executionStarted = e.getExecutionStarted(); this.setName(executionStarted.getName()); this.setInput(executionStarted.getInput().getValue()); - this.setInstanceId(executionStarted.getOrchestrationInstance().getInstanceId()); + this.setInstanceId(executionStarted.getWorkflowInstance().getInstanceId()); this.logger.fine(() -> this.instanceId + ": Workflow execution started"); // For cross-app suborchestrations, if the router has a target, use that as our appID // since that's where we're actually executing @@ -1122,13 +1122,13 @@ private void processEvent(HistoryEvents.HistoryEvent e) { case TIMERFIRED: this.handleTimerFired(e); break; - case SUBORCHESTRATIONINSTANCECREATED: + case CHILDWORKFLOWINSTANCECREATED: this.handleSubOrchestrationCreated(e); break; - case SUBORCHESTRATIONINSTANCECOMPLETED: + case CHILDWORKFLOWINSTANCECOMPLETED: this.handleSubOrchestrationCompleted(e); break; - case SUBORCHESTRATIONINSTANCEFAILED: + case CHILDWORKFLOWINSTANCEFAILED: this.handleSubOrchestrationFailed(e); break; case EVENTRAISED: @@ -1149,14 +1149,14 @@ private void processEvent(HistoryEvents.HistoryEvent e) { public void setVersionNotRegistered() { this.pendingActions.clear(); - OrchestratorActions.CompleteOrchestrationAction.Builder builder = OrchestratorActions.CompleteOrchestrationAction + OrchestratorActions.CompleteWorkflowAction.Builder builder = OrchestratorActions.CompleteWorkflowAction .newBuilder(); - builder.setOrchestrationStatus(Orchestration.OrchestrationStatus.ORCHESTRATION_STATUS_STALLED); + builder.setWorkflowStatus(Orchestration.OrchestrationStatus.ORCHESTRATION_STATUS_STALLED); int id = this.sequenceNumber++; - OrchestratorActions.OrchestratorAction action = OrchestratorActions.OrchestratorAction.newBuilder() + OrchestratorActions.WorkflowAction action = OrchestratorActions.WorkflowAction.newBuilder() .setId(id) - .setCompleteOrchestration(builder.build()) + .setCompleteWorkflow(builder.build()) .build(); this.pendingActions.put(id, action); diff --git a/durabletask-client/src/main/java/io/dapr/durabletask/TaskOrchestratorResult.java b/durabletask-client/src/main/java/io/dapr/durabletask/TaskOrchestratorResult.java index 0e6d21d2e..35ea8b2f3 100644 --- a/durabletask-client/src/main/java/io/dapr/durabletask/TaskOrchestratorResult.java +++ b/durabletask-client/src/main/java/io/dapr/durabletask/TaskOrchestratorResult.java @@ -21,7 +21,7 @@ public final class TaskOrchestratorResult { - private final Collection actions; + private final Collection actions; private final String customStatus; @@ -37,7 +37,7 @@ public final class TaskOrchestratorResult { * @param version the orchestrator version * @param patches the patches to apply */ - public TaskOrchestratorResult(Collection actions, + public TaskOrchestratorResult(Collection actions, String customStatus, String version, List patches) { this.actions = Collections.unmodifiableCollection(actions); this.customStatus = customStatus; @@ -45,7 +45,7 @@ public TaskOrchestratorResult(Collection this.patches = patches; } - public Collection getActions() { + public Collection getActions() { return this.actions; } diff --git a/durabletask-client/src/main/java/io/dapr/durabletask/runner/ActivityRunner.java b/durabletask-client/src/main/java/io/dapr/durabletask/runner/ActivityRunner.java index be134c677..54407edd0 100644 --- a/durabletask-client/src/main/java/io/dapr/durabletask/runner/ActivityRunner.java +++ b/durabletask-client/src/main/java/io/dapr/durabletask/runner/ActivityRunner.java @@ -77,7 +77,7 @@ private void runWithTracing() { .setParent(parentContext) .setSpanKind(SpanKind.INTERNAL) .setAttribute("durabletask.task.instance_id", - activityRequest.getOrchestrationInstance().getInstanceId()) + activityRequest.getWorkflowInstance().getInstanceId()) .setAttribute("durabletask.task.id", activityRequest.getTaskId()) .setAttribute("durabletask.activity.name", activityRequest.getName()) .startSpan(); @@ -123,7 +123,7 @@ private void executeActivity() throws Throwable { OrchestratorService.ActivityResponse.Builder responseBuilder = OrchestratorService.ActivityResponse .newBuilder() - .setInstanceId(activityRequest.getOrchestrationInstance().getInstanceId()) + .setInstanceId(activityRequest.getWorkflowInstance().getInstanceId()) .setTaskId(activityRequest.getTaskId()) .setCompletionToken(workItem.getCompletionToken()); diff --git a/durabletask-client/src/main/java/io/dapr/durabletask/runner/OrchestratorRunner.java b/durabletask-client/src/main/java/io/dapr/durabletask/runner/OrchestratorRunner.java index eb7515a04..f98bb5052 100644 --- a/durabletask-client/src/main/java/io/dapr/durabletask/runner/OrchestratorRunner.java +++ b/durabletask-client/src/main/java/io/dapr/durabletask/runner/OrchestratorRunner.java @@ -31,7 +31,7 @@ public class OrchestratorRunner extends DurableRunner { private static final Logger logger = Logger.getLogger(OrchestratorRunner.class.getPackage().getName()); - private final OrchestratorService.OrchestratorRequest orchestratorRequest; + private final OrchestratorService.WorkflowRequest orchestratorRequest; private final TaskOrchestrationExecutor taskOrchestrationExecutor; /** @@ -49,7 +49,7 @@ public OrchestratorRunner( @Nullable Tracer tracer) { super(workItem, sidecarClient, tracer); - this.orchestratorRequest = workItem.getOrchestratorRequest(); + this.orchestratorRequest = workItem.getWorkflowRequest(); this.taskOrchestrationExecutor = taskOrchestrationExecutor; } @@ -59,7 +59,7 @@ public void run() { orchestratorRequest.getPastEventsList(), orchestratorRequest.getNewEventsList()); - var versionBuilder = Orchestration.OrchestrationVersion.newBuilder(); + var versionBuilder = Orchestration.WorkflowVersion.newBuilder(); if (StringUtils.isNotEmpty(taskOrchestratorResult.getVersion())) { versionBuilder.setName(taskOrchestratorResult.getVersion()); @@ -69,7 +69,7 @@ public void run() { versionBuilder.addAllPatches(taskOrchestratorResult.getPatches()); } - OrchestratorService.OrchestratorResponse response = OrchestratorService.OrchestratorResponse.newBuilder() + OrchestratorService.WorkflowResponse response = OrchestratorService.WorkflowResponse.newBuilder() .setInstanceId(orchestratorRequest.getInstanceId()) .addAllActions(taskOrchestratorResult.getActions()) .setCustomStatus(StringValue.of(taskOrchestratorResult.getCustomStatus())) diff --git a/durabletask-client/src/test/java/io/dapr/durabletask/SubOrchestrationCrossAppTest.java b/durabletask-client/src/test/java/io/dapr/durabletask/SubOrchestrationCrossAppTest.java index dc51716eb..9ed6bb47e 100644 --- a/durabletask-client/src/test/java/io/dapr/durabletask/SubOrchestrationCrossAppTest.java +++ b/durabletask-client/src/test/java/io/dapr/durabletask/SubOrchestrationCrossAppTest.java @@ -44,7 +44,7 @@ private static HistoryEvents.HistoryEvent orchestratorStarted() { return HistoryEvents.HistoryEvent.newBuilder() .setEventId(-1) .setTimestamp(Timestamp.newBuilder().setSeconds(1000).build()) - .setOrchestratorStarted(HistoryEvents.OrchestratorStartedEvent.newBuilder().build()) + .setWorkflowStarted(HistoryEvents.WorkflowStartedEvent.newBuilder().build()) .build(); } @@ -56,8 +56,8 @@ private static HistoryEvents.HistoryEvent executionStarted( HistoryEvents.ExecutionStartedEvent.Builder esBuilder = HistoryEvents.ExecutionStartedEvent .newBuilder() .setName(name) - .setOrchestrationInstance( - Orchestration.OrchestrationInstance.newBuilder().setInstanceId(instanceId).build()) + .setWorkflowInstance( + Orchestration.WorkflowInstance.newBuilder().setInstanceId(instanceId).build()) .setInput(StringValue.of(input)); HistoryEvents.HistoryEvent.Builder builder = HistoryEvents.HistoryEvent.newBuilder() @@ -79,7 +79,7 @@ private static HistoryEvents.HistoryEvent orchestratorCompleted() { return HistoryEvents.HistoryEvent.newBuilder() .setEventId(-1) .setTimestamp(Timestamp.newBuilder().setSeconds(1000).build()) - .setOrchestratorCompleted(HistoryEvents.OrchestratorCompletedEvent.newBuilder().build()) + .setWorkflowCompleted(HistoryEvents.WorkflowCompletedEvent.newBuilder().build()) .build(); } @@ -145,14 +145,14 @@ void callSubOrchestrator_withTargetAppId_setsRouterOnAction() { TaskOrchestratorResult result = executor.execute(new ArrayList<>(), newEvents); // There should be a CreateSubOrchestration action - List actions = new ArrayList<>(result.getActions()); + List actions = new ArrayList<>(result.getActions()); assertEquals(1, actions.size()); - OrchestratorActions.OrchestratorAction action = actions.get(0); - assertTrue(action.hasCreateSubOrchestration()); + OrchestratorActions.WorkflowAction action = actions.get(0); + assertTrue(action.hasCreateChildWorkflow()); // Verify the CreateSubOrchestrationAction has the router - OrchestratorActions.CreateSubOrchestrationAction createSub = action.getCreateSubOrchestration(); + OrchestratorActions.CreateChildWorkflowAction createSub = action.getCreateChildWorkflow(); assertEquals(subOrchestratorName, createSub.getName()); assertEquals("child-instance-1", createSub.getInstanceId()); assertTrue(createSub.hasRouter()); @@ -192,14 +192,14 @@ void callSubOrchestrator_withoutTargetAppId_setsRouterWithSourceOnly() { TaskOrchestratorResult result = executor.execute(new ArrayList<>(), newEvents); - List actions = new ArrayList<>(result.getActions()); + List actions = new ArrayList<>(result.getActions()); assertEquals(1, actions.size()); - OrchestratorActions.OrchestratorAction action = actions.get(0); - assertTrue(action.hasCreateSubOrchestration()); + OrchestratorActions.WorkflowAction action = actions.get(0); + assertTrue(action.hasCreateChildWorkflow()); // Router should have source only, no target - OrchestratorActions.CreateSubOrchestrationAction createSub = action.getCreateSubOrchestration(); + OrchestratorActions.CreateChildWorkflowAction createSub = action.getCreateChildWorkflow(); assertTrue(createSub.hasRouter()); assertEquals(sourceAppId, createSub.getRouter().getSourceAppID()); assertFalse(createSub.getRouter().hasTargetAppID()); @@ -232,14 +232,14 @@ void callSubOrchestrator_withNullAppId_noRouterSet() { TaskOrchestratorResult result = executor.execute(new ArrayList<>(), newEvents); - List actions = new ArrayList<>(result.getActions()); + List actions = new ArrayList<>(result.getActions()); assertEquals(1, actions.size()); - OrchestratorActions.OrchestratorAction action = actions.get(0); - assertTrue(action.hasCreateSubOrchestration()); + OrchestratorActions.WorkflowAction action = actions.get(0); + assertTrue(action.hasCreateChildWorkflow()); // No router should be set when appId is null - OrchestratorActions.CreateSubOrchestrationAction createSub = action.getCreateSubOrchestration(); + OrchestratorActions.CreateChildWorkflowAction createSub = action.getCreateChildWorkflow(); assertFalse(createSub.hasRouter()); assertFalse(action.hasRouter()); } @@ -365,13 +365,13 @@ void completeOrchestration_withAppId_setsRouterOnCompletionAction() { TaskOrchestratorResult result = executor.execute(new ArrayList<>(), newEvents); - List actions = new ArrayList<>(result.getActions()); + List actions = new ArrayList<>(result.getActions()); assertEquals(1, actions.size()); - OrchestratorActions.OrchestratorAction action = actions.get(0); - assertTrue(action.hasCompleteOrchestration()); + OrchestratorActions.WorkflowAction action = actions.get(0); + assertTrue(action.hasCompleteWorkflow()); assertEquals(Orchestration.OrchestrationStatus.ORCHESTRATION_STATUS_COMPLETED, - action.getCompleteOrchestration().getOrchestrationStatus()); + action.getCompleteWorkflow().getWorkflowStatus()); // The completion action should have a router with source appId assertTrue(action.hasRouter()); @@ -398,11 +398,11 @@ void completeOrchestration_withNullAppId_noRouterOnCompletionAction() { TaskOrchestratorResult result = executor.execute(new ArrayList<>(), newEvents); - List actions = new ArrayList<>(result.getActions()); + List actions = new ArrayList<>(result.getActions()); assertEquals(1, actions.size()); - OrchestratorActions.OrchestratorAction action = actions.get(0); - assertTrue(action.hasCompleteOrchestration()); + OrchestratorActions.WorkflowAction action = actions.get(0); + assertTrue(action.hasCompleteWorkflow()); // No router should be set assertFalse(action.hasRouter()); @@ -435,11 +435,11 @@ void completeOrchestration_crossAppSubOrchestrator_routerHasTargetDerivedAppId() TaskOrchestratorResult result = executor.execute(new ArrayList<>(), newEvents); - List actions = new ArrayList<>(result.getActions()); + List actions = new ArrayList<>(result.getActions()); assertEquals(1, actions.size()); - OrchestratorActions.OrchestratorAction action = actions.get(0); - assertTrue(action.hasCompleteOrchestration()); + OrchestratorActions.WorkflowAction action = actions.get(0); + assertTrue(action.hasCompleteWorkflow()); // The router source should be the target app (since that's where we're executing) assertTrue(action.hasRouter()); @@ -478,14 +478,14 @@ void crossAppSubOrchestration_fullFlow_routersCorrectlySet() { TaskOrchestratorResult result = executor.execute(new ArrayList<>(), newEvents); - List actions = new ArrayList<>(result.getActions()); + List actions = new ArrayList<>(result.getActions()); // Should have 1 action: CreateSubOrchestration assertEquals(1, actions.size()); - OrchestratorActions.OrchestratorAction subAction = actions.get(0); - assertTrue(subAction.hasCreateSubOrchestration()); + OrchestratorActions.WorkflowAction subAction = actions.get(0); + assertTrue(subAction.hasCreateChildWorkflow()); - OrchestratorActions.CreateSubOrchestrationAction createSub = subAction.getCreateSubOrchestration(); + OrchestratorActions.CreateChildWorkflowAction createSub = subAction.getCreateChildWorkflow(); assertEquals(subOrchestratorName, createSub.getName()); assertEquals("child-id-1", createSub.getInstanceId()); @@ -520,14 +520,14 @@ void callSubOrchestrator_withEmptyAppId_noRouterSet() { TaskOrchestratorResult result = executor.execute(new ArrayList<>(), newEvents); - List actions = new ArrayList<>(result.getActions()); + List actions = new ArrayList<>(result.getActions()); assertEquals(1, actions.size()); - OrchestratorActions.OrchestratorAction action = actions.get(0); - assertTrue(action.hasCreateSubOrchestration()); + OrchestratorActions.WorkflowAction action = actions.get(0); + assertTrue(action.hasCreateChildWorkflow()); // No router should be set when appId is empty - assertFalse(action.getCreateSubOrchestration().hasRouter()); + assertFalse(action.getCreateChildWorkflow().hasRouter()); assertFalse(action.hasRouter()); } @@ -563,13 +563,13 @@ void callSubOrchestrator_withRetryPolicyAndAppId_setsRouterAndRetries() { // With RetriableTask the first attempt creates the action; we should still see // the sub-orchestration action with cross-app routing - List actions = new ArrayList<>(result.getActions()); + List actions = new ArrayList<>(result.getActions()); assertTrue(actions.size() >= 1); - OrchestratorActions.OrchestratorAction action = actions.get(0); - assertTrue(action.hasCreateSubOrchestration()); + OrchestratorActions.WorkflowAction action = actions.get(0); + assertTrue(action.hasCreateChildWorkflow()); - OrchestratorActions.CreateSubOrchestrationAction createSub = action.getCreateSubOrchestration(); + OrchestratorActions.CreateChildWorkflowAction createSub = action.getCreateChildWorkflow(); assertTrue(createSub.hasRouter()); assertEquals(sourceAppId, createSub.getRouter().getSourceAppID()); assertEquals(targetAppId, createSub.getRouter().getTargetAppID());