66import com .google .protobuf .util .Durations ;
77import io .temporal .api .command .v1 .*;
88import io .temporal .api .common .v1 .*;
9+ import io .temporal .api .common .v1 .Link ;
910import io .temporal .api .enums .v1 .CommandType ;
1011import io .temporal .api .enums .v1 .EventType ;
1112import io .temporal .api .enums .v1 .TaskQueueKind ;
@@ -121,6 +122,10 @@ public void testNexusOperationAsyncCompletion() {
121122
122123 // Manually start handler WF with callback
123124 TaskQueue handlerWFTaskQueue = TaskQueue .newBuilder ().setName ("nexus-handler-tq" ).build ();
125+ List <Link > links =
126+ startReq .getStartOperation ().getLinksList ().stream ()
127+ .map (LinkConverter ::nexusLinkToWorkflowEvent )
128+ .collect (Collectors .toList ());
124129 testWorkflowRule
125130 .getWorkflowClient ()
126131 .getWorkflowServiceStubs ()
@@ -135,12 +140,10 @@ public void testNexusOperationAsyncCompletion() {
135140 .setTaskQueue (handlerWFTaskQueue )
136141 .setInput (Payloads .newBuilder ().addPayloads (defaultInput ))
137142 .setIdentity ("test" )
138- .addAllLinks (
139- startReq .getStartOperation ().getLinksList ().stream ()
140- .map (LinkConverter ::nexusLinkToWorkflowEvent )
141- .collect (Collectors .toList ()))
143+ .addAllLinks (links )
142144 .addCompletionCallbacks (
143145 Callback .newBuilder ()
146+ .addAllLinks (links )
144147 .setNexus (
145148 Callback .Nexus .newBuilder ()
146149 .setUrl (startReq .getStartOperation ().getCallback ())
@@ -196,6 +199,10 @@ public void testNexusOperationAsyncCompletionBeforeStart() {
196199
197200 // Manually start handler WF with callback
198201 TaskQueue handlerWFTaskQueue = TaskQueue .newBuilder ().setName ("nexus-handler-tq" ).build ();
202+ List <Link > links =
203+ startReq .getStartOperation ().getLinksList ().stream ()
204+ .map (LinkConverter ::nexusLinkToWorkflowEvent )
205+ .collect (Collectors .toList ());
199206 testWorkflowRule
200207 .getWorkflowClient ()
201208 .getWorkflowServiceStubs ()
@@ -209,12 +216,10 @@ public void testNexusOperationAsyncCompletionBeforeStart() {
209216 .setTaskQueue (handlerWFTaskQueue )
210217 .setInput (Payloads .newBuilder ().addPayloads (defaultInput ))
211218 .setIdentity ("test" )
212- .addAllLinks (
213- startReq .getStartOperation ().getLinksList ().stream ()
214- .map (LinkConverter ::nexusLinkToWorkflowEvent )
215- .collect (Collectors .toList ()))
219+ .addAllLinks (links )
216220 .addCompletionCallbacks (
217221 Callback .newBuilder ()
222+ .addAllLinks (links )
218223 .setNexus (
219224 Callback .Nexus .newBuilder ()
220225 .setUrl (startReq .getStartOperation ().getCallback ())
@@ -261,6 +266,10 @@ public void testNexusOperationAsyncHandlerCanceled() {
261266
262267 // Manually start handler WF with callback
263268 TaskQueue handlerWFTaskQueue = TaskQueue .newBuilder ().setName ("nexus-handler-tq" ).build ();
269+ List <Link > links =
270+ startReq .getStartOperation ().getLinksList ().stream ()
271+ .map (LinkConverter ::nexusLinkToWorkflowEvent )
272+ .collect (Collectors .toList ());
264273 StartWorkflowExecutionResponse startResp =
265274 testWorkflowRule
266275 .getWorkflowClient ()
@@ -276,12 +285,10 @@ public void testNexusOperationAsyncHandlerCanceled() {
276285 .setTaskQueue (handlerWFTaskQueue )
277286 .setInput (Payloads .newBuilder ().addPayloads (defaultInput ))
278287 .setIdentity ("test" )
279- .addAllLinks (
280- startReq .getStartOperation ().getLinksList ().stream ()
281- .map (LinkConverter ::nexusLinkToWorkflowEvent )
282- .collect (Collectors .toList ()))
288+ .addAllLinks (links )
283289 .addCompletionCallbacks (
284290 Callback .newBuilder ()
291+ .addAllLinks (links )
285292 .setNexus (
286293 Callback .Nexus .newBuilder ()
287294 .setUrl (startReq .getStartOperation ().getCallback ())
@@ -367,6 +374,10 @@ public void testNexusOperationAsyncHandlerTerminated() {
367374
368375 // Manually start handler WF with callback
369376 TaskQueue handlerWFTaskQueue = TaskQueue .newBuilder ().setName ("nexus-handler-tq" ).build ();
377+ List <Link > links =
378+ startReq .getStartOperation ().getLinksList ().stream ()
379+ .map (LinkConverter ::nexusLinkToWorkflowEvent )
380+ .collect (Collectors .toList ());
370381 StartWorkflowExecutionResponse startResp =
371382 testWorkflowRule
372383 .getWorkflowClient ()
@@ -382,12 +393,10 @@ public void testNexusOperationAsyncHandlerTerminated() {
382393 .setTaskQueue (handlerWFTaskQueue )
383394 .setInput (Payloads .newBuilder ().addPayloads (defaultInput ))
384395 .setIdentity ("test" )
385- .addAllLinks (
386- startReq .getStartOperation ().getLinksList ().stream ()
387- .map (LinkConverter ::nexusLinkToWorkflowEvent )
388- .collect (Collectors .toList ()))
396+ .addAllLinks (links )
389397 .addCompletionCallbacks (
390398 Callback .newBuilder ()
399+ .addAllLinks (links )
391400 .setNexus (
392401 Callback .Nexus .newBuilder ()
393402 .setUrl (startReq .getStartOperation ().getCallback ())
@@ -463,6 +472,10 @@ public void testNexusOperationAsyncHandlerTimeout() {
463472
464473 // Manually start handler WF with callback
465474 TaskQueue handlerWFTaskQueue = TaskQueue .newBuilder ().setName ("nexus-handler-tq" ).build ();
475+ List <Link > links =
476+ startReq .getStartOperation ().getLinksList ().stream ()
477+ .map (LinkConverter ::nexusLinkToWorkflowEvent )
478+ .collect (Collectors .toList ());
466479 testWorkflowRule
467480 .getWorkflowClient ()
468481 .getWorkflowServiceStubs ()
@@ -478,12 +491,10 @@ public void testNexusOperationAsyncHandlerTimeout() {
478491 .setInput (Payloads .newBuilder ().addPayloads (defaultInput ))
479492 .setWorkflowRunTimeout (Durations .fromSeconds (1 ))
480493 .setIdentity ("test" )
481- .addAllLinks (
482- startReq .getStartOperation ().getLinksList ().stream ()
483- .map (LinkConverter ::nexusLinkToWorkflowEvent )
484- .collect (Collectors .toList ()))
494+ .addAllLinks (links )
485495 .addCompletionCallbacks (
486496 Callback .newBuilder ()
497+ .addAllLinks (links )
487498 .setNexus (
488499 Callback .Nexus .newBuilder ()
489500 .setUrl (startReq .getStartOperation ().getCallback ())
0 commit comments