aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Hanrahan <daniel.hanrahan@est.tech>2024-04-29 10:52:08 +0000
committerGerrit Code Review <gerrit@onap.org>2024-04-29 10:52:08 +0000
commitb14427c97fb5db371f5629b1e300958ad69366e3 (patch)
tree878270959fbdc8da5b1d4273d5034303966cd73b
parentf679ac737984cfbbf10873f1d178fb718b876de2 (diff)
parent5a48974558ea300b76ad20a84850c0523877eb63 (diff)
Merge "Module sync task failing with WebClient"
-rw-r--r--cps-application/src/main/resources/application.yml1
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/DmiWebClientConfiguration.java6
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/config/DmiWebClientConfigurationSpec.groovy3
-rw-r--r--cps-ncmp-service/src/test/resources/application.yml1
-rw-r--r--integration-test/src/test/resources/application.yml1
5 files changed, 11 insertions, 1 deletions
diff --git a/cps-application/src/main/resources/application.yml b/cps-application/src/main/resources/application.yml
index 27bc6c6189..aeec8a2553 100644
--- a/cps-application/src/main/resources/application.yml
+++ b/cps-application/src/main/resources/application.yml
@@ -174,6 +174,7 @@ ncmp:
maximumConnectionsPerRoute: 50
maximumConnectionsTotal: 100
idleConnectionEvictionThresholdInSeconds: 5
+ maximumInMemorySizeInMegabytes: 16
auth:
username: ${DMI_USERNAME}
password: ${DMI_PASSWORD}
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/DmiWebClientConfiguration.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/DmiWebClientConfiguration.java
index 4f9e8800dd..8ac2e3fc1c 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/DmiWebClientConfiguration.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/config/DmiWebClientConfiguration.java
@@ -46,6 +46,9 @@ public class DmiWebClientConfiguration {
@Value("${ncmp.dmi.httpclient.connectionTimeoutInSeconds:20000}")
private Integer connectionTimeoutInSeconds;
+ @Value("${ncmp.dmi.httpclient.maximumInMemorySizeInMegabytes:1}")
+ private Integer maximumInMemorySizeInMegabytes;
+
@Getter
@Component
public static class DmiProperties {
@@ -77,6 +80,9 @@ public class DmiWebClientConfiguration {
.defaultHeaders(header -> header.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE))
.defaultHeaders(header -> header.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE))
.clientConnector(new ReactorClientHttpConnector(httpClient))
+ .codecs(configurer -> configurer
+ .defaultCodecs()
+ .maxInMemorySize(maximumInMemorySizeInMegabytes * 1024 * 1024))
.build();
}
}
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/config/DmiWebClientConfigurationSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/config/DmiWebClientConfigurationSpec.groovy
index c9491cd02e..2ce5b50093 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/config/DmiWebClientConfigurationSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/config/DmiWebClientConfigurationSpec.groovy
@@ -29,7 +29,7 @@ import spock.lang.Specification
@SpringBootTest
@ContextConfiguration(classes = [DmiWebClientConfiguration.DmiProperties])
-@TestPropertySource(properties = ["ncmp.dmi.httpclient.connectionTimeoutInSeconds=1"])
+@TestPropertySource(properties = ["ncmp.dmi.httpclient.connectionTimeoutInSeconds=1", "ncmp.dmi.httpclient.maximumInMemorySizeInMegabytes=1"])
class DmiWebClientConfigurationSpec extends Specification {
@Autowired
@@ -39,6 +39,7 @@ class DmiWebClientConfigurationSpec extends Specification {
def setup() {
objectUnderTest.connectionTimeoutInSeconds = 10
+ objectUnderTest.maximumInMemorySizeInMegabytes = 1
}
def 'DMI Properties.'() {
diff --git a/cps-ncmp-service/src/test/resources/application.yml b/cps-ncmp-service/src/test/resources/application.yml
index 574b49982b..eca28b9917 100644
--- a/cps-ncmp-service/src/test/resources/application.yml
+++ b/cps-ncmp-service/src/test/resources/application.yml
@@ -38,6 +38,7 @@ ncmp:
dmi:
httpclient:
connectionTimeoutInSeconds: 180
+ maximumInMemorySizeInMegabytes: 16
auth:
username: some-user
password: some-password
diff --git a/integration-test/src/test/resources/application.yml b/integration-test/src/test/resources/application.yml
index 6fd3bcae4e..407210fa34 100644
--- a/integration-test/src/test/resources/application.yml
+++ b/integration-test/src/test/resources/application.yml
@@ -169,6 +169,7 @@ ncmp:
maximumConnectionsPerRoute: 50
maximumConnectionsTotal: 100
idleConnectionEvictionThresholdInSeconds: 5
+ maximumInMemorySizeInMegabytes: 16
auth:
username: dmi
password: dmi