Age | Commit message (Collapse) | Author | Files | Lines |
|
Addressed issues reported due to updates to the sonar rules:
- invoke only one method in a junit lambda
- complete the assertion
- add DOCTYPE to html
Issue-ID: POLICY-2650
Change-Id: Ib8b8a2e4736cc23849c0f7aef972ffa3365a3e00
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>
|
|
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>
|
|
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
|
|
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
|
|
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>
|
|
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
|
|
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
|
|
|
|
"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
|
|
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
|
|
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
|
|
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>
|
|
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>
|
|
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>
|
|
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
|
|
Issue-ID: POLICY-2204
Signed-off-by: Jim Hahn <jrh3@att.com>
Change-Id: If0a11913f614e038ecd3e8c3f0b56d3ac78b03ec
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
Update junit to add test cases
Change-Id: If3236853138a05faac5f51a859b935265c14f0d6
Issue-ID: POLICY-1945
Signed-off-by: Chou, Joseph (jc2555) <jc2555@att.com>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Refactored MapDoubleAdapterFactory, extracting DoubleConverter to be
used by code needing to convert Double to Integer/Long after being
decoded by GSON.
Enhanced StandardCoder to automatically use the above converter if
the desired class is a generic Object.
Change-Id: I1d4e83910de41ceda383f257bfea706db2b8fbbe
Issue-ID: POLICY-1919
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
Renamed a constant.
Change-Id: I5e1f2fb6de8445a8f667ea48a595773173c6beae
Issue-ID: POLICY-1791
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
CryptoUtilsTest runs slowly because the SecureRandom that CryptoUtils
uses to generate an "iv" takes a while to create enough randomness.
However, as the "iv" is only used as a "salt", it is not necessary
to use SecureRandom; the values generated by Random are sufficient.
Change-Id: I1f3b03b85d28852a7969d3a83802a2691308caa5
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>
|
|
By default, gson treats all numbers as Double when placed into a
generic Map. This is not backward compatible with existing policy
APIs. Added a type adapter that walks Map objects and converts the
Double values to Integer or Long, where possible.
Made this the default behavior in the GsonMessageBodyHandler, the
JacksonHandler, and the StandardCoder.
Also fixed a couple of checkstyle errors in the gson project.
Change-Id: I9ac0c77e6592d1c039646f0662c077b77a1e9aaf
Issue-ID: POLICY-1542
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
Class written by Jim Hahn that implements Comparable for comparing
semantic versions. Lifted from policy models pap.
Issue-ID: POLICY-1095
Change-Id: Ie8c5f9066c06cb569085e1390b3de3e4aa580267
Signed-off-by: liamfallon <liam.fallon@est.tech>
|
|
Typically, singleton classes have lots of static methods, or use
a getInstance() method to get the singleton. This provides an alternative
mechanism, similar to the JDNI and the common-paramater property registry,
where singletons can be registered.
Clean up registry after junit test.
Modified a few comments. (I prefer 90 characters for comments.)
Added a method to register or replace an existing key without throwing
an exception.
Change-Id: I3b62719013d3b5f71adb5e9299d3c1257fb55c80
Issue-ID: POLICY-1542
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
This makes it easier for a class to implement a Startable interface,
using a ServiceManager internally, while preventing other classes from
adding services to the manager (as would be the case if the class were
simply subclassed from the ServiceManager).
Changed the field name to be more descriptive.
Fixed a typo in a comment.
Change-Id: I1bed6291114d21c20d2324cbda81518bf9183139
Issue-ID: POLICY-1542
Signed-off-by: Jim Hahn <jrh3@att.com>
|
|
|
|
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>
|
|
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>
|
|
This is part 1 of introducing the mdc filter feature. Network
logging has to have interception points in order to pre/post
process messages coming in from a network endpoint.
The OrderedService interface and OrderedServiceImpl of the
drools-pdp project have now been migrated to common but is
also left in drools-pdp to mitigate disruption to existing
features. However for features that need to use common's
OrderedServiceImpl and drools-pdp version of OrderedServiceImpl
there will be a conflict with getSequenceNumber(). So a migration
of the other features is suggested.
Network logging is moved to its own util class so that feature
hooks can be invoked any time an event is being logged by a
network logger. This util class will also be accessible to
drools-applications in the case where drools-applications
would like to invoke network logging features for REST events.
Change-Id: I83d7c46e5abb351486f841c3be4d9009f7992476
Issue-ID: POLICY-1499
Signed-off-by: Daniel Cruz <dc443y@att.com>
|
|
|
|
Migrate ECOMP Policy password encryption tool to ONAP
Issue-ID: POLICY-1561
Change-Id: I9020efb7698b95c36c4ebff842a318bf8beefc69
Signed-off-by: Joseph Chou <jc2555@att.com>
|
|
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>
|
|
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|