From 6c6b7b78d6255d27d36d88edd0ba90d741118995 Mon Sep 17 00:00:00 2001 From: Mateusz Warowny Date: Thu, 6 Jul 2023 15:56:38 +0200 Subject: [PATCH] JAL-4199 Patch task execution in action tests --- test/jalview/ws2/actions/alignment/AlignmentActionTest.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/jalview/ws2/actions/alignment/AlignmentActionTest.java b/test/jalview/ws2/actions/alignment/AlignmentActionTest.java index 5586108..e573032 100644 --- a/test/jalview/ws2/actions/alignment/AlignmentActionTest.java +++ b/test/jalview/ws2/actions/alignment/AlignmentActionTest.java @@ -24,6 +24,7 @@ import jalview.datamodel.SequenceI; import jalview.gui.AlignViewport; import jalview.viewmodel.AlignmentViewport; import jalview.ws.params.ParamDatastoreI; +import jalview.ws2.actions.PollingTaskExecutor; import jalview.ws2.actions.api.JobI; import jalview.ws2.actions.api.TaskEventListener; import jalview.ws2.api.Credentials; @@ -210,12 +211,16 @@ public class AlignmentActionTest return null; }) .when(listener).taskCompleted(any(), any()); - action.perform(viewport, List.of(), Credentials.empty(), listener); + var executor = PollingTaskExecutor.fromPool(viewport.getServiceExecutor()); + var task = action.createTask(viewport, List.of(), Credentials.empty()); + task.addTaskEventListener(listener); + var cancellable = executor.submit(task); try { latch.await(100, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { + cancellable.cancel(true); } return listener; } -- 1.7.10.2