JAMES-2264 Correct TaskRoute test synchronisation
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/21a63331 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/21a63331 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/21a63331 Branch: refs/heads/master Commit: 21a633311c7713cfcaf36f4b0b8d1152b13e558e Parents: 90bdf71 Author: benwa <[email protected]> Authored: Thu Feb 1 11:50:12 2018 +0700 Committer: benwa <[email protected]> Committed: Thu Feb 1 17:42:29 2018 +0700 ---------------------------------------------------------------------- .../apache/james/webadmin/routes/TasksRoutesTest.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/21a63331/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 4317035..486b0b8 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 @@ -112,12 +112,16 @@ public class TasksRoutesTest { } @Test - public void listShouldListTaskWhenStatusFilter() { + public void listShouldListTaskWhenStatusFilter() throws Exception { + CountDownLatch inProgressLatch = new CountDownLatch(1); TaskId taskId = taskManager.submit(() -> { + inProgressLatch.countDown(); await(); return Task.Result.COMPLETED; }); + inProgressLatch.await(); + given() .param("status", TaskManager.Status.IN_PROGRESS.getValue()) .when() @@ -151,12 +155,16 @@ public class TasksRoutesTest { } @Test - public void getShouldReturnTaskDetails() { + public void getShouldReturnTaskDetails() throws Exception { + CountDownLatch inProgressLatch = new CountDownLatch(1); TaskId taskId = taskManager.submit(() -> { + inProgressLatch.countDown(); await(); return Task.Result.COMPLETED; }); + inProgressLatch.await(); + when() .get("/" + taskId.getValue()) .then() --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
