aboutsummaryrefslogtreecommitdiffstats
path: root/controlloop/common/rules-test/src
diff options
context:
space:
mode:
authoradheli.tavares <adheli.tavares@est.tech>2024-01-31 10:39:45 +0000
committerAdheli Tavares <adheli.tavares@est.tech>2024-02-09 14:28:59 +0000
commiteeb8a6a39d2bdd20bc54c11ac69700739d8faac1 (patch)
treeb22a3a34482af847905062fb1ebeab43cab39162 /controlloop/common/rules-test/src
parentb0455b141643f18d5025e23ac7859da43afe7f19 (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/rules-test/src')
-rw-r--r--controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/BaseTest.java18
-rw-r--r--controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/SimulatorException.java4
-rw-r--r--controlloop/common/rules-test/src/main/java/org/onap/policy/controlloop/common/rules/test/Simulators.java7
-rw-r--r--controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/BaseTestTest.java16
-rw-r--r--controlloop/common/rules-test/src/test/java/org/onap/policy/controlloop/common/rules/test/DroolsRuleTestTest.java16
-rw-r--r--controlloop/common/rules-test/src/test/resources/META-INF/kmodule.xml3
6 files changed, 35 insertions, 29 deletions
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"/>