summaryrefslogtreecommitdiffstats
path: root/policy-management/src/test
AgeCommit message (Collapse)AuthorFilesLines
2019-02-21Add Nested JSON FilteringDaniel Cruz2-221/+141
The refactoring of the JsonProtocolFilter allows for complex filter queries for JSON events coming in on network topics. The underlying library used is json-path, which supports path based searching and ruby regex filtering at any level of the JSON document. The JsonProtocolFilter no longer requires a FilterRule class as one json-path filter can contain multiple constraints using "&&" or "||". This eliminates the need to identify the field name as a key with a regex associated with it in the controller properties file (see the original FilterRule implementation). It also simplifies the parsing needed in the DroolsControllerFactory when extracting the filter property and creating the JsonProtocolFilter. JUnit coverage is 100% and all sonar flags were addressed related to the JsonProtocolFilter class. Tested and verified working with the telemetry API in a locally deployed PDP-D. Change-Id: I8bd63db4e497c1ba0b5044b5449ccb7a9e4dbdbc Issue-ID: POLICY-1489 Signed-off-by: Daniel Cruz <dc443y@att.com>
2019-02-15Test gson in policy-managementJim Hahn20-46/+465
Added jackson-like Gson annotations to policy-management classes. Also added tests to verify that the classes serialize the same with gson as with jackson. Removed some trailing spaces. Replaced tabs and adjusted spacing in json files. Removed trailing newlines. Updated license data per review comment. Fixed merge conflict. Added files that were inadvertently deleted. Change-Id: Ib546e70f9d9d83187a6a93ff5c634000c4d53da5 Issue-ID: POLICY-1431 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-02-14Remove jackson from policy codersJim Hahn3-32/+3
Coders came in pairs, one for GSON and one for Jackson. Replaced the pairs with a single coder for GSON. Simplified list copy. Removed multipleToolsetRetries flag. Removed additional jackson code. It had been removed, but the changes were somehow lost. Simplified another list copy. Updated license dates. Note: the date in PolicyEngineTest will be updated via a different review (mgmt-gson). Change-Id: Id3c7688c2389d194f66afcefa14303cf403ada16 Issue-ID: POLICY-1431 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-02-11Replace PolicyAssert with assertjJim Hahn3-101/+111
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-02-04Report KieBase names in rules artifacts.Jorge Hernandez3-10/+18
The rule writer at design time can embed the domain base model(s) supported at design time. This information can be extracted at runtime to match a controller with the domain/model functionality that it can support. Change-Id: I7f7f1320d7d601d50949d0cd09bc48982c222333 Issue-ID: POLICY-1500 Signed-off-by: Jorge Hernandez <jorge.hernandez-herrero@att.com>
2019-01-15Change Junit to check for error code 406Jorge Hernandez1-1/+1
This is to support some clean up changes done in policy/common under commit 55f5c4dc9e130e48a25b048e1f3091b10c17e365. Change-Id: I2961d7ba719d22f144af972dc3964c3ac402e75c Issue-ID: POLICY-1397 Signed-off-by: Jorge Hernandez <jorge.hernandez-herrero@att.com>
2018-12-04Fix sonar issue in droolspdfKrishnakumar Jinka1-6/+17
Modify protocol coder to fix sonar issue about method params too many. Using existing builder. Address review comments, replace modified with modification Issue-ID: POLICY-1251 Change-Id: I67bd753f346108865404b733e7cf6008c2012766 Signed-off-by: krisjinka <kris.jinka@samsung.com>
2018-11-29Remove Factory from various drools-pdp classesJim Hahn1-42/+48
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-11-15Modify event (en)coder to use param objskris.jinka2-8/+13
Use builder object to send params to event protocol coder and encoder methods to fix sonar issue Issue-ID: POLICY-1251 Change-Id: I6ca5823e1aa35d9aa3a05eb23ac159947efdde23 Signed-off-by: kris.jinka <kris.jinka@samsung.com>
2018-11-07Fix for Test failure issue in drools-pdpParshad Patel1-1/+1
Replace JAVA_HOME with PATH env variable in assert statement Issue-ID: POLICY-1241 Change-Id: I2441d7be44a9578a3137a7a0b5747ec0799f0869 Signed-off-by: Parshad Patel <pars.patel@samsung.com>
2018-10-31Set new master version for Dublinliamfallon1-2/+1
Issue-ID: POLICY-1232 Change-Id: I768c9f4e0e1411854fe6aadb52abbc616654127d Signed-off-by: liamfallon <liam.fallon@ericsson.com>
2018-10-05Add junit coverage to PolicyEngine classJim Hahn1-0/+1742
Also fixed a typo in a test comment. Change-Id: I4ad72cc7c103014e6f5920f912c862560af5a331 Issue-ID: POLICY-1148 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-10-03Add coverage for policy-managementJim Hahn3-1/+1370
Added coverage for PolicyControllerFactory and AggregatedPolicyController. Fixed some typos in comments. Reformatted some code. Change-Id: I33aea8e1e7dde29bd51218d0ecad7b34047b33e5 Issue-ID: POLICY-1148 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-10-01Set drools-pdp checkstyle configPamela Dragosh2-7/+11
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-19AAF Configuration in PDP-DJorge Hernandez2-9/+73
AAF is disabled by default until pairwise testing is completed. Change-Id: Ica83873a2605742689ed0c2e06dfade20bef8bf0 Signed-off-by: Jorge Hernandez <jh1730@att.com> Issue-ID: POLICY-1043 Signed-off-by: Jorge Hernandez <jh1730@att.com>
2018-09-13Fix checkstyle in policy-managementPamela Dragosh11-435/+486
The submodule policy-management checkstyle fixes. There may be one or two sonar fixes in there. Issue-ID: POLICY-882 Change-Id: I9cb43c573c6811dd058943650ba1ea5f6dc880aa Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-07-30Copy policy-endpoints from drools-pdp to commonmmis4-19/+19
Issue-ID: POLICY-967 Change-Id: Ib19d3a89ffa328c39f7871bff59efb3dd1617f7a Signed-off-by: mmis <michael.morris@ericsson.com>
2018-07-25Copy policy-endpoints from drools-pdp to commonmmis5-1226/+1062
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-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-16Add missing licensesPamela Dragosh1-0/+19
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-03-14Unit test modified to be order independentliamfallon1-13/+43
The change of dmaap version caused the order of execution of unit tests to change. This triggered an assertion fail in this test. The test has been redesigned to be independent of test invocation order. Also some small Sonar issues fixed. Change-Id: I3b3a5b1cb69785c69f818eab2473fdbfbb85dbd1 Issue-ID: POLICY-694 Signed-off-by: liamfallon <liam.fallon@ericsson.com>
2018-02-20Sonar fixes to drools-pdpJim Hahn1-8/+10
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>
2018-02-13protocol coder and null drools controller junitsJorge Hernandez2-74/+266
Change-Id: Ie26a8cd44a39007e38c9dc8c28418e988df70c77 Issue-ID: POLICY-583 Signed-off-by: Jorge Hernandez <jh1730@att.com>
2018-02-08protocol coder junitsJorge Hernandez1-0/+242
Change-Id: I7a02a8767dbb19724715e057b1da82f7045d6a44 Issue-ID: POLICY-583 Signed-off-by: Jorge Hernandez <jh1730@att.com>
2018-02-07expose immutable list of filters to its usersJorge Hernandez2-17/+73
+ additional related junits Change-Id: I00293cd9aa911dfb3d658cad4ee0441ad3410e9c Issue-ID: POLICY-164 Signed-off-by: Jorge Hernandez <jh1730@att.com>
2018-01-31junits+utils to generate/test rules applicationsJorge Hernandez6-0/+382
1. utilities to generate rules applications and installing in local maven repository programmatically. 2. using these utilities, use policy abstractions, ie. controllers, containers, .. to junit test it. Change-Id: I13c35e631a1120fad503feef2593d32a99e3358f Issue-ID: POLICY-583 Signed-off-by: Jorge Hernandez <jh1730@att.com>
2017-10-09send messages directly through topicJorge Hernandez2-10/+47
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-10-06Apply review changes, and correct warningsMike Babinski1-0/+184
Issue-ID: POLICY-109 Change-Id: I3a221351e5c68514413c5744334b8c80578c3a02 Signed-off-by: Mike Babinski <mb1915@att.com>
2017-09-27Additional RestManager junitsMagnusen, Drew (dm741q)1-124/+351
Added more junits to RestManagerTest.java to increase coverage of the RestManger class to >29%. Also cleaned up the RestManagerTest class. Issue-Id: POLICY-109 Change-Id: I16885a945579f6aac203b47cf05294396bba2b15 Signed-off-by: Magnusen, Drew (dm741q) <dm741q@att.com>
2017-09-25junits fixesJorge Hernandez4-761/+870
I found multiple issues from latest junit submissions when I built in my local that I tried to fix. 1. feature-test-transaction - prone to race conditions as we have experienced in some jenkins builds. There is an assert that checks if the thread is alive that monitors a policy controller kiesession sanity. The thread is very short-lived as it will exit right away since it detects that the underlying "drools session" does not have an attached rules artifact (brainless). Removed that check to fix the race condition. 2. With the increment of junits in the PolicyEngine.manager for multiple packages, it seems that the static instance is reused across junits (which surprised me), so configuration files that are not supposed to be read in junits for a package are read, and for example the lock state could propagate across junits. I tried to clean all that up to make sure that each junit deals with what is has created and state does not propagate to other junits. 3. feature-active-standy-management had a missing "junit" dependency. I generated the effective pom, and indeed did not show, some junits failed to compile in the test phase. Adding the test dependency fixed the problem. As a note, the feature-active-standy-management junits, take over 20 minutes to run. This time is excessive (see below): logs$ head -1 debug.log 2017-09-25 21:24:21.630 [main] DEBUG o.o.p.d.c.t.StandbyStateManagementTest.setUpClass(111) - setUpClass: userDir=/media/sf_jh1730/dev/open/LF/git/master/policy/drools-pdp/feature-active-standby-management logs$ tail -1 debug.log 2017-09-25 21:46:29.801 [Timer-46] DEBUG o.o.p.d.a.DroolsPdpsElectionHandler.run(919) - TimerUpdateClass.run.exit Change-Id: Ie3167e5f784f35f98fa08997e624c51f976b6501 Issue-ID: POLICY-109 Signed-off-by: Jorge Hernandez <jh1730@att.com>
2017-09-25Added junits to cover PUT/DELETE in RestManagerMagnusen, Drew (dm741q)1-3/+89
Added some more junits that cover some of the PUT/DELETE methods in the RestManager class. Not all are covered yet. Issue-Id: POLICY-109 Change-Id: I7d7ac9656338c6ba0b3ffb76221fde5a90637236 Signed-off-by: Magnusen, Drew (dm741q) <dm741q@att.com>
2017-09-22Added more junit coverage for RestManager classMagnusen, Drew (dm741q)1-2/+238
More logic to GETTest which provides coverage for all GET methods in RestManager class. Issue-ID: POLICY-109 Change-Id: Ic5840b8baab73b1e3b440ca6f0b9909dd273c9fa Signed-off-by: Magnusen, Drew (dm741q) <dm741q@att.com>
2017-09-22Merge "Added junits to cover configuration classes"Jorge Hernandez2-0/+207
2017-09-21Added junit for policy-managementMagnusen, Drew (dm741q)3-2/+407
Junits were added to cover the FileSystemPersistence and RestManager classes Patch 2: Merged some test functionality from FileSystemPersistenceTest class into SystemPersistenceTest class. Deleted FileSystemPersistenceTest class. Issue-ID: POLICY-109 Change-Id: Ifd058b9988db30f6b5bc49ae54e5060c67f4ad5e Signed-off-by: Magnusen, Drew (dm741q) <dm741q@att.com>
2017-09-21Added junits to cover configuration classesMagnusen, Drew (dm741q)2-0/+207
Added junits to cover DroolsConfiguration and ControllerConfiguration classes. Issue-Id: POLICY-262 Change-Id: Ie6cf4b15f8b08220a93b4469cc6fd4eda9299138 Signed-off-by: Magnusen, Drew (dm741q) <dm741q@att.com>
2017-09-19Adding JUnits for Configuration ClassesPamela Dragosh1-0/+250
Also fixed some Sonar Major issues to help clean that up. Issue-ID: POLICY-109 Change-Id: Ic8a0b8d97f2be1cc1f8e8e4e8b319c6117b231a4 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2017-09-07Support environment configurationsJorge Hernandez2-186/+317
This enables PDP-D to have knowledge of any installation property or else configured via OS environment variable or as an environment file. This allows the user to query or set via REST API of programmatically through PolicyEngine any environment variable. It also provides a means to make data globally available to all drools applications. For example: http://localhost:9696/policy/pdp/engine/environment> get HTTP/1.1 200 OK Content-Length: 749 Content-Type: application/json Date: Wed, 06 Sep 2017 23:53:57 GMT Server: Jetty(9.3.14.v20161028) { "DCAE_SERVERS": "", "DCAE_TOPIC": "", "DMAAP_SERVERS": "", "ENGINE_MANAGEMENT_HOST": "0.0.0.0", "ENGINE_MANAGEMENT_PASSWORD": "", "ENGINE_MANAGEMENT_PORT": "9696", "ENGINE_MANAGEMENT_USER": "", "HEALTHCHECK_PASSWORD": "", "HEALTHCHECK_USER": "", "JAVA_HOME": "/usr/lib/jvm/java-8-oracle", "M2_HOME": "/usr/share/maven", "PAP_HOST": "", "PAP_PASSWORD": "", "PAP_USERNAME": "", "PDPD_CONFIGURATION_API_KEY": "", "PDPD_CONFIGURATION_API_SECRET": "", "PDPD_CONFIGURATION_CONSUMER_GROUP": "", "PDPD_CONFIGURATION_CONSUMER_INSTANCE": "", "PDPD_CONFIGURATION_PARTITION_KEY": "", "PDPD_CONFIGURATION_SERVERS": "", "PDPD_CONFIGURATION_TOPIC": "PDPD-CONFIGURATION", "PDP_HOST": "", "PDP_PASSWORD": "", "PDP_USERNAME": "", "POLICY_HOME": "/home/policy/snapshot", "SQL_HOST": "", "SQL_PASSWORD": "", "SQL_USER": "" } policy@newton:~/snapshot/config$ echo -n "http://one.com/aai" | http --verbose PUT :9696/policy/pdp/engine/environment/AAI_URL Content-Type:text/plain Accept:text/plain PUT /policy/pdp/engine/environment/AAI_URL HTTP/1.1 Accept: text/plain Accept-Encoding: gzip, deflate Connection: keep-alive Content-Length: 18 Content-Type: text/plain Host: localhost:9696 User-Agent: HTTPie/0.9.2 http://one.com/aai HTTP/1.1 200 OK Content-Length: 0 Content-Type: text/plain Date: Thu, 07 Sep 2017 00:05:05 GMT Server: Jetty(9.3.14.v20161028) policy@newton:~/snapshot/config$ echo -n "http://one.com/aai2" | http --verbose PUT :9696/policy/pdp/engine/environment/AAI_URL Content-Type:text/plain Accept:text/plain PUT /policy/pdp/engine/environment/AAI_URL HTTP/1.1 Accept: text/plain Accept-Encoding: gzip, deflate Connection: keep-alive Content-Length: 19 Content-Type: text/plain Host: localhost:9696 User-Agent: HTTPie/0.9.2 http://one.com/aai2 HTTP/1.1 200 OK Content-Length: 18 Content-Type: text/plain Date: Thu, 07 Sep 2017 00:05:45 GMT Server: Jetty(9.3.14.v20161028) http://one.com/aai policy@newton:~/snapshot/config$ http :9696/policy/pdp/engine/environment/AAI_URL HTTP/1.1 200 OK Content-Length: 19 Content-Type: application/json Date: Thu, 07 Sep 2017 05:14:57 GMT Server: Jetty(9.3.14.v20161028) http://one.com/aai2 Change-Id: I1fcd610938af751977bb2db925b57b4e5b3f7ba4 Issue-ID: POLICY-162 Signed-off-by: Jorge Hernandez <jh1730@att.com>
2017-08-28junits in policy-managementJorge Hernandez2-35/+168
- add additional junits for policy-management module - allow for no configuration pdp-d start up. - minor changes junits for policy-endpoints to avoid race conditions in jenkins environment, starting up, and shutting down servers. Issue-ID: POLICY-109 Change-Id: Ibccefeb5d7cf762da27fe3282887df18d79db5df Signed-off-by: Jorge Hernandez <jh1730@att.com>
2017-08-20sonar criticals and some majorsJorge Hernandez1-0/+3
Issue-ID: POLICY-114 Change-Id: I5fe12b6538379a4d018bb76173247fe53fba21d7 Signed-off-by: Jorge Hernandez <jh1730@att.com>
2017-07-28[POLICY-72] replace openecomp for drools-pdpGuo Ruijing2-7/+7
Change-Id: I8aa8e32d3ba10f7c655b50e97aaf6865514d4777 Signed-off-by: Guo Ruijing <ruijing.guo@intel.com>
2017-07-27[POLICY-52] pdp-d: PolicyEngine junitsJorge Hernandez2-0/+115
Change-Id: I8c85d75d7eddd7c959ed4cfb7167b58d9c7c9854 Signed-off-by: Jorge Hernandez <jh1730@att.com>