From 0f51fa4e072aeb29f4e323cb6013fb4a873aae5c Mon Sep 17 00:00:00 2001 From: Jim Hahn Date: Wed, 31 Jan 2018 18:10:34 -0500 Subject: Fix sonar generic Exceptions in policy/common IntegrityMonitor.java: Renamed variables, Ex: dep_groups => depGroups. Renamed enum constants, Ex: pdp_xacml => PDP_XACML. Merged "if" tests. Cast values to "long" before multiplying. Re-throw interrupt(). Write exception via logger instead of e.printStackTrace(). Moved constructor to top of the file. Removed most logger.isDebugEnabled() checks. Returned generic List instead of ArrayList. Used entrySet() instead of keySet(). Removed useless parentheses. Removed superfluous exceptions from "throws" declaration. DbAudit.java: Modified DbAudit to throw DbAuditException. Replaced references to HashSet and HashMap with generic Set and Map. Modified DbAudit to iterate over entrySet() instead of keySet(). ComponentAdminException: Created ComponentAdminException class. Modified ComponentAdmin methods to throw new exception class. Extracted "stateManager" String constant. Eliminated logger.isDebugEnabled() calls. Updated the license data. Eliminated double-checked locking problem from PropertyUtil: Modified code to use Initialization On Demand Holder idiom. Change-Id: Ic01288542041da26df483ce85ecaf292ac138f85 Issue-ID: POLICY-246 Signed-off-by: Jim Hahn --- .../org/onap/policy/common/im/test/IntegrityMonitorTest.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'integrity-monitor/src/test/java/org') diff --git a/integrity-monitor/src/test/java/org/onap/policy/common/im/test/IntegrityMonitorTest.java b/integrity-monitor/src/test/java/org/onap/policy/common/im/test/IntegrityMonitorTest.java index 563c5d55..1efc90cc 100644 --- a/integrity-monitor/src/test/java/org/onap/policy/common/im/test/IntegrityMonitorTest.java +++ b/integrity-monitor/src/test/java/org/onap/policy/common/im/test/IntegrityMonitorTest.java @@ -20,9 +20,10 @@ package org.onap.policy.common.im.test; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; -import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Properties; @@ -38,7 +39,6 @@ import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; import org.onap.policy.common.im.IntegrityMonitor; import org.onap.policy.common.im.IntegrityMonitorProperties; @@ -883,7 +883,7 @@ public class IntegrityMonitorTest { et.commit(); logger.debug("\nIntegrityMonitorTest:testGetAllForwardProgressEntity Calling im.getAllForwardProgressEntity()\n\n"); - ArrayList fpeList = im.getAllForwardProgressEntity(); + List fpeList = im.getAllForwardProgressEntity(); assertTrue(fpeList.size()==4); @@ -919,8 +919,6 @@ public class IntegrityMonitorTest { IntegrityMonitor im = IntegrityMonitor.getInstance(resourceName, myProp); - StateManagement sm = im.getStateManager(); - logger.debug("\nIntegrityMonitorTest: Creating ForwardProgressEntity entries\n\n"); // Add resources to put an entry in the forward progress table Date staleDate = new Date(0); @@ -975,7 +973,7 @@ public class IntegrityMonitorTest { et.commit(); logger.debug("\nIntegrityMonitorTest:testStateAudit Calling im.getAllForwardProgressEntity()\n\n"); - ArrayList fpeList = im.getAllForwardProgressEntity(); + List fpeList = im.getAllForwardProgressEntity(); logger.debug("\n\n"); logger.debug("IntegrityMonitorTest:testStateAudit:ForwardProgressEntity entries"); -- cgit 1.2.3-korg