From d7cc059bfce52da57e8cc12e17280641878bce19 Mon Sep 17 00:00:00 2001 From: PatrikBuhr Date: Mon, 14 Dec 2020 13:33:06 +0100 Subject: Removing host from genernated doc Change-Id: If25daa12d270a43928f583d3a5cbc2258bb426d9 Issue-ID: CCSDK-2966 Signed-off-by: PatrikBuhr --- .../configuration/ApplicationConfig.java | 35 ++++++++++++---------- .../controllers/v2/ApplicationTest.java | 4 ++- 2 files changed, 23 insertions(+), 16 deletions(-) (limited to 'a1-policy-management/src') diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfig.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfig.java index ab3e89ef..6449e48b 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfig.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/configuration/ApplicationConfig.java @@ -81,26 +81,31 @@ public class ApplicationConfig { private Map controllerConfigs = new HashMap<>(); + private WebClientConfig webClientConfig = null; + public synchronized Collection getRicConfigs() { return this.ricConfigs.values(); } public WebClientConfig getWebClientConfig() { - HttpProxyConfig httpProxyConfig = ImmutableHttpProxyConfig.builder() // - .httpProxyHost(this.httpProxyHost) // - .httpProxyPort(this.httpProxyPort) // - .build(); - - return ImmutableWebClientConfig.builder() // - .keyStoreType(this.sslKeyStoreType) // - .keyStorePassword(this.sslKeyStorePassword) // - .keyStore(this.sslKeyStore) // - .keyPassword(this.sslKeyPassword) // - .isTrustStoreUsed(this.sslTrustStoreUsed) // - .trustStore(this.sslTrustStore) // - .trustStorePassword(this.sslTrustStorePassword) // - .httpProxyConfig(httpProxyConfig) // - .build(); + if (this.webClientConfig == null) { + HttpProxyConfig httpProxyConfig = ImmutableHttpProxyConfig.builder() // + .httpProxyHost(this.httpProxyHost) // + .httpProxyPort(this.httpProxyPort) // + .build(); + + this.webClientConfig = ImmutableWebClientConfig.builder() // + .keyStoreType(this.sslKeyStoreType) // + .keyStorePassword(this.sslKeyStorePassword) // + .keyStore(this.sslKeyStore) // + .keyPassword(this.sslKeyPassword) // + .isTrustStoreUsed(this.sslTrustStoreUsed) // + .trustStore(this.sslTrustStore) // + .trustStorePassword(this.sslTrustStorePassword) // + .httpProxyConfig(httpProxyConfig) // + .build(); + } + return this.webClientConfig; } public synchronized ControllerConfig getControllerConfig(String name) throws ServiceException { diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java index 2170b3c1..5edee150 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ApplicationTest.java @@ -217,7 +217,9 @@ class ApplicationTest { String url = "https://localhost:" + this.port + "/v2/api-docs"; ResponseEntity resp = restClient("", false).getForEntity(url).block(); assertThat(resp.getStatusCode()).isEqualTo(HttpStatus.OK); - String indented = (new JSONObject(resp.getBody())).toString(4); + JSONObject jsonObj = new JSONObject(resp.getBody()); + jsonObj.remove("host"); + String indented = (jsonObj).toString(4); String docDir = "api/"; Files.createDirectories(Paths.get(docDir)); try (PrintStream out = new PrintStream(new FileOutputStream(docDir + "pms-api.json"))) { -- cgit 1.2.3-korg