From 53f9550501ca1854318c1f552b0aba2e255b6748 Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Wed, 3 Jul 2019 14:04:48 -0400 Subject: Fix remaining sonar issues in Integrity Audit Renamed enums to upper case - this might disrupt other repos, though it should be minimal. Renamed constants in a junit test. Change-Id: Ifd864bb61eec3d9b3c7a0321fe3841696046f6f6 Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn --- .../src/main/java/org/onap/policy/common/ia/AuditThread.java | 2 +- .../src/main/java/org/onap/policy/common/ia/DbDao.java | 2 +- .../src/main/java/org/onap/policy/common/ia/IntegrityAudit.java | 9 +++++---- .../java/org/onap/policy/common/ia/IntegrityAuditProperties.java | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) (limited to 'integrity-audit/src/main/java') diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/AuditThread.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/AuditThread.java index 25bafdc4..25335540 100644 --- a/integrity-audit/src/main/java/org/onap/policy/common/ia/AuditThread.java +++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/AuditThread.java @@ -131,7 +131,7 @@ public class AuditThread extends Thread { * other nodes of similar type. */ dbDao = new DbDao(this.resourceName, this.persistenceUnit, this.properties); - this.nodeType = properties.getProperty(IntegrityAuditProperties.NODE_TYPE); + this.nodeType = properties.getProperty(IntegrityAuditProperties.NODE_TYPE).toLowerCase(); } diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java index 0235715d..80177b30 100644 --- a/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java +++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/DbDao.java @@ -143,7 +143,7 @@ public class DbDao { this.dbUrl = properties.getProperty(IntegrityAuditProperties.DB_URL).trim(); this.dbUser = properties.getProperty(IntegrityAuditProperties.DB_USER).trim(); this.siteName = properties.getProperty(IntegrityAuditProperties.SITE_NAME).trim(); - this.nodeType = properties.getProperty(IntegrityAuditProperties.NODE_TYPE).trim(); + this.nodeType = properties.getProperty(IntegrityAuditProperties.NODE_TYPE).trim().toLowerCase(); this.properties = properties; logger.debug("DbDao.assignProperties: exit:" + "\nresourceName: " + this.resourceName + "\npersistenceUnit: " + this.persistenceUnit + "\nproperties: " + this.properties); diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/IntegrityAudit.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/IntegrityAudit.java index 61bf947e..41aea118 100644 --- a/integrity-audit/src/main/java/org/onap/policy/common/ia/IntegrityAudit.java +++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/IntegrityAudit.java @@ -105,7 +105,7 @@ public class IntegrityAudit { */ public static boolean isNodeTypeEnum(String nt) { for (NodeTypeEnum n : NodeTypeEnum.values()) { - if (n.toString().equals(nt)) { + if (n.toString().equalsIgnoreCase(nt)) { return true; } } @@ -171,11 +171,12 @@ public class IntegrityAudit { } else { nodeType = nodeType.trim(); if (!isNodeTypeEnum(nodeType)) { - String nodetypes = "nodeType must be one of["; + badparams.append("nodeType must be one of["); for (NodeTypeEnum n : NodeTypeEnum.values()) { - nodetypes = nodetypes.concat(n.toString() + " "); + badparams.append(n.toString()); + badparams.append(' '); } - badparams.append(nodetypes + "] "); + badparams.append("] "); return true; } } diff --git a/integrity-audit/src/main/java/org/onap/policy/common/ia/IntegrityAuditProperties.java b/integrity-audit/src/main/java/org/onap/policy/common/ia/IntegrityAuditProperties.java index 2ca5dd58..40b2af5a 100644 --- a/integrity-audit/src/main/java/org/onap/policy/common/ia/IntegrityAuditProperties.java +++ b/integrity-audit/src/main/java/org/onap/policy/common/ia/IntegrityAuditProperties.java @@ -35,7 +35,7 @@ public class IntegrityAuditProperties { public static final String NODE_TYPE = "node_type"; public enum NodeTypeEnum { - pdp_xacml, pdp_drools, pap, pap_admin, logparser, brms_gateway, astra_gateway, elk_server, pypdp + PDP_XACML, PDP_DROOLS, PAP, PAP_ADMIN, LOGPARSER, BRMS_GATEWAY, ASTRA_GATEWAY, ELK_SERVER, PYPDP } -- cgit 1.2.3-korg