policy/common.git
6 years agoMake ServiceManager implement Startable 18/82518/3
Jim Hahn [Sat, 16 Mar 2019 17:47:21 +0000 (13:47 -0400)]
Make ServiceManager implement Startable

Also added a "name" to the manager, for logger purposes.

Change-Id: Ide57cdec1fafc36c43b7f7584c0baad6261e8412
Issue-ID: POLICY-1542
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoMerge "Update INFO.yaml file"
Pamela Dragosh [Sat, 16 Mar 2019 14:54:37 +0000 (14:54 +0000)]
Merge "Update INFO.yaml file"

6 years agoAdd equals() to Policy class 13/82513/1
Jim Hahn [Sat, 16 Mar 2019 13:50:59 +0000 (09:50 -0400)]
Add equals() to Policy class

Change-Id: I7cc9baa21654e3d416a6ca1143f365ca295bf1d6
Issue-ID: POLICY-1542
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoUpdate INFO.yaml file 88/82488/1
Jessica Wagantall [Fri, 15 Mar 2019 20:53:33 +0000 (13:53 -0700)]
Update INFO.yaml file

Update missing information blocks and
indentation to pass verify job.

Change-Id: I0f514e9fb4a429addf40ba1171a8b7a363a070ae
Issue-ID: CIMAN-134
Signed-off-by: Jessica Wagantall <jwagantall@linuxfoundation.org>
6 years agoAdd support for TOSCA JSON Parsing 50/82250/2
liamfallon [Thu, 14 Mar 2019 14:24:14 +0000 (14:24 +0000)]
Add support for TOSCA JSON Parsing

Added a getter to allow the Gson object to be retrieved from a GSON
message body handler, useful for testing.

Moved the TextFileUtils utility class from APEX utilites to policy common
utils

Issue-ID: POLICY-1195
Change-Id: I7c8074e8177a90b292c6dfd6e7f0d352063818e7
Signed-off-by: liamfallon <liam.fallon@est.tech>
6 years agoAdd policyVersion to Policy model 95/82195/1
Jim Hahn [Wed, 13 Mar 2019 21:44:51 +0000 (17:44 -0400)]
Add policyVersion to Policy model

Change-Id: I64a997bbd1f21cb4eef134a1c474f8b5780dceb6
Issue-ID: POLICY-1542
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoMerge "ONAP password encryption tool"
Pamela Dragosh [Tue, 12 Mar 2019 14:33:23 +0000 (14:33 +0000)]
Merge "ONAP password encryption tool"

6 years agoMerge "Add ServiceManager class"
Liam Fallon [Tue, 12 Mar 2019 14:25:52 +0000 (14:25 +0000)]
Merge "Add ServiceManager class"

6 years agoONAP password encryption tool 36/79936/9
Chou, Joseph [Thu, 7 Mar 2019 16:49:23 +0000 (11:49 -0500)]
ONAP password encryption tool

Migrate ECOMP Policy password encryption tool to ONAP

Issue-ID: POLICY-1561
Change-Id: I9020efb7698b95c36c4ebff842a318bf8beefc69
Signed-off-by: Joseph Chou <jc2555@att.com>
6 years agoAdd ServiceManager class 62/81962/3
Jim Hahn [Mon, 11 Mar 2019 15:37:53 +0000 (11:37 -0400)]
Add ServiceManager class

Added ServiceManager class to start a list of services, in order,
and stop them in reverse order.
Also addressed minor checkstyle issue in TopicSinkClient.

Enabled logging from tests.
Updated some comments.

Updated license date.
Added state checks and support for multi-threading.

Change-Id: Ie7f053d9884766fe199895691a57eb5a51b1d155
Issue-ID: POLICY-1542
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoAddress sonar issues in utils 46/81946/1
Jim Hahn [Mon, 11 Mar 2019 14:15:19 +0000 (10:15 -0400)]
Address sonar issues in utils

Fixed issues in BeanConfigurator.
Fixed issues in NetworkUtil associated with newly added trust manager.

Change-Id: I0777ff85131d22c92c0ede06335a5b2839a1c482
Issue-ID: POLICY-1519
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoMerge "Create ParameterGroupImpl"
Liam Fallon [Sun, 10 Mar 2019 12:59:16 +0000 (12:59 +0000)]
Merge "Create ParameterGroupImpl"

6 years agoMerge "Add code to allocate server ports"
Jorge Hernandez [Fri, 8 Mar 2019 15:18:42 +0000 (15:18 +0000)]
Merge "Add code to allocate server ports"

6 years agoAdd code to allocate server ports 27/79927/4
Jim Hahn [Thu, 7 Mar 2019 16:30:16 +0000 (11:30 -0500)]
Add code to allocate server ports

Added code to find available server ports.
Also added a trust manager that always trusts certificates.

Made trust manager private so we can allocate new ones in the future,
if we decide it isn't safe to re-use the same one over and over.

Modified test code to allocate a port rather than assuming 8180 was
not in use.  Also modified retry parameters in other tests.

Added another allocPort() that takes an IP address and then modified
the other two to use that so the code does not have to be duplicated,
while providing more functionality.

Change-Id: I08cf18d923af46b1310d8496498bb1d4a0690b6e
Issue-ID: POLICY-1542
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoCreate ParameterGroupImpl 55/81855/1
Jim Hahn [Fri, 8 Mar 2019 00:51:59 +0000 (19:51 -0500)]
Create ParameterGroupImpl

Classes that implement ParameterGroup all have to add their own
name and validate() fields and methods.  Added an "impl" class that
provides the standard functionality and modified subclasses to use
it.

Change-Id: Ic6ee1607fb4fe7164a4e1eeebc480ea7d1e7e4d7
Issue-ID: POLICY-1542
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoMerge "Add NotNull and NotBlank parameter validation"
Liam Fallon [Fri, 8 Mar 2019 13:02:28 +0000 (13:02 +0000)]
Merge "Add NotNull and NotBlank parameter validation"

6 years agoAdd NotNull and NotBlank parameter validation 39/79939/4
Jim Hahn [Thu, 7 Mar 2019 19:53:12 +0000 (14:53 -0500)]
Add NotNull and NotBlank parameter validation

Modified the ParameterValidator to support new NotNull and NotBlank
annotations indicating that a field should not be null or blank.
These annotations can be made at class level or individual field level.

Moved annotations to their own subdirectory.
Added a comment to a method.
Extracted constant strings.
Moved one annotation to the subclass level.

Added support for "Min" annotation.

Propagate validation errors up from nested items.  Apply
field-level validations, even when field is a ParameterGroup.

Change-Id: Ic90df55487dc5db7b7b0be5397624d1957904a81
Issue-ID: POLICY-1542
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoMerge "Remove PropertyConfiguration class"
Pamela Dragosh [Thu, 7 Mar 2019 17:58:53 +0000 (17:58 +0000)]
Merge "Remove PropertyConfiguration class"

6 years agoRemove PropertyConfiguration class 15/79915/1
Jim Hahn [Thu, 7 Mar 2019 15:29:46 +0000 (10:29 -0500)]
Remove PropertyConfiguration class

Removed PropertyConfiguration class, as it has been replaced by the
BeanConfigurator class.

Change-Id: If97a74fe81875d3eb85d7775ce78a7f2b1fb1f70
Issue-ID: POLICY-1444
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoAdding client class for sending message to topic 32/79732/2
ramverma [Wed, 6 Mar 2019 15:43:11 +0000 (15:43 +0000)]
Adding client class for sending message to topic

1) Adding TopicSinkClient class for sending messages to topic. The same
class will be used for PAP->PDP & PDP->PAP communication.

2) Once this review is through, will raise another one to remove
PdpClient from policy/pap.

Change-Id: I7253683d9e88885cfbe2ac9041d01da239b9321b
Issue-ID: POLICY-1443
Signed-off-by: ramverma <ram.krishna.verma@est.tech>
6 years agoMerge "Add bean configurator"
Liam Fallon [Tue, 5 Mar 2019 21:03:06 +0000 (21:03 +0000)]
Merge "Add bean configurator"

6 years agoAdd bean configurator 65/79665/3
Jim Hahn [Mon, 4 Mar 2019 21:03:26 +0000 (16:03 -0500)]
Add bean configurator

Refactored PropertyConfiguration, but left the original class alone
until references to it have been removed from other policy repos.
Split the Property annotation out into its own file.  Cloned the
remaining code into BeanConfigurator, modifying its behavior so that,
instead of operating on its own subclass, it operates on a provided bean.
Also added an ability to copy the bean's fields to a Properties object.

Updated license dates.

Removed unneeded argument from functional interface.
Added comment about always checking default values.
Updated a few comments.

Change-Id: Iff36fd0524032d7630f9ee08f0eef7b05de100d1
Issue-ID: POLICY-1444
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoFix new sonar issue in listener 66/79666/1
Jim Hahn [Tue, 5 Mar 2019 00:46:57 +0000 (19:46 -0500)]
Fix new sonar issue in listener

Change-Id: I0d718ace3099bfa33508b11beece58447c0943ff
Issue-ID: POLICY-1444
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoMerge "Add various listener classes"
Jorge Hernandez [Mon, 4 Mar 2019 20:56:21 +0000 (20:56 +0000)]
Merge "Add various listener classes"

6 years agoAdding pdp-common module to policy/common 97/79397/4
ramverma [Mon, 4 Mar 2019 13:29:54 +0000 (13:29 +0000)]
Adding pdp-common module to policy/common

1) Adding pdp-common module to policy/common. So that all common code
across various pdps will be at one place.
2) Adding java classes for PDP_STATUS, PDP_UPDATE, PDP_STATE_CHANGE &
PDP_HEALTH_CHECK messages.
3) Adding enums for PDPHeathStatus, PDPResponseStatus & PdpState.
4) Adding relevant test cases.

Change-Id: I13e62f393fbd1c261696783cfe4b7dfff72625ba
Issue-ID: POLICY-1443
Signed-off-by: ramverma <ram.krishna.verma@est.tech>
6 years agoAdd various listener classes 78/79478/2
Jim Hahn [Fri, 1 Mar 2019 19:13:11 +0000 (14:13 -0500)]
Add various listener classes

Added various listener classes to support dispatch by message type
and request id.  The listeners are intended to form a pipeline:

TopicSource =>
MessageTypeDispatcher =>
RequestIdDispatcher =>
TypedMessageListener

Removed "PAP" from license.
Changed "handler" to "listener" in most places.
Simplified a test case.
Verified that no error message logged on success cases.
Removed println from test.
Updated some comments.

Change-Id: Ife265d14a6c5c8531601d9ce1343b88c1f8986a8
Issue-ID: POLICY-1444
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoMerge "Add StandardCoderObject to hide GSON internals"
Jorge Hernandez [Fri, 1 Mar 2019 16:16:07 +0000 (16:16 +0000)]
Merge "Add StandardCoderObject to hide GSON internals"

6 years agoAdd StandardCoderObject to hide GSON internals 19/79419/4
Jim Hahn [Fri, 1 Mar 2019 02:59:33 +0000 (21:59 -0500)]
Add StandardCoderObject to hide GSON internals

Added StandardCoderObject to hide GSON's JsonElement so that classes
are not dependent on the use of JsonElement, making it easier to switch
out serialization mechanisms in the future.

Added a test for field-not-found.
Converted tabs to spaces in json test file.

Simplified StandardCoderObject and added methods to Coder for
translating to and from StandardCoderObject.

Removed a test for a method that no longer exists.
Added more tests to a test case.

Change-Id: I5123dc3f17c940ded431ef7f9ccd8c4bff6b1c5f
Issue-ID: POLICY-1444
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoGet proper message in test logger appender 90/79390/3
Jim Hahn [Thu, 28 Feb 2019 18:00:16 +0000 (13:00 -0500)]
Get proper message in test logger appender

The logger appender that's used in junit tests was getting the
raw message, which still had "{}" place-holders in it.  Fixed that.

Split a test method to avoid checkstyle error.

Change-Id: I57571d8717aaee4adb7df186fe156501e9cc669e
Issue-ID: POLICY-1444
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoUpdate INFO.yaml Liam's email 67/79367/1
Pamela Dragosh [Thu, 28 Feb 2019 15:15:36 +0000 (10:15 -0500)]
Update INFO.yaml Liam's email

est.tech

Issue-ID: POLICY-1556
Change-Id: If83637b547d84b4caac6ad9b2b117d0051735c8c
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
6 years agoAdd additional encode and decode methods to Coder 10/79310/5
Jim Hahn [Wed, 27 Feb 2019 22:42:52 +0000 (17:42 -0500)]
Add additional encode and decode methods to Coder

Also:
Updated some comments and renamed a few parameters.
Removed a "throws" for a RuntimeException.

Short-circuit some calls.

Typo in comment.
Let gson create the JsonWriter.
Renamed a few more parameters.

Change-Id: I22e48c2191820c2a3d0743200edca79bd74353e7
Issue-ID: POLICY-1444
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoMerge "Add common coder classes"
Liam Fallon [Wed, 27 Feb 2019 21:47:37 +0000 (21:47 +0000)]
Merge "Add common coder classes"

6 years agoAdd common coder classes 69/79269/3
Jim Hahn [Wed, 27 Feb 2019 15:08:55 +0000 (10:08 -0500)]
Add common coder classes

Added coder classes as a common utility that can be used to encode
and decode json data.  Currently, it uses gson, but that can be
changed.

Separated the Coder interface from implementation.

Used assertSame to compare references.
Used numbers instead of strings so don't have to deal with escaping quotes
in the test cases.

Change-Id: Iea9001d2adc5a3150b3367619b5f43e96b5f8b41
Issue-ID: POLICY-1444
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoAssertion class for DAO code 76/79176/2
liamfallon [Tue, 26 Feb 2019 22:20:13 +0000 (22:20 +0000)]
Assertion class for DAO code

This class is used by the DAO model code being moved from
the APEX PDP to policy-models for generic DAO handling in the
Policy Framework

Issue-ID: POLICY-1264
Change-Id: I67cca540d9357f9ab16532090cb2edf397b332be
Signed-off-by: liamfallon <liam.fallon@est.tech>
6 years agoLog which gson style is being used 47/79047/1
Jim Hahn [Fri, 22 Feb 2019 21:30:07 +0000 (16:30 -0500)]
Log which gson style is being used

Different gson providers may be used for REST APIs.  Updated the code
to identify which was being used.

Change-Id: I8ffbda7409142ec728e217a87c9bcba3c34b814b
Issue-ID: POLICY-1428
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoMerge "Support for lab contextual topic names."
Pamela Dragosh [Fri, 22 Feb 2019 12:53:33 +0000 (12:53 +0000)]
Merge "Support for lab contextual topic names."

6 years agoSupport for lab contextual topic names. 96/78796/2
Jorge Hernandez [Wed, 20 Feb 2019 02:05:31 +0000 (20:05 -0600)]
Support for lab contextual topic names.

This work allows a drools application, with its drl
template to refer to the topic name by its invariable
canonical name, ie. POLICY-CL-MGT.    Since the drl
is a design time artifact, it is desired to know topics
by its canonical non-changeable name.

The actual per lab environment topic name may change
on a per deployment basis, for example POLICY-CL-MGT-WINDRIVER
or POLICY-CL-MGT-TLAB.   The template can still use
POLICY-CL-MGT without modification but the actual installation
configuration would use the "effectiveTopic" property to
point to the right topic on a per lab basis.

This also helps with installation (long story) since
the canonical topics will be known ahead of time.

Change-Id: I8322bf7e427569c37a76eea5ce6d5b9547cb2ff3
Issue-ID: POLICY-1534
Signed-off-by: Jorge Hernandez <jorge.hernandez-herrero@att.com>
6 years agoRemove jackson from policy-endpoints pom 04/78704/2
Jim Hahn [Mon, 18 Feb 2019 18:30:00 +0000 (13:30 -0500)]
Remove jackson from policy-endpoints pom

Removed most jackson dependencies from the policy-endpoints pom,
leaving jackson-annotations.
Moved jersey.version to top-level pom.

Change-Id: I73c6fef79d104ef62c7632ad3e02bc52865351cd
Issue-ID: POLICY-1531
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoAdd log message when gson used 01/78601/1
Jim Hahn [Fri, 15 Feb 2019 22:43:45 +0000 (17:43 -0500)]
Add log message when gson used

Added code to log a message when gson is used instead of jackson.

Change-Id: I8cbb8ad8461cc364c3419aaa174cef2680c5a672
Issue-ID: POLICY-1428
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoMerge "Remove erroneous comments"
Liam Fallon [Fri, 15 Feb 2019 19:37:49 +0000 (19:37 +0000)]
Merge "Remove erroneous comments"

6 years agoMerge "Remove unneeded jackson references"
Liam Fallon [Fri, 15 Feb 2019 19:36:27 +0000 (19:36 +0000)]
Merge "Remove unneeded jackson references"

6 years agoRemove unneeded jackson references 76/78576/1
Jim Hahn [Fri, 15 Feb 2019 16:33:25 +0000 (11:33 -0500)]
Remove unneeded jackson references

Removed some jackson references that are no longer needed.
Others remain; those must remain in place until they are no longer
needed by other policy repos.

Change-Id: Ica6624baf17be118714bb566c8db3ffce2c3587c
Issue-ID: POLICY-1428
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoRemove erroneous comments 68/78568/1
Jim Hahn [Fri, 15 Feb 2019 15:57:14 +0000 (10:57 -0500)]
Remove erroneous comments

Some comments still said that including the maven artifact,
jersey-media-json-jackson, could override gson behavior, but
that is no longer true.  The comments have been removed.

Change-Id: I9b6477b76f835b96c52ccb9777b80791fc6b1d77
Issue-ID: POLICY-1428
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoFix sonar issues with gson code 66/78566/2
Jim Hahn [Fri, 15 Feb 2019 14:50:25 +0000 (09:50 -0500)]
Fix sonar issues with gson code

Fixed issues with GsonTestUtils:
- don't set static from within a non-static method
- don't throw generic RuntimeException
Resolved checkstyle issue.
Removed trailing spaces.

Change-Id: If0c85733f62a24b56088dc90aadd4b95b3a6c91a
Issue-ID: POLICY-1428
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoSonar fixes 40/78440/5
Jim Hahn [Wed, 13 Feb 2019 21:16:45 +0000 (16:16 -0500)]
Sonar fixes

Added test for Serializer to increase junit coverage.
Added tests for TestTimeMulti to increase junit coverage.
Sonar fixes for PropertyConfiguration:
- use equalsIgnoreCase
- use the exception
Updated license dates.
Some fixes for LoggerFactoryWrapper to address sonar issue - utility
classes should typically have a private constructor.

Change-Id: I8957e9673fe8371ecca7abbb7ece87b0d6f46c1a
Issue-ID: POLICY-1519
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoMerge "Add gson handler and tests"
Jorge Hernandez [Thu, 14 Feb 2019 15:05:27 +0000 (15:05 +0000)]
Merge "Add gson handler and tests"

6 years agoRefactor common class from gson code 05/78405/3
Jim Hahn [Wed, 13 Feb 2019 15:42:19 +0000 (10:42 -0500)]
Refactor common class from gson code

The TypeAdapters in the gson-jackson code were nearly identical,
so a common class was factored out.  This also enabled junit tests
to attain 100% coverage on that code, whereas there were a couple
of branches that could not be tested previously.
Addressed new sonar issues.
Removed unused import.

Change-Id: Id8e6460c881c6ce0239768f182e4e652cd10645f
Issue-ID: POLICY-1428
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoAdd gson handler and tests 07/78407/3
Jim Hahn [Wed, 13 Feb 2019 15:53:12 +0000 (10:53 -0500)]
Add gson handler and tests

Added JacksonHandler which provides jackson behavior in gson.
Also added classes to facilitate testing of gson serializations.
Added compareGson(xxx, Class).
Removed trailing spaces from some files.
Updated license dates.
Replaced incorrect constant with ${xxx} in json test file.
Fixed typo in test method name.

Change-Id: If05b654d76a4ffc88646f03334be82b32506f28f
Issue-ID: POLICY-1428
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoMerge "Fix sonar issues in gson superclasses"
Liam Fallon [Wed, 13 Feb 2019 13:45:20 +0000 (13:45 +0000)]
Merge "Fix sonar issues in gson superclasses"

6 years agoMerge "Add jackson behavior for fields"
Liam Fallon [Wed, 13 Feb 2019 13:44:37 +0000 (13:44 +0000)]
Merge "Add jackson behavior for fields"

6 years agoMerge "Add jackson behavior for methods"
Liam Fallon [Wed, 13 Feb 2019 13:43:21 +0000 (13:43 +0000)]
Merge "Add jackson behavior for methods"

6 years agoMerge "Replace PolicyAssert with assertj"
Liam Fallon [Wed, 13 Feb 2019 13:26:34 +0000 (13:26 +0000)]
Merge "Replace PolicyAssert with assertj"

6 years agoAdd jackson behavior for methods 20/78320/3
Jim Hahn [Tue, 12 Feb 2019 18:17:09 +0000 (13:17 -0500)]
Add jackson behavior for methods

Added classes to make gson treat methods as jackson does.
Remove unneeded "forGetter" parameter from constructors.
Fixed sonar issue with too long "if" test.
Corrected comment about annotation names.
Adjusted error message.
Removed unused constant.
Removed trailing spaces.

Change-Id: I3a4fc92193737a0dc89f1218e70f093aedbdb152
Issue-ID: POLICY-1428
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoAdd jackson behavior for fields 15/78315/3
Jim Hahn [Tue, 12 Feb 2019 16:20:13 +0000 (11:20 -0500)]
Add jackson behavior for fields

Added classes to make gson treat fields as jackson does.
Added check for input OR output fields.
Corrected comment about annotation names.
Removed trailing spaces.
Extracted some string constants.
Fixed checkstyle issue.

Change-Id: I665b31774086d72a5a95bee6cf3486a019b72402
Issue-ID: POLICY-1428
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoFix sonar issues in gson superclasses 12/78312/2
Jim Hahn [Tue, 12 Feb 2019 15:50:06 +0000 (10:50 -0500)]
Fix sonar issues in gson superclasses

Fixing some of the issues necessitated the use of generic/raw types.
Removed version from assertj in pom.
Removed trailing spaces.

Change-Id: I76e0a05ca06c103ccc876675be04a4ab5e4de5ea
Issue-ID: POLICY-1428
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoAdd Serializer interface 54/78254/1
Jim Hahn [Mon, 11 Feb 2019 20:53:14 +0000 (15:53 -0500)]
Add Serializer interface

Added missing Serializer interface, needed by other gson classes.

Change-Id: I4c37dea89011a833d71c11e2d2c4d74ad768e750
Issue-ID: POLICY-1428
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoMerge "Add superclasses for gson-jackson migration"
Liam Fallon [Mon, 11 Feb 2019 18:04:51 +0000 (18:04 +0000)]
Merge "Add superclasses for gson-jackson migration"

6 years agoMerge "Return true only if thread has been really started"
Pamela Dragosh [Mon, 11 Feb 2019 13:24:29 +0000 (13:24 +0000)]
Merge "Return true only if thread has been really started"

6 years agoAdd superclasses for gson-jackson migration 00/78000/8
Jim Hahn [Wed, 6 Feb 2019 18:14:57 +0000 (13:14 -0500)]
Add superclasses for gson-jackson migration

Added common classes needed by other gson-jackson code.
Modified some logic to make it more maintainable or perform better.
Updated comments and spacing.
Fix another comment.
Moved gson classes from utils to a separate gson project.
Added GsonXxx annotations to mirror jackson annotations.
Removed unneeded dependencies from gson pom.
Removed old GsonMessage class from policy-endpoints.
Removed trailing spaces.
Updated licenses.
Removed more trailing spaces.
Removed unneeded checkstyle suppression file from utils.

Change-Id: I1a285500faeb0a0b6a1467d09b92ecd3cded713e
Issue-ID: POLICY-1428
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoReplace PolicyAssert with assertj 07/78307/1
Jim Hahn [Fri, 8 Feb 2019 18:38:53 +0000 (13:38 -0500)]
Replace PolicyAssert with assertj

Removed PolicyAssert from utils-test, as its functionality is
superseded by assertj.

Change-Id: Ie7620fea98cd368a8ce4f8511e8e88f291013cff
Issue-ID: POLICY-1392
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoReturn true only if thread has been really started 04/77604/5
Krzysztof Opasiak [Wed, 30 Jan 2019 18:55:20 +0000 (19:55 +0100)]
Return true only if thread has been really started

Accortding to doc start() should return true if start operation was
successful. Unfortunately value of this.alive may change between end
of synchronized block and return for example when other thread
executes stop() in parallel.

Change-Id: I4103f0f4c65620c47b4acf2d276f104937b91187
Issue-ID: POLICY-1387
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
6 years agoMerge "Skip all fields in gson by default"
Pamela Dragosh [Wed, 6 Feb 2019 17:55:09 +0000 (17:55 +0000)]
Merge "Skip all fields in gson by default"

6 years agoSkip all fields in gson by default 42/77842/6
Jim Hahn [Mon, 4 Feb 2019 23:19:15 +0000 (18:19 -0500)]
Skip all fields in gson by default

Created an exclusion strategy that will prevent gson from serializing
any fields within a class. The strategy must be registered to take
effect.
Uses lists to identify classes to be excluded when using gson with
the jackson default behavior.

Change-Id: I747fb1159846ad3000f69603f9b5d3f03bc8764f
Issue-ID: POLICY-1428
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoFix potential race condition 03/77603/4
Krzysztof Opasiak [Wed, 30 Jan 2019 13:10:35 +0000 (14:10 +0100)]
Fix potential race condition

init() is currently called outside of synhronized block.
This is may lead to race condition as init() creates new bus consumer
(this.consumer) which is the copied and nulled in stop() synchronized
block. This may lead to race condition if:

Thread #1                       Thread #2

this.alive = true;
this.alive = false
consumerCopy = this.consumer;

this.consumer = new Consumer();

// false
if(consumerCopy != null) {
    consumerCopy.close();
} else {
    log.warn();
}

As a result, new BusConsumers are being created but they are never
close().

Issue-ID: POLICY-1387
Change-Id: I2eadb12ef1c4b07b9e47dc6ebc096acc713299a0
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
6 years agoExteract common params 47/77547/5
Krzysztof Opasiak [Tue, 29 Jan 2019 22:18:57 +0000 (23:18 +0100)]
Exteract common params

Most of parameters used to initialize consumers are repeated in
every branch. Instead of having 3 copies of the same code let's
extract all common values and then add only those which are
specific to given consumer type.

Change-Id: I5884f6dd77a7e2f1a7f7614c909c1cad4826d4f1
Issue-ID: POLICY-1387
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
6 years agoDon't reinit allowSelfSignedCerts 46/77546/5
Krzysztof Opasiak [Tue, 29 Jan 2019 22:12:46 +0000 (23:12 +0100)]
Don't reinit allowSelfSignedCerts

allowselfsignedcerts field is defined and initialized in BusTopicBase
so there is need to overwrite it once agin with the same value.

Change-Id: Id0a389921954606392eb2cb3c23cd0d8ee3dc4ae
Issue-ID: POLICY-1387
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
6 years agoRemove constant from Topic interface 79/77479/8
Krzysztof Opasiak [Mon, 28 Jan 2019 20:11:38 +0000 (21:11 +0100)]
Remove constant from Topic interface

Fix sonar issue:

Move constants to a class or enum

Issue-ID: POLICY-1486
Depends-On: I453a14c3dda337f2a4d08914ead32b37adc17353
Change-Id: I6baac1fe6e692074bca971f3c35bb2a29cb49205
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
6 years agoUse helper class to retrieve network logger 78/77478/7
Krzysztof Opasiak [Mon, 28 Jan 2019 20:07:52 +0000 (21:07 +0100)]
Use helper class to retrieve network logger

Instead of abusing constant from Topic interface use new dedicated
helper class to retrive network logger.

Issue-ID: POLICY-1486
Change-Id: Ia715aafb578aeb2842566de2623e8d22e42652fc
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
6 years agoAdd helper class to retrive network logger 77/77477/5
Krzysztof Opasiak [Mon, 28 Jan 2019 19:34:09 +0000 (20:34 +0100)]
Add helper class to retrive network logger

Instead of defining static string variable inside Topic class let's
create helper class for getting specific loggers.

Issue-ID: POLICY-1486
Change-Id: Ic1f07466e1ab6abcc00098e617f0e82da19e852d
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
6 years agoMerge "Add gson support to policy-endpoints"
Liam Fallon [Thu, 24 Jan 2019 16:30:15 +0000 (16:30 +0000)]
Merge "Add gson support to policy-endpoints"

6 years agoAdd gson support to policy-endpoints 91/76091/10
Jim Hahn [Mon, 21 Jan 2019 17:42:10 +0000 (12:42 -0500)]
Add gson support to policy-endpoints

Added "provider" property to both http client and server builders.
The provider defaults to jackson, to maintain backward compatibility
until other policy code has been converted to gson.
Removed commented item from pom.
Added some comments and re-arranged a few pieces of code.
Fixed a few typos and removed spacing at the end of some lines.
Reordered imports.
Added comments about limitations when using jersey-media-json-jackson.
Address ridiculous checkstyle complaint.
Support comma-separated list of serialization providers in jersey client.
Disabled metainf discovery from jersey client and server so that the
media-json dependencies could be re-instated in the pom.
Address another ridiculous checkstyle complaint.

Change-Id: Ic5a93b475d0ee9b435352b3516de6b865b00a86a
Issue-ID: POLICY-1428
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoAdd gson to utils pom 31/76231/1
Jim Hahn [Wed, 23 Jan 2019 19:25:12 +0000 (14:25 -0500)]
Add gson to utils pom

Added gson dependency to utils pom in anticipation of future
reviews.

Change-Id: I1d0e4130083a73d250fe01f0e1a0154c608c6ce6
Issue-ID: POLICY-1428
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoAdd post and delete http client methods 34/75834/3
Jorge Hernandez [Tue, 15 Jan 2019 19:28:16 +0000 (13:28 -0600)]
Add post and delete http client methods

Additional clean up for sonars have also been added for the
classes that have been modified

Issue-ID: POLICY-1367
Change-Id: Ie97d9057273e89850420a7c1b5b2d275709bdfd0
Signed-off-by: Jorge Hernandez <jorge.hernandez-herrero@att.com>
6 years agoRemove policy-endpoints checkstyle suppressions 22/75822/1
Jim Hahn [Tue, 15 Jan 2019 14:43:13 +0000 (09:43 -0500)]
Remove policy-endpoints checkstyle suppressions

Split class files so each file only contains one class.

Change-Id: Iaf94c4c079380dc7db3aff2affbe48f50e3cc0a2
Issue-ID: POLICY-1134
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoAdding NOOP sources support 54/75654/3
Jorge Hernandez [Thu, 10 Jan 2019 23:24:53 +0000 (17:24 -0600)]
Adding NOOP sources support

In addition, Noop* classes have been refactored to
increase code reuse and clean some checkstyle issues.
Additional Junits have been added for existing functionality.

Change-Id: I072f9ff2f415630ac82eca949a8360249f73da86
Issue-ID: POLICY-1397
Signed-off-by: Jorge Hernandez <jorge.hernandez-herrero@att.com>
6 years agoRemove policy/common integrity-audit suppressions 89/75589/3
Jim Hahn [Wed, 9 Jan 2019 20:39:46 +0000 (15:39 -0500)]
Remove policy/common integrity-audit suppressions

Changed "DbDAO" to "DbDao".

Change-Id: I51a6706cceef6857404ae7c12ce43e553ea0da29
Issue-ID: POLICY-1133
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoReplace expectException with AssertJ 03/75503/1
Jim Hahn [Tue, 8 Jan 2019 22:15:07 +0000 (17:15 -0500)]
Replace expectException with AssertJ

Change-Id: I73c186f181960ac7ac8cd985e55db1831963910f
Issue-ID: POLICY-1392
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoAdd support for parameter inheritance 36/74936/1
liamfallon [Wed, 19 Dec 2018 19:14:35 +0000 (19:14 +0000)]
Add support for parameter inheritance

Common parameter support does not allow for inheritance of parameters
from a super class. This change allows inheritance of public and protected
members from a parameter superclass to a parameter subclass.

Issue-ID: POLICY-1222
Change-Id: Ia4f452abab80953b41784c44e4202e8d5405a197
Signed-off-by: liamfallon <liam.fallon@est.tech>
6 years agoUpdate eclipselink version in policy common 71/74071/1
Jim Hahn [Fri, 30 Nov 2018 14:28:09 +0000 (09:28 -0500)]
Update eclipselink version in policy common

Use eclipselink from policy parent.

Change-Id: I472900a82a5c8b69e1a4a1efc4b3bcb86f3965a8
Issue-ID: POLICY-1359
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoRemove Factory from IntegrityMonitor 53/73553/3
Jim Hahn [Tue, 27 Nov 2018 20:15:57 +0000 (15:15 -0500)]
Remove Factory from IntegrityMonitor

Also removed unneeded method override in junit test.

Change-Id: I7186e9f75443f7b8ba8376aa0e00a5cf4c573696
Issue-ID: POLICY-1287
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoMerge "Fix checkstyle issue in policy common"
Jorge Hernandez [Tue, 27 Nov 2018 16:28:40 +0000 (16:28 +0000)]
Merge "Fix checkstyle issue in policy common"

6 years agoFix checkstyle issue in policy common 79/73479/4
Krishnakumar Jinka [Sun, 25 Nov 2018 03:27:05 +0000 (12:27 +0900)]
Fix checkstyle issue in policy common

Move method into class it is being called. Fix minor checkstyle
formatting in the class. The changes have side effects hence
revert some changes. Modify the javadoc tags

Issue-ID: POLICY-1251
Change-Id: Iecb513dafe3f60628664f3e60d6c49d3e4ce3148
Signed-off-by: kris.jinka <kris.jinka@samsung.com>
6 years agoRename test classes in policy/common 05/73405/3
Parshad Patel [Fri, 23 Nov 2018 06:41:03 +0000 (15:41 +0900)]
Rename test classes in policy/common

Make test classes name consistence

Issue-ID: POLICY-1281
Change-Id: I2d70eda0a2fe7dc60e020dd91c743c1708d1f11a
Signed-off-by: Parshad Patel <pars.patel@samsung.com>
6 years agoUpdate dmaap code for 1.1.9 83/71983/1
Pamela Dragosh [Tue, 6 Nov 2018 18:00:56 +0000 (13:00 -0500)]
Update dmaap code for 1.1.9

The new version has changed class names.

Issue-ID: POLICY-1229
Change-Id: Id268b1a57667ffa3b5950dba7c10db2181586245
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
6 years agoSet new master version for Dublin 54/71554/1
liamfallon [Wed, 31 Oct 2018 15:23:33 +0000 (15:23 +0000)]
Set new master version for Dublin

Issue-ID: POLICY-1232
Change-Id: Icb6179ace3f320bdda3da2160afd2d058762ae5e
Signed-off-by: liamfallon <liam.fallon@ericsson.com>
6 years agoRemove openecomp repo from common pom 64/71464/1
Jim Hahn [Tue, 30 Oct 2018 13:48:25 +0000 (09:48 -0400)]
Remove openecomp repo from common pom

Change-Id: I7c654ef350fb1d83a4fd43c57b6b2fb960acf42e
Issue-ID: POLICY-1231
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoDetection of AAF enablement 11/71311/1 3.0.0-ONAP
Jorge Hernandez [Fri, 26 Oct 2018 13:46:00 +0000 (08:46 -0500)]
Detection of AAF enablement

Change-Id: I049e88bec2c83f6224ba1d1f24b93e0fb1aa807e
Issue-ID: POLICY-1216
Signed-off-by: Jorge Hernandez <jorge.hernandez-herrero@att.com>
6 years agoFix refering to snapshot in policy/common 49/71149/2 1.3.1
ramverma [Wed, 24 Oct 2018 13:50:13 +0000 (14:50 +0100)]
Fix refering to snapshot in policy/common

Issue-ID: POLICY-1213
Change-Id: Id34f28a3f41687993009128940e9ddec69d5b88f
Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>
6 years agoMerge "Remove constraints" 1.3.0
Jorge Hernandez [Fri, 5 Oct 2018 18:12:44 +0000 (18:12 +0000)]
Merge "Remove constraints"

6 years agoRemove constraints 27/69927/1
Pamela Dragosh [Fri, 5 Oct 2018 16:22:43 +0000 (12:22 -0400)]
Remove constraints

Sonar is flagging the null checks.

Issue-ID: POLICY-1130
Change-Id: I4ab94b3db79d4089f20afaf3f80f3c925541084a
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
6 years agoSupport Throwables in expectException() 62/69762/2
Jim Hahn [Wed, 3 Oct 2018 16:09:28 +0000 (12:09 -0400)]
Support Throwables in expectException()

Also fixed some bugs in the junit tests.
Renamed expectException() to assertThrows().
Added test cases.

Change-Id: I13dff0007e35c2d2521a4ca40bb65e6820416ed1
Issue-ID: POLICY-1148
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoAdd expectException to policy-common 94/69694/2
Jim Hahn [Tue, 2 Oct 2018 21:46:04 +0000 (17:46 -0400)]
Add expectException to policy-common

Also fixed new checkstyle error.

Change-Id: I2d2c2518f3f7da1a0ace8c32e10b4151d941bb6f
Issue-ID: POLICY-1148
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoFix minor sonar 11/69611/4
Pamela Dragosh [Mon, 1 Oct 2018 18:44:26 +0000 (14:44 -0400)]
Fix minor sonar

These are mainly duplicate strings. But also combined
if statements and fixing some debug messages missing
arguments or format specifiers. Some duplicates I left
alone as it seemed unreadable to change them. Also
moving variables to their correct place (before constructors).

Issue-ID: POLICY-1130
Change-Id: I8018c676b22fe8fec635f129fa37921ad1004569
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
6 years agoFix RestManager test issue 54/69554/1
Jim Hahn [Sat, 29 Sep 2018 14:06:26 +0000 (10:06 -0400)]
Fix RestManager test issue

Apparently drools-pdp code depends on Dmaap topic factories throwing
IllegalArgumentException instead of IllegalStateException (which is what
the other topic factories throw) when an unknown topic name is requested.
Therefore, the change to make them consistent has been backed out.

Change-Id: Ia3d7e26a61027977eb626c9ddad6369982eae002
Issue-ID: POLICY-1148
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoAdd junit coverage to rest of policy-endpoint bus 11/69511/3
Jim Hahn [Fri, 28 Sep 2018 13:53:14 +0000 (09:53 -0400)]
Add junit coverage to rest of policy-endpoint bus

Also extracted out common code from tests.
Fix checkstyle issues.
Be consistent in returning IllegalStateException when topic is not
found by any Topic Factory.
Added/updated some comments.
Use better name for "validate" argument.
Renamed test() to testDestroy().
Added NoopTopicPropertyBuilder.
Renamed BusTopicTestBase to TopicTestBase.

Change-Id: Id4c7ab9f2b5572dc5195b0da116e285c5e9b6f06
Issue-ID: POLICY-1148
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoMerge "Add coverage for policy-endpoints bus"
Jorge Hernandez [Fri, 28 Sep 2018 02:58:51 +0000 (02:58 +0000)]
Merge "Add coverage for policy-endpoints bus"

6 years agoAdd coverage for policy-endpoints bus 97/69397/2
Jim Hahn [Thu, 27 Sep 2018 13:09:40 +0000 (09:09 -0400)]
Add coverage for policy-endpoints bus

Added license.
Fix checkstyle warnings.

Change-Id: I2279b8b80b3dc175583353ced3d71c3a5cc4f975
Issue-ID: POLICY-1148
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoMerge "Added more coverage to policy-endpoints internal"
Pamela Dragosh [Thu, 27 Sep 2018 16:19:48 +0000 (16:19 +0000)]
Merge "Added more coverage to policy-endpoints internal"

6 years agoAdded more coverage to policy-endpoints internal 35/69335/2
Jim Hahn [Wed, 26 Sep 2018 19:10:52 +0000 (15:10 -0400)]
Added more coverage to policy-endpoints internal

Fixed checkstyle error.

Change-Id: Ie6a85633bab098a30ccb2c1c309e1640aa1c8131
Issue-ID: POLICY-1148
Signed-off-by: Jim Hahn <jrh3@att.com>
6 years agoMerge "Use powermock version from parent pom"
Pamela Dragosh [Thu, 27 Sep 2018 11:43:14 +0000 (11:43 +0000)]
Merge "Use powermock version from parent pom"