Age | Commit message (Collapse) | Author | Files | Lines |
|
Typecasting Map to NavigableMap leads to ClassCastException.
The usages of the get methods in delete policy, policyType
endpoints in policy/api (using spring data jpa) cause the
unchecked class-cast exception. Fix is to instead copy the
Map entries into a newly created TreeMap instance.
Issue-ID: POLICY-3924
Signed-off-by: Rashmi Pujar <rashmi.pujar1@bell.ca>
Change-Id: I60625980d6f2692ffa7dd3bd9f53d10b43c13f4a
|
|
PfGeneratedIdKey class (which is used as a composite key
in JpaPolicyAudit and JpaPdpStatistics) uses GeneratedValue
in a wrong way and not according to the specification.
This review fixes it. PfGeneratedIdKey class is removed, and the
generatedId is directly specified in the JpaPolicyAudit and
JpaPdpStatistics classes.
Note: These classes are only used by PAP, so the related methods for db
interaction is removed as PAP directly talks to DB using spring
repository layer. Also the only end result this change brings is that the
'generatedId' alone will be used as the primary key instead of
'generatedId, name and version' together.
Corresponding changes in
DB Migrator: https://gerrit.onap.org/r/c/policy/docker/+/127139
PAP: https://gerrit.onap.org/r/c/policy/pap/+/127130
Change-Id: Ib4ea8b60ffe5c2480746569c0354bf474a6b7006
Issue-ID: POLICY-3897
Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
|
|
Issues identified in the entity classes are fixed in this
review. Some fixes doesn't affect the table structure at all.
Tables actually affected by some of these fixes are not really used today, and doesn't
contain any data. A separate review is raised for the db-migrator
changes.
Change-Id: I0efdf2c5f17e12225f1b443b5fe8e27c578229f7
Issue-ID: POLICY-3871
Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
|
|
Issue-ID: POLICY-3396
Change-Id: I7b37efc13a25e0e27d63a85a3ee291e91a4e1682
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
Fixed:
- a few other "var" cases
- use re2j instead of java.util.regex
- use correct class for constants
- remove unused constants
Issue-ID: POLICY-3094
Change-Id: Ifcb2b0623e8df0527f0a279e666d062422978ded
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
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.
Issue-ID: POLICY-2059
Change-Id: I245e4a647fcbb718faa63a7543f9f81c85da958c
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
This will provide an alternative unique key.
It will be used in place of PfTimestampKey in the PdpStatistics table.
We make use of the @GeneratedValue annotation to provide this feature.
Added DummyGeneratedIdEntity and unit tests
Added PfFilterFactory class
Added new filter classes
Issue-ID: POLICY-3189
Change-Id: I097eab318d2cb958e1157e35825fd6d35d429a25
Signed-off-by: ktimoney <kevin.timoney@est.tech>
|
|
|
|
Due to the precision of time stamps being saved to the nearest second,
a millisecond precision timestamp was being compared to a second
precision timestamp, causing the write to fail. This change fixes that.
A unit test is also added to test for this on the provider.
In addition, a USE-MARIADB flag is being introduced, which allows unit
tests to be run against a locally installed MariaDB instance so that the
unit tests can be verified against MariaDB locally rather than H2, the
default in Gerrit.
Issue-ID: POLICY-3146
Change-Id: I878f160956e89506743dc074679ee81ac1c48216
Signed-off-by: liamfallon <liam.fallon@est.tech>
|
|
Tests refactoring to reduce number of assertions
Issue-ID: POLICY-3094
Change-Id: I445462f0ec5d49474b10c1940c7fa12e687636de
Signed-off-by: lapentafd <francesco.lapenta@est.tech>
|
|
Tests refactoring to reduce number of assertions
Removed lines 167-169 in PfKeyImplTest
Issue-ID: POLICY-3094
Change-Id: I94ef11068811c81108b0fbf3e5b878d02ab25306
Signed-off-by: lapentafd <francesco.lapenta@est.tech>
|
|
|
|
Use of Timestamp in JPA classes appears to cause
EntityNotFoundException. Changed from Timestamp back to Date.
Issue-ID: POLICY-3125
Change-Id: I3ee29675849e3feda2641e9b240207c96fd975d4
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
Added casting for 4 asserts in policy/models/base
Issue-ID: POLICY-3094
Change-Id: Ibc97be3eca366a7e9b8b9611bc284f2473acff6e
Signed-off-by: lapentafd <francesco.lapenta@est.tech>
|
|
|
|
Tests refactoring to reduce number of assertions to less then 25
Issue-ID: POLICY-3094
Change-Id: Icd3d83c7f8168dd81df13a584229eab36c646f37
Signed-off-by: lapentafd <francesco.lapenta@est.tech>
|
|
Problem: When PfReferenceTimestamp Key is persisted in db, the parent
class fields are ignored which causes inconsistent data while saving and
fetching in db.
Fix: JPA is not supporting inheritance in @Embeddable classes. Hence
included the super class as @Embedded property in PfReferenceTimestamp
key. @Embedded properties are unable to be queried directly. Slightly
modified Dao methods to support querying @embedded fields.
Issue-ID: POLICY-3049
Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech>
Change-Id: I5c2e03a5ae98525764a64dd6cce1a1298c5f9816
|
|
isNUllKey check for PfReferenceTimestamp key is always returning false as the parent class is
validating the child object in its method which has additional parameters (timestamp).
Fixing the issue by validating only the fields of parent class.
Issue-ID: POLICY-3069
Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech>
Change-Id: Ie22d09552c9d0cedb7535bda359df0d70e1ebe77
|
|
Updated JPA classes to use java.sql.TImestamp rather than Instant.
Issue-ID: POLICY-3069
Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech>
Change-Id: If5b874ec96931d4b8dd142d46a9980e83a4708fc
|
|
property
Issue-ID: POLICY-3011
Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech>
Change-Id: I7a9db3a4fb0345e0979952e5c086523cc1d960f9
|
|
Addressed the following:
- make constructors protected
- check exception type
- too many assertions
- remove annotation lists
- use "<>"
- reduce cognitive complexity
- extract constant
- multiple method calls in one assert
- don't use eq() in verify()
- indentation
Issue-ID: POLICY-2905
Change-Id: I25bb3951f781250e9cdfe8f5f3b80cb63e129184
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
Sometimes the exception thrown by the database providers has to be
converted to a runtime exception, especiall if the database provider is
running in a thread (called by the rum() method that does not return
exceptions). It is convenient to have a constructor on the
PfModelRuntimeException class that takes a PfModelException class as its
argument, thus creating the runtime exception.
Also the mapMap method in pfUtils is updated to allow the key of the map
to be templated. By doing this, the utility can be used for maps that
are keyed with types other than String (such as UUID).
Issue-ID: POLICY-2971
Change-Id: Ib0b3678de531fd383753a1cd0ce47a06f4079ec0
Signed-off-by: liamfallon <liam.fallon@est.tech>
|
|
Updated the code to place validation annotations directly on the
annotated types instead of using the @Items and @Entries annotations.
Also added/updated junits for validation code.
Issue-ID: POLICY-2648
Change-Id: Ia535da07a38cec77a74c5c3215b5ae784d7a4e1a
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
|
|
Today we can only handle a single service template in the database. We
should be able to handle multiple service templates and assign arbitrary
policy types and policies to maned and versioned service templates.
This review brings in the Java API in models provider for handling
service templates in this way and uses a simplistic single-teplate
implementation in models-tosca, that will work but still only handles a
single service template under the hood.
Issue-ID: POLICY-2900
Change-Id: Ia02dea8abe44b7f407e685090a4b8e0360889653
Signed-off-by: liamfallon <liam.fallon@est.tech>
|
|
Changes to the validation code broke the validation check for the
supportedPolicyTypes field in PdpSubGroup - it no longer supports wild-
cards in the name. Modified the validation annotation in
PfSearchableKey to allow wild-card names.
Issue-ID: POLICY-2648
Change-Id: Ibd2853025ce72ed88697dd9a7d6d5eed2b28475e
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
Modified models to use annotations instead of function calls for most
field validations. Created a few new validation annotations for use
within models.
Per review comments:
- renamed Key to VerifyKey
- enhanced VerifyKey to imply "@Valid", unless disabled
Issue-ID: POLICY-2648
Change-Id: I2b53f218b0a2ab1ed1f5e278816a3509f1408972
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
Policy models uses PfValidationXxx classes which are totally unrelated
to ValidationResult in policy common. This precludes the use of various
utility methods and annotations for doing validation. Modified policy
models to use ValidationResult instead.
This approach uses function calls, though a future approach could make
use of annotations instead.
Issue-ID: POLICY-2648
Change-Id: I9760f1dc46902ab6bef7f440f3caf5e951660a5d
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
Implement the Database persistence parts for the new TOSCA concepts so
that those concepts can be written to and read from the database.
First batch of comment fixes
Issue-ID: POLICY-2900
Change-Id: I45191c1ff57cf1ea8563399db6cc8e51b2724813
Signed-off-by: liamfallon <liam.fallon@est.tech>
|
|
Add a functional interface to PfUtils for mapping maps so that more
complex conversions can be handled.
List mapping functional methods added as well.
Issue-ID: POLICY-2900
Change-Id: I4189e09d6d8621638960b5d9f0d19792a7faceb8
Signed-off-by: liamfallon <liam.fallon@est.tech>
|
|
Issue-ID: POLICY-2900
Change-Id: Iaba37b81473b60d3da15a52ffcccdaa16a5b7091
Signed-off-by: liamfallon <liam.fallon@est.tech>
|
|
This review brings in extra TOSCA concepts for Node types, nodes, and
capabilities.
The TOSCA handling is also amended to make the handling of equality
consistent. Now, if filtering or ordering is required using an order
rather than natural ordering, a comparator must be supplied by the user.
Issue-ID: POLICY-2900
Change-Id: Ie40e86870b97eb993b1338bdc0666ac116f72f67
Signed-off-by: liamfallon <liam.fallon@est.tech>
|
|
Addressed the following eclipse/sonar warnings:
- unused imports
- unchanged type
- unreachable "catch" block
- reinterrupt
Issue-ID: POLICY-2714
Change-Id: I2fe6011ec74b7fab8889050e5c83647ab034ea25
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
The PfConceptContainer class uses incompatible JPA anotations
@MappedSuperClass and @Entity are incompatible as a MappedSuperClass
cannot be an entity.
Eclipselink silently tolerates this incompatibility but Hibernate (used
in CLAMP) throws a build error on this class.
Issue-ID: POLICY-2851
Change-Id: I2fd3d9217dc00717f8f2471e4848d254e7726b11
Signed-off-by: liamfallon <liam.fallon@est.tech>
|
|
Addressed sonar issues:
- diamond operator
Also removed a number of the "NOSONAR" comments now that we know how to
address them without disabling sonar.
Issue-ID: POLICY-2714
Change-Id: I440f4fa955968fd911616c2b6ee61b4b4d013821
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
Change-Id: Icd82ea1aef90e4d638b13958519aac5ed5a53f73
Issue-ID: POLICY-2714
Signed-off-by: uj426b <uj426b@att.com>
|
|
|
|
Issue-ID: POLICY-2188
Change-Id: I6db16763c1d2d80ff934302081a8dfc16afa7d9a
Signed-off-by: liamfallon <liam.fallon@est.tech>
|
|
Issue-ID: POLICY-2451
Change-Id: I095beb674196d5ec5c4dd9b93d3a56cca5ee4788
Signed-off-by: waynedunican <wayne.dunican@est.tech>
|
|
Addressed the following sonar issues:
- use RE2 instead of java.util Pattern for "+" and "*"
- don't use deprecated methods
- for Date(long), sonar appeared not to parse the argument's
type correctly. Modified the code slightly to make sonar happy
- duplicate blocks of code
- either log or throw
- missing assert in junit
- for SDNR & VFC, eliminated threads, as they are unnecessary
- duplicate code block in different branches
- useless assignments
- redeclaring abstract methods
- cyclomatic complexity
- used lombok in some cases (e.g., EqualsAndHashCode)
- assert argument order
- actually deleted ControlLoopTargetType, because it is not needed
and sonar complains regardless of which order is used
- add private constructor to utility classes
- use StandardCharsets instead of literals
Also:
- added logback-test.xml to SO to eliminate the voluminous output
from the junit test
Issue-ID: POLICY-2305
Change-Id: I586c331781bedbd54a115a71847d04d293689445
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
This patch tests cascaded get requests with multiple revisions.
Issue-ID: POLICY-2377
Change-Id: Ie7dc849d7b930b861d38c386a9950ae7e84e2a05
Signed-off-by: liamfallon <liam.fallon@est.tech>
|
|
|
|
Issue-ID: POLICY-2389
Signed-off-by: Chris Ramstad <cramstad@ciena.com>
Change-Id: I7ce91e331a128aaadaab5ac837e19873a3388164
|
|
Issue-ID: POLICY-2377
Change-Id: Iaad1da84de058fcb50d24663156b4b0bcedd427e
Signed-off-by: liamfallon <liam.fallon@est.tech>
|
|
Due to the problems with TOSCA and version handling, the filtering for
policy types on old versions did not work. This change fixes that
problem.
Issue-ID: POLICY-2377
Change-Id: I462bd5710b9dea37475861d1021d28b2c7391a24
Signed-off-by: liamfallon <liam.fallon@est.tech>
|
|
This review amends the behaviour of "get" operations on entities to
always return the latest version of an entity when the version of the
search key is the null key (value of 0.0.0).
Issue-ID: POLICY-2377
Change-Id: I4f7c12637c90bc1a83ce2ba5ef40e15b461a7d51
Signed-off-by: liamfallon <liam.fallon@est.tech>
|
|
This review enables specification of versions of entities on incoming
service templates using a ':' delimiter.
So this will load version 1.00, version 2.0.0, and version 3.0.0:
org.onap.entitiy:1.0.0:
version: 1.0.0
org.onap.entity:2.0.0:
version: 2.0.0
org.onap.entity
version: 3.0.0
So this will load version 1.00, version 2.0.0, and version 4.0.0:
org.onap.entitiy:1.0.0:
version: 1.0.0
org.onap.entity:2.0.0:
version: 2.0.0
org.onap.entity:
version: 3.0.0
org.onap.entity:
version: 4.0.0
This will load
org.onap.entity:1.0.0
name: org.onap.entity
version: 1.0.0
This will throw an exception
org.onap.entity:1.0.0
name: org.onap.some.other.entity
version: 1.0.0
This will throw an exception
org.onap.entity:1.0.0:
name: org.onap.entity
version: 2.0.0
Issue-ID: POLICY-2377
Change-Id: I34bccf065b4ee4d2fe71b052bf009d4a40e2cba8
Signed-off-by: liamfallon <liam.fallon@est.tech>
|
|
NOTE: This review will require changes to the persistence.xml file in
other policy framework components.
This change brings in two changes:
1) Validation of the references betwen policies, policy types, and data
types
This change mans that additions to and changes to policies, policy
types, and data types must be structurally correct in the change coming
in and with whatever is already in the database
2) Hierarchical return of referenced entitites on policy types,
policies and data types.
When a policy, policy type, or data type is read from the database, the
entities referenced byt the returned policy, policy type, or data type
are returned as well.
Tests are amended for the stricter validation and structure.
Examples are corrected where they are incorrect.
Issue-ID: POLICY-1402
Change-Id: Ie6a4cb7ed336562338924079114df405f0ab889f
Signed-off-by: liamfallon <liam.fallon@est.tech>
|
|
This utility function allows a TOSCA service template fragment to be
merged with an exsiting service template and will be tbe backbone of
"create" methods on the API from now on.
Issue-ID: POLICY-1402
Change-Id: I3381cb2a1bd30621a639dedc213c546eeb2bf9aa
Signed-off-by: liamfallon <liam.fallon@est.tech>
|
|
Persistence needs to be carried out at service template level in order
to guarantee consistency of the service template in the database as much
as possible. Therefire, service template lelve reading, writing, and
delting is required.
Issue-ID: POLICY-1402
Change-Id: I5be57c29381bf6ddc87afdbb64ddae66a5ea5e5f
Signed-off-by: liamfallon <liam.fallon@est.tech>
|