summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/main
diff options
context:
space:
mode:
authorwaqas.ikram <waqas.ikram@est.tech>2023-12-19 15:24:28 +0000
committerWaqas Ikram <waqas.ikram@est.tech>2023-12-20 09:49:58 +0000
commit177d66d0048466cba23eb3a1cc4fe56bf1dce58e (patch)
tree2434b8acb250a78eefd7ce5d42a0f5d5ad84c4df /cps-ncmp-service/src/main
parent89945a1bde22e0ab0a9fb35d26d8084fadf909ee (diff)
Updating config variable names for HttpClient
for DMI Issue-ID: CPS-2016 Change-Id: Ief5428e6e4afc8309ceed2a8221365e2fab31686 Signed-off-by: waqas.ikram <waqas.ikram@est.tech>
Diffstat (limited to 'cps-ncmp-service/src/main')
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/HttpClientConfiguration.java2
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/NcmpConfiguration.java14
2 files changed, 8 insertions, 8 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/HttpClientConfiguration.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/HttpClientConfiguration.java
index aaa4f1e5bb..729930e65e 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/HttpClientConfiguration.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/HttpClientConfiguration.java
@@ -29,7 +29,7 @@ import org.springframework.boot.convert.DurationUnit;
@Getter
@Setter
-@ConfigurationProperties(prefix = "httpclient5", ignoreUnknownFields = true)
+@ConfigurationProperties(prefix = "ncmp.dmi.httpclient", ignoreUnknownFields = true)
public class HttpClientConfiguration {
/**
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/NcmpConfiguration.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/NcmpConfiguration.java
index 4460094f54..c6ff116a7f 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/NcmpConfiguration.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/NcmpConfiguration.java
@@ -72,33 +72,33 @@ public class NcmpConfiguration {
*/
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
- public static RestTemplate restTemplate(final RestTemplateBuilder restTemplateBuilder,
+ public static RestTemplate restTemplate(final RestTemplateBuilder restTemplateBuilder,
final HttpClientConfiguration httpClientConfiguration) {
-
+
final ConnectionConfig connectionConfig = ConnectionConfig.copy(ConnectionConfig.DEFAULT)
.setConnectTimeout(Timeout.of(httpClientConfiguration.getConnectionTimeoutInSeconds()))
.build();
-
+
final PoolingHttpClientConnectionManager connectionManager = PoolingHttpClientConnectionManagerBuilder.create()
.setDefaultConnectionConfig(connectionConfig)
.setMaxConnTotal(httpClientConfiguration.getMaximumConnectionsTotal())
.setMaxConnPerRoute(httpClientConfiguration.getMaximumConnectionsPerRoute())
.build();
-
+
final CloseableHttpClient httpClient = HttpClients.custom()
.setConnectionManager(connectionManager)
.evictExpiredConnections()
.evictIdleConnections(
TimeValue.of(httpClientConfiguration.getIdleConnectionEvictionThresholdInSeconds()))
.build();
-
+
final ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient);
-
+
final RestTemplate restTemplate = restTemplateBuilder
.requestFactory(() -> requestFactory)
.setConnectTimeout(httpClientConfiguration.getConnectionTimeoutInSeconds())
.build();
-
+
setRestTemplateMessageConverters(restTemplate);
return restTemplate;
}