summaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
authorJorge Hernandez <jorge.hernandez-herrero@att.com>2019-04-16 16:48:27 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-16 16:48:27 +0000
commitbdcdec03d07abebbdf40afdff74e4fd540ce78b4 (patch)
treef716a04abf1b1bc82e29ae306748711202fe9fc8 /main/src
parent4bcbf1096bf65d91993ebfd240fa199d5ba8ab77 (diff)
parent4e5549ea37d5ab7d73cbd9b87640f05237253fa0 (diff)
Merge "Fix sonar issue in PdpStatusMessageHandler"
Diffstat (limited to 'main/src')
-rw-r--r--main/src/main/java/org/onap/policy/pap/main/comm/PdpStatusMessageHandler.java23
1 files changed, 15 insertions, 8 deletions
diff --git a/main/src/main/java/org/onap/policy/pap/main/comm/PdpStatusMessageHandler.java b/main/src/main/java/org/onap/policy/pap/main/comm/PdpStatusMessageHandler.java
index b3bc1401..c0a78fa0 100644
--- a/main/src/main/java/org/onap/policy/pap/main/comm/PdpStatusMessageHandler.java
+++ b/main/src/main/java/org/onap/policy/pap/main/comm/PdpStatusMessageHandler.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2019 AT&T Intellectual Property.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,7 +24,7 @@ package org.onap.policy.pap.main.comm;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
-
+import org.apache.commons.lang3.builder.EqualsBuilder;
import org.onap.policy.common.utils.services.Registry;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.pdp.concepts.Pdp;
@@ -221,13 +222,19 @@ public class PdpStatusMessageHandler {
}
private boolean validatePdpDetails(final PdpStatus message, final PdpGroup pdpGroup, final PdpSubGroup subGroup,
- final Pdp pdpInstanceDetails) {
-
- return message.getPdpGroup().equals(pdpGroup.getName())
- && message.getPdpSubgroup().equals(subGroup.getPdpType())
- && message.getState().equals(pdpInstanceDetails.getPdpState())
- && message.getSupportedPolicyTypes().containsAll(subGroup.getSupportedPolicyTypes())
- && message.getPdpType().equals(subGroup.getPdpType());
+ final Pdp pdpInstanceDetails) {
+
+ /*
+ * "EqualsBuilder" is a bit of a misnomer, as it uses containsAll() to check
+ * supported policy types. Nevertheless, it does the job and provides a convenient
+ * way to build a bunch of comparisons.
+ */
+ return new EqualsBuilder().append(message.getPdpGroup(), pdpGroup.getName())
+ .append(message.getPdpSubgroup(), subGroup.getPdpType())
+ .append(message.getPdpType(), subGroup.getPdpType())
+ .append(message.getState(), pdpInstanceDetails.getPdpState())
+ .append(message.getSupportedPolicyTypes().containsAll(subGroup.getSupportedPolicyTypes()), true)
+ .build();
}
private void updatePdpHealthStatus(final PdpStatus message, final PdpSubGroup pdpSubgroup, final Pdp pdpInstance,