policy/common.git
3 years agoFix test case broken by new GSON version 18/126618/1
liamfallon [Mon, 17 Jan 2022 18:21:48 +0000 (18:21 +0000)]
Fix test case broken by new GSON version

The "com/google" resource bundle now contains more than 189 files, so
this test is changed to insetead check for the existence of
"com/google/gson", otherwise this test could break every time we update
gson.

Issue-ID: POLICY-3849
Change-Id: Id979bb7a3d2453956701f64057accb08228a774d
Signed-off-by: liamfallon <liam.fallon@est.tech>
3 years agoAdd newline to end of POM file 77/126577/2
liamfallon [Wed, 12 Jan 2022 16:39:37 +0000 (16:39 +0000)]
Add newline to end of POM file

If the new line is not there, then it breaks the release scripts because
the line count is off.

Issue-ID: POLICY-3835
Change-Id: I1e2e583ead723de6d1a2c312dad78510c5e2778f
Signed-off-by: liamfallon <liam.fallon@est.tech>
3 years agoremove apache-log4j-extras deps from endpoints 41/126241/1
jhh [Tue, 14 Dec 2021 21:39:29 +0000 (15:39 -0600)]
remove apache-log4j-extras deps from endpoints

Issue-ID: POLICY-3862
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Change-Id: I7f8f42e2980fb8f545773599f5ebecabaacf7234

3 years agoUse prometheus libraries defined in parent pom 89/125989/1
Rashmi Pujar [Tue, 30 Nov 2021 18:31:56 +0000 (13:31 -0500)]
Use prometheus libraries defined in parent pom

Depends on https://gerrit.onap.org/r/c/policy/parent/+/125974 for build to pass.

Issue-ID: POLICY-3760
Signed-off-by: Rashmi Pujar <rashmi.pujar1@bell.ca>
Change-Id: I255bf085e0d33e09c1fdd3aea373f3c497074a85

3 years agoUpdate snapshot of policy/common to 1.10.1-SNAPSHOT 74/125874/1
liamfallon [Wed, 24 Nov 2021 16:34:21 +0000 (16:34 +0000)]
Update snapshot of policy/common to 1.10.1-SNAPSHOT

*** This commit is generated by a PF release script ***

This commit updates the snapshot of the repo to the next patch version.

Issue-ID: POLICY-3827
Signed-off-by: liamfallon <liam.fallon@est.tech>
Change-Id: I4ce7c53f5df1e0e1ad954146240899230a45d945

3 years agoRelease policy/common: 1.10.0 51/125851/1
liamfallon [Tue, 23 Nov 2021 15:21:14 +0000 (15:21 +0000)]
Release policy/common: 1.10.0

*** Release Phase 4: This commit is generated by a PF release script ***

This is the fourth phase in releasing images, it releases policy/common.

Issue-ID: POLICY-3827
Signed-off-by: liamfallon <liam.fallon@est.tech>
Change-Id: I666ef9c61ec920750eaa7eb224da9e9c9a820229

3 years agoUpdate policy/parent to 3.5.0 on policy/common 45/125845/1
liamfallon [Tue, 23 Nov 2021 11:50:09 +0000 (11:50 +0000)]
Update policy/parent to 3.5.0 on policy/common

*** This commit is generated by a PF release script ***

This commit updates the version of policy/parent
to the latest released version.

Issue-ID: POLICY-3827
Signed-off-by: liamfallon <liam.fallon@est.tech>
Change-Id: I048978d2bd9ea9769f2594e4395e799867862763

3 years agoPoint to snapshot dependency 37/125337/1
Ram Krishna Verma [Mon, 25 Oct 2021 22:03:12 +0000 (18:03 -0400)]
Point to snapshot dependency

Issue-ID: POLICY-3788
Change-Id: I91441dba5c4fe3de448c354a57784afb8bf8e42c
Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
3 years agoBump policy/common master to 1.10.0-SNAPSHOT 91/124891/1
liamfallon [Wed, 13 Oct 2021 14:25:08 +0000 (15:25 +0100)]
Bump policy/common master to 1.10.0-SNAPSHOT

Issue-ID: POLICY-3696
Change-Id: I3710faca8799cfdbf0d6c75ae286b1765ddf6b97
Signed-off-by: liamfallon <liam.fallon@est.tech>
3 years agoBump policy/common to 1.9.2-SNAPSHOT 79/124879/1
liamfallon [Wed, 13 Oct 2021 10:35:38 +0000 (11:35 +0100)]
Bump policy/common to 1.9.2-SNAPSHOT

Issue-ID: POLICY-3696
Change-Id: I599ac2e36c45ba6882c95681a531da8b57efbb58
Signed-off-by: liamfallon <liam.fallon@est.tech>
3 years agoRelease policy/common 1.9.1 67/124867/1
liamfallon [Tue, 12 Oct 2021 21:09:27 +0000 (22:09 +0100)]
Release policy/common 1.9.1

Issue-ID: POLICY-3696
Change-Id: Ia942f56bbd02a76d13a6b5511bd7872db502f171
Signed-off-by: liamfallon <liam.fallon@est.tech>
3 years agoPoint at released policy/parent 50/124850/1
liamfallon [Tue, 12 Oct 2021 16:06:44 +0000 (17:06 +0100)]
Point at released policy/parent

Issue-ID: POLICY-3696
Change-Id: Ib9769f66ba2da0726cbabca17fc07e5a44082b1a
Signed-off-by: liamfallon <liam.fallon@est.tech>
3 years agoDon't use keytool in test code 73/124373/4
Jim Hahn [Tue, 21 Sep 2021 03:23:38 +0000 (23:23 -0400)]
Don't use keytool in test code

Modified code to generate a self-signed certificate file
programmatically instead of using keytool.

Issue-ID: POLICY-3587
Change-Id: I53b6ffe65f33e5710eba633973e5d23b148f049f
Signed-off-by: Jim Hahn <jrh3.lf@gmail.com>
3 years agoRevert ignoring tests in common 64/124364/1
Ram Krishna Verma [Mon, 20 Sep 2021 14:30:43 +0000 (10:30 -0400)]
Revert ignoring tests in common

Reverting the ignoring of tests in common
as the staging jobs have been marked to skip tests.

Issue-ID: POLICY-3587
Change-Id: Idcb9f432d1f563ba5e072c0c7511de7b650163fa
Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
3 years agoBump snapshot version 78/124078/1
liamfallon [Mon, 13 Sep 2021 15:02:13 +0000 (16:02 +0100)]
Bump snapshot version

Issue-ID: POLICY-3587
Change-Id: I11043890dfd4dfbc19ec24eb15a546745393d105
Signed-off-by: liamfallon <liam.fallon@est.tech>
3 years agoRelease policy-common 1.9.0 75/124075/1
liamfallon [Mon, 13 Sep 2021 14:13:34 +0000 (15:13 +0100)]
Release policy-common 1.9.0

Issue-ID: POLICY-3587
Change-Id: I76b7a870e330154394a8e1b20e711ab97fed01d7
Signed-off-by: liamfallon <liam.fallon@est.tech>
3 years agoWork around test failure in staging job 66/124066/1
liamfallon [Mon, 13 Sep 2021 12:20:45 +0000 (13:20 +0100)]
Work around test failure in staging job

The "keytool" program does not exist in the Jenkins staging job
environment, so the test case that checks for a keytool error message
fails because an unexpected error message is received.

Other tests also break so the tests are morked with @Ignore for now.

Issue-ID: POLICY-3587
Change-Id: Iebdbce8f5e61fb209d65198d7f7e28f5ca70e589
Signed-off-by: liamfallon <liam.fallon@est.tech>
3 years agoFix test failure in staging job 58/124058/1
liamfallon [Fri, 10 Sep 2021 14:48:31 +0000 (15:48 +0100)]
Fix test failure in staging job

The "keytool" program does not exist in the Jenkins staging job
environment, so the test case that checks for a keytool error message
fails because an unexpected error message is received.

By changing the test case to expect "keytool" rather than "keytool
exited with", then the test will pass when the error message "Cannot
run program "keytool": error=2, No such file or directory" is returned.

Issue-ID: POLICY-3587
Change-Id: I3a6b77fb571cfbf170f5f16bf93eece2d78a7bbb
Signed-off-by: liamfallon <liam.fallon@est.tech>
3 years agoPoint at released policy-parent 97/123997/1
liamfallon [Thu, 9 Sep 2021 14:06:02 +0000 (15:06 +0100)]
Point at released policy-parent

Issue-ID: POLICY-3587
Change-Id: I5827b432e436620d4e014dbc4d97e0bacdb7e8e9
Signed-off-by: liamfallon <liam.fallon@est.tech>
3 years agoMerge "Update INFO.yaml"
Pamela Dragosh [Thu, 9 Sep 2021 13:34:52 +0000 (13:34 +0000)]
Merge "Update INFO.yaml"

3 years agoPoint at released policy parent 81/123981/1
liamfallon [Thu, 9 Sep 2021 10:34:35 +0000 (11:34 +0100)]
Point at released policy parent

Issue-ID: POLICY-3587
Change-Id: Ia541b927eb591f2790141f11f40f3124c32beb6d
Signed-off-by: liamfallon <liam.fallon@est.tech>
3 years agoUpdate INFO.yaml 48/123948/1
liamfallon [Wed, 8 Sep 2021 11:18:38 +0000 (12:18 +0100)]
Update INFO.yaml

Update the INFO.yaml file with latest information.

Issue-ID: POLICY-3552
Change-Id: Icc9b3dc4bfa2266cc1c023761861ca22b1f6f586
Signed-off-by: liamfallon <liam.fallon@est.tech>
3 years agoCreate methods for creating temp files 51/123851/2
Jim Hahn [Thu, 2 Sep 2021 16:18:49 +0000 (12:18 -0400)]
Create methods for creating temp files

Created utility methods to create temp files and set default
permissions.  These can be used in other repos to satisfy sonar.
Also added code to close streams and clean up temp files created
by some junit tests.
Modified to use IOUtils to read a stream.

Issue-ID: POLICY-3289
Change-Id: Ic83e4f4d7745be7b37ebb42bf1d81e303d8dadc9
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoSupport multiple filters in RestServer 66/123466/2
Jim Hahn [Mon, 23 Aug 2021 16:27:41 +0000 (12:27 -0400)]
Support multiple filters in RestServer

Added an API to RestServer so that multiple Filters may be provided.

Issue-ID: POLICY-3531
Change-Id: I21f474c01d58237c744d1d70f5b39c2c90fdb401
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoMerge "Prevent deadlock in ServiceManager"
Ram Krishna Verma [Mon, 23 Aug 2021 16:22:56 +0000 (16:22 +0000)]
Merge "Prevent deadlock in ServiceManager"

3 years agoMerge "Fix sonars and java warnings in common"
Ram Krishna Verma [Mon, 23 Aug 2021 16:22:02 +0000 (16:22 +0000)]
Merge "Fix sonars and java warnings in common"

3 years agoPrevent deadlock in ServiceManager 52/123452/1
Jim Hahn [Mon, 23 Aug 2021 13:54:38 +0000 (09:54 -0400)]
Prevent deadlock in ServiceManager

Modified the ServiceManager code so that isAlive() can be invoked
without requiring synchronization, thus eliminating one potential area
of deadlock.

Issue-ID: POLICY-3531
Change-Id: I27d060c3a7cfad8dab20a197d1e42c4ee607a1e2
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoDisable prometheus by default in policy/common 47/123447/1
a.sreekumar [Mon, 23 Aug 2021 13:27:41 +0000 (14:27 +0100)]
Disable prometheus by default in policy/common

Change-Id: I30acac6ea84bfb032994e81a93f38443818a0d1a
Issue-ID: POLICY-3538
Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
3 years agoFix sonars and java warnings in common 24/123424/1
Jim Hahn [Fri, 20 Aug 2021 21:02:13 +0000 (17:02 -0400)]
Fix sonars and java warnings in common

Issue-ID: POLICY-3284
Change-Id: I13fc28c6ae681871be8bb9cf3d222d7c65459a44
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoAdd topic checker 62/123362/4
Jim Hahn [Wed, 18 Aug 2021 14:46:28 +0000 (10:46 -0400)]
Add topic checker

Added a method to check the readiness of a bidirectional topic.

Issue-ID: POLICY-3531
Change-Id: I2fefae7ba1ea5ed9ed33140717d05828e6dec94d
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoIntegrating prometheus with Policy components 87/123187/13
a.sreekumar [Mon, 9 Aug 2021 11:01:02 +0000 (12:01 +0100)]
Integrating prometheus with Policy components

With this change, all PF components can export prometheus metrics
by default. The prometheus metrics servlet will be running on
/metrics servletPath..
If the metrics shouldn't be exported, just add a flag
    "promethus": false
in the restServerParameters of default configuration file.
This brings up prometheus servlet on /metrics servletPath.

Also as part of standard servlet support, "servletUriPath" and
"servletClass" are 2 other fields added to RestServerParameters
which can be used to add standard servlets. This can be revisited later
if needed.
Basically, any servlet can be added by passing these fields, for
example, to add prometheus metrics servlet on /test/metrics,
add the below to restServerParameters:
    "servletUriPath": "/test/metrics",
    "servletClass": "io.prometheus.client.exporter.MetricsServlet"

In addition, we can later go to individual components and add more
metrics, say for e.g.,
deployedPoliciesCounter/undeployedPoliciesCounter etc on PAP,
executedEvents/failedEvents etc on PDP and so on.
This will look something like below, for e.g. in policy-pap component:
 io.prometheus.client.Counter counter = Counter.build()
  .name("policies_deployed_total")
  .help("Number of policies deployed.").register()
Whenever a policy is deployed, just call
 counter.inc()

Usage of code like above in the individual component will expose
such data as well as part of the exposed metrics.

Change-Id: Id667f27b15c012398421ba657b5324cc1d82cf1f
Issue-ID: POLICY-3524
Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
3 years agorefactor slf4j logger to common util 02/123102/1
Taka Cho [Wed, 4 Aug 2021 13:30:11 +0000 (09:30 -0400)]
refactor slf4j logger to common util

avoid EELF lib dependency, was suggested to move
to common util instead

Issue-ID: POLICY-3087
Change-Id: I79a2f5ba32fd3fc496ef3f72a02f4696b766f9c7
Signed-off-by: Taka Cho <takamune.cho@att.com>
3 years agorefactor slf4j Marker to common repo 37/123037/3
Taka Cho [Mon, 2 Aug 2021 16:06:08 +0000 (12:06 -0400)]
refactor slf4j Marker to common repo

slf4j Marker logger is using in drools-pdp
and clamp. was suggested to move to common repo
to reduce duplicated codes. And possibly other
repo would be used also.

Issue-ID: POLICY-3087
Change-Id: If14b89c18e28f517f83a2b9a8dcce201333a919e
Signed-off-by: Taka Cho <takamune.cho@att.com>
3 years agoUpdate Pam's email INFO.yaml 01/122601/1
Dragosh, Pamela (pd1248) [Tue, 13 Jul 2021 14:26:03 +0000 (10:26 -0400)]
Update Pam's email INFO.yaml

Issue-ID: POLICY-3484
Change-Id: I57aa0b25c104acaa5529f95ee2cbf4e5c73195ab
Signed-off-by: Dragosh, Pamela (pd1248) <pd1248@att.com>
3 years agoMerge "Use UUID for topic consumer instance"
Jim Hahn [Fri, 2 Jul 2021 16:48:47 +0000 (16:48 +0000)]
Merge "Use UUID for topic consumer instance"

3 years agoWait after fetch exception on topic 03/122403/2
Jim Hahn [Thu, 1 Jul 2021 15:41:00 +0000 (11:41 -0400)]
Wait after fetch exception on topic

When dmaap is inaccessible for some reason, the topic source frequently
enters a fast fail loop, rapidly filling up the log.  Modified the code
to wait the configured fetchTimeout when this occurs.

With any luck, this will also fix the sporadic kubernetes crash-fail
loops sometimes seen with the xacml-pdp pod.

Modified to limit how long it will sleep after a failure, regardless of
the fetchTimeout that was specified.

Issue-ID: POLICY-3457
Change-Id: I88e360fb1d31197b46f4959e5ea0ea2d741ad25c
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoUse UUID for topic consumer instance 93/122393/2
Jim Hahn [Thu, 1 Jul 2021 14:21:23 +0000 (10:21 -0400)]
Use UUID for topic consumer instance

Modified the code so that if the consumer group is defined, but the
consumer instance is not, then policy-endpoints will generate a UUID for
the consumer instance.
Made the logic a little more straight-forward in response to a review
comment.

Issue-ID: POLICY-3405
Change-Id: If74440bdb01525bc463a28e5b8a9a2eca89a855a
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoAddress sonars in common 49/122349/2
Jim Hahn [Tue, 29 Jun 2021 20:48:07 +0000 (16:48 -0400)]
Address sonars in common

Fixed:
- use "var"
- duplicate code block

Issue-ID: POLICY-3284
Change-Id: I8cd7f2588353a2e7702c90d37d7b9f972634dca9
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoMerge "Add name generator for PAP and PDPs"
Ajith Sreekumar [Tue, 29 Jun 2021 08:28:39 +0000 (08:28 +0000)]
Merge "Add name generator for PAP and PDPs"

3 years agoMerge "Update policy-common for checkstyle 8.43"
Liam Fallon [Mon, 28 Jun 2021 14:44:54 +0000 (14:44 +0000)]
Merge "Update policy-common for checkstyle 8.43"

3 years agoUpdate policy-common for checkstyle 8.43 65/122265/1
liamfallon [Mon, 28 Jun 2021 09:32:06 +0000 (10:32 +0100)]
Update policy-common for checkstyle 8.43

Issue-ID: POLICY-3206
Change-Id: I6d14a62e6619e2162e68846853feb36b95274866
Signed-off-by: liamfallon <liam.fallon@est.tech>
3 years agoAdd name generator for PAP and PDPs 24/122224/1
Jim Hahn [Fri, 25 Jun 2021 21:29:21 +0000 (17:29 -0400)]
Add name generator for PAP and PDPs

Added a method that PAPs and PDPs can use to generate a unique name or
identifier to be used in PAP-PDP messages.

Issue-ID: POLICY-3410
Change-Id: I22b075b123f79ba05e0884f743296c4bc64842b9
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoMove Validators and RestClientParameters in policy-common 71/122071/4
FrancescoFioraEst [Mon, 21 Jun 2021 09:39:22 +0000 (10:39 +0100)]
Move Validators and RestClientParameters in policy-common

Issue-ID: POLICY-3402
Change-Id: I7479027e3ea1e960266264c2d13cd69e2103710b
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
3 years agoMerge "Fix new checkstyle issues in policy-common"
Jim Hahn [Fri, 18 Jun 2021 14:12:38 +0000 (14:12 +0000)]
Merge "Fix new checkstyle issues in policy-common"

3 years agoMerge "Use lombok in policy-endpoints"
Jim Hahn [Fri, 18 Jun 2021 13:40:05 +0000 (13:40 +0000)]
Merge "Use lombok in policy-endpoints"

3 years agoFix new checkstyle issues in policy-common 39/122039/1
Jim Hahn [Fri, 18 Jun 2021 13:27:39 +0000 (09:27 -0400)]
Fix new checkstyle issues in policy-common

The new version of checkstyle identified new issues.  Fixed those.

Issue-ID: POLICY-3284
Change-Id: I2a8bf2b460fda7972ce573f14df5af52d46c9993
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoUse lombok in policy-common utils-test 19/122019/3
Jim Hahn [Thu, 17 Jun 2021 17:16:43 +0000 (13:16 -0400)]
Use lombok in policy-common utils-test

Issue-ID: POLICY-3394
Change-Id: I85504848afc268be7419654dc95ed555d870272c
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoMerge "Use lombok in policy-common utils"
Jim Hahn [Fri, 18 Jun 2021 12:41:58 +0000 (12:41 +0000)]
Merge "Use lombok in policy-common utils"

3 years agoMerge "Use lombok annotations in IM and ONAP logging"
Jim Hahn [Thu, 17 Jun 2021 22:22:41 +0000 (22:22 +0000)]
Merge "Use lombok annotations in IM and ONAP logging"

3 years agoUse lombok in policy-common utils 18/122018/2
Jim Hahn [Thu, 17 Jun 2021 17:02:08 +0000 (13:02 -0400)]
Use lombok in policy-common utils

Issue-ID: POLICY-3394
Change-Id: I42a18c115c3ca7110f37fc0ae8aeea3f2bbffb37
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoUse lombok in policy-endpoints 16/122016/1
Jim Hahn [Thu, 17 Jun 2021 15:54:29 +0000 (11:54 -0400)]
Use lombok in policy-endpoints

Issue-ID: POLICY-3394
Change-Id: I8dfb0814d5cc544b2c334dc11a3e69ef407f163f
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoUse lombok annotations in IM and ONAP logging 13/122013/2
Jim Hahn [Thu, 17 Jun 2021 14:32:25 +0000 (10:32 -0400)]
Use lombok annotations in IM and ONAP logging

Issue-ID: POLICY-3394
Change-Id: I25db6b4b13bad8754889eaedb93197cae7d27c4d
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoUse lombok in common params 97/121997/1
Jim Hahn [Wed, 16 Jun 2021 21:45:03 +0000 (17:45 -0400)]
Use lombok in common params

Also condensed some Map calls.

Issue-ID: POLICY-3394
Change-Id: I850fcad5a72d92271da76b0731195e8b93dd4089
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoValidator should report serialized field name 20/121620/1
Jim Hahn [Tue, 1 Jun 2021 14:18:13 +0000 (10:18 -0400)]
Validator should report serialized field name

The validator reports field names as they appear in the class rather
than as they appear on the wire, which may be confusing to the client.
Modified the code to use the serialized name instead.
Note: this will require tweaks to some junits in some of the other
policy repos.

Issue-ID: POLICY-3333
Change-Id: I867dafdc87cd78dec3d3c6fe0236a744284314a3
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoFix sonar issues in common 77/121577/1
Jim Hahn [Thu, 27 May 2021 21:25:07 +0000 (17:25 -0400)]
Fix sonar issues in common

Fixed sonar issue:
- class should not be abstract

Issue-ID: POLICY-3284
Change-Id: I9c4aa149b7321cbcaff8dce5e2999315a06f19b0
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoMerge "Enhance toString methods in factory classes"
Jim Hahn [Mon, 24 May 2021 20:51:53 +0000 (20:51 +0000)]
Merge "Enhance toString methods in factory classes"

3 years agoFix sonar duplicate code issue 07/121507/3
Jim Hahn [Fri, 21 May 2021 21:31:02 +0000 (17:31 -0400)]
Fix sonar duplicate code issue

Issue-ID: POLICY-3284
Change-Id: I78c3a8ac92e18e2b0088eb07e27a4e97866d6182
Signed-off-by: Jim Hahn <jrh3@att.com>
3 years agoEnhance toString methods in factory classes 04/121504/1
Jim Hahn [Fri, 21 May 2021 16:19:44 +0000 (12:19 -0400)]
Enhance toString methods in factory classes

The factory classes in policy-endpoints have toString() methods that
return "[]" for their list contents.  Updated the code to provide a list
of the keys rather than just an empty list.
Also replaced some toString() methods with lombok.
Also replace StringBuilder with concatenation in some cases.

Issue-ID: POLICY-3298
Change-Id: I64fca21a4b009f7e09fcc482b5d156753fb7e680
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoChange java.util.regex to re2j 96/121196/2
Jim Hahn [Fri, 7 May 2021 19:35:55 +0000 (15:35 -0400)]
Change java.util.regex to re2j

Sonar complains about java.util.regex.  Thought I used re2j when
creating all of the patterns, but apparently not.  Fixed that oversight.

Issue-ID: POLICY-3284
Change-Id: Idbec112ab0d4c3b477ce357f8a556d95e4dea083
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoFix sonars in policy-common 36/121136/3
Jim Hahn [Thu, 6 May 2021 15:28:53 +0000 (11:28 -0400)]
Fix sonars in policy-common

Fixed sonars:
- use "var" instead of actual type name
- re-interrupt threads
- use rej2 split() instead of String split()

Issue-ID: POLICY-3285
Change-Id: I82261e0b8a53ee5c5264556fbf5cec37454f014e
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoRemove GroupValidationResult 15/120915/5
Jim Hahn [Mon, 26 Apr 2021 21:41:25 +0000 (17:41 -0400)]
Remove GroupValidationResult

Removed GroupValidationResult, replacing it with BeanValidationResult.
Modified the ParameterGroup subclasses to use BeanValidator, adding
annotations where needed to trigger the validations that had been
automatically performed by GroupValidationResult.
Added Size annotation, used to verify minimum lengths of maps and
collections.
Added ClassName annotation, used to verify that a property contains the
name of a class that is actually in the classpath.
Added another addResult() method to make it easier when replacing calls
to GroupValidationResult setResult() method with BeanValidationResult.

Issue-ID: POLICY-2059
Change-Id: Id4da24886908723006624c5d53edeb034102299d
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoMerge "Revert "Modify StandardCoder to handle empty source""
Pamela Dragosh [Tue, 13 Apr 2021 17:16:58 +0000 (17:16 +0000)]
Merge "Revert "Modify StandardCoder to handle empty source""

4 years agoRevert "Modify StandardCoder to handle empty source" 00/120500/1
Jim Hahn [Tue, 13 Apr 2021 15:31:48 +0000 (15:31 +0000)]
Revert "Modify StandardCoder to handle empty source"

This reverts commit 04623fef95f2b164d79ad48de2ef3708d02eda80.

Reason for revert: prefer consistency with gson

Issue-ID: POLICY-3172
Change-Id: Ic2501abcc68ec1186142a7e520e7985c43fd3315
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoAdd command line handler 23/120423/3
adheli.tavares [Fri, 9 Apr 2021 10:51:05 +0000 (11:51 +0100)]
Add command line handler

Added a Handler for command line classes to share common strucutures.

Issue-ID: POLICY-3128
Change-Id: I662911c467faf5c39b8db018bb1a564fba7587a6
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
4 years agoModify StandardCoder to handle empty source 35/120335/1
Jim Hahn [Wed, 7 Apr 2021 20:23:10 +0000 (16:23 -0400)]
Modify StandardCoder to handle empty source

Currently, if the source string or source file is empty, the
StandardCoder just returns null.  Modified it to throw an exception in
those cases.  However, if the string reference is null, it will still
return null.

Issue-ID: POLICY-3172
Change-Id: Ie7d5e1b0328a24d94a75af8d18a341faebbe5d5f
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoUse self-signed-cert property for HTTP clients 66/119866/2
Jim Hahn [Thu, 25 Mar 2021 17:52:02 +0000 (13:52 -0400)]
Use self-signed-cert property for HTTP clients

Currently, the HttpClient code sets self-signed-certs to true whenever
https is specified.  This is insecure.  Modified the code to set the
value based on the property, defaulting to false.

Issue-ID: POLICY-3145
Change-Id: Ie88cf2411ae44a7c53bc8943f615a74c5b87d1aa
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoAdd utility to generate keystore for testing 57/119457/4
Jim Hahn [Wed, 17 Mar 2021 22:55:15 +0000 (18:55 -0400)]
Add utility to generate keystore for testing

Added a class that will generate a keystore containing a self-signed
certificate.

Issue-ID: POLICY-3147
Change-Id: I25e7307c2e73dbacae24c8fce616bf2ada93df9f
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoRemove more unnecessary plugins from common 75/119275/1
Jim Hahn [Fri, 12 Mar 2021 22:07:34 +0000 (17:07 -0500)]
Remove more unnecessary plugins from common

Issue-ID: POLICY-3126
Change-Id: I2f39e14c9cea0ec58709e24995aab536f2df7990
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoAddress plugin-not-found issues 86/119186/3
Jim Hahn [Mon, 8 Mar 2021 19:28:10 +0000 (14:28 -0500)]
Address plugin-not-found issues

Removed references to archetype-packaging and lifecycle-mapping, where
unnecessary due to pom inheritance.

Issue-ID: POLICY-3126
Change-Id: Ie31edcb7ae31e1bb495904fce2c8ed56d9bf10f5
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoBump version to 1.9.0 in common 06/119106/2
Jim Hahn [Wed, 10 Mar 2021 19:27:32 +0000 (14:27 -0500)]
Bump version to 1.9.0 in common

Issue-ID: POLICY-3105
Change-Id: I1fd654fef96a1e41f150ea13baf39acc882f6bb2
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoUpdate info.yaml in common 85/118385/1
Ram Krishna Verma [Wed, 24 Feb 2021 14:52:26 +0000 (09:52 -0500)]
Update info.yaml in common

Issue-ID: POLICY-3028
Change-Id: Id67f1f5205fe0522b8f909015a7cf503d82a585c
Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
4 years agoBump version to 1.8.1-SNAPSHOT in common 38/118238/2
Jim Hahn [Tue, 23 Feb 2021 13:30:23 +0000 (08:30 -0500)]
Bump version to 1.8.1-SNAPSHOT in common

Issue-ID: POLICY-3088
Change-Id: I1cc2d1d26c337d67b0ecadd852e43b603902415e
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoRelease artifacts 1.8.0 of common 09/118209/1 8.0.0-ONAP
Jim Hahn [Mon, 22 Feb 2021 22:30:54 +0000 (17:30 -0500)]
Release artifacts 1.8.0 of common

Issue-ID: POLICY-3088
Change-Id: I2419754fc055bb350ebb9299a69c5e2d81fac173
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoPoint to non-snapshots in common 04/118204/2
Jim Hahn [Mon, 22 Feb 2021 21:03:13 +0000 (16:03 -0500)]
Point to non-snapshots in common

Issue-ID: POLICY-3088
Change-Id: I3b3afdc15fb006c6b5fc6b223aa4d3ff6f112f31
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoRemove duplicate code from type adapters 85/118085/2
Jim Hahn [Thu, 18 Feb 2021 22:15:07 +0000 (17:15 -0500)]
Remove duplicate code from type adapters

Extracted a common superclass, StringTypeAdapter, out of the gson type
adapter classes.

Issue-ID: POLICY-2914
Change-Id: I4bbd2a6e8372e7f42c4952ba9ff03eed97473fb2
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoAdd more java.time adapters 55/118055/4
Pamela Dragosh [Thu, 18 Feb 2021 15:57:23 +0000 (09:57 -0600)]
Add more java.time adapters

The time extensions require these adapters for anyone using our
gson adapter to serialize/deserialize the DecisionRequest.

Issue-ID: POLICY-2810
Change-Id: I64a7e4a5a256c77bd67dab867664e41b61cd0050
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
4 years agoMake gson type adapters more generic 01/117801/1
Jim Hahn [Fri, 12 Feb 2021 15:06:27 +0000 (10:06 -0500)]
Make gson type adapters more generic

Enhanced ZonedDateTime adapter so a date format string can be provided.
Simplified InstantAsMillis adapter.

Issue-ID: POLICY-2905
Change-Id: Ic4ddba19391b165d6a7528ce18c22541d12324c7
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoFix sonars from depeendency upgrade 63/117763/1
Jim Hahn [Thu, 11 Feb 2021 21:13:32 +0000 (16:13 -0500)]
Fix sonars from depeendency upgrade

The dependency upgrades in policy-parent caused some new sonars.  In
particular, initMocks() has been deprecated - replaced with calls to the
Mockito Runner.

Issue-ID: POLICY-2914
Change-Id: Iaf10f676c380adb9785e836cb15792596b378e4e
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoMore sonar issues in common 97/117697/1
Jim Hahn [Wed, 10 Feb 2021 19:23:02 +0000 (14:23 -0500)]
More sonar issues in common

Addressed the issues:
- use of eq() in verify()
- remove @NamedQueries
- use computeIfAbsent()

Issue-ID: POLICY-2914
Change-Id: I265bc98f0f326e7b4ce86c25e68fc4859bd7fb02
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoRemove javax.persistence dependency 08/117608/2
Jim Hahn [Thu, 4 Feb 2021 22:12:46 +0000 (17:12 -0500)]
Remove javax.persistence dependency

Running into a dependency collision between two eclipselink jars.  Turns
out, we don't actually need to include the javax.persistence dependency,
so removed it altogether.

Issue-ID: POLICY-3005
Change-Id: I5f09ddc27cdaa329b4604e6c715879d52335f870
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoAdd policy-clamp to policy Message constants 29/116929/1
liamfallon [Sat, 16 Jan 2021 09:06:21 +0000 (09:06 +0000)]
Add policy-clamp to policy Message constants

policy-clamp is now a valid component inthe policy framework and should
be added to the message constants in policy common.

Issue-ID: POLICY-2971
Change-Id: Iead3d4f854057c8e968d62928026b74c41bc1346
Signed-off-by: liamfallon <liam.fallon@est.tech>
4 years agoDeprecate old validation annotations 81/116681/1
Jim Hahn [Thu, 7 Jan 2021 15:03:30 +0000 (10:03 -0500)]
Deprecate old validation annotations

Removed @Items and @Entries validation annotations, as they are no
longer needed.

Issue-ID: POLICY-2648
Change-Id: I68b78738d520ad96175567572e3c2f4a845dae44
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoSupport annotations on parameterized types 35/116635/2
Jim Hahn [Wed, 6 Jan 2021 16:15:45 +0000 (11:15 -0500)]
Support annotations on parameterized types

It appears that java.validation allows validation annotations to be used
on the type parameters of Collection and Map classes.  Updated the
validation code to support that.  Once policy-models has been updated to
use this approach, the original @Items and @Entries annotations will be
deprecated.

Issue-ID: POLICY-2648
Change-Id: Ic953be485ebafc9869f72407518f6549585353c9
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoUpdate junits for Validation 76/116576/4
Jim Hahn [Mon, 4 Jan 2021 17:11:32 +0000 (12:11 -0500)]
Update junits for Validation

The Validation code was previously refactored.  Added/updated junits
correspondingly.

Issue-ID: POLICY-2648
Change-Id: I570c0ec692ecfcb6e69ada45f7997f6e63735ea0
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoMake validators extensible 89/116489/1
Jim Hahn [Fri, 18 Dec 2020 20:53:20 +0000 (15:53 -0500)]
Make validators extensible

Modified the validator to make it extensible.  Also added annotations
to:
- cascade a validation to a sub-object
- perform regex
- examine items in a list
- examine entries in a map

Still need more junit tests.

Issue-ID: POLICY-2648
Change-Id: I94f1b9e8fbf7a6b9b002d0b05cc9119bdfcf8bf2
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoConvert YAML Double to Integer/Long 47/116347/1
Jim Hahn [Mon, 14 Dec 2020 16:36:50 +0000 (11:36 -0500)]
Convert YAML Double to Integer/Long

When a YAML number is decoded directly to type Object.class using the
decode() or fromJson() methods of the StandardYamlCoder, the number is
left as a Double.  It should be converted to an Integer or Long, where
possible.

Issue-ID: POLICY-2900
Change-Id: I7707ac5c54167cbc3a4b23985c6e5fa1a507324e
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoFixing sonar issues in policy-common 24/116124/2
a.sreekumar [Fri, 4 Dec 2020 11:04:10 +0000 (11:04 +0000)]
Fixing sonar issues in policy-common

Change-Id: I4dce0dbdf71d01fbb59e9bf861d1af1ab49e5ae7
Issue-ID: POLICY-2914
Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
4 years agoGeneralize LocalDateTimeTypeAdapter 62/115562/1
Jim Hahn [Mon, 30 Nov 2020 19:34:29 +0000 (14:34 -0500)]
Generalize LocalDateTimeTypeAdapter

The GSON DateTime type adapter uses a hard-coded formatter.  Generalized
it to allow a different formatter to be provided to the constructor.

Issue-ID: POLICY-2903
Change-Id: Icdd51190f465bc4c73cd593d6d1b2003165a4b60
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoFix upcoming checkstyle issues 58/114658/1
Pamela Dragosh [Fri, 6 Nov 2020 13:14:51 +0000 (08:14 -0500)]
Fix upcoming checkstyle issues

When we upgrade to oparent, these will fail as oparent upgrades
to 8.37 of puppycrawl which fixes a few bugs that should have
flagged these previously.

Issue-ID: POLICY-2887
Change-Id: I5618ce67d84e94321f884ed6d929c05fc33a0b3d
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
4 years agoRemove server-side filtering from policy-endpoints 02/114502/1
Jim Hahn [Thu, 29 Oct 2020 20:07:19 +0000 (16:07 -0400)]
Remove server-side filtering from policy-endpoints

ONAP DMaaP Message Router no longer supports server-side filtering.
Removed it from policy-endpoints.

Issue-ID: POLICY-2881
Change-Id: I08157f7699608af63992dec78a61c5f9c55037b9
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoInclude jackson jar in policy-endpoints 13/114413/1
Jim Hahn [Thu, 29 Oct 2020 19:12:23 +0000 (15:12 -0400)]
Include jackson jar in policy-endpoints

Issue-ID: POLICY-2878
Change-Id: Ibfe4c220c7b15bb0b752537d080481350a1332e4
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoFix sonar security issue in CryptoUtils 74/114374/3
Jim Hahn [Wed, 28 Oct 2020 20:22:01 +0000 (16:22 -0400)]
Fix sonar security issue in CryptoUtils

Sonar reports that CryptoUtils is using AES with CBC, which is known
to be insecure.  Switched to "AES/GCM/NoPadding".
Note: values in any property files using encryption or the "enc:"
prefix will have to be re-encrypted.

Issue-ID: POLICY-2801
Change-Id: I41f00d4f3ee67a00b92135150120d1faa621655a
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoBump common master to 1.8.0 SNAPSHOT 85/114285/2
Jim Hahn [Tue, 27 Oct 2020 17:26:59 +0000 (13:26 -0400)]
Bump common master to 1.8.0 SNAPSHOT

Bumping minor version now that guilin branch has been created.

Issue-ID: POLICY-2875
Change-Id: Id812dfd1406f8567a17ce4037eaa8cf8e7e4be26
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoFix more sonars in policy/common 04/113404/1
Jim Hahn [Wed, 30 Sep 2020 21:31:34 +0000 (17:31 -0400)]
Fix more sonars in policy/common

Addressed the following sonar issues:
- extract common test methods

Issue-ID: POLICY-2650
Change-Id: I0b27c83d7bbe3d5fe83859b189c37507aabe7489
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoSkip sonar in common utils-test 90/113390/1
Jim Hahn [Wed, 30 Sep 2020 16:41:42 +0000 (12:41 -0400)]
Skip sonar in common utils-test

sonar.tests didn't work, so just switching to sonar.skip, because
utils-test is not used in production code.

Issue-ID: POLICY-2650
Change-Id: I67bf9abda724944e080bbbf3a9bdc108dbd629c8
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoNew sonars in policy-common 78/113278/2
Jim Hahn [Mon, 28 Sep 2020 18:37:44 +0000 (14:37 -0400)]
New sonars in policy-common

Addressed the following sonars:
- too many assertions in a test case
- use parameterized test method

Disabled production sonars for util-test, as the entire module is only
used for testing other modules.

Issue-ID: POLICY-2650-sonar
Change-Id: If49775a6c95855dcd9601ee0d833bb00741b1550
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoBump common to 1.7.2 84/112284/1
Jim Hahn [Tue, 8 Sep 2020 15:08:56 +0000 (11:08 -0400)]
Bump common to 1.7.2

Issue-ID: POLICY-2789
Change-Id: Ia29c63d215facba9796a9dabdd4e9ea6792a852a
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoRelease common 1.7.1 77/112277/2 7.0.0-ONAP
Jim Hahn [Tue, 8 Sep 2020 13:46:53 +0000 (09:46 -0400)]
Release common 1.7.1

Issue-ID: POLICY-2789
Change-Id: Ifbbf7eadca68892254acabcecbb3710a0de41aff
Signed-off-by: Jim Hahn <jrh3@att.com>
4 years agoAdding common success/failure messages for policy components 71/111271/3
a.sreekumar [Fri, 14 Aug 2020 10:24:10 +0000 (11:24 +0100)]
Adding common success/failure messages for policy components

Change-Id: Ic1b0a3b467fd9e4f65b2e12d9f6ed33e38e4f44d
Issue-ID: POLICY-2755
Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
4 years agoUpdate INFO.yaml in policy-common 70/110670/2
Jim Hahn [Tue, 28 Jul 2020 18:04:18 +0000 (14:04 -0400)]
Update INFO.yaml in policy-common

Verified with Jessica W that the "type" should still be "Addition",
even when updating the PTL.
Updated to Mature, per TSC.

Issue-ID: POLICY-2738
Change-Id: I9fd1adf4986edfe0b87b337a3e913608084da04d
Signed-off-by: Jim Hahn <jrh3@att.com>