File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
src/test/java/com/uber/cadence/workflow Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -445,6 +445,31 @@ public void testWorkflowCancellation() {
445
445
}
446
446
}
447
447
448
+ public static class TestCancellationScopePromise implements TestWorkflow1 {
449
+
450
+ @ Override
451
+ public String execute (String taskList ) {
452
+ Promise <String > cancellationRequest = CancellationScope .current ().getCancellationRequest ();
453
+ cancellationRequest .get ();
454
+ return "done" ;
455
+ }
456
+ }
457
+
458
+ @ Test
459
+ public void testWorkflowCancellationScopePromise () {
460
+ startWorkerFor (TestCancellationScopePromise .class );
461
+ UntypedWorkflowStub client =
462
+ workflowClient .newUntypedWorkflowStub (
463
+ "TestWorkflow1::execute" , newWorkflowOptionsBuilder (taskList ).build ());
464
+ client .start (taskList );
465
+ client .cancel ();
466
+ try {
467
+ client .getResult (String .class );
468
+ fail ("unreachable" );
469
+ } catch (CancellationException ignored ) {
470
+ }
471
+ }
472
+
448
473
public static class TestDetachedCancellationScope implements TestWorkflow1 {
449
474
450
475
@ Override
You can’t perform that action at this time.
0 commit comments