Support multiple nearRtRICs and fix unit-tests 86/1186/2
authorRehanRaza <muhammad.rehan.raza@est.tech>
Fri, 18 Oct 2019 14:51:47 +0000 (16:51 +0200)
committerRehanRaza <muhammad.rehan.raza@est.tech>
Mon, 21 Oct 2019 12:14:34 +0000 (14:14 +0200)
Change-Id: Iaf446bc8b99900019925936a53c0b5b890dfb933
Issue-ID: NONRTRIC-35
Signed-off-by: RehanRaza <muhammad.rehan.raza@est.tech>
sdnc-a1-controller/northbound/nonrt-ric-api/model/src/main/yang/NONRT-RIC-API.yang
sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/provider/NonrtRicApiProvider.java
sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadpter/NearRicUrlProvider.java
sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/resources/NearRtRicList.properties [new file with mode: 0644]
sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/test/java/org/onap/sdnc/northbound/NonrtRicApiProviderTest.java

index b6a2869..806bdc1 100644 (file)
@@ -15,8 +15,8 @@ module A1-ADAPTER-API {
 \r
 ///Flattend interface using RPC\r
 \r
-    //Get a comma separated list of near-rt rics, e.g. domain-name1:port1,domainname2:port2\r
-    //Each item in the returned list will be regarded as one near-rt-ric-id.\r
+    //Get an array of near-rt-ric IDs,\r
+    //Each item in the returned array will be regarded as one near-rt-ric-id.\r
     rpc getNearRT-RICs {\r
         output {\r
             leaf-list near-rt-ric-id-list {\r
@@ -37,11 +37,11 @@ module A1-ADAPTER-API {
             leaf health-status {\r
                 type boolean;\r
             }\r
-        }   \r
+        }\r
     }\r
 \r
-    //Get a comma separated list of integer policy type ids\r
-    //Each item in the returned list will be regarded as one policy-type-id.\r
+    //Get an array of integer policy type ids\r
+    //Each item in the returned array will be regarded as one policy-type-id.\r
     rpc getPolicyTypes {\r
         input {\r
             leaf near-rt-ric-id {\r
@@ -120,8 +120,8 @@ module A1-ADAPTER-API {
         }\r
     }\r
 \r
-    //Get a comma separeated list of string policy instance ids\r
-    //Each item in the returned list will be regarded as one policy-instance-id.\r
+    //Get an array of string policy instance ids\r
+    //Each item in the returned array will be regarded as one policy-instance-id.\r
     rpc getPolicyInstances {\r
         input {\r
             leaf near-rt-ric-id {\r
@@ -156,7 +156,7 @@ module A1-ADAPTER-API {
             }\r
         }\r
     }\r
-    \r
+\r
     ///Get a policy instance\r
     rpc getPolicyInstance {\r
         input {\r
@@ -176,7 +176,7 @@ module A1-ADAPTER-API {
             }\r
         }\r
     }\r
-    \r
+\r
     //Delete a policy instance\r
     rpc deletePolicyInstance {\r
         input {\r
index 7f29fd1..66af597 100644 (file)
@@ -61,6 +61,7 @@ import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev19100
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.GetHealthCheckOutputBuilder;
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.GetNearRTRICsInput;
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.GetNearRTRICsOutput;
+import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.GetNearRTRICsOutputBuilder;
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.GetPolicyInstanceInput;
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.GetPolicyInstanceOutput;
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.GetPolicyInstanceOutputBuilder;
@@ -272,8 +273,13 @@ public class NonrtRicApiProvider implements AutoCloseable, A1ADAPTERAPIService {
 
   @Override
   public ListenableFuture<RpcResult<GetNearRTRICsOutput>> getNearRTRICs(GetNearRTRICsInput input) {
-    // TODO Auto-generated method stub
-    return null;
+      log.info("Start of getNearRTRICs");
+      GetNearRTRICsOutputBuilder responseBuilder = new GetNearRTRICsOutputBuilder();
+      responseBuilder.setNearRtRicIdList(nearRicUrlProvider.getNearRTRicIdsList());
+      log.info("End of getNearRTRICs");
+      RpcResult<GetNearRTRICsOutput> rpcResult = RpcResultBuilder.<GetNearRTRICsOutput>status(true)
+          .withResult(responseBuilder.build()).build();
+      return Futures.immediateFuture(rpcResult);
   }
 
   @Override
index 496b4bd..14c34e4 100644 (file)
 
 package org.onap.sdnc.northbound.restadpter;
 
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Properties;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.web.util.UriComponentsBuilder;
 
 /**
@@ -31,10 +40,42 @@ import org.springframework.web.util.UriComponentsBuilder;
 
 public class NearRicUrlProvider {
 
-  private String baseUrl;
+  // nearRicMap provides mapping from nearRtRicId to domainname:port of nearRTRics
+  private HashMap<String, String> nearRicMap = new HashMap<>();
+  private static final String NEAR_RIC_LIST_FILE = "NearRtRicList.properties";
+  private final Logger log = LoggerFactory.getLogger(NearRicUrlProvider.class);
 
   public NearRicUrlProvider() {
-    // Near ric ip:port is passed in payload currently
+      try {
+        readNearRtRicConfigFile();
+      } catch (IOException ex) {
+        log.error("Exception while reading nearRtRicConfigFile: {}", ex);
+      }
+  }
+
+  private void readNearRtRicConfigFile() throws IOException {
+      InputStream inputStream = NearRicUrlProvider.class.getClassLoader().getResourceAsStream(NEAR_RIC_LIST_FILE);
+      if (inputStream == null) {
+          log.error("The file {} not found in classpath", NEAR_RIC_LIST_FILE);
+      } else {
+          Properties properties = new Properties();
+          properties.load(inputStream);
+          Enumeration<?> keys = properties.propertyNames();
+          while (keys.hasMoreElements()) {
+              String key = (String) keys.nextElement();
+              nearRicMap.put(key, properties.getProperty(key));
+          }
+          inputStream.close();
+      }
+  }
+
+  /**
+   * Retrieve the list of Near-RICs
+   *
+   * @return the list of Near-RICs
+   */
+  public List<String> getNearRTRicIdsList () {
+      return new ArrayList<>(nearRicMap.keySet());
   }
 
   /**
@@ -43,7 +84,7 @@ public class NearRicUrlProvider {
    * @return the base url
    */
   public String getBaseUrl(final String nearRtRicId) {
-    baseUrl = "http://" + nearRtRicId + "/a1-p/";
+    String baseUrl = "http://" + nearRicMap.get(nearRtRicId) + "/a1-p/";
     return UriComponentsBuilder.fromUriString(baseUrl).build().toString();
   }
 
diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/resources/NearRtRicList.properties b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/resources/NearRtRicList.properties
new file mode 100644 (file)
index 0000000..948c2f7
--- /dev/null
@@ -0,0 +1,23 @@
+# ========================LICENSE_START=================================
+# O-RAN-SC
+# %%
+# Copyright (C) 2019 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.
+# ========================LICENSE_END===================================
+
+# Defines the list of nearRTRics that the SDNC can contact,
+# where key is nearRTRicId and value is domainname:port of a nearRTRic.
+
+NearRtRic1 = nearRtRic-sim1:8080
+NearRtRic2 = nearRtRic-sim2:8080
\ No newline at end of file
index 9c40a88..e67304c 100644 (file)
@@ -23,6 +23,8 @@ package org.onap.sdnc.northbound;
 import static org.mockito.Matchers.anyObject;
 import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.when;
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.ListenableFuture;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.ExecutionException;
@@ -40,14 +42,8 @@ import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.CreatePolicyInstanceInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.CreatePolicyInstanceOutput;
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.CreatePolicyTypeInputBuilder;
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.CreatePolicyTypeOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.DeletePolicyInstanceInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.DeletePolicyInstanceOutput;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.DeletePolicyTypeInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.DeletePolicyTypeOutput;
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.GetHealthCheckInputBuilder;
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.GetHealthCheckOutput;
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.GetPolicyInstanceInputBuilder;
@@ -61,15 +57,12 @@ import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev19100
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.GetStatusInputBuilder;
 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.GetStatusOutput;
 import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.oransc.ric.a1med.client.model.PolicyTypeSchema;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.ListenableFuture;
 
 /**
  * This class Tests all the methods in NonrtRicApiProvider
- * 
+ *
  * @author lathishbabu.ganesan@est.tech
  *
  */
@@ -87,6 +80,7 @@ public class NonrtRicApiProviderTest extends AbstractConcurrentDataBrokerTest {
   @Mock
   private RestAdapter restAdapter;
   private NearRicUrlProvider nearRicUrlProvider;
+  private static String nearRtRicId = "NearRtRic1";
   private static Long policyTypeId = 11L;
   private static String policyTypeInstanceId = "12";
 
@@ -102,10 +96,11 @@ public class NonrtRicApiProviderTest extends AbstractConcurrentDataBrokerTest {
   @Test
   public void testCreatePolicyType() throws InterruptedException, ExecutionException {
     CreatePolicyTypeInputBuilder inputBuilder = new CreatePolicyTypeInputBuilder();
+    inputBuilder.setNearRtRicId(nearRtRicId);
     inputBuilder.setPolicyTypeId(policyTypeId);
     Whitebox.setInternalState(nonrtRicApiProvider, "restAdapter", restAdapter);
-    String uri =
-        nearRicUrlProvider.getPolicyTypeId(String.valueOf(inputBuilder.build().getPolicyTypeId()));
+    String uri = nearRicUrlProvider.getPolicyTypeId(inputBuilder.build().getNearRtRicId(),
+                String.valueOf(inputBuilder.build().getPolicyTypeId()));
     Optional<Object> createPolicyTyperesponse = null;
     when(restAdapter.put(eq(uri), anyObject())).thenReturn(createPolicyTyperesponse);
     ListenableFuture<RpcResult<CreatePolicyTypeOutput>> result =
@@ -116,127 +111,93 @@ public class NonrtRicApiProviderTest extends AbstractConcurrentDataBrokerTest {
   @Test
   public void testGetPolicyType() throws InterruptedException, ExecutionException {
     GetPolicyTypeInputBuilder inputBuilder = new GetPolicyTypeInputBuilder();
+    inputBuilder.setNearRtRicId(nearRtRicId);
     inputBuilder.setPolicyTypeId(policyTypeId);
     Whitebox.setInternalState(nonrtRicApiProvider, "restAdapter", restAdapter);
-    String uri =
-        nearRicUrlProvider.getPolicyTypeId(String.valueOf(inputBuilder.build().getPolicyTypeId()));
-    PolicyTypeSchema policyTypeSchema = new PolicyTypeSchema();
-    policyTypeSchema.setName("AdmissionControlPolicy");
-    policyTypeSchema.setCreateSchema("{}");
-    when(restAdapter.get(eq(uri), anyObject())).thenReturn(Optional.of(policyTypeSchema));
+    String uri = nearRicUrlProvider.getPolicyTypeId(inputBuilder.build().getNearRtRicId(),
+            String.valueOf(inputBuilder.build().getPolicyTypeId()));
+    String policyType =
+            "{\"name\":\"Policy type 1\",\"description\":\"PT 1\",\"policy_type_id\":1,\"create_schema\":{}}";
+    when(restAdapter.get(eq(uri), anyObject())).thenReturn(Optional.of(policyType));
     ListenableFuture<RpcResult<GetPolicyTypeOutput>> result =
         nonrtRicApiProvider.getPolicyType(inputBuilder.build());
-    Assert.assertEquals(policyTypeSchema.getName(), result.get().getResult().getName());
+    Assert.assertEquals("Policy type 1", result.get().getResult().getName());
   }
 
   @Test
   public void testGetPolicyTypes() throws InterruptedException, ExecutionException {
     GetPolicyTypesInputBuilder inputBuilder = new GetPolicyTypesInputBuilder();
+    inputBuilder.setNearRtRicId(nearRtRicId);
     Whitebox.setInternalState(nonrtRicApiProvider, "restAdapter", restAdapter);
-    String uri = nearRicUrlProvider.getPolicyTypes();
-    List<Long> policyTypes = new ArrayList<>();
-    policyTypes.add(20001L);
-    when(restAdapter.get(eq(uri), eq(List.class))).thenReturn(Optional.of(policyTypes));
+    String uri = nearRicUrlProvider.getPolicyTypes(inputBuilder.build().getNearRtRicId());
+    List<Integer> policyTypesInteger = new ArrayList<>();
+    policyTypesInteger.add(20001);
+    List<Long> policyTypesLong = new ArrayList<>();
+    policyTypesLong.add(20001L);
+    when(restAdapter.get(eq(uri), eq(List.class))).thenReturn(Optional.of(policyTypesInteger));
     ListenableFuture<RpcResult<GetPolicyTypesOutput>> result =
         nonrtRicApiProvider.getPolicyTypes(inputBuilder.build());
-    Assert.assertEquals(policyTypes, result.get().getResult().getPolicyTypeIdList());
-  }
-
-  @Test
-  public void testDeletePolicyType() throws InterruptedException, ExecutionException {
-    DeletePolicyTypeInputBuilder inputBuilder = new DeletePolicyTypeInputBuilder();
-    inputBuilder.setPolicyTypeId(policyTypeId);
-    Whitebox.setInternalState(nonrtRicApiProvider, "restAdapter", restAdapter);
-    String uri =
-        nearRicUrlProvider.getPolicyTypeId(String.valueOf(inputBuilder.build().getPolicyTypeId()));
-    Optional<Object> deletePolicyTyperesponse = null;
-    when(restAdapter.delete(uri)).thenReturn(deletePolicyTyperesponse);
-    ListenableFuture<RpcResult<DeletePolicyTypeOutput>> result =
-        nonrtRicApiProvider.deletePolicyType(inputBuilder.build());
-  }
-
-  @Test
-  public void testCreatePolicyInstance() throws InterruptedException, ExecutionException {
-    CreatePolicyInstanceInputBuilder inputBuilder = new CreatePolicyInstanceInputBuilder();
-    inputBuilder.setPolicyTypeId(policyTypeId);
-    inputBuilder.setPolicyInstanceId(policyTypeInstanceId);
-    Whitebox.setInternalState(nonrtRicApiProvider, "restAdapter", restAdapter);
-    String uri = nearRicUrlProvider.getPolicyInstanceId(
-        String.valueOf(inputBuilder.build().getPolicyTypeId()), inputBuilder.getPolicyInstanceId());
-    Optional<Object> createPolicyInstanceresponse = null;
-    when(restAdapter.put(eq(uri), anyObject())).thenReturn(createPolicyInstanceresponse);
-    ListenableFuture<RpcResult<CreatePolicyInstanceOutput>> result =
-        nonrtRicApiProvider.createPolicyInstance(inputBuilder.build());
-  }
-
-  @Test
-  public void testDeletePolicyInstance() throws InterruptedException, ExecutionException {
-    DeletePolicyInstanceInputBuilder inputBuilder = new DeletePolicyInstanceInputBuilder();
-    inputBuilder.setPolicyTypeId(policyTypeId);
-    inputBuilder.setPolicyInstanceId(policyTypeInstanceId);
-    Whitebox.setInternalState(nonrtRicApiProvider, "restAdapter", restAdapter);
-    String uri = nearRicUrlProvider.getPolicyInstanceId(
-        String.valueOf(inputBuilder.build().getPolicyTypeId()), inputBuilder.getPolicyInstanceId());
-    Optional<Object> deletePolicyInstanceresponse = null;
-    when(restAdapter.delete(uri)).thenReturn(deletePolicyInstanceresponse);
-    ListenableFuture<RpcResult<DeletePolicyInstanceOutput>> result =
-        nonrtRicApiProvider.deletePolicyInstance(inputBuilder.build());
+    Assert.assertEquals(policyTypesLong, result.get().getResult().getPolicyTypeIdList());
   }
 
   @Test
   public void testGetPolicyInstance() throws InterruptedException, ExecutionException {
     GetPolicyInstanceInputBuilder inputBuilder = new GetPolicyInstanceInputBuilder();
+    inputBuilder.setNearRtRicId(nearRtRicId);
     inputBuilder.setPolicyTypeId(policyTypeId);
     inputBuilder.setPolicyInstanceId(policyTypeInstanceId);
     Whitebox.setInternalState(nonrtRicApiProvider, "restAdapter", restAdapter);
-    String uri = nearRicUrlProvider.getPolicyInstanceId(
+    String uri = nearRicUrlProvider.getPolicyInstanceId(inputBuilder.build().getNearRtRicId(),
         String.valueOf(inputBuilder.build().getPolicyTypeId()), inputBuilder.getPolicyInstanceId());
-    String getPolicyInstanceresponse = "{}";
+    String policyInstance =
+            "{\"scope\":{\"ue_id\":\"2\"},\"statement\":{\"priority_level\":\"1\"},\"policy_id\":\"pi12\"}";
     when(restAdapter.get(eq(uri), eq(String.class)))
-        .thenReturn(Optional.of(getPolicyInstanceresponse));
+        .thenReturn(Optional.of(policyInstance));
     ListenableFuture<RpcResult<GetPolicyInstanceOutput>> result =
         nonrtRicApiProvider.getPolicyInstance(inputBuilder.build());
+    Assert.assertEquals(policyInstance, result.get().getResult().getPolicyInstance());
   }
 
   @Test
   public void testGetPolicyInstances() throws InterruptedException, ExecutionException {
     GetPolicyInstancesInputBuilder inputBuilder = new GetPolicyInstancesInputBuilder();
+    inputBuilder.setNearRtRicId(nearRtRicId);
     inputBuilder.setPolicyTypeId(policyTypeId);
     Whitebox.setInternalState(nonrtRicApiProvider, "restAdapter", restAdapter);
-    String uri = nearRicUrlProvider
-        .getPolicyInstances(String.valueOf(inputBuilder.build().getPolicyTypeId()));
-    List<String> getPolicyInstances = new ArrayList<>();
-    getPolicyInstances.add("3d2157af-6a8f-4a7c-810f-38c2f824bf12");
-    when(restAdapter.get(eq(uri), eq(List.class))).thenReturn(Optional.of(getPolicyInstances));
+    String uri = nearRicUrlProvider.getPolicyInstances(inputBuilder.build().getNearRtRicId(),
+            String.valueOf(inputBuilder.build().getPolicyTypeId()));
+    List<String> policyInstances = new ArrayList<>();
+    policyInstances.add("3d2157af-6a8f-4a7c-810f-38c2f824bf12");
+    when(restAdapter.get(eq(uri), eq(List.class))).thenReturn(Optional.of(policyInstances));
     ListenableFuture<RpcResult<GetPolicyInstancesOutput>> result =
         nonrtRicApiProvider.getPolicyInstances(inputBuilder.build());
+    Assert.assertEquals(policyInstances, result.get().getResult().getPolicyInstanceIdList());
   }
 
   @Test
   public void testGetStatus() throws InterruptedException, ExecutionException {
     GetStatusInputBuilder inputBuilder = new GetStatusInputBuilder();
+    inputBuilder.setNearRtRicId(nearRtRicId);
     inputBuilder.setPolicyTypeId(policyTypeId);
     inputBuilder.setPolicyInstanceId(policyTypeInstanceId);
     Whitebox.setInternalState(nonrtRicApiProvider, "restAdapter", restAdapter);
-    String uri = nearRicUrlProvider.getPolicyInstanceIdStatus(
+    String uri = nearRicUrlProvider.getPolicyInstanceIdStatus(inputBuilder.build().getNearRtRicId(),
         String.valueOf(inputBuilder.build().getPolicyTypeId()), inputBuilder.getPolicyInstanceId());
-    List<String> getPolicyInstanceIdStatus = new ArrayList<>();
-    getPolicyInstanceIdStatus.add("");
-    when(restAdapter.get(eq(uri), eq(List.class)))
-        .thenReturn(Optional.of(getPolicyInstanceIdStatus));
+    String policyInstanceStatus = "{\"status\":\"enforced\"}";
+    when(restAdapter.get(eq(uri), eq(String.class))).thenReturn(Optional.of(policyInstanceStatus));
     ListenableFuture<RpcResult<GetStatusOutput>> result =
         nonrtRicApiProvider.getStatus(inputBuilder.build());
-    // TODO: Define the proper response message for get policy instance status
-    Assert.assertEquals("Success", result.get().getResult().getStatus());
+    Assert.assertEquals("enforced", result.get().getResult().getStatus());
   }
 
   @Test
   public void testHealthCheck() throws InterruptedException, ExecutionException {
     GetHealthCheckInputBuilder inputBuilder = new GetHealthCheckInputBuilder();
+    inputBuilder.setNearRtRicId(nearRtRicId);
     Whitebox.setInternalState(nonrtRicApiProvider, "restAdapter", restAdapter);
-    String uri = nearRicUrlProvider.getHealthCheck();
+    String uri = nearRicUrlProvider.getHealthCheck(inputBuilder.build().getNearRtRicId());
     String healthCheckStatus = "";
-    when(restAdapter.get(eq(uri), eq(String.class))).thenReturn(Optional.of(healthCheckStatus));
+    when(restAdapter.get(eq(uri), eq(String.class))).thenReturn(null);
     ListenableFuture<RpcResult<GetHealthCheckOutput>> result =
         nonrtRicApiProvider.getHealthCheck(inputBuilder.build());
     Assert.assertEquals(true, result.get().getResult().isHealthStatus());