@@ -114,7 +114,7 @@ public class WorkflowTest {
114
114
*/
115
115
private static final boolean DEBUGGER_TIMEOUTS = false ;
116
116
117
- public static final String ANNOTATION_TASK_LIST = "WorkflowTest-testExecute[Docker]" ;
117
+ private static final String ANNOTATION_TASK_LIST = "WorkflowTest-testExecute[Docker]" ;
118
118
119
119
private TracingWorkflowInterceptorFactory tracer ;
120
120
private static final boolean useDockerService =
@@ -3733,6 +3733,58 @@ public void testGetVersion() {
3733
3733
"executeActivity customActivity1" );
3734
3734
}
3735
3735
3736
+ static CompletableFuture <Boolean > executionStarted = new CompletableFuture <>();
3737
+ public static class TestGetVersionWithoutDecisionEventWorkflowImpl implements TestWorkflowSignaled {
3738
+
3739
+ CompletablePromise <Boolean > signalReceived = Workflow .newPromise ();
3740
+
3741
+ @ Override
3742
+ public String execute () {
3743
+ try {
3744
+ if (!getVersionExecuted .contains ("getVersionWithoutDecisionEvent" )) {
3745
+ // Execute getVersion in non-replay mode.
3746
+ getVersionExecuted .add ("getVersionWithoutDecisionEvent" );
3747
+ executionStarted .complete (true );
3748
+ signalReceived .get ();
3749
+ } else {
3750
+ // Execute getVersion in replay mode. In this case we have no decision event, only a signal.
3751
+ int version = Workflow .getVersion ("test_change" , Workflow .DEFAULT_VERSION , 1 );
3752
+ if (version == Workflow .DEFAULT_VERSION ) {
3753
+ signalReceived .get ();
3754
+ return "result 1" ;
3755
+ } else {
3756
+ return "result 2" ;
3757
+ }
3758
+ }
3759
+ } catch (Exception e ) {
3760
+ throw new RuntimeException ("failed to get from signal" );
3761
+ }
3762
+
3763
+ throw new RuntimeException ("unreachable" );
3764
+ }
3765
+
3766
+ @ Override
3767
+ public void signal1 (String arg ) {
3768
+ signalReceived .complete (true );
3769
+ }
3770
+ }
3771
+
3772
+ @ Test
3773
+ public void testGetVersionWithoutDecisionEvent () throws Exception {
3774
+ Assume .assumeTrue ("skipping as there will be no replay" , disableStickyExecution );
3775
+ executionStarted = new CompletableFuture <>();
3776
+ getVersionExecuted .remove ("getVersionWithoutDecisionEvent" );
3777
+ startWorkerFor (TestGetVersionWithoutDecisionEventWorkflowImpl .class );
3778
+ TestWorkflowSignaled workflowStub =
3779
+ workflowClient .newWorkflowStub (
3780
+ TestWorkflowSignaled .class , newWorkflowOptionsBuilder (taskList ).build ());
3781
+ WorkflowClient .start (workflowStub ::execute );
3782
+ executionStarted .get ();
3783
+ workflowStub .signal1 ("test signal" );
3784
+ String result = workflowStub .execute ();
3785
+ assertEquals ("result 1" , result );
3786
+ }
3787
+
3736
3788
// The following test covers the scenario where getVersion call is removed before a
3737
3789
// non-version-marker decision.
3738
3790
public static class TestGetVersionRemovedInReplayWorkflowImpl implements TestWorkflow1 {
0 commit comments