aboutsummaryrefslogtreecommitdiffstats
path: root/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java
AgeCommit message (Collapse)AuthorFilesLines
2023-09-29Fix security vulnerabilitiesadheli.tavares1-113/+111
- 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-7/+7
Issue-ID: POLICY-4668 Change-Id: If4e79224de61d66d7514f3abbd7b8bee1c3d5681 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2023-02-06Replace Eclipselink with Hibernateliamfallon1-11/+1
Issue-ID: POLICY-4533 Change-Id: I9d2e4d90bf997935efad16e8ae4473d635ae9d65 Signed-off-by: liamfallon <liam.fallon@est.tech>
2021-06-17Use lombok annotations in IM and ONAP loggingJim Hahn1-26/+8
Issue-ID: POLICY-3394 Change-Id: I25db6b4b13bad8754889eaedb93197cae7d27c4d Signed-off-by: Jim Hahn <jrh3@att.com>
2021-05-07Change java.util.regex to re2jJim Hahn1-1/+1
Sonar complains about java.util.regex. Thought I used re2j when creating all of the patterns, but apparently not. Fixed that oversight. Issue-ID: POLICY-3284 Change-Id: Idbec112ab0d4c3b477ce357f8a556d95e4dea083 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-05-06Fix sonars in policy-commonJim Hahn1-28/+36
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-06-18Changes for checkstyle 8.32liamfallon1-1/+1
Issue-ID: POLICY-2188 Change-Id: I00843c61a6567001fc35c3ebb77b6843a1eb7da2 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-06-17Cleanup various sonar issues in policy-commonJim Hahn1-48/+58
Addressed the following issues: - unused imports - unused method parameters - use assertEquals, assertSame instead of assertTrue - provide the parametrized type for this generic Also fixed some checkstyle issues: - removed blank lines between "import" groups Issue-ID: POLICY-2650 Change-Id: I004bb650ac10c49ccd0fc405f6959896fec39f9b Signed-off-by: Jim Hahn <jrh3@att.com>
2020-04-09rename jpa persistence filejhh1-0/+4
After inspecting the fat jar generated by brmsgw, noticed that the persistence.xml included from here it was overriden by another one, therefore the persistence unit was not available. This may solve the issue for the brmsgw, as with a far jar build, there are the risks of collisions such as this of files with the same name. Issue-ID: POLICY-2471 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I91cf2b6d3d2f5086d77795e08800ca96d984c214
2020-04-06Address sonar issues in commonJim Hahn1-74/+97
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-6/+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>
2020-03-24Sonar and eclipse warnings commonPamela Dragosh1-110/+85
Unused imports Not enough arguments Issue-ID: POLICY-2204 Change-Id: I6405cb697ea976096b1276e2291b1c73617d33b5 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-07-05Fix sonar issues in Integrity MonitorJim Hahn1-30/+41
Fixed most sonar issues, except for code coverage. Change-Id: I473635d896797b2290920da86c6770848bc2e883 Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-24Fix more sonar issues in Integrity Audit & MonitorJim Hahn1-194/+177
Removed duplicate code in DbDao by refactoring common code into a new updateIae() method. Removed duplicate code in IntegrityMonitor by refactoring common code into a new withinTransaction() method. Removed duplicate code in StateManagementEntity, StateElement by replacing with lombok Getter & Setter annotations. Removed duplicate code in StateManagement by refactoring common code into new setState() and getState() methods. Also removed logger.isDebugEnabled() tests. Added coverage for StateChangeNotifier. Change-Id: I2e29b836dafc5de569a2267206a6a34105e44021 Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-21Fix sonar issues in integrity monitorJim Hahn1-520/+544
Used Eclipse Refactor->Extract Method to reduce cyclomatic complexity. Flattened nested FpManager class into IntegrityMonitor class. Changed some strings to StringBuilder, where lots of concatenation was being done. Simplified some things by eliminating some try/catch blocks where an exception can't actually (except may an out-of-memory exception). Also addressed some sonar issues in the tests (e.g., use "<>" where appropriate). Eliminated some assertException methods, replacing them with assertj methods. Did not attempt to increase junit coverage. Change-Id: I311acaffcd87f0cbbf382c06c7fa26177007abd5 Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-11-27Remove Factory from IntegrityMonitorJim Hahn1-37/+31
Also removed unneeded method override in junit test. Change-Id: I7186e9f75443f7b8ba8376aa0e00a5cf4c573696 Issue-ID: POLICY-1287 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-11-27Fix checkstyle issue in policy commonKrishnakumar Jinka1-105/+96
Move method into class it is being called. Fix minor checkstyle formatting in the class. The changes have side effects hence revert some changes. Modify the javadoc tags Issue-ID: POLICY-1251 Change-Id: Iecb513dafe3f60628664f3e60d6c49d3e4ce3148 Signed-off-by: kris.jinka <kris.jinka@samsung.com>
2018-10-05Remove constraintsPamela Dragosh1-2/+1
Sonar is flagging the null checks. Issue-ID: POLICY-1130 Change-Id: I4ab94b3db79d4089f20afaf3f80f3c925541084a Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-10-01Fix minor sonarPamela Dragosh1-65/+75
These are mainly duplicate strings. But also combined if statements and fixing some debug messages missing arguments or format specifiers. Some duplicates I left alone as it seemed unreadable to change them. Also moving variables to their correct place (before constructors). Issue-ID: POLICY-1130 Change-Id: I8018c676b22fe8fec635f129fa37921ad1004569 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-08-14Fixes for checkstyle issuesPamela Dragosh1-4/+7
More fixes for spacing, adding comments, adding period at the end, and move code closer to usage. Issue-ID: POLICY-881 Change-Id: Ife99eaf627a221e87d65d24dfd145b0ee4e06d21 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-06-21IntegrityMonitor: remove sleep from junit testsJim Hahn1-110/+42
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. Update license date. Remove unneeded dependency from pom. Don't start FpManager thread within its own constructor. toMillis() should handle -1 as an input. Fix comment in test base superclass. Change time units in test base from DAYS to MILLISECONDS. Change-Id: Id6a4edb1747ca1a683e5d37522872b781294532d Issue-ID: POLICY-908 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-06-20IntegrityMonitory - remove latch for non-test codeJim Hahn1-47/+53
Change-Id: I95ebcf8aabfa01eb6453a4ba5dd88d11c8f025c9 Issue-ID: POLICY-908 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-03-20Removed checkstyle warningsmmis1-1906/+1908
Removed checkstyle warnings in policy/common/im Issue-ID: POLICY-695 Change-Id: I32b4797249386c0d1bd0f50792880a1759503a67 Signed-off-by: mmis <michael.morris@ericsson.com>
2018-02-16Fix more generic exceptions in commonJim Hahn1-24/+29
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-13Add test coverage to integrity-monitorJim Hahn1-513/+517
Removed "test" from package name. Refactored tests, creating common IntegrityMonitorTestBase. Turned log/print statements into assertEquals in StateTransitionTest. Turned log/print statements into assertEquals in StateManagementTest. Modified AllSeemsWellTest to use IntegrityMonitorTestBase. Modified IntegrityMonitorTest to use IntegrityMonitorTestBase. Added several hooks to IntegrityMonitor to control timers at a finer granularity. Added hooks to IntegrityMonitor to control the FPManager thread. Remove hooks for refresh timer, as property suffices. Added assertException() and assertNoException() methods to IntegrityMonitorTestBase, and then replaced most "try/catch" blocks with calls to those methods. Updated StateManagement to close EntityManagers. Modify pom to remove scope from utils dependency. Fix some comments and remove an unneeded EntityTransaction variable. Change-Id: Ic0789d26f985a40a35f618343fa4e88aa473b2b3 Issue-ID: POLICY-582 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-02-01Addressing technical debt integrity-monitorPamela Dragosh1-8/+8
Issue-ID: POLICY-457 Change-Id: I6e4bc00bc85f73bcb4c58c54378f062d98e6876d Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-02-01Fix sonar generic Exceptions in policy/commonJim Hahn1-482/+298
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-15Fix issues blocking election handler threadKevin McKiou1-651/+1125
Patch 1: This bug tracks the AT&T bug 355533. The symptom was that drools pdps that were backing each other up were becoming stuck in a standby state. The cause was that the election handler thread was being hung by a call to PolicyEngine.manager.deactivate which shuts down the topic endpoints when the drools pdp operational state transitions to disabled. Related problems were that the election handler heartbeat was NOT blocked when the main thread was blocked and the IntegrityMonitor forward progress counter was NOT blocked from incrementing when the election handler thread was blocked. This prevented the correct failover of the drools pdp to another healthy one. This change fixes the two causes of the thread blockage, moves the election handler heartbeat to the main thread and adds an interface (AllSeemsWell) which is called when the election handler has stalled/resumed. The AllSeemsWell interface will block forward progress counter increments when ALLNOTWELL and will resume forward progress counter increments when ALLSEEMSWELL. In addition, it reduces the run time of the StandbyStateManagementTest from approximately 8 minutes to approximately 2 minutes. Since this changes classes also changed by POLICY-444, this change must be merged before POLICY-444 can be merged. Patch 2: Extended sleep times in AllSeemsWellTest. Patch 3: Commented out asserts that are keeping it from building. Note: It builds just fine in local environment. Patch 4: Moved the check of allNotWellMap from testTransaction to endTransaction so it will cover calls to endTransaction from application code rather than just calls from testTransaction. Patch 5: Fixed potential Sonar issue in initialization of HashMaps allSeemsWellMap and allNotWellMap Patch 6: Changes to IntegrityMonitorTest to make it run faster and more deterministically. This satisfies POLICY-444. Issue-ID: POLICY-501 Change-Id: I8fbbdc481839ec6066f26392d30e230d6b1293f2 Signed-off-by: Kevin McKiou <km097d@att.com>
2017-11-06Fix bug when IntegrityMonitor runs subsystem lateTemoc Rodriguez1-37/+34
Changes to dependencyCheck to correctly take into account subsystemTest on the first pass through dependencies. Allows for status of repo to remain failed in the case that it fails. Issue-ID: POLICY-431 Change-Id: I23ce43ce41c546edad73ec8055e513ccc61933b0 Signed-off-by: Temoc Rodriguez <cr056n@att.com>
2017-10-27Tweak testTransactionv1.1.0Kevin McKiou1-8/+4
Remove startTransaction from testTransaction since it does nothing functionally and causes exceptions which are logged. Issue-ID: POLICY-369 Change-Id: Idd064b49e1d68832d14039870414626ca56c779b Signed-off-by: Kevin McKiou <km097d@att.com>
2017-09-14Changed logger to slf4jMagnusen, Drew (dm741q)1-147/+244
Changed all instances of Sys.out or PolicyLogger to slf4j. Issue-ID: POLICY-178 Change-Id: Ia91af1deb18a9b5c466f6f8a6c546c17c54e14ad Signed-off-by: Magnusen, Drew (dm741q) <dm741q@att.com>
2017-09-14Logging exceptions to clear sonar criticalPamela Dragosh1-1/+2
Just logging the exceptions anyway and remove e.printstack since that goes to stdout/stderr. Issue-ID: POLICY-195 Change-Id: I60616bd6ce633e2fcae266bb37eb735c6e6bb4c4 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2017-09-12Fix sonar critical associated with loggingPamela Dragosh1-16/+16
Addressing the following sonar critical: Use a logger to log this exception Either log or rethrow this exception It does not hurt to simply do these as well as clean out lines of code that dump to Sys.out via e.printStackTrace. Issue-ID: POLICY-195 Change-Id: Ibc328094a0653b7baa04778298e4a69955105ea3 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2017-08-15Resolve major/critical issues in integrity-monitorMagnusen, Drew (dm741q)1-56/+39
Resolved major and critical sonar issues in integrity-monitor module. Issue-ID: [POLICY-96] Change-Id: If1da196134a73535668d42f429d647fc819ecaee Signed-off-by: Magnusen, Drew (dm741q) <dm741q@att.com>
2017-08-04[POLICY-96] Resolved sonar blockers in im/ia.Magnusen, Drew (dm741q)1-26/+57
Resolved 7 sonar blockers in the integrity monitor and integrity audit projects. Change-Id: I7bba7619d3b71f7aebcc2642d07a64876ee7aea0 Signed-off-by: Magnusen, Drew (dm741q) <dm741q@att.com>
2017-07-31[POLICY-71] replace openecomp for policy-commonGuo Ruijing1-0/+1566
Change-Id: I3241f5d1f0234043b4dff718eda1ffdc48052276 Signed-off-by: Guo Ruijing <ruijing.guo@intel.com> Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>