summaryrefslogtreecommitdiffstats
path: root/services/services-engine
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2020-04-06 15:41:28 +0100
committerliamfallon <liam.fallon@est.tech>2020-04-06 18:44:17 +0100
commit69c227a9f1d91268fbd91471b012af38fba8b857 (patch)
tree6d950f8c4f7b54f8348dc7960e982a8dd26feee3 /services/services-engine
parente1085f59c1ecd68de574391dc490973abd72a731 (diff)
Fix intermittent unit test failures WebSocket
The Web Socket server is marked as started before the start process has complted. This change fixes that issue. Issue-ID: POLICY-1470 Change-Id: I5b5ef5832893d884a6551b0516df91cb71d6c622 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'services/services-engine')
-rw-r--r--services/services-engine/pom.xml7
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/engdep/EngDepMessagingServiceTest.java15
2 files changed, 15 insertions, 7 deletions
diff --git a/services/services-engine/pom.xml b/services/services-engine/pom.xml
index 23858a06e..3748097b2 100644
--- a/services/services-engine/pom.xml
+++ b/services/services-engine/pom.xml
@@ -1,7 +1,7 @@
<!--
============LICENSE_START=======================================================
Copyright (C) 2018 Ericsson. All rights reserved.
- 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.
@@ -64,6 +64,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.awaitility</groupId>
+ <artifactId>awaitility</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.onap.policy.models</groupId>
<artifactId>policy-models-pdp</artifactId>
<exclusions>
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/engdep/EngDepMessagingServiceTest.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/engdep/EngDepMessagingServiceTest.java
index 901cbeac4..42a3a55d8 100644
--- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/engdep/EngDepMessagingServiceTest.java
+++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/engdep/EngDepMessagingServiceTest.java
@@ -1,27 +1,30 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
+ * Modifications Copyright (C) 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
package org.onap.policy.apex.service.engine.engdep;
+import static org.awaitility.Awaitility.await;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+
+import java.util.concurrent.TimeUnit;
import org.junit.Before;
import org.junit.Test;
@@ -56,10 +59,10 @@ public class EngDepMessagingServiceTest {
@Test
public void testStartStop() throws ApexException {
edMessagingService.start();
- assertTrue(edMessagingService.isStarted());
+ await().atMost(1, TimeUnit.SECONDS).until(() -> edMessagingService.isStarted());
assertFalse(edMessagingService.isStopped());
edMessagingService.stop();
- assertTrue(edMessagingService.isStopped());
+ await().atMost(1, TimeUnit.SECONDS).until(() -> edMessagingService.isStopped());
assertFalse(edMessagingService.isStarted());
}
}