diff options
author | Liam Fallon <liam.fallon@est.tech> | 2020-03-04 13:32:27 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-03-04 13:32:27 +0000 |
commit | a9b60303e7e3699cc4df904144592ea6a9b6c586 (patch) | |
tree | 1b710f2f899598d3032a6485db54c2e4a8cc92a2 /client/client-full | |
parent | 9f17d75f75dd087a58822dcc5aa2821267aa2193 (diff) | |
parent | 153ad0056c3928116d28eb7e1bb14c4a04a76fc2 (diff) |
Merge "replace test sleep() with awaitality package"
Diffstat (limited to 'client/client-full')
-rw-r--r-- | client/client-full/src/test/java/org/onap/policy/apex/client/full/rest/ServicesRestMainTest.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/client/client-full/src/test/java/org/onap/policy/apex/client/full/rest/ServicesRestMainTest.java b/client/client-full/src/test/java/org/onap/policy/apex/client/full/rest/ServicesRestMainTest.java index 1c5c440b4..3e21ee595 100644 --- a/client/client-full/src/test/java/org/onap/policy/apex/client/full/rest/ServicesRestMainTest.java +++ b/client/client-full/src/test/java/org/onap/policy/apex/client/full/rest/ServicesRestMainTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-2020 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,14 +23,16 @@ package org.onap.policy.apex.client.full.rest; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.catchThrowable; +import static org.awaitility.Awaitility.await; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; import java.io.PrintStream; +import java.util.concurrent.TimeUnit; + import org.junit.After; import org.junit.Test; -import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; /** * Test the periodic event manager utility. @@ -189,7 +191,8 @@ public class ServicesRestMainTest { assertThatCode(() -> { monThread.start(); - ThreadUtilities.sleep(2000); + await().atMost(6, TimeUnit.SECONDS).until( + () -> monRestMain.getState().equals(ApexServicesRestMain.EditorState.RUNNING)); monRestMain.shutdown(); }).doesNotThrowAnyException(); } |