summaryrefslogtreecommitdiffstats
path: root/feature-lifecycle/src/main
diff options
context:
space:
mode:
authoradheli.tavares <adheli.tavares@est.tech>2024-01-26 15:28:56 +0000
committerAdheli Tavares <adheli.tavares@est.tech>2024-02-09 10:31:15 +0000
commitcc1d3d352771d1fa35d297e90663539e34b022f6 (patch)
treeb1b00d678b0157742b91be1262fbf614a62063b1 /feature-lifecycle/src/main
parentcce79248655f484e007769ba81b092148f940d27 (diff)
Removing deprecated DMAAP library
Issue-ID: POLICY-4402 Change-Id: I4ce5b303cb3a775010683d3c7102b0bd065280ea Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'feature-lifecycle/src/main')
-rw-r--r--feature-lifecycle/src/main/feature/config/feature-lifecycle.properties41
-rw-r--r--feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java8
-rw-r--r--feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleStateActive.java7
-rw-r--r--feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleStateRunning.java2
-rw-r--r--feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeDroolsController.java2
5 files changed, 20 insertions, 40 deletions
diff --git a/feature-lifecycle/src/main/feature/config/feature-lifecycle.properties b/feature-lifecycle/src/main/feature/config/feature-lifecycle.properties
index 27799543..06fa87e5 100644
--- a/feature-lifecycle/src/main/feature/config/feature-lifecycle.properties
+++ b/feature-lifecycle/src/main/feature/config/feature-lifecycle.properties
@@ -2,6 +2,7 @@
# ONAP
# ================================================================================
# Copyright (C) 2019-2021 AT&T Intellectual Property. 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.
@@ -22,33 +23,17 @@ lifecycle.pdp.type=${envd:POLICY_PDP_PAP_TYPE:drools}
# Mandatory policy types that this PDP-D must support at a minimum
lifecycle.pdp.policytypes=${envd:POLICY_PDP_PAP_POLICYTYPES}
-dmaap.source.topics=POLICY-PDP-PAP
-dmaap.sink.topics=POLICY-PDP-PAP
+kafka.source.topics=POLICY-PDP-PAP
+kafka.sink.topics=POLICY-PDP-PAP
-dmaap.source.topics.POLICY-PDP-PAP.servers=${envd:DMAAP_SERVERS}
-dmaap.source.topics.POLICY-PDP-PAP.effectiveTopic=${envd:POLICY_PDP_PAP_TOPIC}
-dmaap.source.topics.POLICY-PDP-PAP.apiKey=${envd:POLICY_PDP_PAP_API_KEY}
-dmaap.source.topics.POLICY-PDP-PAP.apiSecret=${envd:POLICY_PDP_PAP_API_SECRET}
-dmaap.source.topics.POLICY-PDP-PAP.https=${envd:DMAAP_HTTPS:true}
+kafka.source.topics.POLICY-PDP-PAP.servers=${envd:KAFKA_SERVERS}
+kafka.source.topics.POLICY-PDP-PAP.effectiveTopic=${envd:POLICY_PDP_PAP_TOPIC}
+kafka.source.topics.POLICY-PDP-PAP.apiKey=${envd:POLICY_PDP_PAP_API_KEY}
+kafka.source.topics.POLICY-PDP-PAP.apiSecret=${envd:POLICY_PDP_PAP_API_SECRET}
+kafka.source.topics.POLICY-PDP-PAP.https=${envd:KAFKA_HTTPS:true}
-dmaap.sink.topics.POLICY-PDP-PAP.servers=${envd:DMAAP_SERVERS}
-dmaap.sink.topics.POLICY-PDP-PAP.effectiveTopic=${envd:POLICY_PDP_PAP_TOPIC}
-dmaap.sink.topics.POLICY-PDP-PAP.apiKey=${envd:POLICY_PDP_PAP_API_KEY}
-dmaap.sink.topics.POLICY-PDP-PAP.apiSecret=${envd:POLICY_PDP_PAP_API_SECRET}
-dmaap.sink.topics.POLICY-PDP-PAP.https=${envd:DMAAP_HTTPS:true}
-
-#Replace the properties with the following to use kafka message broker
-#kafka.source.topics=policy-pdp-pap
-#kafka.source.topics.fetchTimeout=15000
-#kafka.sink.topics=policy-pdp-pap
-#kafka.source.topics.policy-pdp-pap.servers=${envd:DMAAP_SERVERS}
-#kafka.source.topics.policy-pdp-pap.effectiveTopic=${envd:POLICY_PDP_PAP_TOPIC}
-#kafka.source.topics.policy-pdp-pap.apiKey=${envd:POLICY_PDP_PAP_API_KEY}
-#kafka.source.topics.policy-pdp-pap.apiSecret=${envd:POLICY_PDP_PAP_API_SECRET}
-#kafka.source.topics.policy-pdp-pap.https=${envd:DMAAP_HTTPS:true}
-
-#kafka.sink.topics.policy-pdp-pap.servers=${envd:DMAAP_SERVERS}
-#kafka.sink.topics.policy-pdp-pap.effectiveTopic=${envd:POLICY_PDP_PAP_TOPIC}
-#kafka.sink.topics.policy-pdp-pap.apiKey=${envd:POLICY_PDP_PAP_API_KEY}
-#kafka.sink.topics.policy-pdp-pap.apiSecret=${envd:POLICY_PDP_PAP_API_SECRET}
-#kafka.sink.topics.policy-pdp-pap.https=${envd:DMAAP_HTTPS:true}
+kafka.sink.topics.POLICY-PDP-PAP.servers=${envd:KAFKA_SERVERS}
+kafka.sink.topics.POLICY-PDP-PAP.effectiveTopic=${envd:POLICY_PDP_PAP_TOPIC}
+kafka.sink.topics.POLICY-PDP-PAP.apiKey=${envd:POLICY_PDP_PAP_API_KEY}
+kafka.sink.topics.POLICY-PDP-PAP.apiSecret=${envd:POLICY_PDP_PAP_API_SECRET}
+kafka.sink.topics.POLICY-PDP-PAP.https=${envd:KAFKA_HTTPS:true}
diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java
index c67367e0..e7656ae6 100644
--- a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java
+++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java
@@ -3,7 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2019-2022 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2021,2023 Nordix Foundation.
+ * Modifications Copyright (C) 2021, 2023-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.
@@ -23,8 +23,6 @@ package org.onap.policy.drools.lifecycle;
import com.google.re2j.Pattern;
import io.prometheus.client.Counter;
-import java.lang.reflect.InvocationTargetException;
-import java.time.Instant;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -42,7 +40,6 @@ import java.util.stream.Collectors;
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
-import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.StringUtils;
import org.onap.policy.common.capabilities.Startable;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
@@ -286,8 +283,7 @@ public class LifecycleFsm implements Startable {
policyTypesMap.values().stream()
.filter(PolicyTypeDroolsController.class::isInstance)
.map(PolicyTypeDroolsController.class::cast)
- .filter(opController -> opController.getControllers().containsKey(controller.getName()))
- .collect(Collectors.toList());
+ .filter(opController -> opController.getControllers().containsKey(controller.getName())).toList();
for (PolicyTypeDroolsController opController : opControllers) {
opController.remove(controller);
diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleStateActive.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleStateActive.java
index 202eb98b..02fc7a93 100644
--- a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleStateActive.java
+++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleStateActive.java
@@ -4,7 +4,7 @@
* ================================================================================
* Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Bell Canada.
- * Modifications Copyright (C) 2023 Nordix Foundation.
+ * Modifications Copyright (C) 2023-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.
@@ -25,7 +25,6 @@ package org.onap.policy.drools.lifecycle;
import java.util.Collections;
import lombok.NonNull;
import lombok.ToString;
-import org.jetbrains.annotations.NotNull;
import org.onap.policy.models.pdp.concepts.PdpStateChange;
import org.onap.policy.models.pdp.enums.PdpResponseStatus;
import org.onap.policy.models.pdp.enums.PdpState;
@@ -46,12 +45,12 @@ public class LifecycleStateActive extends LifecycleStateRunning {
}
@Override
- protected boolean stateChangeToActive(@NotNull PdpStateChange change) {
+ protected boolean stateChangeToActive(@NonNull PdpStateChange change) {
return fsm.statusAction(response(change.getRequestId(), PdpResponseStatus.SUCCESS, null));
}
@Override
- protected boolean stateChangeToPassive(@NotNull PdpStateChange change) {
+ protected boolean stateChangeToPassive(@NonNull PdpStateChange change) {
undeployPolicies(Collections.emptyList());
fsm.transitionToAction(new LifecycleStatePassive(fsm));
return fsm.statusAction(response(change.getRequestId(), PdpResponseStatus.SUCCESS, null));
diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleStateRunning.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleStateRunning.java
index fc62b947..2d5c66b3 100644
--- a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleStateRunning.java
+++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleStateRunning.java
@@ -217,7 +217,7 @@ public abstract class LifecycleStateRunning extends LifecycleStateDefault {
}
protected List<ToscaPolicy> reApplyNonNativePolicies(Map<String, List<ToscaPolicy>> preActivePoliciesMap) {
- // only need to re-apply non native policies if there are new native artifact policies
+ // only need to re-apply non-native policies if there are new native artifact policies
Map<String, List<ToscaPolicy>> activePoliciesByType = fsm.groupPoliciesByPolicyType(fsm.getActivePolicies());
List<ToscaPolicy> activeNativeArtifactPolicies = fsm.getNativeArtifactPolicies(activePoliciesByType);
diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeDroolsController.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeDroolsController.java
index 6973745c..6e248e8d 100644
--- a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeDroolsController.java
+++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeDroolsController.java
@@ -179,7 +179,7 @@ public class PolicyTypeNativeDroolsController implements PolicyTypeController {
List<TopicSink> sinks =
TopicEndpointManager.getManager().getTopicSinks(List.of(configSinkTopic.getTopicName()));
if (sinks.size() != 1) {
- logger.warn("Topic {} is not present or ambigous {}", configSinkTopic.getTopicName(), sinks);
+ logger.warn("Topic {} is not present or ambiguous {}", configSinkTopic.getTopicName(), sinks);
return false;
}