diff options
author | adheli.tavares <adheli.tavares@est.tech> | 2024-01-31 10:39:45 +0000 |
---|---|---|
committer | Adheli Tavares <adheli.tavares@est.tech> | 2024-02-09 14:28:59 +0000 |
commit | eeb8a6a39d2bdd20bc54c11ac69700739d8faac1 (patch) | |
tree | b22a3a34482af847905062fb1ebeab43cab39162 /controlloop/common | |
parent | b0455b141643f18d5025e23ac7859da43afe7f19 (diff) |
Remove deprecated DMAAP dependency
Issue-ID: POLICY-4402
Change-Id: Id3bf1f5833b7d6086345b3747505e2f57036d4ea
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'controlloop/common')
28 files changed, 142 insertions, 216 deletions
diff --git a/controlloop/common/controller-usecases/src/main/resources/META-INF/kmodule.xml b/controlloop/common/controller-usecases/src/main/resources/META-INF/kmodule.xml index 7db705b2b..885568e08 100644 --- a/controlloop/common/controller-usecases/src/main/resources/META-INF/kmodule.xml +++ b/controlloop/common/controller-usecases/src/main/resources/META-INF/kmodule.xml @@ -4,6 +4,7 @@ ONAP ================================================================================ Copyright (C) 2020 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. @@ -18,7 +19,7 @@ limitations under the License. ============LICENSE_END========================================================= --> -<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule"> +<kmodule xmlns="http://www.drools.org/xsd/kmodule"> <kbase name="onap.policies.controlloop.operational.common.Drools" equalsBehavior="equality" packages="org.onap.policy.controlloop"> <ksession name="usecases"/> diff --git a/controlloop/common/controller-usecases/src/main/resources/usecases.drl b/controlloop/common/controller-usecases/src/main/resources/usecases.drl index 14bc9a406..70a1cd8a1 100644 --- a/controlloop/common/controller-usecases/src/main/resources/usecases.drl +++ b/controlloop/common/controller-usecases/src/main/resources/usecases.drl @@ -174,7 +174,7 @@ rule "EVENT" manager.start(); if (manager.getSteps().isEmpty()) { - // no steps implies no policies, thus go straight to DONE state + // no steps imply no policies, thus go straight to DONE state manager.setState(State.DONE); manager.setAccepted(true); @@ -1095,7 +1095,7 @@ end rule "APPC-LCM.Response.CLEANUP" salience 1 when - $msg : org.onap.policy.appclcm.AppcLcmDmaapWrapper( ) + $msg : org.onap.policy.appclcm.AppcLcmMessageWrapper( ) then retract($msg); end diff --git a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManagerTest.java b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManagerTest.java index 3b6463819..79ada39d2 100644 --- a/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManagerTest.java +++ b/controlloop/common/controller-usecases/src/test/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManagerTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021, 2023 AT&T Intellectual Property. All rights reserved. - * 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. @@ -367,6 +367,8 @@ class UsecasesEventManagerTest { @Test void testStoreInDataBase() throws ControlLoopException { + when(services.getDataManager()).thenReturn(dataMgr); + when(workMem.getFactHandle(any())).thenReturn(factHandle); mgr.start(); var outcome = makeOutcome(); mgr.addToHistory(outcome); diff --git a/controlloop/common/controller-usecases/src/test/resources/config/usecases-controller.properties b/controlloop/common/controller-usecases/src/test/resources/config/usecases-controller.properties index 67d0bc854..1bd4766dd 100644 --- a/controlloop/common/controller-usecases/src/test/resources/config/usecases-controller.properties +++ b/controlloop/common/controller-usecases/src/test/resources/config/usecases-controller.properties @@ -40,8 +40,8 @@ noop.source.topics.appc-cl.events.org.onap.policy.appc.Response.filter=[?($.Comm noop.source.topics.appc-cl.events.org.onap.policy.appc.Request.filter=[?($.CommonHeader && $.Action)] noop.source.topics.appc-cl.events.custom.gson=org.onap.policy.appc.util.Serialization,gsonPretty -noop.source.topics.appc-lcm-write.events=org.onap.policy.appclcm.AppcLcmDmaapWrapper -noop.source.topics.appc-lcm-write.events.org.onap.policy.appclcm.AppcLcmDmaapWrapper.filter=[?($.type == 'response')] +noop.source.topics.appc-lcm-write.events=org.onap.policy.appclcm.AppcLcmMessageWrapper +noop.source.topics.appc-lcm-write.events.org.onap.policy.appclcm.AppcLcmMessageWrapper.filter=[?($.type == 'response')] noop.source.topics.appc-lcm-write.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson noop.source.topics.sdnr-cl-rsp.events=org.onap.policy.sdnr.PciResponseWrapper @@ -55,7 +55,7 @@ noop.source.topics.a1-p-RSP.events.custom.gson=org.onap.policy.sdnr.util.Seriali noop.source.topics.policy-cl-mgt.events=org.onap.policy.controlloop.VirtualControlLoopNotification noop.source.topics.policy-cl-mgt.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gsonPretty -noop.source.topics.appc-lcm-read.events=org.onap.policy.appclcm.AppcLcmDmaapWrapper +noop.source.topics.appc-lcm-read.events=org.onap.policy.appclcm.AppcLcmMessageWrapper noop.source.topics.appc-lcm-read.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson noop.sink.topics=appc-cl,appc-lcm-read,policy-cl-mgt,sdnr-cl,dcae_cl_rsp,a1-p diff --git a/controlloop/common/coordination/src/main/java/org/onap/policy/coordination/CoordinationDirective.java b/controlloop/common/coordination/src/main/java/org/onap/policy/coordination/CoordinationDirective.java index 6ba4ca478..a136c7ecc 100644 --- a/controlloop/common/coordination/src/main/java/org/onap/policy/coordination/CoordinationDirective.java +++ b/controlloop/common/coordination/src/main/java/org/onap/policy/coordination/CoordinationDirective.java @@ -3,6 +3,7 @@ * guard * ================================================================================ * Copyright (C) 2019 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. @@ -21,16 +22,16 @@ package org.onap.policy.coordination; import java.util.List; +import lombok.Getter; +import lombok.Setter; +@Setter +@Getter public class CoordinationDirective { private List<String> controlLoop; private String coordinationFunction; - public List<String> getControlLoop() { - return controlLoop; - } - /** * gets the ith control loop. * @@ -41,18 +42,6 @@ public class CoordinationDirective { return controlLoop.get(index); } - public void setControlLoop(List<String> controlLoop) { - this.controlLoop = controlLoop; - } - - public String getCoordinationFunction() { - return coordinationFunction; - } - - public void setCoordinationFunction(String coordinationFunction) { - this.coordinationFunction = coordinationFunction; - } - /** * toString. * diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/drl/legacy/ControlLoopParams.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/drl/legacy/ControlLoopParams.java index 3eac66112..014ccd497 100644 --- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/drl/legacy/ControlLoopParams.java +++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/drl/legacy/ControlLoopParams.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020 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. @@ -20,6 +21,7 @@ package org.onap.policy.controlloop.drl.legacy; +import java.io.Serial; import java.io.Serializable; import lombok.Data; import lombok.NoArgsConstructor; @@ -29,6 +31,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; @NoArgsConstructor public class ControlLoopParams implements Serializable { + @Serial private static final long serialVersionUID = 970755684770982776L; private String closedLoopControlName; diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ClEventManagerWithEvent.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ClEventManagerWithEvent.java index 5a0352bfe..bb322f825 100644 --- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ClEventManagerWithEvent.java +++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ClEventManagerWithEvent.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 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. @@ -20,6 +21,7 @@ package org.onap.policy.controlloop.eventmanager; +import java.io.Serial; import java.util.HashMap; import lombok.AccessLevel; import lombok.Getter; @@ -40,20 +42,20 @@ import org.slf4j.LoggerFactory; * Manager for a single control loop event. Once this has been created, the event can be * retracted from working memory. */ +@Getter public abstract class ClEventManagerWithEvent<T extends Step> extends ClEventManagerWithOutcome<T> implements StepContext { private static final Logger logger = LoggerFactory.getLogger(ClEventManagerWithEvent.class); + @Serial private static final long serialVersionUID = -1216568161322872641L; public enum NewEventStatus { FIRST_ONSET, SUBSEQUENT_ONSET, FIRST_ABATEMENT, SUBSEQUENT_ABATEMENT, SYNTAX_ERROR } - @Getter private final VirtualControlLoopEvent event; - @Getter @Setter(AccessLevel.PROTECTED) private VirtualControlLoopEvent abatement = null; diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java index 354567cd8..f93b2acf5 100644 --- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java +++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2017-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. @@ -20,6 +21,7 @@ package org.onap.policy.controlloop.eventmanager; +import java.io.Serial; import java.io.Serializable; import java.time.Instant; import java.util.Deque; @@ -61,6 +63,7 @@ import org.slf4j.LoggerFactory; public class ControlLoopEventManager implements StepContext, Serializable { private static final Logger logger = LoggerFactory.getLogger(ControlLoopEventManager.class); + @Serial private static final long serialVersionUID = -1216568161322872641L; /** @@ -81,7 +84,7 @@ public class ControlLoopEventManager implements StepContext, Serializable { * otherwise. This will be {@code false} if this object is reconstituted from a * persistent store or by transfer from another server. */ - private transient boolean createdByThisJvmInstance; + private final transient boolean createdByThisJvmInstance; private final transient EventManagerServices services; @@ -115,7 +118,7 @@ public class ControlLoopEventManager implements StepContext, Serializable { /** * Set of properties used while processing the event. */ - private Map<String, Serializable> properties = new ConcurrentHashMap<>(); + private final Map<String, Serializable> properties = new ConcurrentHashMap<>(); /** * Unprocessed outcomes from the operations. Outcomes are added to this each time the @@ -192,7 +195,7 @@ public class ControlLoopEventManager implements StepContext, Serializable { */ private long detmControlLoopTimeoutMs() { // validation checks preclude null or 0 timeout values in the policy - Integer timeout = processor.getPolicy().getProperties().getTimeout(); + int timeout = processor.getPolicy().getProperties().getTimeout(); return TimeUnit.MILLISECONDS.convert(timeout, TimeUnit.SECONDS); } diff --git a/controlloop/common/feature-controlloop-management/src/main/feature/config/A1-P-RSP-topic.properties b/controlloop/common/feature-controlloop-management/src/main/feature/config/A1-P-RSP-topic.properties index 8e9d2dcab..60e54276d 100644 --- a/controlloop/common/feature-controlloop-management/src/main/feature/config/A1-P-RSP-topic.properties +++ b/controlloop/common/feature-controlloop-management/src/main/feature/config/A1-P-RSP-topic.properties @@ -2,6 +2,7 @@ # ONAP # ================================================================================ # Copyright (C) 2022 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. @@ -16,12 +17,5 @@ # limitations under the License. # ============LICENSE_END========================================================= - -dmaap.source.topics=A1-P-RSP -dmaap.source.topics.A1-P-RSP.servers=${envd:DMAAP_SERVERS} -dmaap.source.topics.A1-P-RSP.https=${envd:DMAAP_HTTPS:true} - -#Replace the properties with the following to use kafka message broker -#kafka.source.topics=a1-p-rsp -#kafka.source.topics.a1-p-rsp.servers=${envd:DMAAP_SERVERS} -#kafka.source.topics.a1-p-rsp.https=${envd:DMAAP_HTTPS:true} +kafka.source.topics=a1-p-rsp +kafka.source.topics.a1-p-rsp.servers=${envd:KAFKA_SERVERS} diff --git a/controlloop/common/feature-controlloop-management/src/main/feature/config/A1-P-topic.properties b/controlloop/common/feature-controlloop-management/src/main/feature/config/A1-P-topic.properties index 26591baf0..d15f966e0 100644 --- a/controlloop/common/feature-controlloop-management/src/main/feature/config/A1-P-topic.properties +++ b/controlloop/common/feature-controlloop-management/src/main/feature/config/A1-P-topic.properties @@ -2,6 +2,7 @@ # ONAP # ================================================================================ # Copyright (C) 2022 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. @@ -16,14 +17,6 @@ # limitations under the License. # ============LICENSE_END========================================================= -dmaap.sink.topics=A1-P - -dmaap.sink.topics.A1-P.servers=${envd:DMAAP_SERVERS} -dmaap.sink.topics.A1-P.https=${envd:DMAAP_HTTPS:true} - -#Replace the properties with the following to use kafka message broker -#kafka.sink.topics=a1-p - -#kafka.sink.topics.A1-P.servers=${envd:DMAAP_SERVERS} -#kafka.sink.topics.A1-P.https=${envd:DMAAP_HTTPS:true} +kafka.sink.topics=a1-p +kafka.sink.topics.A1-P.servers=${envd:KAFKA_SERVERS} diff --git a/controlloop/common/feature-controlloop-management/src/main/feature/config/APPC-CL-topic.properties b/controlloop/common/feature-controlloop-management/src/main/feature/config/APPC-CL-topic.properties index f5b7c158c..a2c3c628a 100644 --- a/controlloop/common/feature-controlloop-management/src/main/feature/config/APPC-CL-topic.properties +++ b/controlloop/common/feature-controlloop-management/src/main/feature/config/APPC-CL-topic.properties @@ -2,6 +2,7 @@ # ONAP # ================================================================================ # Copyright (C) 2020-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. @@ -16,22 +17,7 @@ # limitations under the License. # ============LICENSE_END========================================================= - -dmaap.source.topics=APPC-CL -dmaap.sink.topics=APPC-CL - -dmaap.source.topics.APPC-CL.servers=${envd:DMAAP_SERVERS} -dmaap.source.topics.APPC-CL.https=${envd:DMAAP_HTTPS:true} - -dmaap.sink.topics.APPC-CL.servers=${envd:DMAAP_SERVERS} -dmaap.sink.topics.APPC-CL.https=${envd:DMAAP_HTTPS:true} - -#Replace the properties with the following to use kafka message broker -#kafka.source.topics=appc-cl -#kafka.sink.topics=appc-cl - -#kafka.source.topics.appc-cl.servers=${envd:DMAAP_SERVERS} -#kafka.source.topics.appc-cl.https=${envd:DMAAP_HTTPS:true} - -#kafka.sink.topics.appc-cl.servers=${envd:DMAAP_SERVERS} -#kafka.sink.topics.appc-cl.https=${envd:DMAAP_HTTPS:true} +kafka.source.topics=appc-cl +kafka.sink.topics=appc-cl +kafka.source.topics.appc-cl.servers=${envd:KAFKA_SERVERS} +kafka.sink.topics.appc-cl.servers=${envd:KAFKA_SERVERS} diff --git a/controlloop/common/feature-controlloop-management/src/main/feature/config/APPC-LCM-READ-topic.properties b/controlloop/common/feature-controlloop-management/src/main/feature/config/APPC-LCM-READ-topic.properties index f50958f0e..dde79f830 100644 --- a/controlloop/common/feature-controlloop-management/src/main/feature/config/APPC-LCM-READ-topic.properties +++ b/controlloop/common/feature-controlloop-management/src/main/feature/config/APPC-LCM-READ-topic.properties @@ -2,6 +2,7 @@ # ONAP # ================================================================================ # Copyright (C) 2020-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. @@ -16,15 +17,5 @@ # limitations under the License. # ============LICENSE_END========================================================= - -dmaap.sink.topics=APPC-LCM-READ - -dmaap.sink.topics.APPC-LCM-READ.servers=${envd:DMAAP_SERVERS} -dmaap.sink.topics.APPC-LCM-READ.https=${envd:DMAAP_HTTPS:true} - -#Replace the properties with the following to use kafka message broker -#kafka.sink.topics=appc-lcm-read - -#kafka.sink.topics.appc-lcm-read.servers=${envd:DMAAP_SERVERS} -#kafka.sink.topics.appc-lcm-read.https=${envd:DMAAP_HTTPS:true} - +kafka.sink.topics=appc-lcm-read +kafka.sink.topics.appc-lcm-read.servers=${envd:KAFKA_SERVERS} diff --git a/controlloop/common/feature-controlloop-management/src/main/feature/config/APPC-LCM-WRITE-topic.properties b/controlloop/common/feature-controlloop-management/src/main/feature/config/APPC-LCM-WRITE-topic.properties index 414c3a2e8..261d74557 100644 --- a/controlloop/common/feature-controlloop-management/src/main/feature/config/APPC-LCM-WRITE-topic.properties +++ b/controlloop/common/feature-controlloop-management/src/main/feature/config/APPC-LCM-WRITE-topic.properties @@ -2,6 +2,7 @@ # ONAP # ================================================================================ # Copyright (C) 2020-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. @@ -16,14 +17,5 @@ # limitations under the License. # ============LICENSE_END========================================================= - -dmaap.source.topics=APPC-LCM-WRITE - -dmaap.source.topics.APPC-LCM-WRITE.servers=${envd:DMAAP_SERVERS} -dmaap.source.topics.APPC-LCM-WRITE.https=${envd:DMAAP_HTTPS:true} - -#Replace the properties with the following to use kafka message broker -#kafka.source.topics=appc-lcm-write - -#kafka.source.topics.appc-lcm-write.servers=${envd:DMAAP_SERVERS} -#kafka.source.topics.appc-lcm-write.https=${envd:DMAAP_HTTPS:true} +kafka.source.topics=appc-lcm-write +kafka.source.topics.appc-lcm-write.servers=${envd:KAFKA_SERVERS} diff --git a/controlloop/common/feature-controlloop-management/src/main/feature/config/DCAE_CL_RSP-topic.properties b/controlloop/common/feature-controlloop-management/src/main/feature/config/DCAE_CL_RSP-topic.properties index 54ce1aaa7..2c860f1a6 100644 --- a/controlloop/common/feature-controlloop-management/src/main/feature/config/DCAE_CL_RSP-topic.properties +++ b/controlloop/common/feature-controlloop-management/src/main/feature/config/DCAE_CL_RSP-topic.properties @@ -2,7 +2,7 @@ # ONAP # ================================================================================ # Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. -# Modifications Copyright (C) 2022 Nordix Foundation. +# Modifications Copyright (C) 2022, 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. @@ -17,13 +17,5 @@ # limitations under the License. # ============LICENSE_END========================================================= -dmaap.sink.topics=DCAE_CL_RSP - -dmaap.sink.topics.DCAE_CL_RSP.servers=${env:DMAAP_SERVERS} -dmaap.sink.topics.DCAE_CL_RSP.https=${envd:DMAAP_HTTPS:true} - -#Replace the properties with the following to use kafka message broker -#kafka.sink.topics=dcae-cl-rsp - -#kafka.sink.topics.dcae-cl-rsp.servers=${env:DMAAP_SERVERS} -#kafka.sink.topics.dcae-cl-rsp.https=${envd:DMAAP_HTTPS:true} +kafka.sink.topics=dcae-cl-rsp +kafka.sink.topics.dcae-cl-rsp.servers=${env:KAFKA_SERVERS} diff --git a/controlloop/common/feature-controlloop-management/src/main/feature/config/DCAE_TOPIC-topic.properties b/controlloop/common/feature-controlloop-management/src/main/feature/config/DCAE_TOPIC-topic.properties index d444df859..c7ff538df 100644 --- a/controlloop/common/feature-controlloop-management/src/main/feature/config/DCAE_TOPIC-topic.properties +++ b/controlloop/common/feature-controlloop-management/src/main/feature/config/DCAE_TOPIC-topic.properties @@ -2,6 +2,7 @@ # ONAP # ================================================================================ # Copyright (C) 2020-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. @@ -16,17 +17,7 @@ # limitations under the License. # ============LICENSE_END========================================================= -dmaap.source.topics=DCAE_TOPIC - -dmaap.source.topics.DCAE_TOPIC.effectiveTopic=${envd:DCAE_TOPIC} -dmaap.source.topics.DCAE_TOPIC.servers=${envd:DMAAP_SERVERS} -dmaap.source.topics.DCAE_TOPIC.consumerGroup=${envd:DCAE_CONSUMER_GROUP} -dmaap.source.topics.DCAE_TOPIC.https=${envd:DMAAP_HTTPS:true} - -#Replace the properties with the following to use kafka message broker -#kafka.source.topics=dcae_topic - -#kafka.source.topics.dcae_topic.effectiveTopic=${envd:DCAE_TOPIC} -#kafka.source.topics.dcae_topic.servers=${envd:DMAAP_SERVERS} -#kafka.source.topics.dcae_topic.consumerGroup=${envd:DCAE_CONSUMER_GROUP} -#kafka.source.topics.dcae_topic.https=${envd:DMAAP_HTTPS:true} +kafka.source.topics=dcae_topic +kafka.source.topics.dcae_topic.effectiveTopic=${envd:DCAE_TOPIC} +kafka.source.topics.dcae_topic.servers=${envd:KAFKA_SERVERS} +kafka.source.topics.dcae_topic.consumerGroup=${envd:DCAE_CONSUMER_GROUP} diff --git a/controlloop/common/feature-controlloop-management/src/main/feature/config/POLICY-CL-MGT-topic.properties b/controlloop/common/feature-controlloop-management/src/main/feature/config/POLICY-CL-MGT-topic.properties index 74cf296dc..22fe4b2a6 100644 --- a/controlloop/common/feature-controlloop-management/src/main/feature/config/POLICY-CL-MGT-topic.properties +++ b/controlloop/common/feature-controlloop-management/src/main/feature/config/POLICY-CL-MGT-topic.properties @@ -2,6 +2,7 @@ # ONAP # ================================================================================ # Copyright (C) 2020-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. @@ -16,11 +17,5 @@ # limitations under the License. # ============LICENSE_END========================================================= -dmaap.sink.topics=POLICY-CL-MGT -dmaap.sink.topics.POLICY-CL-MGT.servers=${envd:DMAAP_SERVERS} -dmaap.sink.topics.POLICY-CL-MGT.https=${envd:DMAAP_HTTPS:true} - -#Replace the properties with the following to use kafka message broker -#kafka.sink.topics=policy-cl-mgt -#kafka.sink.topics.policy-cl-mgt.servers=${envd:DMAAP_SERVERS} -#kafka.sink.topics.policy-cl-mgt.https=${envd:DMAAP_HTTPS:true} +kafka.sink.topics=policy-cl-mgt +kafka.sink.topics.policy-cl-mgt.servers=${envd:KAFKA_SERVERS} diff --git a/controlloop/common/feature-controlloop-management/src/main/feature/config/SDNR-CL-RSP-topic.properties b/controlloop/common/feature-controlloop-management/src/main/feature/config/SDNR-CL-RSP-topic.properties index b3b8ee297..a76ca2c45 100644 --- a/controlloop/common/feature-controlloop-management/src/main/feature/config/SDNR-CL-RSP-topic.properties +++ b/controlloop/common/feature-controlloop-management/src/main/feature/config/SDNR-CL-RSP-topic.properties @@ -2,6 +2,7 @@ # ONAP # ================================================================================ # Copyright (C) 2020-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. @@ -16,12 +17,5 @@ # limitations under the License. # ============LICENSE_END========================================================= - -dmaap.source.topics=SDNR-CL-RSP -dmaap.source.topics.SDNR-CL-RSP.servers=${envd:DMAAP_SERVERS} -dmaap.source.topics.SDNR-CL-RSP.https=${envd:DMAAP_HTTPS:true} - -#Replace the properties with the following to use kafka message broker -#kafka.source.topics=sdnr-cl-rsp -#kafka.source.topics.sdnr-cl-rsp.servers=${envd:DMAAP_SERVERS} -#kafka.source.topics.sdnr-cl-rsp.https=${envd:DMAAP_HTTPS:true} +kafka.source.topics=sdnr-cl-rsp +kafka.source.topics.sdnr-cl-rsp.servers=${envd:KAFKA_SERVERS} diff --git a/controlloop/common/feature-controlloop-management/src/main/feature/config/SDNR-CL-topic.properties b/controlloop/common/feature-controlloop-management/src/main/feature/config/SDNR-CL-topic.properties index 145943543..4ddd00758 100644 --- a/controlloop/common/feature-controlloop-management/src/main/feature/config/SDNR-CL-topic.properties +++ b/controlloop/common/feature-controlloop-management/src/main/feature/config/SDNR-CL-topic.properties @@ -2,6 +2,7 @@ # ONAP # ================================================================================ # Copyright (C) 2020-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. @@ -16,16 +17,5 @@ # limitations under the License. # ============LICENSE_END========================================================= - - -dmaap.sink.topics=SDNR-CL - -dmaap.sink.topics.SDNR-CL.servers=${envd:DMAAP_SERVERS} -dmaap.sink.topics.SDNR-CL.https=${envd:DMAAP_HTTPS:true} - -#Replace the properties with the following to use kafka message broker -#kafka.sink.topics=sdnr-cl - -#kafka.sink.topics.sdnr-cl.servers=${envd:DMAAP_SERVERS} -#kafka.sink.topics.sdnr-cl.https=${envd:DMAAP_HTTPS:true} - +kafka.sink.topics=sdnr-cl +kafka.sink.topics.sdnr-cl.servers=${envd:KAFKA_SERVERS} diff --git a/controlloop/common/feature-controlloop-management/src/test/resources/op.kmodule b/controlloop/common/feature-controlloop-management/src/test/resources/op.kmodule index 8b49eb6a0..f033fc2e6 100644 --- a/controlloop/common/feature-controlloop-management/src/test/resources/op.kmodule +++ b/controlloop/common/feature-controlloop-management/src/test/resources/op.kmodule @@ -4,6 +4,7 @@ ONAP ================================================================================ Copyright (C) 2018 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. @@ -19,7 +20,7 @@ ============LICENSE_END========================================================= --> -<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule"> +<kmodule xmlns="http://www.drools.org/xsd/kmodule"> <kbase name="kbop"> <ksession name="op"/> </kbase> diff --git a/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeatureTest.java b/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeatureTest.java index 77ce83b83..164cdb733 100644 --- a/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeatureTest.java +++ b/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeatureTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2018-2021 AT&T Intellectual Property. All rights reserved. - * 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. @@ -96,13 +96,13 @@ class ControlLoopMetricsFeatureTest { void testInvalidNotifications() { var feature = new ControlLoopMetricsFeature(); var notification = new VirtualControlLoopNotification(); - feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, notification); + feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, notification); this.testCacheDefaults(); var requestId = UUID.randomUUID(); notification.setRequestId(requestId); - feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, notification); + feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, notification); assertNull(ControlLoopMetricsManager.getManager().getTransaction(requestId)); this.testCacheDefaults(); } @@ -115,7 +115,7 @@ class ControlLoopMetricsFeatureTest { notification.setRequestId(requestId); notification.setNotification(ControlLoopNotificationType.ACTIVE); - feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, notification); + feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, notification); assertNotNull(ControlLoopMetricsManager.getManager().getTransaction(requestId)); assertTrue(ControlLoopMetricsManager.getManager().getTransaction(requestId).getFrom() .contains(testController.getName())); @@ -132,7 +132,7 @@ class ControlLoopMetricsFeatureTest { @Test void testReset() { var notification = this.generateNotification(); - new ControlLoopMetricsFeature().beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, + new ControlLoopMetricsFeature().beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, notification); assertNotNull(ControlLoopMetricsManager.getManager().getTransaction(notification.getRequestId())); @@ -160,7 +160,7 @@ class ControlLoopMetricsFeatureTest { var feature = new ControlLoopMetricsFeature(); for (int i = 0; i < ControlLoopMetricsManager.getManager().getCacheSize(); i++) { var notification = generateNotification(); - feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, notification); + feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, notification); assertNotNull(ControlLoopMetricsManager.getManager().getTransaction(notification.getRequestId())); } @@ -168,7 +168,7 @@ class ControlLoopMetricsFeatureTest { ControlLoopMetricsManager.getManager().getCacheOccupancy()); var overflowNotification = generateNotification(); - feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, overflowNotification); + feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, overflowNotification); assertEquals(ControlLoopMetricsManager.getManager().getCacheOccupancy(), ControlLoopMetricsManager.getManager().getCacheOccupancy()); assertNotNull(ControlLoopMetricsManager.getManager().getTransaction(overflowNotification.getRequestId())); @@ -215,39 +215,39 @@ class ControlLoopMetricsFeatureTest { var activeNotification = ResourceUtils.getResourceAsString("policy-cl-mgt-active.json"); var active = Serialization.gsonPretty.fromJson(activeNotification, VirtualControlLoopNotification.class); - feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, active); + feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, active); assertEquals(1, ControlLoopMetricsManager.getManager().getTransactionIds().size()); var opStartNotification = ResourceUtils.getResourceAsString("policy-cl-mgt-operation.json"); var opStart = Serialization.gsonPretty.fromJson(opStartNotification, VirtualControlLoopNotification.class); - feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, opStart); + feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, opStart); assertEquals(1, ControlLoopMetricsManager.getManager().getTransactionIds().size()); var permitNotification = ResourceUtils.getResourceAsString("policy-cl-mgt-permit.json"); var permit = Serialization.gsonPretty.fromJson(permitNotification, VirtualControlLoopNotification.class); - feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, permit); + feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, permit); assertEquals(1, ControlLoopMetricsManager.getManager().getTransactionIds().size()); var restartNotification = ResourceUtils.getResourceAsString("policy-cl-mgt-restart.json"); var restart = Serialization.gsonPretty.fromJson(restartNotification, VirtualControlLoopNotification.class); - feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, restart); + feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, restart); assertEquals(1, ControlLoopMetricsManager.getManager().getTransactionIds().size()); var restartSuccessNotification = ResourceUtils.getResourceAsString("policy-cl-mgt-restart-success.json"); var restartSuccess = Serialization.gsonPretty.fromJson(restartSuccessNotification, VirtualControlLoopNotification.class); - feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, restartSuccess); + feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, restartSuccess); assertEquals(1, ControlLoopMetricsManager.getManager().getTransactionIds().size()); var finalSuccessNotification = ResourceUtils.getResourceAsString("policy-cl-mgt-final-success.json"); var finalSuccess = Serialization.gsonPretty.fromJson(finalSuccessNotification, VirtualControlLoopNotification.class); - feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, finalSuccess); + feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, finalSuccess); assertEquals(0, ControlLoopMetricsManager.getManager().getTransactionIds().size()); assertEquals(1, PolicyEngineConstants.getManager().getStats().getGroupStat().getPolicyExecutedSuccessCount()); @@ -273,14 +273,14 @@ class ControlLoopMetricsFeatureTest { var finalSuccess = Serialization.gsonPretty.fromJson(finalSuccessNotification, VirtualControlLoopNotification.class); finalSuccess.setRequestId(UUID.randomUUID()); - feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, finalSuccess); + feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, finalSuccess); assertEquals(0, ControlLoopMetricsManager.getManager().getTransactionIds().size()); var opStartNotification = ResourceUtils.getResourceAsString("policy-cl-mgt-operation.json"); var opStart = Serialization.gsonPretty.fromJson(opStartNotification, VirtualControlLoopNotification.class); - feature.beforeDeliver(testController, CommInfrastructure.DMAAP, POLICY_CL_MGT, opStart); + feature.beforeDeliver(testController, CommInfrastructure.NOOP, POLICY_CL_MGT, opStart); assertEquals(1, ControlLoopMetricsManager.getManager().getTransactionIds().size()); Thread.sleep((ControlLoopMetricsManager.getManager().getTransactionTimeout() + 1) * 1000L); // NOSONAR diff --git a/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/server/restful/RestTransactionTrackerTest.java b/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/server/restful/RestTransactionTrackerTest.java index 39adb8120..1ada2714c 100644 --- a/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/server/restful/RestTransactionTrackerTest.java +++ b/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/server/restful/RestTransactionTrackerTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. - * 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. @@ -123,7 +123,7 @@ class RestTransactionTrackerTest { var activeNotification = ResourceUtils.getResourceAsString("policy-cl-mgt-active.json"); var active = Serialization.gsonPretty.fromJson(activeNotification, VirtualControlLoopNotification.class); - feature.beforeDeliver(testController, Topic.CommInfrastructure.DMAAP, "POLICY-CL-MGT", active); + feature.beforeDeliver(testController, Topic.CommInfrastructure.NOOP, "POLICY-CL-MGT", active); assertEquals(1, ControlLoopMetricsManager.getManager().getTransactionIds().size()); assertFalse(HttpClient.getBody(get("/inprogress", Response.Status.OK.getStatusCode()), diff --git a/controlloop/common/feature-controlloop-usecases/src/main/feature/config/usecases-controller.properties b/controlloop/common/feature-controlloop-usecases/src/main/feature/config/usecases-controller.properties index 73c41123f..5cf3ce2b5 100644 --- a/controlloop/common/feature-controlloop-usecases/src/main/feature/config/usecases-controller.properties +++ b/controlloop/common/feature-controlloop-usecases/src/main/feature/config/usecases-controller.properties @@ -3,6 +3,7 @@ # ONAP # ================================================================================ # Copyright (C) 2018-2020 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. @@ -20,43 +21,43 @@ controller.name=usecases -dmaap.source.topics=DCAE_TOPIC,APPC-CL,APPC-LCM-WRITE,SDNR-CL-RSP -dmaap.sink.topics=APPC-CL,APPC-LCM-READ,POLICY-CL-MGT,SDNR-CL,DCAE_CL_RSP +kafka.source.topics=DCAE_TOPIC,APPC-CL,APPC-LCM-WRITE,SDNR-CL-RSP +kafka.sink.topics=APPC-CL,APPC-LCM-READ,POLICY-CL-MGT,SDNR-CL,DCAE_CL_RSP -dmaap.source.topics.DCAE_TOPIC.events=\ +kafka.source.topics.DCAE_TOPIC.events=\ org.onap.policy.controlloop.CanonicalOnset,org.onap.policy.controlloop.CanonicalAbated -dmaap.source.topics.DCAE_TOPIC.events.org.onap.policy.controlloop.CanonicalOnset.\ +kafka.source.topics.DCAE_TOPIC.events.org.onap.policy.controlloop.CanonicalOnset.\ filter=[?($.closedLoopEventStatus == 'ONSET')] -dmaap.source.topics.DCAE_TOPIC.events.org.onap.policy.controlloop.CanonicalAbated.\ +kafka.source.topics.DCAE_TOPIC.events.org.onap.policy.controlloop.CanonicalAbated.\ filter=[?($.closedLoopEventStatus == 'ABATED')] -dmaap.source.topics.DCAE_TOPIC.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gson +kafka.source.topics.DCAE_TOPIC.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gson -dmaap.source.topics.APPC-CL.events=org.onap.policy.appc.Response -dmaap.source.topics.APPC-CL.events.org.onap.policy.appc.Response.filter=[?($.CommonHeader && $.Status)] -dmaap.source.topics.APPC-CL.events.custom.gson=org.onap.policy.appc.util.Serialization,gsonPretty +kafka.source.topics.APPC-CL.events=org.onap.policy.appc.Response +kafka.source.topics.APPC-CL.events.org.onap.policy.appc.Response.filter=[?($.CommonHeader && $.Status)] +kafka.source.topics.APPC-CL.events.custom.gson=org.onap.policy.appc.util.Serialization,gsonPretty -dmaap.source.topics.APPC-LCM-WRITE.events=org.onap.policy.appclcm.AppcLcmDmaapWrapper -dmaap.source.topics.APPC-LCM-WRITE.events.org.onap.policy.appclcm.AppcLcmDmaapWrapper.filter=[?($.type == 'response')] -dmaap.source.topics.APPC-LCM-WRITE.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson +kafka.source.topics.APPC-LCM-WRITE.events=org.onap.policy.appclcm.AppcLcmMessageWrapper +kafka.source.topics.APPC-LCM-WRITE.events.org.onap.policy.appclcm.AppcLcmMessageWrapper.filter=[?($.type == 'response')] +kafka.source.topics.APPC-LCM-WRITE.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson -dmaap.sink.topics.APPC-CL.events=org.onap.policy.appc.Request -dmaap.sink.topics.APPC-CL.events.custom.gson=org.onap.policy.appc.util.Serialization,gsonPretty +kafka.sink.topics.APPC-CL.events=org.onap.policy.appc.Request +kafka.sink.topics.APPC-CL.events.custom.gson=org.onap.policy.appc.util.Serialization,gsonPretty -dmaap.sink.topics.APPC-LCM-READ.events=org.onap.policy.appclcm.AppcLcmDmaapWrapper -dmaap.sink.topics.APPC-LCM-READ.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson +kafka.sink.topics.APPC-LCM-READ.events=org.onap.policy.appclcm.AppcLcmMessageWrapper +kafka.sink.topics.APPC-LCM-READ.events.custom.gson=org.onap.policy.appclcm.util.Serialization,gson -dmaap.sink.topics.POLICY-CL-MGT.events=org.onap.policy.controlloop.VirtualControlLoopNotification -dmaap.sink.topics.POLICY-CL-MGT.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gsonPretty +kafka.sink.topics.POLICY-CL-MGT.events=org.onap.policy.controlloop.VirtualControlLoopNotification +kafka.sink.topics.POLICY-CL-MGT.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gsonPretty -dmaap.sink.topics.SDNR-CL.events=org.onap.policy.sdnr.PciRequestWrapper -dmaap.sink.topics.SDNR-CL.events.custom.gson=org.onap.policy.sdnr.util.Serialization,gson +kafka.sink.topics.SDNR-CL.events=org.onap.policy.sdnr.PciRequestWrapper +kafka.sink.topics.SDNR-CL.events.custom.gson=org.onap.policy.sdnr.util.Serialization,gson -dmaap.sink.topics.DCAE_CL_RSP.events=org.onap.policy.controlloop.ControlLoopResponse -dmaap.sink.topics.DCAE_CL_RSP.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gsonPretty +kafka.sink.topics.DCAE_CL_RSP.events=org.onap.policy.controlloop.ControlLoopResponse +kafka.sink.topics.DCAE_CL_RSP.events.custom.gson=org.onap.policy.controlloop.util.Serialization,gsonPretty -dmaap.source.topics.SDNR-CL-RSP.events=org.onap.policy.sdnr.PciResponseWrapper -dmaap.source.topics.SDNR-CL-RSP.events.org.onap.policy.sdnr.PciResponseWrapper.filter=[?($.type == 'response')] -dmaap.source.topics.SDNR-CL-RSP.events.custom.gson=org.onap.policy.sdnr.util.Serialization,gson +kafka.source.topics.SDNR-CL-RSP.events=org.onap.policy.sdnr.PciResponseWrapper +kafka.source.topics.SDNR-CL-RSP.events.org.onap.policy.sdnr.PciResponseWrapper.filter=[?($.type == 'response')] +kafka.source.topics.SDNR-CL-RSP.events.custom.gson=org.onap.policy.sdnr.util.Serialization,gson rules.groupId=${project.groupId} rules.artifactId=controller-usecases diff --git a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseTest.java b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseTest.java index 321938240..15e03e634 100644 --- a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseTest.java +++ b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseTest.java @@ -37,7 +37,7 @@ import org.apache.commons.collections.MapUtils; import org.awaitility.Awaitility; import org.junit.jupiter.api.Test; import org.onap.policy.appc.Request; -import org.onap.policy.appclcm.AppcLcmDmaapWrapper; +import org.onap.policy.appclcm.AppcLcmMessageWrapper; import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; @@ -161,7 +161,7 @@ public abstract class BaseTest { // used to wait for messages on SINK topics protected Listener<VirtualControlLoopNotification> policyClMgt; protected Listener<Request> appcClSink; - protected Listener<AppcLcmDmaapWrapper> appcLcmRead; + protected Listener<AppcLcmMessageWrapper> appcLcmRead; protected Listener<PciMessage> sdnrClSink; /* @@ -212,7 +212,7 @@ public abstract class BaseTest { //TODO This test needs to be enabled in java-17 branch public void testService123Compliant() { policyClMgt = createNoficationTopicListener(); - appcLcmRead = topics.createListener(APPC_LCM_READ_TOPIC, AppcLcmDmaapWrapper.class, APPC_LCM_CODER); + appcLcmRead = topics.createListener(APPC_LCM_READ_TOPIC, AppcLcmMessageWrapper.class, APPC_LCM_CODER); policy = checkPolicy(SERVICE123_TOSCA_COMPLIANT_POLICY); // inject an ONSET event over the DCAE topic @@ -223,13 +223,13 @@ public abstract class BaseTest { // restart request should be sent and fail four times (i.e., because retry=3) for (var count = 0; count < 4; ++count) { - AppcLcmDmaapWrapper appcreq = appcLcmRead.await(req -> APPC_RESTART_OP.equals(req.getRpcName())); + AppcLcmMessageWrapper appcreq = appcLcmRead.await(req -> APPC_RESTART_OP.equals(req.getRpcName())); topics.inject(APPC_LCM_WRITE_TOPIC, SERVICE123_APPC_RESTART_FAILURE, appcreq.getBody().getInput().getCommonHeader().getSubRequestId()); } // rebuild request should be sent and fail once - AppcLcmDmaapWrapper appcreq = appcLcmRead.await(req -> "rebuild".equals(req.getRpcName())); + AppcLcmMessageWrapper appcreq = appcLcmRead.await(req -> "rebuild".equals(req.getRpcName())); topics.inject(APPC_LCM_WRITE_TOPIC, SERVICE123_APPC_REBUILD_FAILURE, appcreq.getBody().getInput().getCommonHeader().getSubRequestId()); // migrate request should be sent and succeed @@ -258,7 +258,7 @@ public abstract class BaseTest { //TODO This test needs to be enabled in java-17 branch public void testDuplicatesEvents() { policyClMgt = createNoficationTopicListener(); - appcLcmRead = topics.createListener(APPC_LCM_READ_TOPIC, AppcLcmDmaapWrapper.class, APPC_LCM_CODER); + appcLcmRead = topics.createListener(APPC_LCM_READ_TOPIC, AppcLcmMessageWrapper.class, APPC_LCM_CODER); policy = checkPolicy(DUPLICATES_TOSCA_COMPLIANT_POLICY); @@ -275,7 +275,7 @@ public abstract class BaseTest { // should see two restarts for (var count = 0; count < 2; ++count) { - AppcLcmDmaapWrapper appcreq = appcLcmRead.await(req -> APPC_RESTART_OP.equals(req.getRpcName())); + AppcLcmMessageWrapper appcreq = appcLcmRead.await(req -> APPC_RESTART_OP.equals(req.getRpcName())); // indicate success topics.inject(APPC_LCM_WRITE_TOPIC, DUPLICATES_APPC_SUCCESS, @@ -422,7 +422,7 @@ public abstract class BaseTest { */ protected void appcLcmSunnyDay(String policyFile, List<String> onsetFiles, String operation) { policyClMgt = createNoficationTopicListener(); - appcLcmRead = topics.createListener(APPC_LCM_READ_TOPIC, AppcLcmDmaapWrapper.class, APPC_LCM_CODER); + appcLcmRead = topics.createListener(APPC_LCM_READ_TOPIC, AppcLcmMessageWrapper.class, APPC_LCM_CODER); policy = checkPolicy(policyFile); @@ -438,7 +438,7 @@ public abstract class BaseTest { /* * Ensure that an APPC RESTART request was sent in response to the matching ONSET */ - AppcLcmDmaapWrapper appcreq = appcLcmRead.await(req -> operation.equals(req.getRpcName())); + AppcLcmMessageWrapper appcreq = appcLcmRead.await(req -> operation.equals(req.getRpcName())); /* * Inject a 400 APPC Response Return over the APPC topic, with appropriate diff --git a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/SimulatorException.java b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/SimulatorException.java index f9880d07a..73dd2b348 100644 --- a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/SimulatorException.java +++ b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/SimulatorException.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020 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. @@ -20,10 +21,13 @@ package org.onap.policy.controlloop.common.rules.test; +import java.io.Serial; + /** * Exception thrown by <i>Simulators</i>. */ public class SimulatorException extends RuntimeException { + @Serial private static final long serialVersionUID = 1L; public SimulatorException() { diff --git a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/Simulators.java b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/Simulators.java index b1d3d544e..5e1a33d5a 100644 --- a/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/Simulators.java +++ b/controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/Simulators.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-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. @@ -57,7 +58,7 @@ public class Simulators { } /** - * Stops all of the simulators. + * Stops all the simulators. */ public void destroy() { for (HttpServletServer server : servers) { @@ -72,7 +73,7 @@ public class Simulators { } @FunctionalInterface - public static interface SimulatorBuilder { - public HttpServletServer build() throws InterruptedException; + public interface SimulatorBuilder { + HttpServletServer build() throws InterruptedException; } } diff --git a/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/BaseTestTest.java b/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/BaseTestTest.java index cc2bda03e..2bd6a89d2 100644 --- a/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/BaseTestTest.java +++ b/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/BaseTestTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 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. @@ -47,8 +47,8 @@ import org.onap.policy.appc.CommonHeader; import org.onap.policy.appc.Request; import org.onap.policy.appclcm.AppcLcmBody; import org.onap.policy.appclcm.AppcLcmCommonHeader; -import org.onap.policy.appclcm.AppcLcmDmaapWrapper; import org.onap.policy.appclcm.AppcLcmInput; +import org.onap.policy.appclcm.AppcLcmMessageWrapper; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.coder.StandardCoderInstantAsMillis; import org.onap.policy.controlloop.ControlLoopNotificationType; @@ -72,7 +72,7 @@ class BaseTestTest { private BaseTest base; private LinkedList<VirtualControlLoopNotification> clMgtQueue; - private Queue<AppcLcmDmaapWrapper> appcLcmQueue; + private Queue<AppcLcmMessageWrapper> appcLcmQueue; private Queue<Request> appcLegacyQueue; private Queue<PciMessage> sdnrQueue; private int permitCount; @@ -83,7 +83,7 @@ class BaseTestTest { private final Topics topics = mock(Topics.class); private final Listener<VirtualControlLoopNotification> policyClMgt = mock(); private final Listener<Request> appcClSink = mock(); - private final Listener<AppcLcmDmaapWrapper> appcLcmRead = mock(); + private final Listener<AppcLcmMessageWrapper> appcLcmRead = mock(); private final Listener<PciMessage> sdnrClSink = mock(); private final DroolsController drools = mock(DroolsController.class); private final ToscaPolicy policy = mock(ToscaPolicy.class); @@ -117,7 +117,7 @@ class BaseTestTest { public void setUp() { when(topics.createListener(eq(BaseTest.POLICY_CL_MGT_TOPIC), eq(VirtualControlLoopNotification.class), any(StandardCoder.class))).thenReturn(policyClMgt); - when(topics.createListener(eq(BaseTest.APPC_LCM_READ_TOPIC), eq(AppcLcmDmaapWrapper.class), + when(topics.createListener(eq(BaseTest.APPC_LCM_READ_TOPIC), eq(AppcLcmMessageWrapper.class), any(StandardCoder.class))).thenReturn(appcLcmRead); when(topics.createListener(eq(BaseTest.APPC_CL_TOPIC), eq(Request.class), any(StandardCoderInstantAsMillis.class))).thenReturn(appcClSink); @@ -145,8 +145,8 @@ class BaseTestTest { }); when(appcLcmRead.await(any())).thenAnswer(args -> { - AppcLcmDmaapWrapper req = appcLcmQueue.remove(); - Predicate<AppcLcmDmaapWrapper> pred = args.getArgument(0); + AppcLcmMessageWrapper req = appcLcmQueue.remove(); + Predicate<AppcLcmMessageWrapper> pred = args.getArgument(0); assertTrue(pred.test(req)); return req; }); @@ -448,7 +448,7 @@ class BaseTestTest { private void enqueueAppcLcm(String... operationNames) { for (var oper : operationNames) { - var req = new AppcLcmDmaapWrapper(); + var req = new AppcLcmMessageWrapper(); req.setRpcName(oper); var body = new AppcLcmBody(); diff --git a/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/DroolsRuleTestTest.java b/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/DroolsRuleTestTest.java index 0b859adf0..c3c82d507 100644 --- a/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/DroolsRuleTestTest.java +++ b/controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/DroolsRuleTestTest.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 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. @@ -43,8 +43,8 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.onap.policy.appclcm.AppcLcmBody; import org.onap.policy.appclcm.AppcLcmCommonHeader; -import org.onap.policy.appclcm.AppcLcmDmaapWrapper; import org.onap.policy.appclcm.AppcLcmInput; +import org.onap.policy.appclcm.AppcLcmMessageWrapper; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.controlloop.ControlLoopNotificationType; import org.onap.policy.controlloop.VirtualControlLoopNotification; @@ -66,7 +66,7 @@ class DroolsRuleTestTest { private DroolsRuleTest base; private LinkedList<VirtualControlLoopNotification> clMgtQueue; - private Queue<AppcLcmDmaapWrapper> appcLcmQueue; + private Queue<AppcLcmMessageWrapper> appcLcmQueue; private int permitCount; private int finalCount; @@ -76,7 +76,7 @@ class DroolsRuleTestTest { private final Simulators simulators = mock(Simulators.class); private final Topics topics = mock(Topics.class); private final Listener<VirtualControlLoopNotification> policyClMgt = mock(); - private final Listener<AppcLcmDmaapWrapper> appcLcmRead = mock(); + private final Listener<AppcLcmMessageWrapper> appcLcmRead = mock(); private final DroolsController drools = mock(DroolsController.class); private final ToscaPolicy policy = mock(ToscaPolicy.class); @@ -113,7 +113,7 @@ class DroolsRuleTestTest { when(topics.createListener(DroolsRuleTest.POLICY_CL_MGT_TOPIC, VirtualControlLoopNotification.class, controller)).thenReturn(policyClMgt); - when(topics.createListener(eq(DroolsRuleTest.APPC_LCM_READ_TOPIC), eq(AppcLcmDmaapWrapper.class), + when(topics.createListener(eq(DroolsRuleTest.APPC_LCM_READ_TOPIC), eq(AppcLcmMessageWrapper.class), any(StandardCoder.class))).thenReturn(appcLcmRead); Function<String, Rules> ruleMaker = this::makeRules; @@ -137,8 +137,8 @@ class DroolsRuleTestTest { }); when(appcLcmRead.await(any())).thenAnswer(args -> { - AppcLcmDmaapWrapper req = appcLcmQueue.remove(); - Predicate<AppcLcmDmaapWrapper> pred = args.getArgument(0); + AppcLcmMessageWrapper req = appcLcmQueue.remove(); + Predicate<AppcLcmMessageWrapper> pred = args.getArgument(0); assertTrue(pred.test(req)); return req; }); @@ -204,7 +204,7 @@ class DroolsRuleTestTest { private void enqueueAppcLcm(String... operationNames) { for (String oper : operationNames) { - AppcLcmDmaapWrapper req = new AppcLcmDmaapWrapper(); + AppcLcmMessageWrapper req = new AppcLcmMessageWrapper(); req.setRpcName(oper); AppcLcmBody body = new AppcLcmBody(); diff --git a/controlloop/common/rules-test/src/test/resources/META-INF/kmodule.xml b/controlloop/common/rules-test/src/test/resources/META-INF/kmodule.xml index 9ace783c0..fd06328b3 100644 --- a/controlloop/common/rules-test/src/test/resources/META-INF/kmodule.xml +++ b/controlloop/common/rules-test/src/test/resources/META-INF/kmodule.xml @@ -4,6 +4,7 @@ ONAP ================================================================================ Copyright (C) 2020 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. @@ -18,7 +19,7 @@ limitations under the License. ============LICENSE_END========================================================= --> -<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule"> +<kmodule xmlns="http://www.drools.org/xsd/kmodule"> <kbase name="onap.policies.controlloop.operational.common.Drools" equalsBehavior="equality" packages="org.onap.policy.controlloop"> <ksession name="rulesTest"/> |