diff options
author | rameshiyer27 <ramesh.murugan.iyer@est.tech> | 2024-01-29 17:51:52 +0000 |
---|---|---|
committer | rameshiyer27 <ramesh.murugan.iyer@est.tech> | 2024-02-09 10:29:59 +0000 |
commit | dfc5d564659ea5faccceaf5ecb7eb6fbc54bd701 (patch) | |
tree | db9dcf25f3daf387aba6940f93ddb1e40bf833b2 /main/src/main/java | |
parent | 875d5ca25cf09bbf80a8493639f2abfc501fc844 (diff) |
Remove Dmaap from PAP
Issue-ID: POLICY-4402
Signed-off-by: rameshiyer27 <ramesh.murugan.iyer@est.tech>
Change-Id: Ib1715bde8b4d0ca78b3c74c62784d5579900c2d4
Diffstat (limited to 'main/src/main/java')
-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); |