From 9ab2a91f585864bf18fef788adeaf61f4f450b39 Mon Sep 17 00:00:00 2001 From: Lukasz Rajewski Date: Thu, 18 Aug 2022 21:50:31 +0200 Subject: Refactor rest clients and support timeouts - Refactored rest clients to remove redundant code - Timeouts added to the configuration of rest clients Issue-ID: CCSDK-3716 Signed-off-by: Lukasz Rajewski Change-Id: I706b8efd8447570455b8b65bd5b1a22da474f62b --- .../resource/resolution/mock/MockBlueprintWebClientService.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'ms/blueprintsprocessor/functions/resource-resolution/src') diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt index 86a9ed056..ba273e179 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockBlueprintWebClientService.kt @@ -21,6 +21,7 @@ import org.mockserver.model.Header import org.mockserver.model.HttpRequest.request import org.mockserver.model.HttpResponse.response import org.onap.ccsdk.cds.blueprintsprocessor.rest.RestClientProperties +import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BaseBlueprintWebClientService import org.onap.ccsdk.cds.blueprintsprocessor.rest.service.BlueprintWebClientService import org.springframework.http.HttpHeaders import org.springframework.http.MediaType @@ -28,7 +29,7 @@ import java.nio.charset.Charset import java.util.Base64 class MockBlueprintWebClientService(private var restClientProperties: RestClientProperties) : - BlueprintWebClientService { + BaseBlueprintWebClientService() { private var mockServer: ClientAndServer private var port: String = if (restClientProperties.url.split(":")[2].isEmpty()) "8080" @@ -52,6 +53,10 @@ class MockBlueprintWebClientService(private var restClientProperties: RestClient ) } + override fun getRestClientProperties(): RestClientProperties { + return restClientProperties + } + override fun defaultHeaders(): Map { val encodedCredentials = this.setBasicAuth("admin", "aaiTest") return mapOf( @@ -61,10 +66,6 @@ class MockBlueprintWebClientService(private var restClientProperties: RestClient ) } - override fun host(uri: String): String { - return restClientProperties.url + uri - } - fun tearDown() { mockServer.close() } -- cgit 1.2.3-korg