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 /plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test | |
parent | 9f17d75f75dd087a58822dcc5aa2821267aa2193 (diff) | |
parent | 153ad0056c3928116d28eb7e1bb14c4a04a76fc2 (diff) |
Merge "replace test sleep() with awaitality package"
Diffstat (limited to 'plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test')
2 files changed, 6 insertions, 6 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumerTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumerTest.java index 46390f9d6..0c6067a75 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumerTest.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/ApexRestRequestorConsumerTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications 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. @@ -21,11 +21,13 @@ package org.onap.policy.apex.plugins.event.carrier.restrequestor; +import static org.awaitility.Awaitility.await; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; import java.util.Properties; +import java.util.concurrent.TimeUnit; import org.junit.Test; import org.onap.policy.apex.core.infrastructure.threading.ThreadUtilities; @@ -126,7 +128,7 @@ public class ApexRestRequestorConsumerTest { consumer.start(); ApexRestRequest request = new ApexRestRequest(123, null, EVENT_NAME, EVENT_BODY); consumer.processRestRequest(request); - ThreadUtilities.sleep(200); + await().atMost(200, TimeUnit.MILLISECONDS).until(() -> consumer.getEventsReceived() == 0); consumer.stop(); assertEquals(0, consumer.getEventsReceived()); } @@ -152,7 +154,7 @@ public class ApexRestRequestorConsumerTest { consumer.start(); ApexRestRequest request = new ApexRestRequest(123, properties, EVENT_NAME, EVENT_BODY); consumer.processRestRequest(request); - ThreadUtilities.sleep(2000); + await().atMost(2000, TimeUnit.MILLISECONDS).until(() -> consumer.getEventsReceived() == 0); consumer.stop(); assertEquals(0, consumer.getEventsReceived()); } diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorTest.java index a650d796f..55baf3cf7 100644 --- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorTest.java +++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-restrequestor/src/test/java/org/onap/policy/apex/plugins/event/carrier/restrequestor/RestRequestorTest.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2019 Nordix Foundation. + * Modifications 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. @@ -365,8 +365,6 @@ public class RestRequestorTest { client.close(); assertEquals(Double.valueOf(8.0), getsSoFar); - - ThreadUtilities.sleep(1000); } /** |