diff options
Diffstat (limited to 'rest-services')
3 files changed, 11 insertions, 4 deletions
diff --git a/rest-services/aai-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/service/http/get/AaiGetServiceInstanceClient.java b/rest-services/aai-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/service/http/get/AaiGetServiceInstanceClient.java index 6a1aaf91..6d623ff5 100644 --- a/rest-services/aai-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/service/http/get/AaiGetServiceInstanceClient.java +++ b/rest-services/aai-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/service/http/get/AaiGetServiceInstanceClient.java @@ -38,7 +38,6 @@ import reactor.core.publisher.Mono; public class AaiGetServiceInstanceClient implements AaiHttpClient<AaiServiceInstanceQueryModel, HttpResponse> { - //variables for query "/business/customers/customer/${customer}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${serviceInstanceId}" private static final String CUSTOMER = "customer"; private static final String SERVICE_TYPE = "serviceType"; private static final String SERVICE_INSTANCE_ID = "serviceInstanceId"; @@ -69,6 +68,6 @@ public class AaiGetServiceInstanceClient implements } private String getUri(final String endpoint) { - return new URI.URIBuilder().path(configuration.pnfUrl() + endpoint).build().toString(); + return new URI.URIBuilder().path(configuration.baseUrl() + endpoint).build().toString(); } } diff --git a/rest-services/aai-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/AaiClientConfigurations.java b/rest-services/aai-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/AaiClientConfigurations.java index 23bfb171..8e27b2f4 100644 --- a/rest-services/aai-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/AaiClientConfigurations.java +++ b/rest-services/aai-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/AaiClientConfigurations.java @@ -53,7 +53,7 @@ public final class AaiClientConfigurations { .keyStorePasswordPath("/server.pass") .enableAaiCertAuth(secure) .aaiHeaders(headers) - .aaiServiceInstancePath("sample-instance-path") + .aaiServiceInstancePath("/business/customers/customer/${customer}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${serviceInstanceId}") .build(); } }
\ No newline at end of file diff --git a/rest-services/aai-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/service/http/get/AaiGetServiceInstanceClientTest.java b/rest-services/aai-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/service/http/get/AaiGetServiceInstanceClientTest.java index ce5d2c95..ae26404e 100644 --- a/rest-services/aai-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/service/http/get/AaiGetServiceInstanceClientTest.java +++ b/rest-services/aai-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/service/http/get/AaiGetServiceInstanceClientTest.java @@ -37,6 +37,9 @@ import reactor.test.StepVerifier; class AaiGetServiceInstanceClientTest extends AbstractHttpClientTest { + public static final String SERVICE_INSTANCE_PATH = "https://aai.onap.svc.cluster.local:8443/aai/v12/business/customers/customer/Demonstration/" + + "service-subscriptions/service-subscription/VCPE/service-instances/service-instance/df018f76-7fc8-46ab-8444-7d67e1efc284"; + @Test void getAaiResponse_shouldCallGetMethod_withGivenAaiHeaders() { @@ -46,6 +49,10 @@ class AaiGetServiceInstanceClientTest extends AbstractHttpClientTest { AaiGetServiceInstanceClient cut = new AaiGetServiceInstanceClient(secureConfiguration(headers.toJavaMap()), httpClient); + given(model.customerId()).willReturn("Demonstration"); + given(model.serviceInstanceId()).willReturn("df018f76-7fc8-46ab-8444-7d67e1efc284"); + given(model.serviceType()).willReturn("VCPE"); + given(httpClient.call(any(HttpRequest.class))) .willReturn(Mono.just(response)); @@ -57,6 +64,7 @@ class AaiGetServiceInstanceClientTest extends AbstractHttpClientTest { //then verify(httpClient) - .call(argThat(httpRequest -> httpRequest.customHeaders().equals(headers))); + .call(argThat(httpRequest -> httpRequest.customHeaders().equals(headers) && + httpRequest.url().equals(SERVICE_INSTANCE_PATH))); } } |