aboutsummaryrefslogtreecommitdiffstats
path: root/feature-state-management/src
AgeCommit message (Collapse)AuthorFilesLines
2021-09-03Fix sonar security issues in drools-pdpJim Hahn1-13/+3
Fixed sonar security issues: - set permissions of temporary files; modified to use utility from policy-common Issue-ID: POLICY-3289 Change-Id: I55b70175429052e0dfaf5939fa6b940f191d9267 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-09-01Don't create world-writeable directoryJim Hahn1-32/+11
Fix sonar: - world-writeable directory Issue-ID: POLICY-3289 Change-Id: I421dd9722d8642992ff8f5991f41a341c834ba1d Signed-off-by: Jim Hahn <jrh3@att.com>
2021-08-26Fix sonars in drools-pdpJim Hahn4-24/+21
Fixed sonars: - use "var" - override "equals" - unused imports Also changed some of the JPA queries to make them typed queries. Issue-ID: POLICY-3289 Change-Id: Ib3a00be322d8d00ba492673708439cacfe2c7fc4 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-08-10Add SQL_PORT configurationjhh1-3/+3
Issue-ID: POLICY-3533 Change-Id: I03fc41332d4739d5a4d6cee5f86ba823714336d6 Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
2021-08-05Use lombok in drools-pdp #2Jim Hahn5-73/+24
Updated feature-session-persistence thru drools-domains. Issue-ID: POLICY-3397 Change-Id: I0b1c6da8b2301c00dd792675e8cf1f49888edb9f Signed-off-by: Jim Hahn <jrh3@att.com>
2021-06-28Update policy-drools-pdp for checkstyle 8.43liamfallon1-2/+3
Updates are indentation changes on annotations. Issue-ID: POLICY-3209 Change-Id: I7b55b2affa3e16afb0c0f8398b902a04f13c4db0 Signed-off-by: liamfallon <liam.fallon@est.tech>
2021-05-10interrupted exception and var usage sonarsjhh1-8/+8
Issue-ID: POLICY-3230 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I50a4ee81f0a1c97df25732a4e4507e8b7f8c8e4d
2021-02-10More sonars in drools-pdpJim Hahn1-1/+1
Addressed the following issues: - log user-controlled data; moved the "NOSONAR" to a different line - make constructors protected Issue-ID: POLICY-2909 Change-Id: Ic69c100af777779e791c38cc444dd2ea726258f2 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-02-09Upgrade dependenciesJim Hahn4-8/+13
Changes to eclipselink are incompatible with javax-persistence-api so removed the latter. Also added target-database property. Also replaced string constants with eclipselink constants. Per review comments, moved target-database values to property files. Issue-ID: POLICY-3005 Change-Id: I043203a952d54406a5996c1e8b5ba8936bf558c0 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-08-31Fix more sonars in drools-pdpJim Hahn4-35/+38
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>
2020-08-25Address more sonars in drools-pdpJim Hahn1-5/+6
Addressed the following sonars: - either log or rethrow - call "remove()" for thread-local-storage - use assertEquals - only one method call in exception test - swap arguments in assertEquals - add assertion to assertThatThrownBy() - explain @Ignore Also addressed eclipse warnings: - unused fields and methods Issue-ID: POLICY-2616 Change-Id: I6590c0d2b103885bc933014d48bf5fd92401cd80 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-06-19Address checkstyle version issues in drools-pdpJim Hahn6-21/+13
Also added serializationId to several classes to address eclipse warnings. Issue-ID: POLICY-2188 Change-Id: I3df5e8abaad8da9261c0d5cd19a93ed68dceb870 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-04-08Address more sonar issues in drools-pdpJim Hahn1-4/+11
Addressed the following sonar issues: - use of "synchronized" - use Files.delete() instead of File.delete() Issue-ID: POLICY-2305 Change-Id: Id55628fe12d9d764616e57321382a70cb5704ba1 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-04-06Address sonar issues in drools-pdpJim Hahn3-16/+19
Addressed the following sonar issues: - add "final" to public static fields - commented code; some were bogus - just updated the comments so sonar is happy - use "{}" instead of string concatenation - junit should assert something - when using logger, invoke compute-intensive tasks conditionally - use superclass name instead of subclass name to access static fields - don't always return the same value - remove "transient" from fields of classes that aren't Serializable - don't nest try/catch blocks - use appropriate class name in Logger.getLogger() - use Predicate<T> instead of Function<T,Boolean> - remove unused parameters from private methods - either log or throw - remove duplicate methods - use remove() TLS instead of set(null) - null check is implicit in instanceof check - do something with return value - don't use volatile - don't return "null" list; used Optional instead - add no-arg constructor to non-Serializable superclass - add callSuper=true for EqualsAndHashCode - don't declare "throws XXX" where XXX is a subclass of RuntimeException - remove serialVersionUID field if the class isn't Serializable Also addressed some eclipse warnings: - unused fields - suppress generic typic cast warnings Issue-ID: POLICY-2305 Change-Id: I906d5bf71c1f86531423e23b3667a585cdba45e1 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-02-26Reapply SQL output feature-state-mgtJim Hahn3-25/+28
Just need to keep the memory DB open until the test completes. Issue-ID: POLICY-2381 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I7833a66d86ea12e46460b37f695c8b4d938a9077
2020-02-26Revert "Cleanup SQL output feature-state-mgt"Pamela Dragosh3-5/+5
This reverts commit 4de095c769c28f3f304d99f132a845993bf58dfa. Reason for revert: Failing to merge Issue-ID: POLICY-2381 Change-Id: Icbb4d75a3876a44f8207fa84410c4d565da34f98 signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-02-25Cleanup SQL output feature-state-mgtPamela Dragosh3-5/+5
use an in-memory database and not store temp files in the development directory. Upgrading to H2 1.4.200 seemed to expose the database issues. mvn clean does NOT remove the sql directory which makes it hard to figure out what is going on. Issue-ID: POLICY-2381 Change-Id: Icab5d9b6f62ed0f9c4e5be91c2b518ab2b442167 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-01-13policy/drools-pdp jdk11 upgradesHockla, Ali (ah999m)1-2/+3
Issue-ID: POLICY-1589 Change-Id: I0ed05c6e471a7da6658e02a4ba3115d3a117cedd Signed-off-by: Hockla, Ali (ah999m) <ah999m@att.com>
2020-01-10Prepare drools-pdp for java 11Jim Hahn1-4/+3
The Observer class has been deprecated. Changed the code to use StateChangeNotifier, instead, in anticipation of a corresponding change in policy/common. Also fixed new issue with missing getSupportedPolicyTypes() method. Issue-ID: POLICY-1406 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I2d3ee29f13bd12a2e16644a1746f066c91c05475
2019-11-08Detemine number of nexus repos to supportPeyton Puckett1-124/+167
Modify RepositoryAudit.java to determine number of additional reposities to support as defined in the feature-state-management.properties file Issue-ID: POLICY-2035 Change-Id: I31edae42025a8167e242535da6eb41c15228bac8 Signed-off-by: Peyton Puckett <peyton.puckett@att.com>
2019-09-16Add YAML support to drools-pdp rest servletsJim Hahn1-1/+1
Drools-pdp depends on some of the GsonJackson annotations that cannot be easily worked around via standard gson. Consequently, this continues to use the JacksonHandler for json-encoding, thus it uses the YamlJacksonHandler for yaml-encoding. Added YAML to swagger "consumes" list. Change-Id: Ic70c68bb274222db571b3515cbf1ab22d9ff2366 Issue-ID: POLICY-2081 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-08-15Fix more sonar issues in drools-pdpJim Hahn1-216/+272
Addressed issues of cyclomatic complexity and deep nesting by refactoring code into separate methods. In some cases, had to refactor the code into nested classes to avoid passing too many parameters to the newly extracted methods. Addressed issue "too many conditionals" by breaking conditionals apart. Addressed issue "Remove usage of generic wildcard type" by eliminating "? extends" from return values. Addressed issue "Remove this use of 'Thread.sleep()'" in junit tests by introducing latches or using Awaitility. Note: this won't build until ApiUtils has been merged. Change-Id: I0d5596b4cb918a36bc22f426f426bd238195b458 Issue-ID: POLICY-1968 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-08-13Fix sonar issues in drools-pdpJim Hahn2-11/+12
Address sonar issue, "Move constants to a class or enum", by moving them from interfaces to classes: ActiveStandbyFeatureApi StateManagementFeatureApi PolicyResourceLockFeatureApi PolicySessionFeatureApi DroolsController DroolsControllerFeatureApi PolicyControllerFeatureApi PolicyEngineFeatureApi HealthCheck SystemPersistence EventProtocolCoder PolicyController PolicyEngine TestTransaction MdcTransaction Address sonar issue, "Move constants to a class or enum", by change the interface to a class: DroolsProperties Address sonar issue, "Override the "equals" method in this class", by adding equals & hashCode to: DroolsPdpEntity DroolsPdpImpl Use lombok for a number of getters & setters. Address sonar issue, "Define a constant instead of duplicating this literal" in: DroolsPdpsElectionHandler JpaDroolsPdpsConnector MavenDroolsController GenericEventProtocolCoder GsonProtocolCoderToolset RestManager Address sonar issue, "Remove the parentheses around the parameter" in: MavenDroolsController Address sonar issue, "Replace this lambda with a method reference" in: LifecycleFsm Address sonar issue, "Move this constructor to comply with Java Code Conventions" in: LifecycleStateRunning Address sonar issue, "Replace this 'switch' statement by 'if' statements to increase readability", as specified in: PolicyEngineManager Address sonar issue, "Rename field to prevent any misunderstanding/clash with field" in: MdcTransactionImpl Address sonar issue, "Either log or rethrow this exception", in: RestManager Address sonar issue, "Rename this constant name to" uppercase, by replacing enums with static lists in: RestManager Addressed review comments: Fixed license dates. Renamed getSiteName/setSiteName methods to getSite/setSite in the interface to match the field names in the implementation classes. Renamed *Instance classes to *Constants. Next round of review comments. Change-Id: I1c26af9f194833dd773f2b25dc5f60cde163201c Issue-ID: POLICY-1968 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-07-24Add coverage to feature-active-standby-managementJim Hahn3-26/+17
Also removed some logger.isXxx() tests, which should reduce the number of branches that need to be tested. Removed unneeded objects and methods from feature-lifecyle. Change-Id: Ic3eb9c0b63a2ad5585846525eb0ebda81fc55d5e Issue-ID: POLICY-1772 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-07-17Fix checkstyle issues in api-state-managementJim Hahn3-13/+13
Also deleted the checkstyle suppression file. Change-Id: Ib43a75c2e214db61a75173be095c380c7c7488f1 Issue-ID: POLICY-1902 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-07-16Fix checkstyle issues in policy-coreJim Hahn3-5/+5
Also deleted the checkstyle suppression file. Change-Id: I93e9f9154b614b56f7826ec978e1a99bd9369348 Issue-ID: POLICY-1907 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-07-16Merge "Fix checkstyle issues in policy-management"Jorge Hernandez2-2/+2
2019-07-11Fix checkstyle issues in policy-managementJim Hahn2-3/+3
Also deleted the checkstyle suppression file. Moved classes into their own source files per checkstyle. Change-Id: I586223aac0e5b7623cfd7b0acfceca4742ecc013 Issue-ID: POLICY-1908-mgmt-style Signed-off-by: Jim Hahn <jrh3@att.com>
2019-07-10Fix checkstyle issues in feature-state-managementJim Hahn5-21/+21
Also deleted the checkstyle suppression file. Change-Id: I41adf8c09fe0613134876976c6aadd193e38fbaa Issue-ID: POLICY-1905 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-07-08Fix drools-pdp due to sonar changes in commonJim Hahn1-19/+20
Fixed breakages due to changes made in policy/common to satisfy sonar. Change-Id: I26a38340707b2903e089350c31c5dfdb5c019ee0 Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-02-21Moving hard install config to environment varsJorge Hernandez1-3/+3
Change-Id: I01e0cf2e2399ec81337961e0a2b3a349c34f55c4 Issue-ID: POLICY-1517 Signed-off-by: Jorge Hernandez <jorge.hernandez-herrero@att.com>
2019-02-15Change properties to use gsonJim Hahn1-0/+1
Modified property files to use gson instead of jackson for REST calls, for both clients and servers. Change-Id: Ib836886df33cd585b4c2d227e9cc496cc165fc2c Issue-ID: POLICY-1431 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-02-14Decouple nexus reconfiguration from installationJorge Hernandez1-6/+6
This allows for nexus to be reconfigured dynamically. Change-Id: I103707ab7525ddb29663d7785739a34dff538605 Issue-ID: POLICY-1518 Signed-off-by: Jorge Hernandez <jorge.hernandez-herrero@att.com>
2019-01-04Add tooling for drools policy developersJorge Hernandez1-5/+5
This commit adds tooling to better support development activities for drools developers. 1. deploy artifacts to nexus or to local file repository on demand. It also allows to test on a single drools instance without the dependency on a nexus repo. 2. make installation configuration files conform to same convention (all upper case). Change-Id: Ia0a2fc25db2ef21b774a9eee4ed51d4b876a1993 Issue-ID: POLICY-1367 Signed-off-by: Jorge Hernandez <jorge.hernandez-herrero@att.com>
2018-10-01Set drools-pdp checkstyle configPamela Dragosh3-19/+21
Fixed last remaining checkstyle issues along with setting the pom.xml to the correct path setting. Fixed forbidden summary fragments, not allowed to prepend summary with "This method returns" Issue-ID: POLICY-1153 Change-Id: I267842080494132a7b5507731e14f027a3f6fe44 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-09-13Fix checkstyle for features submodules.Pamela Dragosh11-1320/+1258
These are the remaining submodules that have checkstyle. Pretty clean compile after this. There were a couple of sonar fixes in there also. Issue-ID: POLICY-882 Change-Id: I8191ea1aa261f4a7b9d3d21c108572fd31db1b8c Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-07-30Copy policy-endpoints from drools-pdp to commonmmis1-3/+1
Issue-ID: POLICY-967 Change-Id: Ib19d3a89ffa328c39f7871bff59efb3dd1617f7a Signed-off-by: mmis <michael.morris@ericsson.com>
2018-07-25Copy policy-endpoints from drools-pdp to commonmmis2-467/+460
Removed policy-endpoints, and 3 classes from policy-core. Replaced refenences to the deleted classes with references to the corresponding classes in policy-common Issue-ID: POLICY-967 Change-Id: I547cde4894424b8f40b7ddd4e2342ebb729cb588 Signed-off-by: mmis <michael.morris@ericsson.com>
2018-04-19Sonar cleanupMagnusen, Drew (dm741q)1-3/+4
More sonar cleanup. Resolved some of the simpler issues. Issue-ID: POLICY-728 Change-Id: If9c4718f10c6d3524239d2a05c09badb791ef2f0 Signed-off-by: Magnusen, Drew (dm741q) <dm741q@att.com>
2018-03-21Fix bugs identified by Sonar on drools-pdpliamfallon2-5/+6
Three bugs fixed: 1. Set of static variable in DMaaPSimulatorJaxR 2. Use of opssibly null variable "output" in RepositoryAudit 3. Unreachable statement error in RepositoryAudit Change-Id: I72e028cfc51a82250afd02fb4109d3dea08072dc Issue-ID: POLICY-691 Signed-off-by: liamfallon <liam.fallon@ericsson.com>
2018-02-19Fix compilation issue due to generic ExceptionJim Hahn1-2/+2
After modifying common to remove generic Exceptions, drools-pdp would no longer compile. Had to modify drools-pdp to accomodate the specific exception. Change-Id: Ib804da2ebfc7dbf5f4035ba3d48832ffe541f902 Issue-ID: POLICY-246 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-02-06Fix sonar issues with RepositoryAuditJim Hahn1-2/+0
Per sonar, removed commented code from RepositoryAudit. Change-Id: Ia81780f7528bd4fc42062454728a2c215709ea45 Issue-ID: POLICY-469 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-01-31Fix sonar issues in feature-state-managementJim Hahn4-184/+198
DroolsPDPIntegrityMonitor.java: Modified init() to throw just IntegrityMonitorException. Modified DroolsPDPIntegrityMonitor init() method to throw specific types of exceptions. StateManagementFeature.java: Sonar complained about needing to merge "if" statements, but chose to eliminate the "if(logger.isDebugEnabled())" instead - did this through-out the source file. Removed extra runtime exception from "throws" declaration. DbAudit.java: Fixed sonar issue regarding setting a static variable from within a non-static method. Removed logger.isDebugEnabled() tests where method calls are not involed. Simplified invoke() method complexity as reported by sonar. DroolsPDPIntegrityMonitor.java: Reduced init() complexity reported by sonar. Change-Id: Ib2722b21bbf3aad130af46c8790f40d8777e36be Issue-ID: POLICY-469 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-01-18Resolve bug in DroolsPDPIntegrityMonitorMagnusen, Drew (dm741q)1-8/+20
This fix ensures that the testServices, testRestClasses, tesManaged, and testSwagger properties are all populated in the stateManagementProperties object within DroolsPDPIntegrityMonitor class. Issue-ID: POLICY-564 Change-Id: Ie517b19f61ab084416ce1e6f8418d69dc9e4f85d Signed-off-by: Magnusen, Drew (dm741q) <dm741q@att.com>
2017-12-13Fix issues blocking election handler threadKevin McKiou2-4/+10
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. Issue-ID: POLICY-501 Change-Id: I7b8180d11077ccf59b21b6484cb58b5522a3df8f Signed-off-by: Kevin McKiou <km097d@att.com>
2017-12-01Modified state mgmt to fix some sonar issuesJim Hahn6-159/+198
Reordered modifiers. Reordered variables, methods, and constructors. Removed useless parentheses. Removed unneeded "catch" clauses. Extracted nested try blocks into their own method. Replaced a string with a constant. Removed extra thrown exceptions when they are unnecessary (i.e., they're subclasses of RuntimeException, or the method is already declared to throw an Exception). Replaced a large anonymous class with a named, nested class. Separated variable declarations onto individual lines. Changed "String args[]" to "String[] args". Replaced if-then-else by single return statement. Invoked super() inside empty, default constructor. Removed Thread.sleep() calls from junit test per comments on 11/29. Commented out Thread.sleep() in junit tests, as they don't appear to be necessary. If that turns out to be untrue, then CountdownLatch.await() can be used instead. Sonar complained about useless assignments to "phase", but those did not appear to be useless. Did not remove commented-out lines, as they may be needed when debugging. Change-Id: I90ba6f7317a18a10ce1b881cfc6d21a602171ff5 Issue-ID: POLICY-469 Signed-off-by: Jim Hahn <jrh3@att.com>
2017-11-02Modify state-management propertiesv1.1.0Kevin McKiou6-112/+190
Patch 1: Removed hostPort and added server.TEST properties from feature-state-management.properties and modified associated code in IntegrityMonitor and properties in associated JUnit tests. Patch 2: Modified in response to comments from Jorge Hernandez. Including adding contant usage instead of strings and replacing generic exceptions with specific exceptions. Patch 3: Tied property constants to PolicyProperties. Added default property contants. Added error/warning log statemeents when something other than expected value is used. Add logging of all constant values for inspection in debugging. Issue-ID: POLICY-369 Change-Id: Ie2218b68761e0338642a2ed28ef840b1b6ece1a4 Signed-off-by: Kevin McKiou <km097d@att.com>
2017-09-27SonarCube Critical IssueKevin McKiou2-4/+14
Patch 1: Modifying DbAudit to access isJunit variable to, hopefully, satisfy SonarCube on a critical issue. Issue-ID: POLICY-261 Change-Id: Ibc1a2876bdf08377798c503110b05e79a0986c38 Signed-off-by: Kevin McKiou <km097d@att.com>
2017-09-25Merge "Incr State Mgmt Code Coverage"Jorge Hernandez6-26/+111
2017-09-25Incr State Mgmt Code CoverageKevin McKiou6-27/+111
Patch 1: Added JUnit tests to feature-state-management to increase coverage. Estimated coverage is now 48%. Patch 2: Trivial change to force a rebuild. Patch 3: Tweaking the JUnit to try and account for the difference between the LF environment and my local environment. Patch 4: Something caused the policy endpoints JUnits to fail - unrelated to these changes. Made a trival change to force a rebuild. Patch 5: Trivial change to force rebuild. Patch 6: Minor changes in response to Jorge Hernandez comments. Issue-ID; POLICY-266 Change-Id: I7979c200ab18d5861ba20e0d5f23bd0083193daa Signed-off-by: Kevin McKiou <km097d@att.com>