aboutsummaryrefslogtreecommitdiffstats
path: root/integrity-monitor/src/main/java/org/onap/policy/common/im/IntegrityMonitor.java
AgeCommit message (Collapse)AuthorFilesLines
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>