aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoanna Jeremicz <joanna.jeremicz@nokia.com>2019-08-01 08:57:28 +0200
committerJoanna Jeremicz <joanna.jeremicz@nokia.com>2019-08-01 10:17:41 +0200
commitb74990149a1369a432c45f5e3a32b14b1116032f (patch)
tree253b5a8793f1c02355ccf6b035c4ad32e41eec43
parent6059dc9c430eb323a407d6ab935b243004833681 (diff)
Correct path in AaiGetServiceInstanceClient
Change-Id: Id8dd6e21092de900aa0c4524339566b16b913db9 Issue-ID: DCAEGEN2-1699 Signed-off-by: Joanna Jeremicz <joanna.jeremicz@nokia.com>
-rw-r--r--rest-services/aai-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/service/http/get/AaiGetServiceInstanceClient.java3
-rw-r--r--rest-services/aai-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/AaiClientConfigurations.java2
-rw-r--r--rest-services/aai-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/aai/client/service/http/get/AaiGetServiceInstanceClientTest.java10
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)));
}
}