diff options
Diffstat (limited to 'main/src/main/java/org/onap/policy/pap/main/rest')
-rw-r--r-- | main/src/main/java/org/onap/policy/pap/main/rest/KafkaGetTopicResponse.java (renamed from main/src/main/java/org/onap/policy/pap/main/rest/DmaapGetTopicResponse.java) | 5 | ||||
-rw-r--r-- | main/src/main/java/org/onap/policy/pap/main/rest/PolicyComponentsHealthCheckProvider.java | 18 |
2 files changed, 12 insertions, 11 deletions
diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/DmaapGetTopicResponse.java b/main/src/main/java/org/onap/policy/pap/main/rest/KafkaGetTopicResponse.java index 82886509..dd63a507 100644 --- a/main/src/main/java/org/onap/policy/pap/main/rest/DmaapGetTopicResponse.java +++ b/main/src/main/java/org/onap/policy/pap/main/rest/KafkaGetTopicResponse.java @@ -1,6 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2021 Bell Canada. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,12 +27,12 @@ import lombok.Setter; import lombok.ToString; /** - * Class to capture get topic response from dmaap. + * Class to capture get topic response from kafka. */ @Getter @Setter @ToString -public class DmaapGetTopicResponse { +public class KafkaGetTopicResponse { private List<String> topics; } diff --git a/main/src/main/java/org/onap/policy/pap/main/rest/PolicyComponentsHealthCheckProvider.java b/main/src/main/java/org/onap/policy/pap/main/rest/PolicyComponentsHealthCheckProvider.java index 02d27605..32d43143 100644 --- a/main/src/main/java/org/onap/policy/pap/main/rest/PolicyComponentsHealthCheckProvider.java +++ b/main/src/main/java/org/onap/policy/pap/main/rest/PolicyComponentsHealthCheckProvider.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2020, 2022-2023 Nordix Foundation. + * Copyright (C) 2019-2020, 2022-2024 Nordix Foundation. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2020-2022 Bell Canada. All rights reserved. * ================================================================================ @@ -204,8 +204,8 @@ public class PolicyComponentsHealthCheckProvider { HealthCheckReport clientReport; try { Response resp = httpClient.get(); - if (httpClient.getName().equalsIgnoreCase("dmaap")) { - clientReport = verifyDmaapClient(httpClient, resp); + if (httpClient.getName().equalsIgnoreCase("kafka")) { + clientReport = verifyKafkaClient(httpClient, resp); } else { clientReport = replaceIpWithHostname(resp.readEntity(HealthCheckReport.class), httpClient.getBaseUrl()); } @@ -244,12 +244,12 @@ public class PolicyComponentsHealthCheckProvider { return report; } - private HealthCheckReport verifyDmaapClient(HttpClient httpClient, Response resp) { - DmaapGetTopicResponse dmaapResponse = resp.readEntity(DmaapGetTopicResponse.class); - var topicVerificationStatus = (dmaapResponse.getTopics() != null - && dmaapResponse.getTopics().contains(topicPolicyPdpPap)); - String message = (topicVerificationStatus ? "PAP to DMaaP connection check is successful" - : "PAP to DMaaP connection check failed"); + private HealthCheckReport verifyKafkaClient(HttpClient httpClient, Response resp) { + KafkaGetTopicResponse kafkaResponse = resp.readEntity(KafkaGetTopicResponse.class); + var topicVerificationStatus = (kafkaResponse.getTopics() != null + && kafkaResponse.getTopics().contains(topicPolicyPdpPap)); + String message = (topicVerificationStatus ? "PAP to Kafka connection check is successful" + : "PAP to Kafka connection check failed"); int code = (topicVerificationStatus ? resp.getStatus() : 503); return createHealthCheckReport(httpClient.getName(), httpClient.getBaseUrl(), code, topicVerificationStatus, message); |