JAMES-2272 Fix a webadmin Task test Sometime, read was performed while the task was still waiting
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/19308d4d Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/19308d4d Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/19308d4d Branch: refs/heads/master Commit: 19308d4d7f7a33528acd0ae9293cfe362c2d2781 Parents: 6d7f60e Author: benwa <[email protected]> Authored: Fri Jan 19 10:36:34 2018 +0700 Committer: benwa <[email protected]> Committed: Fri Jan 19 10:36:34 2018 +0700 ---------------------------------------------------------------------- .../java/org/apache/james/webadmin/routes/TasksRoutesTest.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/19308d4d/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/TasksRoutesTest.java ---------------------------------------------------------------------- diff --git a/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/TasksRoutesTest.java b/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/TasksRoutesTest.java index 5403349..cc18b42 100644 --- a/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/TasksRoutesTest.java +++ b/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/TasksRoutesTest.java @@ -92,12 +92,16 @@ public class TasksRoutesTest { } @Test - public void listShouldReturnTaskDetailsWhenTaskInProgress() { + public void listShouldReturnTaskDetailsWhenTaskInProgress() throws Exception { + CountDownLatch taskInProgressLatch = new CountDownLatch(1); TaskId taskId = taskManager.submit(() -> { + taskInProgressLatch.countDown(); await(); return Task.Result.COMPLETED; }); + taskInProgressLatch.await(); + when() .get() .then() --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
