Age | Commit message (Collapse) | Author | Files | Lines |
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Issue-ID: POLICY-2188
Change-Id: I00843c61a6567001fc35c3ebb77b6843a1eb7da2
Signed-off-by: liamfallon <liam.fallon@est.tech>
|
|
Addressed the following issues:
- unused imports
- unused method parameters
- use assertEquals, assertSame instead of assertTrue
- provide the parametrized type for this generic
Also fixed some checkstyle issues:
- removed blank lines between "import" groups
Issue-ID: POLICY-2650
Change-Id: I004bb650ac10c49ccd0fc405f6959896fec39f9b
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
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
|
|
Per javadocs, getName() should generally be used instead of
Class.getCanonicalName().
This change only applies to classes; it does not apply to File
objects.
Change-Id: Iea0995d1167f4837607f194d35f0193eeedeacd7
Issue-ID: POLICY-1646
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
Note: this does not increase code coverage, but should fix other
code issues.
Resolved cyclomatic complexity issue in ParameterValidationResult.
Refactored duplicate code in GroupValidationResult.
Removed IOException from NetworkUtil "throws".
Replaced null/empty string tests with StringUtils.isBlank().
Added @FunctionalInterface where needed.
Replaced anonymous classes with lambda expressions.
Replaced duplicate strings with a constant.
Added private constructors for utility classes.
Removed sleep() from tests.
Removed unused parameter from method call.
Made some protected methods private.
Compute integrity monitor's state-transition table once.
Use for-loop instead of iterator.
Moved constructors.
Fixed some checkstyle issues (tabs => spaces, trailing spaces).
Change-Id: I9a962ca45c4ff3f212c6014da799d06f07b232ef
Issue-ID: POLICY-1791
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
Note: A number of these were identified, by SonarLint, in the Test
classes, which are not typically scanned by Sonar.
Removed unnecessary imports.
Removed unneeded "throws Xxx".
Replaced lambda with method references.
Replaced duplicate strings with constants.
Replaced try-fail-catch with assert-j methods to eliminate sonar
complaints about duplicate failure messages.
Added missing @Override annotations.
Use map.computeIfAbsent() where appropriate.
Also fixed some minor checkstyle issues.
Removed unneeded "volatile" declarations.
Replaced some if-else constructs with "?:" construct, per sonar.
Replaced Object.wait() with CountDownLatch.await(); according to sonar
(and javadocs), Object.wait() can return due to "spurious wakeups".
Fixed issue whereby CryptoUtilsTest wouldn't run in my Eclipse.
Change-Id: Ib6b71ed65662cfd6209400dac57ed69279bf29ec
Issue-ID: POLICY-1791
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
Change-Id: I928eeb6bf52cb9e825db456278ce8bff449c692c
Issue-ID: POLICY-1762
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
Added implementations of ValidationResult for arbitrary objects and
for beans (i.e., containers of arbitrary objects).
Change-Id: I4c6f35bd19f1386062ce19125cbc648c399cc331
Issue-ID: POLICY-1542
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
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>
|
|
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>
|
|
Parameter handling refactored to remove changing of
access on fields in parameters, new implementation requires
getters to be defined for all fields.
Note: This change causes a knock on into distribution
Change-Id: I172f5d9310caf92d6ea825ff93292019c00a47c3
Issue-ID: POLICY-1095
Signed-off-by: liamfallon <liam.fallon@ericsson.com>
|
|
Add proper handling for optional parameters
Add setName() to the parameter group interface to force definition
of that method
Add some convenience metnods to parameter service
Issue-ID: POLICY-1035
Change-Id: Iaa9226f45215b00aff9b78ab5fc120c24a0af46d
Signed-off-by: liamfallon <liam.fallon@ericsson.com>
|
|
In GroupValidationResult & GroupMapValidationResult, the setResult
method was not setting the actual status that it has recieved from the
nested group rather it was setting its own status again. Due to which
the validation status of overall ParameterGroup was coming as CLEAN even
if a nested child has reported it as INVALID.
Changed the expected validation result texts for TestValidation accordingly.
Change-Id: I5943decce39574089ca74f9bbccbfbe66d8d542c
Issue-ID: POLICY-1035
Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>
|
|
Some dependency versions are now managed in the master POM
Checkstyle showed up some warnings in paramters and capabilities.
Change-Id: Ifebd8a076bdb3fda626b5b1fda9324801bf58643
Issue-ID: POLICY-716
Signed-off-by: liamfallon <liam.fallon@ericsson.com>
|
|
Parameter validaiton updated to generically support nested groups of
parameters, and nested maps of parameters.
Unit test showing JSON parameter input added.
Unit test showing YAML parameter inout added.
Test parameter group classes moved into subdirectory
This allows parameters to be unmarshaled seamlessly from JSON and YAML
files.
Change-Id: I768e11f31ee7f62299c4d5d95ab68a005d1aff16
Issue-ID: POLICY-922
Signed-off-by: liamfallon <liam.fallon@ericsson.com>
|
|
This common module is proposed to handle all parameters and properties
for the ONAP Policy Framework in a common way.
Parameters and Properties:
- are validated once when they are loaded and need not be checked again
in classes that use them
- are available for lookup in a parameter service, they need not be passed
in constructors and method arguments
- are input using a single implementiation of input method only
(JSON/YAML/Java properties/REST)
- are defined in a schema and the schema is used for validation as much
as possible
Issue-ID: POLICY-922
Change-Id: I1fac88b9e952b6b5fcbea04319cb4294a9653327
Signed-off-by: liamfallon <liam.fallon@ericsson.com>
|