summaryrefslogtreecommitdiffstats
path: root/controlloop/common/controller-usecases/src
diff options
context:
space:
mode:
authoradheli.tavares <adheli.tavares@est.tech>2024-03-14 21:52:12 +0000
committeradheli.tavares <adheli.tavares@est.tech>2024-03-15 09:49:55 +0000
commit9da69f932b1378e1d16a9206a3aa5b3acbb1d38a (patch)
treedccb457b96fe520f98f089d494a9ed174310ebce /controlloop/common/controller-usecases/src
parente3f23281573c0e75d281709bfdd74b01c2900313 (diff)
Make drools-pdp work with drools and java versions compatible
with current DRL rules files syntax. Issue-ID: POLICY-4857 Change-Id: I40889288828da9aea757087e2c74004008336e41 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'controlloop/common/controller-usecases/src')
-rw-r--r--controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/GetTargetEntityOperation2.java17
-rw-r--r--controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManager.java5
-rw-r--r--controlloop/common/controller-usecases/src/main/resources/usecases.drl6
3 files changed, 16 insertions, 12 deletions
diff --git a/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/GetTargetEntityOperation2.java b/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/GetTargetEntityOperation2.java
index 29689edf7..8341be1d3 100644
--- a/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/GetTargetEntityOperation2.java
+++ b/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/GetTargetEntityOperation2.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.
@@ -93,11 +93,16 @@ public class GetTargetEntityOperation2 extends OperationPartial {
throw new IllegalArgumentException("The target type is null");
}
- return switch (targetType) {
- case PNF -> detmPnfTarget();
- case VM, VNF, VFMODULE -> detmVfModuleTarget();
- default -> throw new IllegalArgumentException("The target type is not supported");
- };
+ switch (targetType) {
+ case PNF:
+ return detmPnfTarget();
+ case VM:
+ case VNF:
+ case VFMODULE:
+ return detmVfModuleTarget();
+ default:
+ throw new IllegalArgumentException("The target type is not supported");
+ }
}
/**
diff --git a/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManager.java b/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManager.java
index 86a189dd3..62d5f70a9 100644
--- a/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManager.java
+++ b/controlloop/common/controller-usecases/src/main/java/org/onap/policy/drools/apps/controller/usecases/UsecasesEventManager.java
@@ -37,7 +37,6 @@ import static org.onap.policy.drools.apps.controller.usecases.UsecasesConstants.
import static org.onap.policy.drools.apps.controller.usecases.UsecasesConstants.VSERVER_PROV_STATUS;
import static org.onap.policy.drools.apps.controller.usecases.UsecasesConstants.VSERVER_VSERVER_NAME;
-import java.io.Serial;
import java.util.Deque;
import java.util.Map;
import java.util.Set;
@@ -72,7 +71,6 @@ import org.onap.policy.sdnr.PciMessage;
*/
public class UsecasesEventManager extends ClEventManagerWithEvent<Step2> implements StepContext {
- @Serial
private static final long serialVersionUID = -1216568161322872641L;
/**
@@ -255,7 +253,8 @@ public class UsecasesEventManager extends ClEventManagerWithEvent<Step2> impleme
throw new ControlLoopException("The Target type is null");
}
switch (event.getTargetType()) {
- case VM, VNF:
+ case VM:
+ case VNF:
validateAaiVmVnfData(eventAai);
return;
case PNF:
diff --git a/controlloop/common/controller-usecases/src/main/resources/usecases.drl b/controlloop/common/controller-usecases/src/main/resources/usecases.drl
index 70a1cd8a1..f337f2179 100644
--- a/controlloop/common/controller-usecases/src/main/resources/usecases.drl
+++ b/controlloop/common/controller-usecases/src/main/resources/usecases.drl
@@ -741,7 +741,7 @@ rule "EVENT.MANAGER.PROCESS.FINAL.FAILURE.ACCEPTED"
notification.setPolicyName($manager.getPolicyName());
notification.setPolicyVersion($manager.getPolicyVersion());
notification.setHistory($manager.getPartialHistory().stream().map(OperationOutcome2::getClOperation)
- .toList());
+ .collect(Collectors.toList()));
// trigger move to the next policy - clear all steps
$manager.getSteps().clear();
@@ -800,7 +800,7 @@ rule "EVENT.MANAGER.PROCESS.FINAL.FAILURE.REJECTED"
notification.setPolicyName($manager.getPolicyName());
notification.setPolicyVersion($manager.getPolicyVersion());
notification.setHistory($manager.getPartialHistory().stream().map(OperationOutcome2::getClOperation)
- .toList());
+ .collect(Collectors.toList()));
$manager.deliver("policy-cl-mgt", notification, "notification", drools.getRule().getName());
@@ -1004,7 +1004,7 @@ rule "EVENT.MANAGER.FINAL"
notification.setPolicyName($manager.getPolicyName());
notification.setPolicyVersion($manager.getPolicyVersion());
notification.setHistory($manager.getFullHistory().stream().map(OperationOutcome2::getClOperation)
- .toList());
+ .collect(Collectors.toList()));
OperationFinalResult finalResult = $manager.getFinalResult();
if (finalResult == null) {