From 25501ccf6b73c3afded66eade70ee59af102844f Mon Sep 17 00:00:00 2001 From: RehanRaza Date: Fri, 18 Oct 2019 16:51:47 +0200 Subject: [PATCH] Support multiple nearRtRICs and fix unit-tests Change-Id: Iaf446bc8b99900019925936a53c0b5b890dfb933 Issue-ID: NONRTRIC-35 Signed-off-by: RehanRaza --- .../model/src/main/yang/NONRT-RIC-API.yang | 18 +-- .../northbound/provider/NonrtRicApiProvider.java | 10 +- .../northbound/restadpter/NearRicUrlProvider.java | 47 +++++++- .../src/main/resources/NearRtRicList.properties | 23 ++++ .../sdnc/northbound/NonrtRicApiProviderTest.java | 125 +++++++-------------- 5 files changed, 127 insertions(+), 96 deletions(-) create mode 100644 sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/resources/NearRtRicList.properties diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/model/src/main/yang/NONRT-RIC-API.yang b/sdnc-a1-controller/northbound/nonrt-ric-api/model/src/main/yang/NONRT-RIC-API.yang index b6a2869c..806bdc1c 100644 --- a/sdnc-a1-controller/northbound/nonrt-ric-api/model/src/main/yang/NONRT-RIC-API.yang +++ b/sdnc-a1-controller/northbound/nonrt-ric-api/model/src/main/yang/NONRT-RIC-API.yang @@ -15,8 +15,8 @@ module A1-ADAPTER-API { ///Flattend interface using RPC - //Get a comma separated list of near-rt rics, e.g. domain-name1:port1,domainname2:port2 - //Each item in the returned list will be regarded as one near-rt-ric-id. + //Get an array of near-rt-ric IDs, + //Each item in the returned array will be regarded as one near-rt-ric-id. rpc getNearRT-RICs { output { leaf-list near-rt-ric-id-list { @@ -37,11 +37,11 @@ module A1-ADAPTER-API { leaf health-status { type boolean; } - } + } } - //Get a comma separated list of integer policy type ids - //Each item in the returned list will be regarded as one policy-type-id. + //Get an array of integer policy type ids + //Each item in the returned array will be regarded as one policy-type-id. rpc getPolicyTypes { input { leaf near-rt-ric-id { @@ -120,8 +120,8 @@ module A1-ADAPTER-API { } } - //Get a comma separeated list of string policy instance ids - //Each item in the returned list will be regarded as one policy-instance-id. + //Get an array of string policy instance ids + //Each item in the returned array will be regarded as one policy-instance-id. rpc getPolicyInstances { input { leaf near-rt-ric-id { @@ -156,7 +156,7 @@ module A1-ADAPTER-API { } } } - + ///Get a policy instance rpc getPolicyInstance { input { @@ -176,7 +176,7 @@ module A1-ADAPTER-API { } } } - + //Delete a policy instance rpc deletePolicyInstance { input { diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/provider/NonrtRicApiProvider.java b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/provider/NonrtRicApiProvider.java index 7f29fd17..66af597e 100644 --- a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/provider/NonrtRicApiProvider.java +++ b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/provider/NonrtRicApiProvider.java @@ -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> 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 rpcResult = RpcResultBuilder.status(true) + .withResult(responseBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); } @Override diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadpter/NearRicUrlProvider.java b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadpter/NearRicUrlProvider.java index 496b4bdf..14c34e4f 100644 --- a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadpter/NearRicUrlProvider.java +++ b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadpter/NearRicUrlProvider.java @@ -20,6 +20,15 @@ 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 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 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 index 00000000..948c2f77 --- /dev/null +++ b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/resources/NearRtRicList.properties @@ -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 diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/test/java/org/onap/sdnc/northbound/NonrtRicApiProviderTest.java b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/test/java/org/onap/sdnc/northbound/NonrtRicApiProviderTest.java index 9c40a880..e67304c0 100644 --- a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/test/java/org/onap/sdnc/northbound/NonrtRicApiProviderTest.java +++ b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/test/java/org/onap/sdnc/northbound/NonrtRicApiProviderTest.java @@ -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 createPolicyTyperesponse = null; when(restAdapter.put(eq(uri), anyObject())).thenReturn(createPolicyTyperesponse); ListenableFuture> 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> 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 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 policyTypesInteger = new ArrayList<>(); + policyTypesInteger.add(20001); + List policyTypesLong = new ArrayList<>(); + policyTypesLong.add(20001L); + when(restAdapter.get(eq(uri), eq(List.class))).thenReturn(Optional.of(policyTypesInteger)); ListenableFuture> 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 deletePolicyTyperesponse = null; - when(restAdapter.delete(uri)).thenReturn(deletePolicyTyperesponse); - ListenableFuture> 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 createPolicyInstanceresponse = null; - when(restAdapter.put(eq(uri), anyObject())).thenReturn(createPolicyInstanceresponse); - ListenableFuture> 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 deletePolicyInstanceresponse = null; - when(restAdapter.delete(uri)).thenReturn(deletePolicyInstanceresponse); - ListenableFuture> 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> 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 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 policyInstances = new ArrayList<>(); + policyInstances.add("3d2157af-6a8f-4a7c-810f-38c2f824bf12"); + when(restAdapter.get(eq(uri), eq(List.class))).thenReturn(Optional.of(policyInstances)); ListenableFuture> 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 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> 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> result = nonrtRicApiProvider.getHealthCheck(inputBuilder.build()); Assert.assertEquals(true, result.get().getResult().isHealthStatus()); -- 2.16.6