diff options
author | Remigiusz Janeczek <remigiusz.janeczek@nokia.com> | 2021-02-04 13:18:45 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-02-04 13:18:45 +0000 |
commit | 307ea99aec88799edda09ccd54116eddf0e4d50e (patch) | |
tree | 478232f8089e70e0e16a0358625f06bd57237352 /prh-app-server | |
parent | a137dfc901cf4d631561d9076a28b6f9cba9cb82 (diff) | |
parent | 14011f96caec688a121f9a9f19a0f27c37a67770 (diff) |
Merge "Upgrade Spring Boot and Spring Cloud versions"
Diffstat (limited to 'prh-app-server')
3 files changed, 12 insertions, 7 deletions
diff --git a/prh-app-server/pom.xml b/prh-app-server/pom.xml index 630a0080..aaaf47b3 100644 --- a/prh-app-server/pom.xml +++ b/prh-app-server/pom.xml @@ -3,7 +3,7 @@ ~ ============LICENSE_START======================================================= ~ PNF-REGISTRATION-HANDLER ~ ================================================================================ - ~ Copyright (C) 2018-2020 NOKIA Intellectual Property. All rights reserved. + ~ Copyright (C) 2018-2021 NOKIA Intellectual Property. All rights reserved. ~ ================================================================================ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. @@ -221,6 +221,10 @@ <artifactId>spring-cloud-starter-config</artifactId> </dependency> <dependency> + <groupId>org.springframework.cloud</groupId> + <artifactId>spring-cloud-starter-bootstrap</artifactId> + </dependency> + <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/bootstrap/CbsPropertySourceLocator.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/bootstrap/CbsPropertySourceLocator.java index 7b660202..c068988c 100644 --- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/bootstrap/CbsPropertySourceLocator.java +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/bootstrap/CbsPropertySourceLocator.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * PNF-REGISTRATION-HANDLER * ================================================================================ - * Copyright (C) 2019 NOKIA Intellectual Property. All rights reserved. + * Copyright (C) 2019-2021 NOKIA Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,6 +31,7 @@ import org.springframework.cloud.bootstrap.config.PropertySourceLocator; import org.springframework.core.env.Environment; import org.springframework.core.env.MapPropertySource; import org.springframework.core.env.PropertySource; +import reactor.util.retry.Retry; import java.util.Map; @@ -63,9 +64,9 @@ public class CbsPropertySourceLocator implements PropertySourceLocator { Map<String, Object> properties = cbsClientFactoryFacade.createCbsClient(cbsClientConfiguration) .flatMap(cbsClient -> cbsClient.get(CbsRequests.getAll(RequestDiagnosticContext.create()))) .doOnError(e -> LOGGER.warn("Failed fetching config properties from CBS - retrying...", e)) - .retryBackoff(cbsProperties.getFetchRetries().getMaxAttempts(), - cbsProperties.getFetchRetries().getFirstBackoff(), - cbsProperties.getFetchRetries().getMaxBackoff()) + .retryWhen(Retry. + backoff(cbsProperties.getFetchRetries().getMaxAttempts(), cbsProperties.getFetchRetries().getFirstBackoff()). + maxBackoff(cbsProperties.getFetchRetries().getMaxBackoff())) .doOnNext(this::updateCbsConfig) .map(cbsJsonToPropertyMapConverter::convertToMap) .block(); diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/bootstrap/CbsPropertySourceLocatorTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/bootstrap/CbsPropertySourceLocatorTest.java index faf1867a..22a11ed6 100644 --- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/bootstrap/CbsPropertySourceLocatorTest.java +++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/bootstrap/CbsPropertySourceLocatorTest.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * PNF-REGISTRATION-HANDLER * ================================================================================ - * Copyright (C) 2019 NOKIA Intellectual Property. All rights reserved. + * Copyright (C) 2019-2021 NOKIA Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -80,7 +80,7 @@ class CbsPropertySourceLocatorTest { @BeforeEach void setup() { - virtualTimeScheduler = VirtualTimeScheduler.getOrSet(); + virtualTimeScheduler = VirtualTimeScheduler.getOrSet(true); when(cbsClientConfigurationResolver.resolveCbsClientConfiguration()).thenReturn(cbsClientConfiguration); when(cbsClientFactoryFacade.createCbsClient(cbsClientConfiguration)).thenReturn(Mono.just(cbsClient)); |