diff options
author | Jim Hahn <jrh3@att.com> | 2020-08-31 08:22:13 -0400 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2020-08-31 10:15:07 -0400 |
commit | d5c365f60e492e37a361654974eba1719146bdc2 (patch) | |
tree | f717c2198c1aebe0cc03a5d3e9aec653d0d73807 /feature-state-management/src/test | |
parent | 7dc71c3d0aedb322aff0cdaaa84340354c41b089 (diff) |
Fix more sonars in drools-pdp
Fixed more sonars in drools-pdp:
- remove commented code
- don't throw generic Exception
- unused field (made it protected instead of private)
- log conditionally
- cognitive complexity
- too many break/continue
- return empty list instead of null
- Random() is not secure
Fixed more eclipse warnings:
- parameterize generic types
Issue-ID: POLICY-2616-sonars3
Change-Id: Ia5ad769b2ea763568cfae3d81807926d89153b09
Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'feature-state-management/src/test')
-rw-r--r-- | feature-state-management/src/test/java/org/onap/policy/drools/statemanagement/test/StateManagementTest.java | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/feature-state-management/src/test/java/org/onap/policy/drools/statemanagement/test/StateManagementTest.java b/feature-state-management/src/test/java/org/onap/policy/drools/statemanagement/test/StateManagementTest.java index 33bfaedc..8d47e1d6 100644 --- a/feature-state-management/src/test/java/org/onap/policy/drools/statemanagement/test/StateManagementTest.java +++ b/feature-state-management/src/test/java/org/onap/policy/drools/statemanagement/test/StateManagementTest.java @@ -25,7 +25,6 @@ import static org.junit.Assert.assertTrue; import java.io.File; import java.io.FileInputStream; -import java.io.IOException; import java.util.Properties; import javax.persistence.EntityManager; import javax.persistence.EntityManagerFactory; @@ -37,6 +36,7 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; +import org.onap.policy.common.im.IntegrityMonitorException; import org.onap.policy.common.im.StateManagement; import org.onap.policy.drools.core.PolicySessionFeatureApi; import org.onap.policy.drools.statemanagement.DbAudit; @@ -196,28 +196,18 @@ public class StateManagementTest { repositoryAudit.invoke(fsmProperties); //Should not throw an IOException in Linux Foundation env - assertTrue(true); - } catch (IOException e) { + + } catch (IntegrityMonitorException e) { //Note: this catch is here because in a local environment mvn will not run in //in the temp directory logger.debug("testSubsytemTest RepositoryAudit IOException", e); - } catch (InterruptedException e) { - assertTrue(false); - logger.debug("testSubsytemTest RepositoryAudit InterruptedException", e); } /* ****************Db Audit Test. ************** */ logger.debug("\n\ntestStateManagementOperation: DB Audit\n\n"); - try { - DbAudit dbAudit = (DbAudit) DbAudit.getInstance(); - dbAudit.invoke(fsmProperties); - - assertTrue(true); - } catch (Exception e) { - assertTrue(false); - logger.debug("testSubsytemTest DbAudit exception", e); - } + DbAudit dbAudit = (DbAudit) DbAudit.getInstance(); + dbAudit.invoke(fsmProperties); /* ************IntegrityMonitorRestManager Test. ************ */ logger.debug("\n\ntestStateManagementOperation: IntegrityMonitorRestManager\n\n"); |