diff options
author | PatrikBuhr <patrik.buhr@est.tech> | 2021-05-05 08:38:07 +0200 |
---|---|---|
committer | PatrikBuhr <patrik.buhr@est.tech> | 2021-05-05 09:43:13 +0200 |
commit | 9a8965fa835da0639719245e44625e15f165d7d5 (patch) | |
tree | 88ae75e958ae6abe54514b50f2cef36ac93e2f43 /a1-policy-management/src/test/java | |
parent | 25d78500922291a2ade59799654c8b05a5ee7640 (diff) |
PMS Persistent storage of service definitions - A1 Istanbul
Bugfix,only sending AVAILABLE notifications for RICs that has been successfully
synched.
Issue-ID: CCSDK-3256
Signed-off-by: PatrikBuhr <patrik.buhr@est.tech>
Change-Id: Ic915c3d83a51ac23cb4652bda9ab696fc27bae3d
Diffstat (limited to 'a1-policy-management/src/test/java')
-rw-r--r-- | a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java | 35 |
1 files changed, 31 insertions, 4 deletions
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 84bc47ad..91eb6333 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 @@ -50,6 +50,7 @@ import org.onap.ccsdk.oran.a1policymanagementservice.clients.A1ClientFactory; import org.onap.ccsdk.oran.a1policymanagementservice.clients.AsyncRestClient; import org.onap.ccsdk.oran.a1policymanagementservice.clients.AsyncRestClientFactory; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfig; +import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ApplicationConfig.RicConfigUpdate; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableRicConfig; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.ImmutableWebClientConfig; import org.onap.ccsdk.oran.a1policymanagementservice.configuration.RicConfig; @@ -263,10 +264,9 @@ class ApplicationTest { putService("service"); - RicConfig config = ricConfig(RIC, "me1"); - ApplicationConfig.RicConfigUpdate update = - new ApplicationConfig.RicConfigUpdate(config, ApplicationConfig.RicConfigUpdate.Type.ADDED); - refreshConfigTask.handleUpdatedRicConfig(update).block(); + refreshConfigTask.handleUpdatedRicConfig( // + new RicConfigUpdate(ricConfig(RIC, "me1"), RicConfigUpdate.Type.ADDED)) // + .block(); waitForRicState(RIC, RicState.AVAILABLE); // Test that the type has been synched @@ -283,6 +283,33 @@ class ApplicationTest { } @Test + void testAddingRicFromConfiguration_nonRespondingRic() throws ServiceException { + putService("service"); + + final String RIC = "NonRespondingRic"; + MockA1Client a1Client = a1ClientFactory.getOrCreateA1Client(RIC); + WebClientResponseException a1Exception = new WebClientResponseException(404, "", null, null, null); + doReturn(Mono.error(a1Exception)).when(a1Client).getPolicyTypeIdentities(); + + refreshConfigTask.handleUpdatedRicConfig( // + new RicConfigUpdate(ricConfig(RIC, "me1"), RicConfigUpdate.Type.ADDED)) // + .block(); + + waitForRicState(RIC, RicState.UNAVAILABLE); + + // Check that no service callback for the UNAVAILABLE RIC is invoked + RappSimulatorController.TestResults receivedCallbacks = rAppSimulator.getTestResults(); + assertThat(receivedCallbacks.getReceivedInfo().size()).isEqualTo(0); + + // Run a synch and check that the AVAILABLE notificationis received + a1ClientFactory.reset(); + supervision.checkAllRics(); + waitForRicState(RIC, RicState.AVAILABLE); + receivedCallbacks = rAppSimulator.getTestResults(); + assertThat(receivedCallbacks.getReceivedInfo().size()).isEqualTo(1); + } + + @Test void testGetRics() throws Exception { addRic("ric1"); this.addPolicyType("type1", "ric1"); |