policy/common.git
5 years agoPoint to released parent 28/107128/1
Pamela Dragosh [Tue, 5 May 2020 16:12:03 +0000 (12:12 -0400)]
Point to released parent

Issue-ID: POLICY-2514
Change-Id: I5de2239e78761d0e4433521054fa9e3cad5f5a99
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
5 years agoMerge "Logging enhancement work"
Pamela Dragosh [Tue, 28 Apr 2020 14:18:30 +0000 (14:18 +0000)]
Merge "Logging enhancement work"

5 years agoLogging enhancement work 61/106461/14
Joseph Chou [Wed, 22 Apr 2020 18:06:23 +0000 (14:06 -0400)]
Logging enhancement work

Update log tool to provide placeholder feature

Change-Id: I3f2b10d009a1d51f30a6080c07459eb0ac07189f
Issue-ID: POLICY-2478
Signed-off-by: Joseph Chou <jc2555@att.com>
5 years agoBump parent release version in common 88/106588/1
Jim Hahn [Fri, 24 Apr 2020 13:34:07 +0000 (09:34 -0400)]
Bump parent release version in common

Issue-ID: POLICY-2521
Change-Id: I27ca8ba624ce91a249be175b61d50f7ace5256da
Signed-off-by: Jim Hahn <jrh3@att.com>
5 years agoBump common to 1.6.5-SNAPSHOT 26/105926/1
Ram Krishna Verma [Tue, 14 Apr 2020 16:39:27 +0000 (12:39 -0400)]
Bump common to 1.6.5-SNAPSHOT

Issue-ID: POLICY-2378
Change-Id: I0012a2cd7acbb9d634b1fc7226992b873142016a
Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
5 years agoRelease common 1.6.4 16/105916/1
Ram Krishna Verma [Tue, 14 Apr 2020 14:51:55 +0000 (10:51 -0400)]
Release common 1.6.4

Issue-ID: POLICY-2378
Change-Id: Id54e49ffded160a4df3540ed6adf3961ba6b9def
Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
5 years agoFix handling of number fields Yaml 56/105856/1
Jim Hahn [Mon, 13 Apr 2020 17:03:08 +0000 (13:03 -0400)]
Fix handling of number fields Yaml

This fix also impacts StandardCoder, allowing Map.class to be used
as the target type instead of requiring LinkedHashMap.class.

Note: still doesn't do any translation if Object.class is used, as
there is no way to override GSON's handler for the Object type.

Issue-ID: POLICY-2488
Change-Id: Ia7cd0c85dc5a2a9e93360fa1c8397531b8503f2d
Signed-off-by: Jim Hahn <jrh3@att.com>
5 years agoBump common to 1.6.4-SNAPSHOT 99/105799/1
Pamela Dragosh [Fri, 10 Apr 2020 18:48:07 +0000 (14:48 -0400)]
Bump common to 1.6.4-SNAPSHOT

Issue-ID: POLICY-2378
Change-Id: Ib3afcf81460f42e1a62d51a484184763d61dace6
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
5 years agoRelease common 1.6.3 73/105773/1
Pamela Dragosh [Fri, 10 Apr 2020 17:17:42 +0000 (13:17 -0400)]
Release common 1.6.3

Issue-ID: POLICY-2378
Change-Id: I708035d5e1ba13150d51a7bf6317ce43b313419e
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
5 years agoMerge "Update common-logging for log enhancement work"
Pamela Dragosh [Fri, 10 Apr 2020 16:49:36 +0000 (16:49 +0000)]
Merge "Update common-logging for log enhancement work"

5 years agoUpdate common-logging for log enhancement work 68/105568/5
Joseph Chou [Wed, 8 Apr 2020 21:45:38 +0000 (17:45 -0400)]
Update common-logging for log enhancement work

Resolve missing error code, add marker/mdc for audit/metrics

Change-Id: I490b17aac86f3b63df43e267a5dbe1d1588e5fdf
Issue-ID: POLICY-2478
Signed-off-by: Joseph Chou <jc2555@att.com>
5 years agoPoint to released parent 3.1.2 67/105767/1
Pamela Dragosh [Fri, 10 Apr 2020 15:20:05 +0000 (11:20 -0400)]
Point to released parent 3.1.2

Issue-ID: POLICY-2378
Change-Id: If1ac42ecc4465321d0392610bf0d1c94ccb22dd7
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
5 years agorename jpa persistence file 13/105713/1
jhh [Thu, 9 Apr 2020 18:31:38 +0000 (13:31 -0500)]
rename jpa persistence file

After inspecting the fat jar generated by brmsgw, noticed that
the persistence.xml included from here it was overriden by another
one, therefore the persistence unit was not available.   This
may solve the issue for the brmsgw, as with a far jar build, there
are the risks of collisions such as this of files with the same
name.

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

5 years agoUpdate licenses on sonar fixes in common 50/105250/1
Jim Hahn [Tue, 7 Apr 2020 12:35:36 +0000 (08:35 -0400)]
Update licenses on sonar fixes in common

Forgot to update licenses on some of the files that were modified
as part of addressing sonar issues.  Updated.

Issue-ID: POLICY-2305
Change-Id: I9858bfb54be5b8eb42406e944361ec100ae238ff
Signed-off-by: Jim Hahn <jrh3@att.com>
5 years agoMerge "More sonar issues in common"
Jim Hahn [Mon, 6 Apr 2020 19:12:11 +0000 (19:12 +0000)]
Merge "More sonar issues in common"

5 years agoAddress sonar issues in ONAP-logging 70/105170/1
Jim Hahn [Mon, 6 Apr 2020 16:17:11 +0000 (12:17 -0400)]
Address sonar issues in ONAP-logging

Addressed the following sonar issues in ONAP-logging:
- use Map instead of ConcurrentHashMap
- remove unusued fields
- use Map.computeIfAbsent() instead of get()/put() pair
- readObject is unsafe
- use try-with-resources
- junit should assert something

Also removed some unused imports.

Issue-ID: POLICY-2305
Signed-off-by: Jim Hahn <jrh3@att.com>
Change-Id: I3480a55da4d0e771f8083c97770a6c9707d871f7
Signed-off-by: Jim Hahn <jrh3@att.com>
5 years agoMore sonar issues in common 64/105164/2
Jim Hahn [Mon, 6 Apr 2020 15:26:13 +0000 (11:26 -0400)]
More sonar issues in common

Fixed additional sonar issues:
- infinit loop; while the issue is bogus, it was easy enough to
  modify the code to satisfy sonar
- doesn't like "volatile"; again, the issue is bogus, but easy enough
  to modify the code

Disabled a couple of sonars in NetworkUtil, as they are not actually
an issue.

Issue-ID: POLICY-2305
Change-Id: I5500183e3fe4060696994cff55bdae4ba7e138c7
Signed-off-by: Jim Hahn <jrh3@att.com>
5 years agoAddress sonar issues in common 10/105110/3
Jim Hahn [Fri, 3 Apr 2020 13:44:26 +0000 (09:44 -0400)]
Address sonar issues in common

Addressed the following sonar issues:
- missing assertion in junit test case
- disable sonars about setAccessible() as it's required for jackson
  emulation
- sleep in junit
- don't use wild-cards (e.g., "*") with java.util Pattern
  - use re2j instead of java.util Pattern
  - use String methods (e.g., startsWith())
- duplicate method bodies
- duplicate code in Coder classes
- string concatenation in logger calls
- UTF-8 encoding
- return primitive instead of boxed primitive
- add assertion to tests
  - renamed support methods from doTestXxx to verifyXxx
- cognitive complexity
- use AtomicRef instead of volatile
- use specific Functionals (e.g., IntConsumer)
- function always returns the same value
- serializable vs transient

Issue-ID: POLICY-2305
Change-Id: I08eb7aa495a80bdc1d26827ba17a7946c83b9828
Signed-off-by: Jim Hahn <jrh3@att.com>
5 years agoMore sonar issues cleanup 56/104556/2
Pamela Dragosh [Fri, 27 Mar 2020 12:03:24 +0000 (08:03 -0400)]
More sonar issues cleanup

Either log or rethrow
Use boolean expression
Add at least one test
Remove commented out code

Issue-ID: POLICY-2204
Change-Id: I4fdf31aea75303e4f49d25198eb3b12341995bfe
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
5 years agoSonar and eclipse warnings common 12/104312/1
Pamela Dragosh [Tue, 24 Mar 2020 21:13:24 +0000 (17:13 -0400)]
Sonar and eclipse warnings common

Unused imports
Not enough arguments

Issue-ID: POLICY-2204
Change-Id: I6405cb697ea976096b1276e2291b1c73617d33b5
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
5 years agoBump common to 1.6.3-SNAPSHOT 47/104047/1
Pamela Dragosh [Fri, 20 Mar 2020 11:35:03 +0000 (07:35 -0400)]
Bump common to 1.6.3-SNAPSHOT

Released 1.6.2

Issue-ID: POLICY-2378
Change-Id: I12c93a88af2b00c25d457ff9aa9e50c1845e004c
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
5 years agoRelease policy/common 1.6.2 16/104016/1
Pamela Dragosh [Thu, 19 Mar 2020 22:14:48 +0000 (18:14 -0400)]
Release policy/common 1.6.2

Issue-ID: POLICY-2378
Change-Id: I0b35e462f3ecbd193680548e94e65a2c438a5a9a
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
5 years agoPoint to policy/parent 3.1.1 08/104008/1
Pamela Dragosh [Thu, 19 Mar 2020 20:10:54 +0000 (16:10 -0400)]
Point to policy/parent 3.1.1

Issue-ID: POLICY-2378
Change-Id: Id362530ff1947220827adfc9428ff7453190876e
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
5 years agoMove code from drools-apps to common 36/103636/1
Jim Hahn [Thu, 12 Mar 2020 19:49:01 +0000 (15:49 -0400)]
Move code from drools-apps to common

Extracted code from ControlLoopUtils to create a new class in
common, PropertyObjectUtils.
Fixed a deprecated method invocation in a junit.
Fixed an object casting (i.e., sonar) issue in SCO.

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

5 years agoSONAR: Resolving server hostnames should be verified 66/103066/1
Chris Ramstad [Wed, 4 Mar 2020 21:10:18 +0000 (13:10 -0800)]
SONAR: Resolving server hostnames should be verified

Per Jorge Hernandez, we don't want to fix this as
it falls under the selfSignedCert clause which is
used in testing and non-production environments.

Marking as //NOSONAR

Issue-ID: POLICY-2389
Signed-off-by: Chris Ramstad <cramstad@ciena.com>
Change-Id: Iaf47e19dc8450607b1dc3aa260370e9c0d7d491d

5 years agoAdd gson adapters for special field types 90/102890/4
Jim Hahn [Tue, 3 Mar 2020 16:55:02 +0000 (11:55 -0500)]
Add gson adapters for special field types

Added type adapters for Instant, LocalDateTime, and ZonedDateTime.  UUID
seems to work already.
Added new Coder that offers an alternative encoding for Instant.

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

5 years agoMerge "Add JettyStaticResourceServer to policy-endpoints"
Ram Krishna Verma [Tue, 3 Mar 2020 15:10:50 +0000 (15:10 +0000)]
Merge "Add JettyStaticResourceServer to policy-endpoints"

5 years agoMerge "Use policy/parent awaitility"
Jim Hahn [Tue, 3 Mar 2020 15:00:09 +0000 (15:00 +0000)]
Merge "Use policy/parent awaitility"

5 years agoMerge "BidirectionalTopic should use plain TopicSink"
Jim Hahn [Tue, 3 Mar 2020 14:57:45 +0000 (14:57 +0000)]
Merge "BidirectionalTopic should use plain TopicSink"

5 years agoUse policy/parent awaitility 57/102857/1
Pamela Dragosh [Tue, 3 Mar 2020 13:28:36 +0000 (08:28 -0500)]
Use policy/parent awaitility

Consolidate to what is in policy/parent - this upgrades
the version.

Issue-ID: POLICY-2381
Change-Id: Ibf18fb131c7fc694215a5d34d734392e722f5970
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
5 years agoBidirectionalTopic should use plain TopicSink 07/102807/1
Jim Hahn [Tue, 3 Mar 2020 04:43:06 +0000 (23:43 -0500)]
BidirectionalTopic should use plain TopicSink

BidirectionalTopicClient use plain TopicSink instead of
TopicSinkClient, because the latter encodes its message, while
BidirectionalTopicClient should not, because encoding should
be left up to the user of the class.

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

5 years agoProvide access to HttpClient's WebTarget 92/102792/2
Jim Hahn [Tue, 3 Mar 2020 00:13:16 +0000 (19:13 -0500)]
Provide access to HttpClient's WebTarget

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

5 years agoAdd JettyStaticResourceServer to policy-endpoints 53/102653/3
Hengye [Sat, 29 Feb 2020 12:39:45 +0000 (20:39 +0800)]
Add JettyStaticResourceServer to policy-endpoints

Using DefaultServlet to manage static resources
on Jetty Server.

Issue-ID: POLICY-2311
Signed-off-by: Hengye <yehui.wang@est.tech>
Change-Id: Ife0eda06334eb0b6350110254945975050181f20

5 years agoAdding DefaultServlet to support static resources 83/102283/4
Hengye [Tue, 25 Feb 2020 02:43:40 +0000 (10:43 +0800)]
Adding DefaultServlet to support static resources

Adding DefaultServlet to make embeded jetty not only
support Jersey, but also support static resources, like
html, css and js.

Issue-ID: POLICY-2311
Signed-off-by: Hengye <yehui.wang@est.tech>
Change-Id: I71309036627d75dcc56947b395688a4e2f22c0ce

5 years agoFixes to support dependency upgrade 29/102229/3
Pamela Dragosh [Mon, 24 Feb 2020 12:38:20 +0000 (07:38 -0500)]
Fixes to support dependency upgrade

Uped the time for Thread.sleep due to new http core dependency. It
seems to randomly timeout inconsistently due to that upgrade.

Google gson seems to have changed its layout. Did not see any
problems with the other repos.

Issue-ID: POLICY-2381
Change-Id: Id2a9bfffd42a2c713af042bd2a8cc4abafba2d9f
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
5 years agoAdd convert() to Coder 47/101847/1
Jim Hahn [Mon, 17 Feb 2020 18:21:08 +0000 (13:21 -0500)]
Add convert() to Coder

This addresses Liam's review comment about moving the "translate"
method from the actor Util class into policy-common.
Added a method to Coder to convert from one object type to
another (e.g., from a Map to a POJO, or vice versa).

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

5 years agoMerge "Allow storing REST servers password and userName in environment variables"
Jim Hahn [Mon, 17 Feb 2020 17:00:55 +0000 (17:00 +0000)]
Merge "Allow storing REST servers password and userName in environment variables"

5 years agoAllow storing REST servers password and userName in environment variables 37/101837/2
Dominik Mizyn [Mon, 17 Feb 2020 14:23:43 +0000 (15:23 +0100)]
Allow storing REST servers password and userName in environment variables

This patch allows to store and get REST servers password and userName from
environment variables. This is needed if we want to send those
variables by helm secrets.

Issue-ID: OOM-2287
Change-Id: I4d6a8bf188a0d17e5444137d871dd341627ec397
Signed-off-by: Dominik Mizyn <d.mizyn@samsung.com>
5 years agoAdd PseudoExecutor to utils-test 65/101765/2
Jim Hahn [Fri, 14 Feb 2020 21:29:11 +0000 (16:29 -0500)]
Add PseudoExecutor to utils-test

Moved MyExec from actors package to policy-common/utils-test,
renaming it to PseudoExecutor.

Updated per review comment(s):
- declare "task" of type "Queue" instead of "LinkedList"

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

5 years agoAdded BidirectionalTopicClient to policy-common 52/101752/3
Jim Hahn [Fri, 14 Feb 2020 16:15:13 +0000 (11:15 -0500)]
Added BidirectionalTopicClient to policy-common

Added review comments:
- check for too many topic sources

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

5 years agoMerge "Add headers to asynchronous get in HttpClient"
Ram Krishna Verma [Mon, 10 Feb 2020 15:58:04 +0000 (15:58 +0000)]
Merge "Add headers to asynchronous get in HttpClient"

5 years agoAdd enhancements to standard coder 26/101426/3
Jim Hahn [Sat, 8 Feb 2020 18:02:02 +0000 (13:02 -0500)]
Add enhancements to standard coder

Added support for array indices in StandardCoderObject getString().
Also made it Serializable.

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

5 years agoAdd headers to asynchronous get in HttpClient 27/101427/1
Jim Hahn [Sat, 8 Feb 2020 19:16:15 +0000 (14:16 -0500)]
Add headers to asynchronous get in HttpClient

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

5 years agoMerge "Fix ResourceUtilsTest junit"
Pamela Dragosh [Mon, 3 Feb 2020 12:23:15 +0000 (12:23 +0000)]
Merge "Fix ResourceUtilsTest junit"

5 years agoMerge "Add pretty() method to Coder"
Pamela Dragosh [Mon, 3 Feb 2020 12:22:59 +0000 (12:22 +0000)]
Merge "Add pretty() method to Coder"

5 years agoAdd pretty() method to Coder 87/100987/3
Jim Hahn [Fri, 31 Jan 2020 16:15:44 +0000 (11:15 -0500)]
Add pretty() method to Coder

"Pretty" JSON is often needed, so added Coder.pretty() to facilitate
that.
Incorporated review comment(s):
- changed pretty() to encode(object, pretty)

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

5 years agoFix ResourceUtilsTest junit 88/100988/1
Jim Hahn [Fri, 31 Jan 2020 17:03:08 +0000 (12:03 -0500)]
Fix ResourceUtilsTest junit

The junit for ResourceUtilsTest fails when run on a non-linux box due
to the different path separator.  Modified the test to normalize path
names before making comparisons.

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

5 years agoAdd async support to HttpClient 79/100979/2
Jim Hahn [Fri, 31 Jan 2020 14:42:04 +0000 (09:42 -0500)]
Add async support to HttpClient

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

5 years agoAdd Configurable to common/capabilities 67/100967/1
Jim Hahn [Fri, 31 Jan 2020 00:15:01 +0000 (19:15 -0500)]
Add Configurable to common/capabilities

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

5 years agoMerge "Add a bean validator"
Pamela Dragosh [Thu, 30 Jan 2020 15:38:57 +0000 (15:38 +0000)]
Merge "Add a bean validator"

5 years agoAdd a bean validator 23/100923/3
Jim Hahn [Thu, 30 Jan 2020 05:11:26 +0000 (00:11 -0500)]
Add a bean validator

Added a bean validator that will validate the fields within an arbitrary
object using the annotations in the parameters package.
Also added validateMap to the bean validators.

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

5 years agoConvert double to int when decoding JSON 19/100919/2
Jim Hahn [Wed, 29 Jan 2020 22:21:24 +0000 (17:21 -0500)]
Convert double to int when decoding JSON

When decoding straight into a List or Map class, StandardCoder was not
applying the double-to-int conversion.  Fixed it.

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

5 years agoSchema validation extension to StandardCoder 14/100814/6
jhh [Mon, 27 Jan 2020 12:45:07 +0000 (06:45 -0600)]
Schema validation extension to StandardCoder

Issue-ID: POLICY-2331
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Change-Id: Ic3e8d21715d17a61ea5d07740dd9f4dd0dbb8641
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
5 years agoMerge "Create path to text file being created"
Liam Fallon [Thu, 23 Jan 2020 13:35:07 +0000 (13:35 +0000)]
Merge "Create path to text file being created"

5 years agoCreate path to text file being created 17/100617/1
liamfallon [Wed, 22 Jan 2020 17:51:26 +0000 (17:51 +0000)]
Create path to text file being created

If you try and write to a file where part of the pat does not exist,
that path should be created.

Issue-ID: POLICY-1581
Change-Id: Ifb7a4ff4e1804814b6679956f0c58d5ac026c4a4
Signed-off-by: liamfallon <liam.fallon@est.tech>
5 years agoReplace deprecated Nashorn javascript engine 19/100519/2
Jim Hahn [Mon, 20 Jan 2020 22:39:32 +0000 (17:39 -0500)]
Replace deprecated Nashorn javascript engine

Some test drivers use javascript to evaluate expected results.
In java 8, the standard javascript engine was Nashorn, but that has
been deprecated.  As the test scripts use a simple xxx.yyy.zzz notation,
decided to go with a small expression language, Apache JEXL, instead.

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

5 years agoSonar cleanup overrides and fixes 90/100290/2
Pamela Dragosh [Tue, 14 Jan 2020 18:51:12 +0000 (13:51 -0500)]
Sonar cleanup overrides and fixes

Removal of UTF-8 because its already set
capabilities doesn't generate any code, no need to include
override false positives for passwords etc.
override for logging and exception throw that we want
add synchronized to overrides that are synchronized
ignore checking of some conditions
adding synchronized to match set* methods

Issue-ID: POLICY-2321
Change-Id: I26d9ca22a0cdd67fdaae9c44b718b8dc103f190e
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
5 years agoMerge "Changed Matchers to ArgumentMatchers"
Pamela Dragosh [Tue, 14 Jan 2020 12:35:41 +0000 (12:35 +0000)]
Merge "Changed Matchers to ArgumentMatchers"

5 years agoAdd method to return resource directory contents 14/100214/4
liamfallon [Fri, 10 Jan 2020 20:27:22 +0000 (20:27 +0000)]
Add method to return resource directory contents

In order to avoid hard coding the policy types and policies that are in
the example directories into unit test cases, and in order to
automatically pick up added and removed policy types and policies, it
would be good to read the contents of resource directories at run time
in unit tests. This change brings in that functionality into
ResourceUtils.

Issue-ID: POLICY-2315
Change-Id: I601718828aad0f065dbbaa1f5af8d0a0f133f44d
Signed-off-by: liamfallon <liam.fallon@est.tech>
5 years agoChanged Matchers to ArgumentMatchers 27/100227/2
Jim Hahn [Fri, 10 Jan 2020 22:20:07 +0000 (17:20 -0500)]
Changed Matchers to ArgumentMatchers

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

5 years agoMerge "Update sonar configuration"
Ram Krishna Verma [Mon, 13 Jan 2020 12:56:55 +0000 (12:56 +0000)]
Merge "Update sonar configuration"

5 years agoMerge "Address items deprecated by move to java 11"
Ram Krishna Verma [Mon, 13 Jan 2020 12:55:56 +0000 (12:55 +0000)]
Merge "Address items deprecated by move to java 11"

5 years agoFix mockito import in common 26/100226/2
Jim Hahn [Fri, 10 Jan 2020 21:59:48 +0000 (16:59 -0500)]
Fix mockito import in common

ONAP-Logging was failing when using powermock-mockito2.
This change also requires a property (version.javax.bind) to be
added to the parent/integration pom.

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

5 years agoUpdate sonar configuration 69/100169/3
Pamela Dragosh [Fri, 10 Jan 2020 01:26:46 +0000 (20:26 -0500)]
Update sonar configuration

Sonarcloud upgrade resulted in new configuration property
Removed deprecated properties
No need for plugin configuration override of oparent

Issue-ID: POLICY-2321
Change-Id: Ia294575d2ea0a589eab6797b48b8c1924f9f1b36
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
5 years agoAddress items deprecated by move to java 11 08/100208/4
Jim Hahn [Fri, 10 Jan 2020 16:30:21 +0000 (11:30 -0500)]
Address items deprecated by move to java 11

Addressed the following deprecated items:
- "new Integer(xxx)"
- Observable/Observer
- Mockito.anyObject()

Added assertion to a junit test to address a sonar issue.

Did not address deprecated Nashorn javascript interpreter; that will be
done in a separate review.

Updated licenses.

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

5 years agopolicy/common jdk11 upgrades 42/100142/1
HOCKLA [Thu, 9 Jan 2020 17:48:49 +0000 (11:48 -0600)]
policy/common jdk11 upgrades

Issue-ID: POLICY-1583
Change-Id: I6bcd320a6cdedd84dad9b54fdb4fec0cb8443b44
Signed-off-by: HOCKLA <ah999m@att.com>
5 years agoUpdate policy common for checkstyle 8 51/99651/2
liamfallon [Thu, 12 Dec 2019 14:11:28 +0000 (14:11 +0000)]
Update policy common for checkstyle 8

Minor changes to clear down checkstyle warnings in policy common.

Issue-ID: POLICY-206
Change-Id: Ifa6753bafdc4b2a9ee0725c4f3751c6eac03e096
Signed-off-by: liamfallon <liam.fallon@est.tech>
5 years agoAdded JDK 11 upgrades and point to parent java 11 branch 02/99502/3
HOCKLA [Wed, 11 Dec 2019 16:24:44 +0000 (10:24 -0600)]
Added JDK 11 upgrades and point to parent java 11 branch

Issue-ID: POLICY-1583
Change-Id: Ic46ffcb6eb5b0d18f9cb0a6a2ec46374e523f54a
Signed-off-by: HOCKLA <ah999m@att.com>
5 years agoMerge "Minor changes for new Eclipse checkstyle checks"
Pamela Dragosh [Fri, 6 Dec 2019 21:47:40 +0000 (21:47 +0000)]
Merge "Minor changes for new Eclipse checkstyle checks"

5 years agoBumped policy/common patch version to 1.6.2-SNAPSHOT 78/99278/2
HOCKLA [Fri, 6 Dec 2019 20:29:46 +0000 (14:29 -0600)]
Bumped policy/common patch version to 1.6.2-SNAPSHOT

Issue-ID: POLICY-1583
Change-Id: I4a1c5848f158d10b4b6f21f048f92d69ccc90a83
Signed-off-by: HOCKLA <ah999m@att.com>
5 years agoRelease 1.6.1 policy/common 69/99269/1
HOCKLA [Fri, 6 Dec 2019 17:16:11 +0000 (11:16 -0600)]
Release 1.6.1 policy/common

This is a re-release, previous release wasn't pointing to
an already installed release

Issue-ID: POLICY-1583
Change-Id: I613dd5a78b439b60455be58b476204e422ebbf02
Signed-off-by: HOCKLA <ah999m@att.com>
5 years agoPoint to 3.1.0 policy/parent to prep for re-release 67/99267/1
HOCKLA [Fri, 6 Dec 2019 15:56:15 +0000 (09:56 -0600)]
Point to 3.1.0 policy/parent to prep for re-release

Issue-ID: POLICY-1583
Change-Id: I1c65a4478d1121b863d29388bd3a7047d92ff5ea
Signed-off-by: HOCKLA <ah999m@att.com>
5 years agoMinor changes for new Eclipse checkstyle checks 33/99133/7
liamfallon [Wed, 4 Dec 2019 10:24:58 +0000 (10:24 +0000)]
Minor changes for new Eclipse checkstyle checks

The laest Eclipse checkstyle version 8.26.0 does more thorough checking
and identified a number of small issues in the apex-pdp codebase. This
review fixes those issues.

logging pattern in logback.xml files amended to be less than 120
characters. Test case added for checking parameter is valid.

Issue-ID: POLICY-2204
Change-Id: Id7293e44b56c225afc6290e1c599603e9ebedb19
Signed-off-by: liamfallon <liam.fallon@est.tech>
5 years agoChanged project version to 1.6.1-SNAPSHOT to isolate for java 11 upgrades 07/99207/1
HOCKLA [Thu, 5 Dec 2019 13:25:42 +0000 (07:25 -0600)]
Changed project version to 1.6.1-SNAPSHOT to isolate for java 11 upgrades

Issue-ID: POLICY-1583
Change-Id: I805ebed75e7e0cb5109946328958341018421aad
Signed-off-by: HOCKLA <ah999m@att.com>
5 years agoAdded a yaml file to release 1.6.0 policy/common 50/99150/2
HOCKLA [Wed, 4 Dec 2019 14:53:28 +0000 (08:53 -0600)]
Added a yaml file to release 1.6.0 policy/common

Issue-ID: POLICY-1583
Change-Id: I20b608a6674a4496e5aa20fa3c26da2a275a289d
Signed-off-by: HOCKLA <ah999m@att.com>
5 years agoMake jersey-hk2 dependency non-test 13/97913/1
liamfallon [Mon, 4 Nov 2019 14:30:14 +0000 (14:30 +0000)]
Make jersey-hk2 dependency non-test

THis change will amke this dependency available to all components when
using policy-endopints.

Issue-ID: POLICY-2209
Change-Id: Ie3c6ca9d21327bdc54b5f14d64c41eed329941ad
Signed-off-by: liamfallon <liam.fallon@est.tech>
5 years agoAdd common Jersey version 44/97844/2
liamfallon [Fri, 1 Nov 2019 11:21:54 +0000 (11:21 +0000)]
Add common Jersey version

Add a common version of Jersey for all Policy Framework components.

Issue-ID: POLICY-2209
Change-Id: I8554a97e9f13887418118966bfe1043b65d9a179
Signed-off-by: liamfallon <liam.fallon@est.tech>
5 years agoFix new sonar issues in common 04/97704/2
Jim Hahn [Tue, 29 Oct 2019 19:02:25 +0000 (15:02 -0400)]
Fix new sonar issues in common

Issue-ID: POLICY-2204
Signed-off-by: Jim Hahn <jrh3@att.com>
Change-Id: If0a11913f614e038ecd3e8c3f0b56d3ac78b03ec
Signed-off-by: Jim Hahn <jrh3@att.com>
5 years agoMerge "Cleanup eclipse warnings in common"
Jorge Hernandez [Tue, 29 Oct 2019 17:45:34 +0000 (17:45 +0000)]
Merge "Cleanup eclipse warnings in common"

5 years agoCleanup eclipse warnings in common 97/97697/1
Jim Hahn [Tue, 29 Oct 2019 16:44:35 +0000 (12:44 -0400)]
Cleanup eclipse warnings in common

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

5 years agoDisable HTML escaping in gson coders 77/97677/2
Jim Hahn [Tue, 29 Oct 2019 13:47:44 +0000 (09:47 -0400)]
Disable HTML escaping in gson coders

Issue-ID: POLICY-1869
Signed-off-by: Jim Hahn <jrh3@att.com>
Change-Id: Ic757d3a8e7e0e3537ecba979a919b9ea3c1aa797
Signed-off-by: Jim Hahn <jrh3@att.com>
5 years agoIntegrate CryptoUtils into ONAP common 23/97423/6
Chou, Joseph (jc2555) [Tue, 22 Oct 2019 13:47:21 +0000 (09:47 -0400)]
Integrate CryptoUtils into ONAP common

Update junit to add test cases

Change-Id: If3236853138a05faac5f51a859b935265c14f0d6
Issue-ID: POLICY-1945
Signed-off-by: Chou, Joseph (jc2555) <jc2555@att.com>
5 years agoAdd CryptoCoder interface 78/97378/3
jhh [Mon, 21 Oct 2019 14:08:11 +0000 (09:08 -0500)]
Add CryptoCoder interface

This is to allow multiple supporting implementations.

Issue-ID: POLICY-1945
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Change-Id: I42491e5671f561fe320f034bf8ffe03848dff43f
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
5 years agoRemoved unthrown checked exceptions from CryptoUtils. 28/97228/1
jhh [Thu, 17 Oct 2019 02:25:57 +0000 (21:25 -0500)]
Removed unthrown checked exceptions from CryptoUtils.

additional minor javadoc clean up

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

5 years agoEliminate constructors with side-effects 55/95755/1
Jim Hahn [Mon, 16 Sep 2019 15:38:20 +0000 (11:38 -0400)]
Eliminate constructors with side-effects

Several of the Gson and Jackson handlers take a GsonBuilder, which
they then configure with additional adapters prior to create a Gson
object that they subsequently use.  The code has been modified so
that the constructors no longer take a GsonBuilder, thus eliminating
the side-effects that they had on the builders.  Instead, a
configBuilder() method has been added to the handler classes that
makes it clear tht they modify the GsonBuilder.

This also has the advantage that classes that want a Gson object
configured per a given handler need only call that handler's
configBuilder() method; previously, they had to constructor the
handler and then retrieve its gson object.

Also updated a few tests to specify the HTTP "Accept" header to ensure
that return results are in yaml format.

Change-Id: I2ef98198041ff9f73913d01ee6ee14ecf20ba617
Issue-ID: POLICY-2081
Signed-off-by: Jim Hahn <jrh3@att.com>
5 years agoExtract YamlJsonTranslator from StandardYamlCoder 82/95682/2
Jim Hahn [Fri, 13 Sep 2019 16:14:25 +0000 (12:14 -0400)]
Extract YamlJsonTranslator from StandardYamlCoder

Refactored StandardYamlCoder, extracting a new class, YamlJsonTranslator,
from it.  This facilitates performing yaml translation when not using a
standard "gson" coder.
Added YamlJacksonHandler which supports YAML translation layered on
top of a JacksonHandler instead of a GsonMessageBodyHandler.
Also added junit tests to complete coverage of StandardCoder.
Also added public APPLICATION_YAML to YamlMessageBodyHandler.

Change-Id: Ia470fa194661fbf1aebeaf0f18b57f2a984cb64b
Issue-ID: POLICY-2081
Signed-off-by: Jim Hahn <jrh3@att.com>
5 years agoMerge "Changes to accomodate to version of jetty"
Jorge Hernandez [Fri, 13 Sep 2019 19:07:53 +0000 (19:07 +0000)]
Merge "Changes to accomodate to version of jetty"

5 years agoMerge "Remove YamlException class"
Jim Hahn [Fri, 13 Sep 2019 15:36:48 +0000 (15:36 +0000)]
Merge "Remove YamlException class"

5 years agoChanges to accomodate to version of jetty 41/95641/1
Jim Hahn [Tue, 10 Sep 2019 17:48:31 +0000 (13:48 -0400)]
Changes to accomodate to version of jetty

With a newer version of jetty being used, a couple of methods have
been deprecated.  Modified the code to use the facilities appropriate
to the new jetty version.

Change-Id: Idcaef11836841480c24b1721c06ed642d3d4394a
Issue-ID: POLICY-2100
Signed-off-by: Jim Hahn <jrh3@att.com>
5 years agoReport bad-request for invalid YAML 23/95623/2
Jim Hahn [Thu, 12 Sep 2019 21:29:49 +0000 (17:29 -0400)]
Report bad-request for invalid YAML

Added classes and modified code to report bad-request when a servlet
attempts to read invalid YAML.

Change-Id: Iacddee92a448fb69d5c778a3c3f3f2b5528983f7
Issue-ID: POLICY-2085
Signed-off-by: Jim Hahn <jrh3@att.com>
5 years agoRemove YamlException class 01/95601/1
Jim Hahn [Thu, 12 Sep 2019 18:25:45 +0000 (14:25 -0400)]
Remove YamlException class

After the implementation was finalized, it turned out that YamlException
was no longer needed, so it has been deleted.

Change-Id: Ie895fc096787f05eff36a6127b08247a7664ff8d
Issue-ID: POLICY-2065
Signed-off-by: Jim Hahn <jrh3@att.com>
5 years agoCreate StandardYamlCoder 80/95280/5
Jim Hahn [Mon, 9 Sep 2019 20:51:32 +0000 (16:51 -0400)]
Create StandardYamlCoder

Created StandardYamlCoder which is like a StandardCoder, except that
the original converts to/from JSON, while the new class converts to/from
YAML.  Also added YamlMessageBodyHandler and incorporated it into the
http server so that it supports a media type of */yaml.

Change-Id: Ibd83a9f6d355a330f63e435f2bb41affcf1947c2
Issue-ID: POLICY-2065
Signed-off-by: Jim Hahn <jrh3@att.com>
5 years agoUpdate default branch in common for master 82/95382/1
Jim Hahn [Tue, 10 Sep 2019 14:43:11 +0000 (10:43 -0400)]
Update default branch in common for master

Change-Id: I7ddce7f583575adc11db4f9cc102d474a827d488
Issue-ID: POLICY-2045
Signed-off-by: Jim Hahn <jrh3@att.com>
5 years agoBump version in policy/common master 75/95075/2
Jim Hahn [Thu, 5 Sep 2019 18:23:30 +0000 (14:23 -0400)]
Bump version in policy/common master

Change-Id: If86cac60ee143b1d8ae92fd3893ea33a0d3e1b81
Issue-ID: POLICY-2045
Signed-off-by: Jim Hahn <jrh3@att.com>
5 years agoUpgrade to released parent 3.0.1 34/95034/1
Pamela Dragosh [Thu, 5 Sep 2019 12:57:24 +0000 (08:57 -0400)]
Upgrade to released parent 3.0.1

Released

Issue-ID: POLICY-2045
Change-Id: I82bf30780064ddaf26fdc6ed96a78653b1af1797
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
5 years agoRemove AlertSeverity from logback in policy/common 68/94368/2
Jim Hahn [Tue, 27 Aug 2019 18:13:25 +0000 (14:13 -0400)]
Remove AlertSeverity from logback in policy/common

Replaced AlertSeverity with severity in logback xml files, because
the MDC only has severity.

Change-Id: I118b195b65555c915c723faf117c4f4854e990f3
Issue-ID: POLICY-1989
Signed-off-by: Jim Hahn <jrh3@att.com>
5 years agoRest servers should return 400 for bad syntax JSON 45/94245/2
Jim Hahn [Fri, 23 Aug 2019 22:35:40 +0000 (18:35 -0400)]
Rest servers should return 400 for bad syntax JSON

Modified common RestServer to inject an exception handler
into the list of providers so that it returns 400 instead
of 500 for JSON parsing errors.

Change-Id: I7c77625e3531e26413d72cc386296a709946cda2
Issue-ID: POLICY-1725
Signed-off-by: Jim Hahn <jrh3@att.com>
5 years agoEnhance TestTimeMulti 92/93892/6
Jim Hahn [Mon, 19 Aug 2019 21:32:09 +0000 (17:32 -0400)]
Enhance TestTimeMulti

Enhance TestTimeMulti to support execution of tasks, whether
submitted via Timers or via Executors.

Change-Id: Ib5f216730b3b69028e9581052645370b827cd446
Issue-ID: POLICY-1968
Signed-off-by: Jim Hahn <jrh3@att.com>
5 years agoAdd ApiUtils to facilitate looping over features 12/93512/2
Jim Hahn [Tue, 6 Aug 2019 16:17:29 +0000 (12:17 -0400)]
Add ApiUtils to facilitate looping over features

A number of places in the code (common & drools-pdp) loop over
features, giving each provider a chance to act on something.
Created a common method in a new ApiUtils class to faciliate
it.
Renamed to FeatureApiUtils per review comment.

Change-Id: I0c2cf0f33854cb5b6921b394f64de498a6234909
Issue-ID: POLICY-1968
Signed-off-by: Jim Hahn <jrh3@att.com>
5 years agoReview maven dependency for snakeyaml 95/93095/1
Bruno Sakoto [Thu, 8 Aug 2019 14:40:11 +0000 (10:40 -0400)]
Review maven dependency for snakeyaml

Remove explicit version for snakeyaml maven dependency and inherit it
from integration parent artifact.

Upgrade snakeyaml to latest 1.24 version.

Issue-ID: POLICY-1603
Signed-off-by: Bruno Sakoto <bruno.sakoto@bell.ca>
Change-Id: Id44753332f39409205d2a64f6bc5563a5869bf91