From 633c8e32702db13c28349152c76efea8e97fb252 Mon Sep 17 00:00:00 2001 From: PatrikBuhr Date: Thu, 26 Aug 2021 10:47:27 +0200 Subject: Bugfix, timing issue in a unittest Issue-ID: CCSDK-3421 Signed-off-by: PatrikBuhr Change-Id: I66bec17ab17d189740c50d6cc8af473b5a0fbbd4 --- .../controllers/v2/ApplicationTest.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'a1-policy-management') diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java index e31d0b91..08350f81 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java @@ -275,8 +275,8 @@ class ApplicationTest { assertThat(addedRic.getSupportedPolicyTypes().iterator().next().getId()).isEqualTo(TYPE); // Check that a service callback for the AVAILABLE RIC is invoked - RappSimulatorController.TestResults receivedCallbacks = rAppSimulator.getTestResults(); - assertThat(receivedCallbacks.getReceivedInfo().size()).isEqualTo(1); + final RappSimulatorController.TestResults receivedCallbacks = rAppSimulator.getTestResults(); + await().untilAsserted(() -> assertThat(receivedCallbacks.getReceivedInfo().size()).isEqualTo(1)); ServiceCallbackInfo callbackInfo = receivedCallbacks.getReceivedInfo().get(0); assertThat(callbackInfo.ricId).isEqualTo(RIC); assertThat(callbackInfo.eventType).isEqualTo(ServiceCallbackInfo.EventType.AVAILABLE); @@ -297,15 +297,15 @@ class ApplicationTest { waitForRicState(RIC, RicState.UNAVAILABLE); // Check that no service callback for the UNAVAILABLE RIC is invoked - RappSimulatorController.TestResults receivedCallbacks = rAppSimulator.getTestResults(); - assertThat(receivedCallbacks.getReceivedInfo()).isEmpty(); + final RappSimulatorController.TestResults receivedCallbacks = rAppSimulator.getTestResults(); + await().untilAsserted(() -> assertThat(receivedCallbacks.getReceivedInfo()).isEmpty()); // Run a synch and check that the AVAILABLE notification is received a1ClientFactory.reset(); supervision.checkAllRics(); waitForRicState(RIC, RicState.AVAILABLE); - receivedCallbacks = rAppSimulator.getTestResults(); - assertThat(receivedCallbacks.getReceivedInfo().size()).isEqualTo(1); + + await().untilAsserted(() -> assertThat(receivedCallbacks.getReceivedInfo().size()).isEqualTo(1)); } @Test @@ -787,8 +787,8 @@ class ApplicationTest { supervision.checkAllRics(); waitForRicState("ric1", RicState.AVAILABLE); - RappSimulatorController.TestResults receivedCallbacks = rAppSimulator.getTestResults(); - assertThat(receivedCallbacks.getReceivedInfo().size()).isEqualTo(1); + final RappSimulatorController.TestResults receivedCallbacks = rAppSimulator.getTestResults(); + await().untilAsserted(() -> assertThat(receivedCallbacks.getReceivedInfo().size()).isEqualTo(1)); ServiceCallbackInfo callbackInfo = receivedCallbacks.getReceivedInfo().get(0); assertThat(callbackInfo.ricId).isEqualTo("ric1"); assertThat(callbackInfo.eventType).isEqualTo(ServiceCallbackInfo.EventType.AVAILABLE); -- cgit 1.2.3-korg