aboutsummaryrefslogtreecommitdiffstats
path: root/integrity-audit/src/main/java/org/onap/policy/common/ia/DbAudit.java
AgeCommit message (Collapse)AuthorFilesLines
2023-09-29Fix security vulnerabilitiesadheli.tavares1-1/+1
- iq nexus vulnerabilities - sonar security hotspots and code smell Issue-ID: POLICY-4761 Issue-ID: POLICY-4833 Change-Id: Iab2e07d2ee7b90031bc5a30210ce7d3f5a47b3fd Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2023-09-21Java 17 Upgradeadheli.tavares1-3/+4
Issue-ID: POLICY-4668 Change-Id: If4e79224de61d66d7514f3abbd7b8bee1c3d5681 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2022-10-19Fix some dependencies flagged in scansliamfallon1-2/+6
Issue-ID: POLICY-4393 Change-Id: I5b82f5e17ae8827486cc477d7ade4ed46e2e902b Signed-off-by: liamfallon <liam.fallon@est.tech>
2021-05-06Fix sonars in policy-commonJim Hahn1-6/+6
Fixed sonars: - use "var" instead of actual type name - re-interrupt threads - use rej2 split() instead of String split() Issue-ID: POLICY-3285 Change-Id: I82261e0b8a53ee5c5264556fbf5cec37454f014e Signed-off-by: Jim Hahn <jrh3@att.com>
2020-04-06Address sonar issues in commonJim Hahn1-33/+22
Addressed the following sonar issues: - missing assertion in junit test case - disable sonars about setAccessible() as it's required for jackson emulation - sleep in junit - don't use wild-cards (e.g., "*") with java.util Pattern - use re2j instead of java.util Pattern - use String methods (e.g., startsWith()) - duplicate method bodies - duplicate code in Coder classes - string concatenation in logger calls - UTF-8 encoding - return primitive instead of boxed primitive - add assertion to tests - renamed support methods from doTestXxx to verifyXxx - cognitive complexity - use AtomicRef instead of volatile - use specific Functionals (e.g., IntConsumer) - function always returns the same value - serializable vs transient Issue-ID: POLICY-2305 Change-Id: I08eb7aa495a80bdc1d26827ba17a7946c83b9828 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-03-27More sonar issues cleanupPamela Dragosh1-13/+6
Either log or rethrow Use boolean expression Add at least one test Remove commented out code Issue-ID: POLICY-2204 Change-Id: I4fdf31aea75303e4f49d25198eb3b12341995bfe Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-06-21Fix sonar issues in integrity auditJim Hahn1-98/+149
Mostly used Eclipse Refactor->Extract Method to reduce cyclomatic complexity. Also combined a few "if" statements to reduce nesting levels. Also addressed some sonar issues in the tests (e.g., use "<>" where appropriate). Did not attempt to increase junit coverage. Change-Id: I9d6c1305ce455f0d64249b548d123bb9bf37292a Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-13More sonar fixes in policy/commonJim Hahn1-14/+16
Note: this does not increase code coverage, but should fix other code issues. Resolved cyclomatic complexity issue in ParameterValidationResult. Refactored duplicate code in GroupValidationResult. Removed IOException from NetworkUtil "throws". Replaced null/empty string tests with StringUtils.isBlank(). Added @FunctionalInterface where needed. Replaced anonymous classes with lambda expressions. Replaced duplicate strings with a constant. Added private constructors for utility classes. Removed sleep() from tests. Removed unused parameter from method call. Made some protected methods private. Compute integrity monitor's state-transition table once. Use for-loop instead of iterator. Moved constructors. Fixed some checkstyle issues (tabs => spaces, trailing spaces). Change-Id: I9a962ca45c4ff3f212c6014da799d06f07b232ef Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-01-09Remove policy/common integrity-audit suppressionsJim Hahn1-5/+5
Changed "DbDAO" to "DbDao". Change-Id: I51a6706cceef6857404ae7c12ce43e553ea0da29 Issue-ID: POLICY-1133 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-06-21IntegrityAuditor: remove sleep from junit testsJim Hahn1-85/+12
Modified the code to use a CurrentTime object for its "time" operations (e.g., sleep(), currentTimeInMillis()). Modified junit tests to replace the CurrentTime object with TestTime objects so they don't actually do any sleeping. Reformat "commit" message. Remove TODO from junit test. Init testTime in junit setUp(). Add AuditorTime and test classes. Change "latch" to "semaphore" in comments. Change time units in junit test from SECONDS to MILLISECONDS. Add sleep() method to auditor test class. Reorder field qualifiers. Change utils scope to "compile" in pom. Change-Id: I8aa8b642b315156c00422192e4aa8e47b4503c2f Issue-ID: POLICY-908 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-03-20Removed checkstyle warningsmmis1-479/+488
Removed checkstyle warnings in policy/common/ia Issue-ID: POLICY-695 Change-Id: I25f589dff5ce1dba0681ba549a53087426593d71 Signed-off-by: mmis <michael.morris@ericsson.com>
2018-02-16Fix more generic exceptions in commonJim Hahn1-22/+45
Fixed a few more generic exceptions in integrity-audit and integrity-monitor. Fixed license dates. Change-Id: Ibbc21ae5f853896e0d3e416e33b5ea2a13672f62 Issue-ID: POLICY-246 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-02-13Speed up integrity-audit testsJim Hahn1-15/+47
Added additional DbDAO constructors to facilitate JUnit testing. Added DbDAO destroy() method to close the EntityManagerFactory. Pulled out common code into IntegrityAuditTestBase and subclassed the tests from there. Added hooks to IntegrityAudit so that the AuditThread timers could be set to smaller values so that all of the junit tests could be run in much less time. Added similar hooks to DbAudit. Modified integrity-audit tests to use new utility classes to auto-close JPA managers. Modified integrity-audit tests to use new utility class to scan logger items without the need to scan the actual log file. Added code to new test superclass to truncate the four ONAP logs. Modified hooks in IntegrityAuditEntity to adjust serialization so that dates are not serialized/de-serialized when used in junit tests. Deleted TestingUtils. Added a test for invalid nodeType property. Fixed issue wherein AuditThread doesn't stop when interrupted. Change-Id: I5101995b6b68655b2810777bc4d2ec80c7cbc363 Issue-ID: POLICY-582 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-02-01Fix sonar generic Exceptions in policy/commonJim Hahn1-28/+40
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 <jrh3@att.com>
2017-12-05Fix technical debt in common integrity-auditTemoc Rodriguez1-1/+1
Address technical debt in policy/common integrity-audit submodule. Implementation for empty constructors, remove useless assignment, use <> on constructor, use @Override. Not all technical debt addressed, only the ones specified by Pam in POLICY-336, except the use Set instead of HashSet where a method signature would change. Issue-ID: POLICY-456 Change-Id: If8f9f4151503bdd22c8c405485538f8be779cabd Signed-off-by: Temoc Rodriguez <cr056n@att.com>
2017-08-11Sonar cleanup for integrity-auditMagnusen, Drew (dm741q)1-5/+3
Modified classes in integrity-audit module to resolve major sonar issues. Issue-ID: [POLICY-96] Change-Id: I5ef0abb8d2a3ea1ae93edc00363c4d2bea1747e2 Signed-off-by: Magnusen, Drew (dm741q) <dm741q@att.com>
2017-07-31[POLICY-71] replace openecomp for policy-commonGuo Ruijing1-0/+462
Change-Id: I3241f5d1f0234043b4dff718eda1ffdc48052276 Signed-off-by: Guo Ruijing <ruijing.guo@intel.com> Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>