diff options
author | Jim Hahn <jrh3@att.com> | 2019-04-16 11:44:18 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2019-04-16 11:47:04 -0400 |
commit | 4e5549ea37d5ab7d73cbd9b87640f05237253fa0 (patch) | |
tree | baa87e0038e8de57bfe342c9ea22d2cf580e83d9 /main | |
parent | 8714a151ff87751b54c362c8a9248995e665e896 (diff) |
Fix sonar issue in PdpStatusMessageHandler
Change-Id: I389f61f9311bba35115a174c8526f897c98a3364
Issue-ID: POLICY-1542
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'main')
-rw-r--r-- | main/src/main/java/org/onap/policy/pap/main/comm/PdpStatusMessageHandler.java | 23 |
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, |