diff options
Diffstat (limited to 'a1-policy-management')
6 files changed, 13 insertions, 6 deletions
diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClient.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClient.java index cba1c7cc..2b8c4fa6 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClient.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/AsyncRestClient.java @@ -211,9 +211,8 @@ public class AsyncRestClient { client = client.secure(c -> c.sslContext(sslContext)); } if (isHttpProxyConfigured()) { - client = client.proxy(proxy -> { - proxy.type(Proxy.HTTP).host(httpProxyConfig.httpProxyHost()).port(httpProxyConfig.httpProxyPort()); - }); + client = client.proxy(proxy -> proxy.type(Proxy.HTTP).host(httpProxyConfig.httpProxyHost()) + .port(httpProxyConfig.httpProxyPort())); } return client; } diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationController.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationController.java index 5497e0a5..7a432f83 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationController.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/controllers/v2/ConfigurationController.java @@ -34,6 +34,8 @@ import org.onap.ccsdk.oran.a1policymanagementservice.configuration.Configuration import org.onap.ccsdk.oran.a1policymanagementservice.controllers.VoidResponse; import org.onap.ccsdk.oran.a1policymanagementservice.controllers.v2.ErrorResponse.ErrorInfo; import org.onap.ccsdk.oran.a1policymanagementservice.exceptions.ServiceException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; @@ -45,6 +47,7 @@ import org.springframework.web.bind.annotation.RestController; @RestController("ConfigurationControllerV2") @Api(tags = {Consts.V2_CONFIG_API_NAME}) public class ConfigurationController { + private static final Logger logger = LoggerFactory.getLogger(ConfigurationController.class); @Autowired ConfigurationFile configurationFile; @@ -63,10 +66,12 @@ public class ConfigurationController { ApplicationConfigParser configParser = new ApplicationConfigParser(); configParser.parse(configJson); configurationFile.writeFile(configJson); + logger.info("Configuration changed through REST call."); } catch (ServiceException | JsonSyntaxException e) { return ErrorResponse.create(String.format("Faulty configuration. %s", e.getMessage()), HttpStatus.BAD_REQUEST); } catch (IOException ioe) { + logger.warn("Configuration file not written, {}.", ioe.getMessage()); ErrorResponse.create("Internal error when writing the configuration. Try again.", HttpStatus.INTERNAL_SERVER_ERROR); } diff --git a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageConsumer.java b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageConsumer.java index 3a06e71f..56765232 100644 --- a/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageConsumer.java +++ b/a1-policy-management/src/main/java/org/onap/ccsdk/oran/a1policymanagementservice/dmaap/DmaapMessageConsumer.java @@ -131,7 +131,7 @@ public class DmaapMessageConsumer { createTask().subscribe(// value -> logger.debug("DmaapMessageConsumer next: {}", value), // - throwable -> logger.error("DmaapMessageConsumer error: {}", throwable), // + throwable -> logger.error("DmaapMessageConsumer error: {}", throwable.getMessage()), // () -> logger.warn("DmaapMessageConsumer stopped") // ); } diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/MockPolicyManagementService.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/MockPolicyManagementService.java index 83b73d18..e6834e77 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/MockPolicyManagementService.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/MockPolicyManagementService.java @@ -60,6 +60,8 @@ import org.springframework.util.StringUtils; @TestPropertySource(properties = { // "server.ssl.key-store=./config/keystore.jks", // "app.webclient.trust-store=./config/truststore.jks"}) +@SuppressWarnings("java:S3577") // Class name should start or end with Test. This is not a test class per se, but a mock + // of the server. class MockPolicyManagementService { private static final Logger logger = LoggerFactory.getLogger(MockPolicyManagementService.class); diff --git a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClientTest.java b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClientTest.java index 985ce558..ced739ad 100644 --- a/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClientTest.java +++ b/a1-policy-management/src/test/java/org/onap/ccsdk/oran/a1policymanagementservice/clients/CcsdkA1AdapterClientTest.java @@ -84,8 +84,9 @@ class CcsdkA1AdapterClientTest { @Test void createClientWithWrongProtocol_thenErrorIsThrown() { + AsyncRestClient asyncRestClient = new AsyncRestClient("", null, null); assertThrows(IllegalArgumentException.class, () -> { - new CcsdkA1AdapterClient(A1ProtocolType.STD_V1_1, null, null, new AsyncRestClient("", null, null)); + new CcsdkA1AdapterClient(A1ProtocolType.STD_V1_1, null, null, asyncRestClient); }); } 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 5e089a0b..516ddd5f 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 @@ -680,7 +680,7 @@ class ApplicationTest { doReturn(Mono.error(a1Exception)).when(a1Client).getPolicyStatus(any()); rsp = restClient().get(url).block(); info = gson.fromJson(rsp, PolicyStatusInfo.class); - assertThat(info.status.toString()).isEqualTo("{}"); + assertThat(info.status).hasToString("{}"); } @Test |