diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2020-08-10 14:47:31 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-08-10 14:47:31 +0000 |
commit | e9261d520a496881c315fe28aa9095f59d579e0a (patch) | |
tree | ec801e5b9e80d8ee74a434e029f8a7d41a3edba9 /services/services-engine/src/main | |
parent | 69db35c582df773c5559ee569f9ba22c6bcb69d8 (diff) | |
parent | f4895ff98b3ed83b44733adc20ad8cf0092a3d83 (diff) |
Merge "Handling apex-pdp multi policy deployment failure:"
Diffstat (limited to 'services/services-engine/src/main')
-rw-r--r-- | services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java index 1e2447b2e..a928f208c 100644 --- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java +++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java @@ -24,6 +24,7 @@ package org.onap.policy.apex.service.engine.main; import java.io.IOException; import java.util.AbstractMap; +import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; @@ -133,16 +134,19 @@ public class ApexActivator { new LinkedHashSet<>(apexParametersMap.entrySet()); apexParamsEntrySet.stream().forEach(apexParamsEntry -> { ApexParameters apexParams = apexParamsEntry.getValue(); - boolean duplicateInputParameterExist = - apexParams.getEventInputParameters().keySet().stream().anyMatch(inputParametersMap::containsKey); - boolean duplicateOutputParameterExist = - apexParams.getEventOutputParameters().keySet().stream().anyMatch(outputParametersMap::containsKey); - if (duplicateInputParameterExist || duplicateOutputParameterExist) { - LOGGER.error("I/O Parameters for {}:{} has duplicates. So this policy is not executed.", - apexParamsEntry.getKey().getName(), apexParamsEntry.getKey().getVersion()); + List<String> duplicateInputParameters = new ArrayList<>(apexParams.getEventInputParameters().keySet()); + duplicateInputParameters.retainAll(inputParametersMap.keySet()); + List<String> duplicateOutputParameters = new ArrayList<>(apexParams.getEventOutputParameters().keySet()); + duplicateOutputParameters.retainAll(outputParametersMap.keySet()); + + if (!(duplicateInputParameters.isEmpty() && duplicateOutputParameters.isEmpty())) { + LOGGER.error("I/O Parameters {}/{} for {}:{} are duplicates. So this policy is not executed.", + duplicateInputParameters, duplicateOutputParameters, apexParamsEntry.getKey().getName(), + apexParamsEntry.getKey().getVersion()); apexParametersMap.remove(apexParamsEntry.getKey()); return; } + inputParametersMap.putAll(apexParams.getEventInputParameters()); outputParametersMap.putAll(apexParams.getEventOutputParameters()); // Check if a policy model file has been specified |