summaryrefslogtreecommitdiffstats
path: root/policy-core/src/test
AgeCommit message (Collapse)AuthorFilesLines
2019-01-08Replace expectException with AssertJJim Hahn3-101/+32
Change-Id: I5c9c5e962a7e2a5617405d534c0719f4bdb6ff1c Issue-ID: POLICY-1393 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-11-29Remove Factory from various drools-pdp classesJim Hahn1-24/+3
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-05Add coverage to policy-coreJim Hahn6-65/+361
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 Dragosh2-12/+12
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-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-10Fix checkstyle policy-corePamela Dragosh10-508/+481
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-07-18Deny subsequent lock()Jim Hahn1-2/+2
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 Hahn3-2/+207
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-06-27Add time limit to locking facilityJim Hahn4-503/+108
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 Hahn3-5/+167
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 Hahn1-38/+9
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-04-16Merge "Sonar fixes to pooling"Jorge Hernandez1-0/+85
2018-04-16Sonar fixes to poolingJim Hahn1-0/+85
Made various changes to the pooling feature to address some of the sonar issues. Remove duplicate classes, Pair & Triple. Fix sonar issue about duplicate process(xxx) methods. Remove extra items from pom.xml and add assembly builder. Fix license text in pom.xml, inadvertently reformatted. Fix a few typos in comments and change LinkedList to Queue. Move assembly.xml to correct source directory. Replace ScheduledFuture<?> with CancellableScheduledTask, to satisfy sonar. Eliminate "TODO" items: add logging, delay after sending Offline message. Add more logging in process(Message) methods. Begin creating end-to-end junit test, fixed bugs found as a result. Restore logback-test.xml to WARN. Fix merge conflict - restored test properties file. Change-Id: Ic70a8cee49678ea0fc3da309699aec1f6088fe70 Issue-ID: POLICY-728 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-04-16Add missing licensesPamela Dragosh2-1/+39
Adding missing licenses to files that should not harm compilation, JUnit tests and instantiation. Issue-ID: POLICY-741 Change-Id: I3075e3493676ee28693323f978c0b5b210b20a34 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-04-12Sonar fixes for policy-core locksJim Hahn5-109/+69
Made a number of changes to the locking code in policy-core, to address sonar issues. This entaileed changing some of the Lock API methods to return OperResult instead of Boolean. Updated distributed locking with the new API return types. Simplified Thread creation using functional methods. Change-Id: If32bf7a435d2aedb969de1b77c7e7e27e110ecb0 Issue-ID: POLICY-728 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-04-03Add api-resource-locks featureJim Hahn6-0/+1486
Added ResourceLockFeatureAPI, to provide an interface for PolicyGuard to use to access other locking mechanisms. Move lock API to policy-core. Changed the interface and added Callback support. Added a class to invoke the API implementers. Changed to set a future instead of expecting the callback to implement the future interface. Also refactored, creating "lock" sub-package. Add junit tests. Increase junit coverage. IsLocked & isLockedBy should check all arguments. Make ImplFuture protected instead of public. Simplify locking - move callback support to an optional feature. Move Reference class to policy-utils. Return plain Future instead of LockRequestFuture. Change-Id: I65154d33833914b4332e02d1ef2512f4c5f09b16 Issue-ID: POLICY-577 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-02-08programatic install of rules artifacts for junitsJorge Hernandez7-2/+158
instead of relying on pom.xml, build settings. since jenkins jobs that generate sonars don't seem to go through a build phase anymore, therefore the preceding artifacts are not available in the local repository, which is required by the tests. Change-Id: Icfd14b2f8a6c6e1ac7d986bd6eb977b2a83b044d Issue-ID: POLICY-621 Signed-off-by: Jorge Hernandez <jh1730@att.com>
2017-10-09send messages directly through topicJorge Hernandez1-4/+2
This work is needed for consolidating the amsterdam templates used both for junits and the official one from the archetype into one, so junits can run in the official one. This work revisits the functionality of when a drools controller cannot be found to check state before delivering a message from the drools application, it will use a standalone enconder (previously configured to do so). This was intended to work like this originally, but never tested nor used as all deliveries are send through the controllers so locked/alive state is checked (but there may ocassions where we want to take this default action). Change-Id: Ie23e4e13323f3ab9fd207f8a396c1af6564b7edf Issue-ID: POLICY-101 Signed-off-by: Jorge Hernandez <jh1730@att.com>
2017-09-18Add Junit tests to 'policy-core'Ralph Straubs3-0/+492
These tests focus on the following classes: - PolicyContainer - PolicySession - PolicySessionFeatureAPI 'maven-invoker-plugin' was used to compile and install artifacts for testing during the 'test-compile' phase. These aren't part of the Maven project hierarchy, so they aren't visible to Sonar and SonarQube, and they aren't deployed. Change-Id: I67c122debbe5280f0153e7330248dc5d13c5b2c0 Issue-ID: POLICY-236 Signed-off-by: Ralph Straubs <rs8887@att.com>