aboutsummaryrefslogtreecommitdiffstats
path: root/policy-core
AgeCommit message (Collapse)AuthorFilesLines
2020-01-13policy/drools-pdp jdk11 upgradesHockla, Ali (ah999m)6-22/+27
Issue-ID: POLICY-1589 Change-Id: I0ed05c6e471a7da6658e02a4ba3115d3a117cedd Signed-off-by: Hockla, Ali (ah999m) <ah999m@att.com>
2019-11-14Add 'DroolsRunnable' classStraubs, Ralph (rs8887)6-1/+279
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-11-11Add drools factory clean up statements to junitsjhh1-2/+0
An attempt to tackle some intermittent junit errors experienced by team mates. Issue-ID: POLICY-1407 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I68a90dc50fe2fa5bfc7214aa26e2e5f78f1e6c23 Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
2019-11-08Miscellaneous code clean upjhh5-21/+18
Issue-ID: POLICY-2203 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I5731d4636bd2aaecbc486406298bcba1b19e8f4d Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
2019-11-06Drools Controller upgrades Testsjhh3-44/+208
Issue-ID: POLICY-1407 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I6963fced5608b62a41b73fef5070c21cf45d6fbe Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
2019-10-31upgrade to 7.28.0.Final drools librariesjhh2-59/+28
commons-lang does not seem to be packaged anymore (commons-lang3 still does, which is the desired one). There are some @SupressWarning that seem to have no effect that were removed. Some libraries that were explicitly added are transitively used now in the latest version of drools, hence some rework in the dependency and exclude sections. We will need to generate a clm report to verify. Issue-ID: POLICY-1407 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I44e09183caca72f5f33bdec0b8fa88b0b4793055 Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
2019-10-29Cleanup eclipse warnings in drools-pdpJim Hahn1-1/+1
Issue-ID: POLICY-2203 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: I3e854b1ea1986cd4992dc2ff84d799e970e443a9
2019-10-17Reimplement Lock API using Lock objectsJim Hahn14-2236/+725
Modified PolicyResourceLockManager to just return a feature, deferring the lock() call/method to the feature, itself. The manager was also modified so that, if it can't find an enabled provider, it will return a default provider, whose lock() methods always fail. Once a feature has been identified, the manager will cache it for use thereafter. Modified the feature API to return lock objects and simplified the interface to remove the beforeXxx and afterXxx methods. Moved the unlock and refresh methods from the feature API into the lock class, renaming them to free and extend, respectively. Added a separate, feature-simple-locking project, which implements a simple version of the locking feature, over a single JVM. Extensively revised the distributed locking feature to fit in with the new API. Added support for persistence so that the various LockImpl classes can be serialized and still function correctly when they are deserialized back into new feature instances Added default implementations of free & extend to LockImpl. Modified API to take the ownerKey string, instead of the owner object. Removed Extractor as unneeded - may add via another review, if still useful. Updates per review comments: - Updated licenses in feature-simple-locking - Added beforeCreateLock & afterCreateLock to feature API - Moved SimpleLockingFeature into policy-management so that it's always available - Moved the executor service, "exsvc", into PolicyEngine - Moved Extrator into policy-utils - Changed Extractor logging level for exceptions - Fixed feature sequence numbers - Fixed mixing of seconds and milliseconds - Renamed exsvc - Modified to use property method with default value - Configured scheduled executor - Added suffix to Extractor.register() - Eliminated Feature Api and tied lock manager into engine - Added non-null checks to LockImpl parameters - Added non-null checks to createLock() parameters - Checked that lockManager is initialized Change-Id: Iddba38157ddc5f7277656979c0e679e5489eb7b1 Issue-ID: POLICY-2113 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-10-15Merge "Add 'PolicySession.insertDrools' method"Jorge Hernandez3-2/+40
2019-10-15Add 'PolicySession.insertDrools' methodStraubs, Ralph (rs8887)3-2/+40
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-10-10Replace protobuf-java 2.6.0 dependency with 3.6.1Bruno Sakoto1-0/+21
This change fixes protobuf-java library conflict when running policy because of presence of 2.6.0 and 3.6.1 librairies in pdp docker container. Issue-ID: POLICY-2088 Signed-off-by: Bruno Sakoto <bruno.sakoto@bell.ca> Change-Id: Ifcebf2207dc54543083d080151e0685d51792be5
2019-09-10Bump versions for drools-pdp masterJim Hahn1-1/+1
Change-Id: I9882ab12334dc4b548de527ab2d7dbfc22177113 Issue-ID: POLICY-2045 Signed-off-by: Jim Hahn <jrh3@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 Hahn9-57/+128
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-08-07Bump version of drools-pdpJim Hahn1-1/+1
Updated the remaining *.pom files. Updated java test file that uses the version. Changed versions in *.pom files to all be 1.0.0. Change-Id: Ia75cdfa5704b1e16b3c78e0257e619cd41220f93 Issue-ID: POLICY-1965 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-07-16Fix checkstyle issues in policy-coreJim Hahn8-49/+18
Also deleted the checkstyle suppression file. Change-Id: I93e9f9154b614b56f7826ec978e1a99bd9369348 Issue-ID: POLICY-1907 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-28Bump drools-pdp to 1.5.1-SNAPSHOTPamela Dragosh1-1/+1
Released 1.5.0 Issue-ID: POLICY-1737 Change-Id: I2ebc4255aa7b03b1c402e825bfb714224fb7db84 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-05-31Bump drools-pdp to version 1.5.0Jim Hahn1-1/+1
Change-Id: I6eb1f0e7dc2c0ac9b4f1594497c321aa57db8ecd Issue-ID: POLICY-1747 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-05-16Step snapshot version of drools-pdpliamfallon1-1/+1
Issue-ID: POLICY-1630 Change-Id: Ia77856077ae89f839aa930101c2002ac25f79595 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-08Initial support for deployjhh1-0/+3
This is a first pass, some functionality is missing (undeploy). Compile error fix from changes in policy/models repo. Change-Id: If448492ab665c135bace99d4d684d403e2a6be03 Issue-ID: POLICY-1624 Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
2019-03-19Remove OrderedService referencesDaniel Cruz2-21/+21
Removed OrderedService and OrderedServiceImpl from the drools-pdp repo to use OrderedService and OrderedServiceImpl from the common repo. All feature interfaces were updated occordingly. Issue-ID: POLICY-1499 Change-Id: Icc80dd1cbe73a97d4832f95ad2dad52d948b711a Signed-off-by: Daniel Cruz <dc443y@att.com>
2019-02-11Replace PolicyAssert with assertjJim Hahn1-1/+0
PolicyAssert has a sonar issue and is no longer needed, as the same functionality (and more) is provided by assertj. Modified drools-pdp test code to replace PolicyAssert with assertj. Updated license dates. Removed trailing spaces. Remove assertj version from poms, as it's now included in parent pom. Change-Id: Ica82a959613e082dc6ed6fc9e103a198c2f17537 Issue-ID: POLICY-1393 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-01-08Replace expectException with AssertJJim Hahn4-102/+39
Change-Id: I5c9c5e962a7e2a5617405d534c0719f4bdb6ff1c Issue-ID: POLICY-1393 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-01-04Add tooling for drools policy developersJorge Hernandez1-13/+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-11-29Remove Factory from various drools-pdp classesJim Hahn2-60/+16
Also merged changes from 'Rename test classes in drools-pdp'. Change-Id: I4d0a3a1b0b5523eadf38d1edb5aa86c404b69d19 Issue-ID: POLICY-1288 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-10-31Set new master version for Dublinliamfallon1-4/+2
Issue-ID: POLICY-1232 Change-Id: I768c9f4e0e1411854fe6aadb52abbc616654127d Signed-off-by: liamfallon <liam.fallon@ericsson.com>
2018-10-24Fix refering to snapshot in policy/drools-pdp1.3.1ramverma1-4/+4
Issue-ID: POLICY-1213 Change-Id: I485c15044ba5cc0d3daceaf0876f543cc5c8af82 Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>
2018-10-05Add coverage to policy-coreJim Hahn9-136/+390
Added easy junit test coverage cases. Fixed sonar issue: removed sleep from DroolsContainerTest. Fixed sonar bug in ClassExtractors. Change-Id: I942badf17c42346c1735bc3951450fc31c02a769 Issue-ID: POLICY-1148 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-10-01Set drools-pdp checkstyle configPamela Dragosh8-59/+127
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-26Use powermock artifacts from parent pomJim Hahn1-6/+0
Change-Id: I0a42dd468b44fc732c526701bb6dd8f8c040233c Issue-ID: POLICY-1148 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-09-21new sonar issues in drools-pdpJim Hahn3-13/+13
No "@Test" methods - renamed class from XxxTest to XxxMock. Changed functional call syntax. Change-Id: I954c2549705e80c00aed8ecbcb19f386cc8b0310 Issue-ID: POLICY-1137 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-09-11Revert back to Drools 6.5.0.FinalJim Hahn2-12/+11
Decided to abandon the conversion to Drools 7.9.0.Final. This undoes the associated changes. Change-Id: I457266d09f7e481da5c0415290241a348786f8ea Issue-ID: POLICY-1093 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-09-10Switch to drools 7.9.0.FinalJim Hahn2-11/+12
Note: This will break policy/drools-applications until the corresponding change is merged there, too. Reformatted lengthy line. Change-Id: I4ae7838dfbc2d537580636eccc545710b5ebc799 Issue-ID: POLICY-1093 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-09-10Fix checkstyle policy-corePamela Dragosh22-755/+771
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-09-04Fix security issuesPamela Dragosh1-1/+9
Guava was not fully defined correctly. In order to exclude an older version being pulled in, the dependencyManagement needs to come from oparent and not overriden in drools-pdp. Issue-ID: INT-619 Change-Id: I58dfb815f02d61e47552e671540144b7b1ed3df5 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-08-29Set parent to policy/parentPamela Dragosh1-87/+87
Set the parent to point to policy/parent instead of oparent. Clean up some duplicate management versions. Change-Id: I28957b05b80c9564ad32c958143822b6b0768219 Issue-ID: INT-619 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-08-20Fix sonar issues in drools-pdpKrishnajinka2-589/+536
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 commonmmis5-1023/+681
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-07-18Deny subsequent lock()Jim Hahn3-14/+9
This is the final step of separating the lock "refresh" operation from the original "lock" operation. This step entails rejecting subsequent "lock" requests, even by the same owner, when a resource is already locked; "refresh" should now be used, instead, to extend a lock. Modified comments to indicate that the lock can only be extended using "refresh". Change-Id: I406cf60c076dbce87afbd94fb301732359dbd2db Issue-ID: POLICY-872 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-07-16Distinguish lock from refreshJim Hahn6-2/+300
This is the first step of separating the lock "refresh" operation from the original "lock" operation. This step entails adding the refresh() method to both the default and the feature-distriubted locking mechanisms. Change method call, in junit test, from lock to refresh. Change branch name in git review. Change-Id: I506de7a96cb3ee786839aca04ad67cdd7378832c Issue-ID: POLICY-872 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-07-03Merge "Fix sonar issues on new code"Jorge Hernandez1-3/+1
2018-07-03Fix sonar issues on new codeJim Hahn1-3/+1
Removed new technical debt. Change-Id: I04e86b85897ab42deca17ecee55f29d48cc24427 Issue-ID: POLICY-872 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-06-29Final piece to remove lock CallbackJim Hahn2-31/+0
Now that drools-applications no longer uses the lock Callback, it can be removed from drools-pdp. Change-Id: Ie82a6d382b54041ab612e73ad8c96176bd01a9f6 Issue-ID: POLICY-872 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-06-27Add time limit to locking facilityJim Hahn9-843/+166
Modified the locking facility to add a time limit and remove the callback parameter. This affected both the default facility as well as the distributed locking feature. It will also require a change to the rules for Closed Loop. Changed testUnlock() to try locking with a different owner. Default feature API should be OPER_UNHANDLED. Put a few things back so-as not to break the drools-applications build. They can be removed once drools-applications is updated. Fix newlines in API java. Change-Id: I3ed7835cac6a582493a9bc8f6d1d4f3e6cb6289e Issue-ID: POLICY-872 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-06-25Added expiration timer to default locking strategyJim Hahn5-16/+371
Fixed comment (missing "}"). Changed default age from 15 hours to 15 minutes. Only increment test time by 1 when testing hashCode. Change-Id: I70ef6cfd34e31ded45b3975f33e5b0ba22afa627 Issue-ID: POLICY-912 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-06-18Add setXxx methods for @Property annotationJim Hahn2-138/+16
We'll be modifying the PropertyConfiguration class so that, instead of directly setting values in private fields, it will use public setXxx methods. Consequently, we have to add the setXxx methods to the PropertyConfiguration subclasses so that they're available when the superclass is modified policy/common. Change-Id: Idff9942eabec182670cbb427b960f6308a2ca30c Issue-ID: POLICY-906 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-06-05Update drools-pdp to SNAPSHOT-1.3.0liamfallon1-1/+1
Snapshot updated for Casablanca. Change-Id: I75c0a41ce2c1a56ab658be8bfd27a5c81977f990 Issue-ID: POLICY-875 Signed-off-by: liamfallon <liam.fallon@ericsson.com>
2018-05-21Update Policy Drools PDP to 1.2.3-SNAPSHOTliamfallon1-1/+1
These reviews must be merged in order because of layering. This review should be merged SECOND. Change-Id: I3d3fb84622686b23d435aaf0cd43d307684a4a1f Issue-ID: POLICY-844 Signed-off-by: liamfallon <liam.fallon@ericsson.com>
2018-05-16Upgrade SNAPSHOT to 1.2.2liamfallon1-1/+1
These reviews must be merged in order because of layering. This review should be merged THIRD Change-Id: Icdb5c18106ade60bbc1eea67a1b42e70ac5383e5 Issue-ID: POLICY-798 Signed-off-by: liamfallon <liam.fallon@ericsson.com>
2018-04-19Sonar cleanupMagnusen, Drew (dm741q)1-0/+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>