summaryrefslogtreecommitdiffstats
path: root/gson
AgeCommit message (Collapse)AuthorFilesLines
2019-07-17Convert double to int when decoding via gsonJim Hahn4-98/+325
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>
2019-07-11Fix checkstyle issues in common/gsonJim Hahn6-68/+107
Also deleted the checkstyle suppression file. Change-Id: I6d310af32d6d4be9633a8f88745447f40a566af7 Issue-ID: POLICY-1074 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-21Bump common to 1.5.1 SNAPSHOTPamela Dragosh1-1/+1
Released 1.5.0 Issue-ID: POLICY-1737 Change-Id: I51b1c264d52cab2b2501dce7c5b0e7805d39ad5c Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-06-12Apply simple sonar fixesJim Hahn12-32/+25
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>
2019-05-28Change version to 1.5.0Pamela Dragosh1-1/+1
Upgrade minor review for El Alto. Update to policy/parent Issue-ID: POLICY-1747 Change-Id: I5c54479d7b1e1951e52580c40127177e5f6d389d Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-05-01Bump common snapshotPamela Dragosh1-1/+1
In prep for next version. Issue-ID: POLICY-1700 Change-Id: I4dec2414dbd3d0d941bf24e9cd359265d7105371 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-04-29Fix sonar issue with double compare4.0.0-ONAP1.4.0Jim Hahn1-2/+2
The gson code to convert Double to Long/Integer use a direct comparison of the original double with a long. However, sonar does not like that so changed the code to use the Double.compare() method instead. Also fixed sonar issue with diamond operator. Addressed some sonar issues in ServiceManager. Addressed some sonar issues in Version. Change-Id: I0959603918d251db671e87e12c295c6ec911f427 Issue-ID: POLICY-1707 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-11Don't map JSON values to DoubleJim Hahn9-14/+357
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>
2019-03-14Add support for TOSCA JSON Parsingliamfallon2-1/+11
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>
2019-02-22Log which gson style is being usedJim Hahn2-2/+8
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>
2019-02-18Remove jackson from policy-endpoints pomJim Hahn1-5/+0
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>
2019-02-15Add log message when gson usedJim Hahn2-0/+11
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>
2019-02-15Remove unneeded jackson referencesJim Hahn1-6/+0
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>
2019-02-14Merge "Add gson handler and tests"Jorge Hernandez2-0/+182
2019-02-13Refactor common class from gson codeJim Hahn5-230/+381
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>
2019-02-13Add gson handler and testsJim Hahn2-0/+182
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>
2019-02-13Merge "Fix sonar issues in gson superclasses"Liam Fallon6-15/+22
2019-02-13Merge "Add jackson behavior for fields"Liam Fallon6-0/+752
2019-02-12Add jackson behavior for methodsJim Hahn16-8/+1421
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>
2019-02-12Add jackson behavior for fieldsJim Hahn6-0/+752
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>
2019-02-12Fix sonar issues in gson superclassesJim Hahn6-15/+22
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>
2019-02-11Add Serializer interfaceJim Hahn1-0/+38
Added missing Serializer interface, needed by other gson classes. Change-Id: I4c37dea89011a833d71c11e2d2c4d74ad768e750 Issue-ID: POLICY-1428 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-02-08Add superclasses for gson-jackson migrationJim Hahn16-0/+2899
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>