aboutsummaryrefslogtreecommitdiffstats
path: root/policy-core/src/main/java/org/onap/policy/drools/core/PolicyContainer.java
AgeCommit message (Collapse)AuthorFilesLines
2024-02-09Removing deprecated DMAAP libraryadheli.tavares1-7/+8
Issue-ID: POLICY-4402 Change-Id: I4ce5b303cb3a775010683d3c7102b0bd065280ea Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2021-08-05Use lombok in drools-pdp #2Jim Hahn1-21/+13
Updated feature-session-persistence thru drools-domains. Issue-ID: POLICY-3397 Change-Id: I0b1c6da8b2301c00dd792675e8cf1f49888edb9f Signed-off-by: Jim Hahn <jrh3@att.com>
2020-09-30Fix new sonars in drools-pdpJim Hahn1-1/+6
Addressed the following sonar issues: - extract common test method - too many assertions in test method - don't always return the same value Issue-ID: POLICY-2616 Change-Id: Iab836cdcd667b35e2db9db7d6ffc7896df33e1c8 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-06-19Address checkstyle version issues in drools-pdpJim Hahn1-1/+0
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-06Address sonar issues in drools-pdpJim Hahn1-46/+48
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>
2019-11-14Add 'DroolsRunnable' classStraubs, Ralph (rs8887)1-0/+43
This provides a simple way to run arbitrary Java code within the Drools thread. This change also includes a general way to specify Drools rules that are automatically added to every Drools session. Change-Id: I5ddcca4c807dc552fbcbd4a19dce311a4d358279 Issue-ID: POLICY-1948 Signed-off-by: Straubs, Ralph (rs8887) <rs8887@att.com>
2019-10-15Add 'PolicySession.insertDrools' methodStraubs, Ralph (rs8887)1-2/+2
This change includes feature hooks, so a "smart insert" could forward the object to a remote host, and do the insert there. The methods 'insert' and 'insertAll' in 'PolicyContainer' now make use of this smart insert. Change-Id: I69f0e874b6fda09d1f457e4353e4b30d63696210 Issue-ID: POLICY-2160 Signed-off-by: Straubs, Ralph (rs8887) <rs8887@att.com>
2019-08-15Fix more sonar issues in drools-pdpJim Hahn1-18/+24
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 Hahn1-18/+18
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-16Fix checkstyle issues in policy-coreJim Hahn1-8/+8
Also deleted the checkstyle suppression file. Change-Id: I93e9f9154b614b56f7826ec978e1a99bd9369348 Issue-ID: POLICY-1907 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-10-01Set drools-pdp checkstyle configPamela Dragosh1-12/+10
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-10Fix checkstyle policy-corePamela Dragosh1-20/+36
Working on the policy-core submodule in drools pdp. Issue-ID: POLICY-882 Change-Id: I58d418110fe0fda90f97117ef17edfc13d648ccc Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-08-20Fix sonar issues in drools-pdpKrishnajinka1-62/+70
Fix sonar issues about nested control loops in drools-pdp. Rework1 build failed due to incorrect condition. fixing it Fix checkstyle. Add modified copyright notice Issue-ID: POLICY-1017 Change-Id: I21a4ad9399b1d234b8d5416ab0d595302a441f10 Signed-off-by: Krishnajinka <kris.jinka@samsung.com>
2018-07-25Copy policy-endpoints from drools-pdp to commonmmis1-820/+657
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-02-20Sonar fixes to drools-pdpJim Hahn1-3/+2
Fixed most of the instances of the following sonar issues: Moved array designator Used diamond operator Changed System.out/err to use a logger Changed several Thread.sleep() in test code to a single sleep() Useless assignments Replaced comparison with "" to string.isEmpty() Merged if's Replaced ArrayList with List in method returns Reordered type modifiers Reordered constructor methods Defined constants for literals, or replaced them with method calls Removed "throws Xxx" for subclasses of RuntimeException Combined identical "catch" blocks Re-interrupted the current thread after catching an InterruptedException Removed tests against the literal "false" Fix indentation of new makeTopicOperError() method. Fix exception variable name in new methods, logNoUebEncoder() and logNoDmaapEncoder(). Change-Id: Iddae5210553662f733b67333b372dec8c3fe2c94 Issue-ID: POLICY-336 Signed-off-by: Jim Hahn <jrh3@att.com>
2017-11-29Fix Sonar issues in policy-coreCharles Cole1-12/+14
Fixed the Sonar issues in policy-core that required minimal refactoring of the code. Issue-ID: POLICY-461 Change-Id: I3d0f7c4411855b2c75d5ae6968665753b50bde75 Signed-off-by: Charles Cole <cc847m@att.com>
2017-09-21Removed useless parenthesesrama-huawei1-45/+51
Added the "@Override" annotation Issue-ID: POLICY-239 Change-Id: I9896f3130b5f8ecaa557d5386c0118e9a09008d2 Signed-off-by: rama-huawei <rama.subba.reddy.s@huawei.com>
2017-09-14Eliminate hanging when updating Drools containersRalph Straubs1-1/+10
'PolicyContainer.updateToVersion(...)' now hangs unless the Drools session threads are stopped prior to the update. This wasn't an issue in the past, and it isn't clear what causes it to happen now. It also happened in the Junit tests I am currently working on. In any case, the 'updateToVersion' method has now been changed to stop the threads prior to an update attempt, do the update, and then restart the threads. Change-Id: I577a67c6e99a68bcbe3c2f476f93c0a72b93451a Issue-ID: POLICY-234 Signed-off-by: Ralph Straubs <rs8887@att.com>
2017-07-28[POLICY-72] replace openecomp for drools-pdpGuo Ruijing1-0/+848
Change-Id: I8aa8e32d3ba10f7c655b50e97aaf6865514d4777 Signed-off-by: Guo Ruijing <ruijing.guo@intel.com>