summaryrefslogtreecommitdiffstats
path: root/utils
AgeCommit message (Collapse)AuthorFilesLines
2019-03-11Add ServiceManager classJim Hahn7-8/+601
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>
2019-03-08Merge "Add code to allocate server ports"Jorge Hernandez2-9/+156
2019-03-08Add code to allocate server portsJim Hahn2-9/+156
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>
2019-03-07Remove PropertyConfiguration classJim Hahn2-1766/+0
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>
2019-03-04Add bean configuratorJim Hahn3-0/+2050
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>
2019-03-01Add StandardCoderObject to hide GSON internalsJim Hahn5-1/+303
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>
2019-02-27Add additional encode and decode methods to CoderJim Hahn4-15/+347
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>
2019-02-27Merge "Add common coder classes"Liam Fallon6-0/+324
2019-02-27Add common coder classesJim Hahn6-0/+324
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>
2019-02-26Assertion class for DAO codeliamfallon2-0/+288
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>
2019-02-14Sonar fixesJim Hahn3-37/+43
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>
2019-02-08Add superclasses for gson-jackson migrationJim Hahn2-306/+0
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>
2019-02-05Skip all fields in gson by defaultJim Hahn2-0/+306
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>
2019-01-30Add helper class to retrive network loggerKrzysztof Opasiak2-0/+91
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>
2019-01-23Add gson to utils pomJim Hahn1-1/+5
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>
2018-11-30Update eclipselink version in policy commonJim Hahn1-3/+2
Use eclipselink from policy parent. Change-Id: I472900a82a5c8b69e1a4a1efc4b3bcb86f3965a8 Issue-ID: POLICY-1359 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-11-26Rename test classes in policy/commonParshad Patel6-6/+6
Make test classes name consistence Issue-ID: POLICY-1281 Change-Id: I2d70eda0a2fe7dc60e020dd91c743c1708d1f11a Signed-off-by: Parshad Patel <pars.patel@samsung.com>
2018-10-31Set new master version for Dublinliamfallon1-4/+3
Issue-ID: POLICY-1232 Change-Id: Icb6179ace3f320bdda3da2160afd2d058762ae5e Signed-off-by: liamfallon <liam.fallon@ericsson.com>
2018-10-24Fix refering to snapshot in policy/common1.3.1ramverma1-1/+1
Issue-ID: POLICY-1213 Change-Id: Id34f28a3f41687993009128940e9ddec69d5b88f Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>
2018-09-26Use powermock version from parent pomJim Hahn2-26/+1
Change-Id: I84fd562e7050508a75b4192ba162a09acd938986 Issue-ID: POLICY-1148 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-09-21Fix policy/common checkstyle issuesPamela Dragosh1-5/+6
The root pom.xml had a syntax error in a declaration. The suppressions xml was not being found by the sub-modules. It was better to create a copy in each of the sub-modules where we will not be fixing abbreviations or the interface declarations in own java file. Added specific checkstyle files for each submodule. One interesting note for the InheritDoc tag. It seems that the mvn compile has a bug that interprets these as missing a period after the tag. Even though the parent interface has it correctly. It was easier to just remove it than duplicate. There are new JIRA's for that work to be done in Dublin. Fixed some spacing in pom's. Issue-ID: POLICY-1131 Change-Id: I5f845958ccefd50a3b7290662da43c994870f1f7 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-09-07Remove changing of access on par fieldsliamfallon1-1/+0
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>
2018-08-28Merge "Adding usage of openpojo in policy common"Pamela Dragosh2-106/+181
2018-08-28Adding usage of openpojo in policy commonramverma2-106/+181
* Changing TestHealthCheckReport to use openpojo for testing the HealthCheckReport class. * Adding a custom Tester implementation called ToStringTester as a utility to test toString() method of classes using openpojo. Change-Id: I491a23c471d50454b4d5591c6c09c6758e2c0624 Issue-ID: POLICY-1035 Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>
2018-08-23Make checkstyle warnings failPamela Dragosh1-1/+1
For this repo, we add an suppression filter for some abbreviation names. It is far too cumbersome to rename these checkstyle issues at this time. We will do so post-Casablanca release. We copy the oparent checkstyle pom settings and set to fail on any warnings. Change-Id: Icfbd005819a3289acd30796693be85c2ea460212 Issue-ID: POLICY-881 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-08-22Adding common utility classes to policy/commonramverma2-0/+125
* Adding HealthCheckReport class to policy/common for wider use among all policy modules. * Adding utility class called ParameterValidationUtils for providing common validation methods to all policy modules. For now, it has only 3 validation methods but we all can add more in future. Change-Id: I363fe116ba74f25299fd71211be73505b3164f72 Issue-ID: POLICY-1035 Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>
2018-08-13Fix checkstyle in utilsPamela Dragosh18-90/+149
Cleared all the checkstyle in these 2 submodules. Issue-ID: POLICY-881 Change-Id: I248e1894aebf549d5a4f8669a6466ec227d40b55 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-08-03Fix pom and checkstyle warnings in commonliamfallon1-2/+0
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>
2018-07-31Add resource handling utility classliamfallon3-0/+541
Add ResourceUtils, a class that provides utility methods for dealing with Java resources on the classpath. Change-Id: Ie4df249315ad145aabdfb35bb827ffbf6d79e095 Issue-ID: POLICY-922 Signed-off-by: liamfallon <liam.fallon@ericsson.com>
2018-07-25Copy policy-endpoints from drools-pdp to commonmmis3-0/+160
Issue-ID: POLICY-967 Change-Id: I374c155ee102c3e157c60d0a22d7191544abb76a Signed-off-by: mmis <michael.morris@ericsson.com>
2018-06-21Merge "Delete SpecPropertyConfiguration class"Pamela Dragosh2-644/+0
2018-06-20Merge "Add CurrentTime utilities"Pamela Dragosh2-0/+120
2018-06-20Delete SpecPropertyConfiguration classJim Hahn2-644/+0
Change-Id: Ie97d2c396ec6df1e03287a7ecb866bc8acf6cfbc Issue-ID: POLICY-907 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-06-19Add CurrentTime utilitiesJim Hahn2-0/+120
Add some comments. Update license text. Change-Id: I4cee208378c44d9730274aee337feb95f9026add Issue-ID: POLICY-908 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-06-19Merge "Move SpecProperties from drools-pdp to common"Pamela Dragosh2-0/+341
2018-06-18Move SpecProperties from drools-pdp to commonJim Hahn2-0/+341
Change-Id: Ifa1785922b42f990d4d84c1410dd1d881b10647d Issue-ID: POLICY-907 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-06-18Use setXxx() methods for @Property fieldsJim Hahn4-180/+534
Fortify generates a security exception when PropertyConfiguration attempts to directly update private fields. PropertyConfiguration has been modified to invoke setXxx() methods, instead, to set the values for the fields. Add junit tests for new methods. Change-Id: Ic4420b6348724c5a384d3c2c8bf7b4c0c6350fa9 Issue-ID: POLICY-906 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-06-05Update policy-common to SNAPSHOT-1.3.0liamfallon1-1/+1
Snapshot updated for Casablanca. Change-Id: Ife941f771b02be68e35fd638adfac78cf2b3ba99 Issue-ID: POLICY-875 Signed-off-by: liamfallon <liam.fallon@ericsson.com>
2018-05-21Update Policy Common to 1.2.3-SNAPSHOTliamfallon1-1/+1
These reviews must be merged in order because of layering. This review should be merged FIRST. Issue-ID: POLICY-844 Change-Id: I7cf07902c3b2d7766dc64f1c1dd80d91dee18467 Signed-off-by: liamfallon <liam.fallon@ericsson.com>
2018-05-16Upgrade SNAPSHOT to 1.2.2liamfallon1-1/+1
These reviews must be merged in order because of layering. This review should be merged FIRST Change-Id: If143b2d23487c073fafad8f6208cd8d320ec98e9 Issue-ID: POLICY-798 Signed-off-by: liamfallon <liam.fallon@ericsson.com>
2018-04-13Upgrade SNAPSHOT to 1.2.1Pamela Dragosh1-1/+1
Issue-ID: POLICY-736 Change-Id: Iccb43b692908ffc35fc0d18da1e967718e3c3519 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-03-25Add PropertyConfiguration classJim Hahn15-0/+2896
Added PropertyConfiguration class, which provides for the loading of properties into the fields of a subclass. Annotations are used to identify the field to be loaded and the name of the property from which it is to be loaded. Changed attribute "useDefault" to "emptyOk" so that it only has to be specified when the default value is empty. Reformatted a couple of files. Added setAllFields() method. Added getRawPropertyValue() method so subclasses can change how values are extracted from the property set. Added SpecPropertyConfiguration so controller or session names may be embedded within property names. Fixed some typos. Refactored out generalizeType2(). Changed exception classes to take field name instead of Field object. Modified getValue() to take the field name and class type instead of Field object. Removed or fixed comments in junit tests. Added more junit tests. Changed emptyOk attribute to accept, to facilitate adding other options in the future. Corrected comments on the isEmptyOk() methods. Change-Id: I6b190fea687f87cf512fb3236bfcf40b7adc4566 Issue-ID: POLICY-577 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-03-16Removed checkstyle warningsmmis6-448/+444
Removed checkstyle warnings in policy/common/utils Issue-ID: POLICY-695 Change-Id: I831b74c889d44784d6328619d88eb92fb524ce74 Signed-off-by: mmis <michael.morris@ericsson.com>
2018-02-20Consolidating and organizing dependenciesPamela Dragosh1-1/+0
This is the first sweep to organize the dependencies. I did upgrade the JUnit in this repo to 4.12 as I thought this would be harmless. Issue-ID: POLICY-626 Change-Id: I4dc120d2d48830b282d9a173ab69cc553a4d5e78 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-02-10Add AutoClose wrappers for JPA classesJim Hahn7-0/+770
Added EntityMgrCloser and EntityMgrTrans classes that will automatically close/rollback the wrapped JPA classes. As a result, these classes can be used in try-with-resource statements to ensure that the JPA EntityTransaction is rolled back and the EntityManager is closed. Add "build" section into pom to make it consistent with other poms in common. Changed scope to "provided" in utils pom for javax.persistence to prevent clashes with other projects that depend on the utils project. Changed scope to "test" in utils pom and to "provided" in utils-test pom for junit. Fixed license date in EntityTransCloser. Fixed license titles in utils & utils-test source files. Moved files from package xxx.test.jpa to package xxx.jpa, because they are not test-specific classes. Include exception when logging message in ThrowablesTester, hopefully eliminating sonar complaint. Change-Id: I531f20d93a679d4bb432c1d75c1feac0e334bc44 Issue-ID: POLICY-582 Signed-off-by: Jim Hahn <jrh3@att.com>