aboutsummaryrefslogtreecommitdiffstats
path: root/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http
AgeCommit message (Collapse)AuthorFilesLines
2020-01-14Sonar cleanup overrides and fixesPamela Dragosh1-3/+4
Removal of UTF-8 because its already set capabilities doesn't generate any code, no need to include override false positives for passwords etc. override for logging and exception throw that we want add synchronized to overrides that are synchronized ignore checking of some conditions adding synchronized to match set* methods Issue-ID: POLICY-2321 Change-Id: I26d9ca22a0cdd67fdaae9c44b718b8dc103f190e Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-11-01Add common Jersey versionliamfallon2-13/+14
Add a common version of Jersey for all Policy Framework components. Issue-ID: POLICY-2209 Change-Id: I8554a97e9f13887418118966bfe1043b65d9a179 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-09-16Eliminate constructors with side-effectsJim Hahn2-2/+5
Several of the Gson and Jackson handlers take a GsonBuilder, which they then configure with additional adapters prior to create a Gson object that they subsequently use. The code has been modified so that the constructors no longer take a GsonBuilder, thus eliminating the side-effects that they had on the builders. Instead, a configBuilder() method has been added to the handler classes that makes it clear tht they modify the GsonBuilder. This also has the advantage that classes that want a Gson object configured per a given handler need only call that handler's configBuilder() method; previously, they had to constructor the handler and then retrieve its gson object. Also updated a few tests to specify the HTTP "Accept" header to ensure that return results are in yaml format. Change-Id: I2ef98198041ff9f73913d01ee6ee14ecf20ba617 Issue-ID: POLICY-2081 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-09-13Extract YamlJsonTranslator from StandardYamlCoderJim Hahn3-26/+81
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>
2019-09-13Changes to accomodate to version of jettyJim Hahn1-6/+7
With a newer version of jetty being used, a couple of methods have been deprecated. Modified the code to use the facilities appropriate to the new jetty version. Change-Id: Idcaef11836841480c24b1721c06ed642d3d4394a Issue-ID: POLICY-2100 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-09-12Report bad-request for invalid YAMLJim Hahn4-6/+78
Added classes and modified code to report bad-request when a servlet attempts to read invalid YAML. Change-Id: Iacddee92a448fb69d5c778a3c3f3f2b5528983f7 Issue-ID: POLICY-2085 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-09-11Create StandardYamlCoderJim Hahn2-1/+112
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>
2019-08-23Rest servers should return 400 for bad syntax JSONJim Hahn2-1/+57
Modified common RestServer to inject an exception handler into the list of providers so that it returns 400 instead of 500 for JSON parsing errors. Change-Id: I7c77625e3531e26413d72cc386296a709946cda2 Issue-ID: POLICY-1725 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-07-31Remove ParameterUtilsJim Hahn1-1/+1
Removed ParameterUtils. Also made RestServer.getServerProperties() protected so it can be overridden. Also fixed issue in TopicParameterGroupTest to prevent it from validating static fields. Change-Id: Icb4580f5802b9edca489a38896d61ad24aece449 Issue-ID: POLICY-1953 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-07-17Copy PapRestServer to policy/commonJim Hahn2-0/+146
Copied and renamed the class to RestServer. Also modified it to derive from ServiceManagerContainer. Added getName() method to HttpServletServer, which facilitated the refactoring. Renamed "controllers" to "providers". Change-Id: I905166e41063e3fe84e356fd6c4a91ca9d4cb8a6 Issue-ID: POLICY-1652 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-07-08Merge "Fix sonar issues in policy/endpoints"Jim Hahn7-40/+147
2019-07-05Fix sonar issues in policy/endpointsJim Hahn7-40/+147
Sonar fixes, other than code coverage. These changes are disruptive and will likely cause breakage in a number of policy repos. Renamed constants. Moved constants/factories from interfaces to classes. Change-Id: I182d50320aa6b53e383081af806c60dd2f806cbe Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-07-05Fix sonar issue in common/utilsJim Hahn1-1/+2
Renamed a constant. Change-Id: I5e1f2fb6de8445a8f667ea48a595773173c6beae Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-26Fix some sonar issues in policy-endpointsJim Hahn3-190/+145
Refactored various classes to reduce cyclomatic complexity. Introduced some endpoint utility classes to facilitate extraction and conversion of property values, and populating of common "builder" values. Change-Id: Ie1c91cd94cb54700dc9127f72780b4d94b82ec39 Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-14Change getCanonicalName() to getName() in commonJim Hahn1-2/+2
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>
2019-06-12Apply simple sonar fixesJim Hahn1-7/+7
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-04-12Set jetty.dump to tracePamela Dragosh1-11/+11
Makes Junit debugging more simple. Issue-ID: POLICY-1641 Change-Id: I5835f608e468e90e11d923973d726b0313e91189 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2019-03-08Add code to allocate server portsJim Hahn1-30/+9
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-02-15Remove erroneous commentsJim Hahn2-8/+0
Some comments still said that including the maven artifact, jersey-media-json-jackson, could override gson behavior, but that is no longer true. The comments have been removed. Change-Id: I9b6477b76f835b96c52ccb9777b80791fc6b1d77 Issue-ID: POLICY-1428 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-02-13Add gson handler and testsJim Hahn2-1/+5
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-08Add superclasses for gson-jackson migrationJim Hahn1-128/+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-01-23Add gson support to policy-endpointsJim Hahn7-68/+253
Added "provider" property to both http client and server builders. The provider defaults to jackson, to maintain backward compatibility until other policy code has been converted to gson. Removed commented item from pom. Added some comments and re-arranged a few pieces of code. Fixed a few typos and removed spacing at the end of some lines. Reordered imports. Added comments about limitations when using jersey-media-json-jackson. Address ridiculous checkstyle complaint. Support comma-separated list of serialization providers in jersey client. Disabled metainf discovery from jersey client and server so that the media-json dependencies could be re-instated in the pom. Address another ridiculous checkstyle complaint. Change-Id: Ic5a93b475d0ee9b435352b3516de6b865b00a86a Issue-ID: POLICY-1428 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-01-16Add post and delete http client methodsJorge Hernandez4-43/+164
Additional clean up for sonars have also been added for the classes that have been modified Issue-ID: POLICY-1367 Change-Id: Ie97d9057273e89850420a7c1b5b2d275709bdfd0 Signed-off-by: Jorge Hernandez <jorge.hernandez-herrero@att.com>
2019-01-15Remove policy-endpoints checkstyle suppressionsJim Hahn4-369/+419
Split class files so each file only contains one class. Change-Id: Iaf94c4c079380dc7db3aff2affbe48f50e3cc0a2 Issue-ID: POLICY-1134 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-12-19Add support for parameter inheritanceliamfallon1-45/+33
Common parameter support does not allow for inheritance of parameters from a super class. This change allows inheritance of public and protected members from a parameter superclass to a parameter subclass. Issue-ID: POLICY-1222 Change-Id: Ia4f452abab80953b41784c44e4202e8d5405a197 Signed-off-by: liamfallon <liam.fallon@est.tech>
2018-10-26Detection of AAF enablement3.0.0-ONAPJorge Hernandez3-1/+30
Change-Id: I049e88bec2c83f6224ba1d1f24b93e0fb1aa807e Issue-ID: POLICY-1216 Signed-off-by: Jorge Hernandez <jorge.hernandez-herrero@att.com>
2018-10-01Fix minor sonarPamela Dragosh1-4/+3
These are mainly duplicate strings. But also combined if statements and fixing some debug messages missing arguments or format specifiers. Some duplicates I left alone as it seemed unreadable to change them. Also moving variables to their correct place (before constructors). Issue-ID: POLICY-1130 Change-Id: I8018c676b22fe8fec635f129fa37921ad1004569 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-09-21Fix policy/common checkstyle issuesPamela Dragosh4-16/+26
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-19tweaks from testing in auth classesJorge Hernandez2-3/+2
Change-Id: Idb1346ca645ffcc55808e25c8957e01d27a48a75 Signed-off-by: Jorge Hernandez <jh1730@att.com> Issue-ID: POLICY-1043
2018-09-19error getting aaf configuration flagJorge Hernandez2-2/+2
Change-Id: I98c3a3f4abef0f46a4cccf8e79ed58f65f328b2c Signed-off-by: Jorge Hernandez <jh1730@att.com> Issue-ID: POLICY-1043 Signed-off-by: Jorge Hernandez <jh1730@att.com>
2018-09-19Merge "Fixes for oparent upgrade"Jorge Hernandez1-2/+5
2018-09-18Fixes for oparent upgradePamela Dragosh1-2/+5
Small code fix to support jetty upgrade within oparent 1.2.1 from 9.3.* to 9.4.* Issue-ID: POLICY-1126 Change-Id: Id2df5579d05acc738d5edfd055f42628b545dd5a Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-09-18Add comments and removed redundant code in FiltersJorge Hernandez2-9/+14
Change-Id: I57db9a90550e89ccf23f23de608eedb5d0b7f4ff Signed-off-by: Jorge Hernandez <jh1730@att.com> Issue-ID: POLICY-1043 Signed-off-by: Jorge Hernandez <jh1730@att.com>
2018-09-18Support for Authorization Generic FiltersJorge Hernandez4-1/+155
These will aid applications using there own authorization system at their desired granularity. Change-Id: Iba7fca8742127bcec177b93452f111d28c7f8ec7 Signed-off-by: Jorge Hernandez <jh1730@att.com> Issue-ID: POLICY-1043
2018-09-17temporarily set aaf version to snapshotJorge Hernandez1-6/+17
With the latest released version of AAF, encountered problems when testing AAF. This seems to be resolved when migrating to the not-released yet, 2.1.2-SNAPSHOT. Checking further into AAF jira's it seems that some necessary fixes have gone into 2.1.2-SNAPSHOT (see for example AAF-460). The assumption is that 2.1.2-SNAPSHOT will be soon released by AAF team, and then we should appropriately change this version. In addition, there has been enhancements to allow policy apps to configure additional filters. These will be used initially by specific "rest" servers to provide additional authorization capabilities. Change-Id: I48e279738de20bd68e3f05323ad9b6cffdafc83e Signed-off-by: Jorge Hernandez <jh1730@att.com> Issue-ID: POLICY-1044 Signed-off-by: Jorge Hernandez <jh1730@att.com>
2018-08-30Add support for http PUTmmis3-11/+25
Added support for http PUT for use by the policy forwarder in policy/distribution Issue-ID: POLICY-926 Change-Id: Ifa5c2e8be0582797936b95b772ad236f35c10f24 Signed-off-by: mmis <michael.morris@ericsson.com>
2018-08-20Use builder for http and jersey clientKrishnajinka2-34/+46
Sonar issue with more than 7 params in a method. Use builder object instead of params. Rework2 for fixing review comments. Add modifications copyright Issue-ID: POLICY-1017 Change-Id: Ib0fa692f8da770dcba06158d6e6cafbed2969c27 Signed-off-by: Krishnajinka <kris.jinka@samsung.com>
2018-08-15Fix checkstyle comments etc.Pamela Dragosh3-12/+29
Adding javadoc comments, renaming variables names, fixed whitespace and 120 length. Also some variables were made final since they were declared further from usage. Splitting out Asserts. Still remaining are the abbreviations. Issue-ID: POLICY-881 Change-Id: I31ce5a9eea02578bce023c0c607a19108bb726fa Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-08-13Remove simple checkstylePamela Dragosh6-68/+81
Mostly concentrated on the period at the end of summary. But I did clear a few others for longer than 120 characters and placement of methods next to each other. Possibly a few others. I did not clear everything, but will submit a few more reviews to get the others. Issue-ID: POLICY-881 Change-Id: I692a5349d686d52fee4040757cdc2ed8b5cc221b Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-08-08generic jetty filter and cadi supportJorge Hernandez3-12/+49
Change-Id: I363e44e85e1d89c6254218629010d5c3e1507e0a Issue-ID: POLICY-1043 Signed-off-by: Jorge Hernandez <jh1730@att.com>
2018-08-03generic jetty https server supportJorge Hernandez3-19/+101
jetty https support in constructor, or by using ".https" when creating an http server service. Change-Id: I94e8e3e4b93eb6b194657028c740b6781316c7da Issue-ID: POLICY-940 Signed-off-by: Jorge Hernandez <jh1730@att.com>
2018-07-31Copy policy-endpoints from drools-pdp to commonmmis6-400/+331
Removed changes made in commit b40acf2d244058c162a8597968e59f2708e6abf4 that went beyond the scope of POLICY-967 Issue-ID: POLICY-967 Change-Id: Ibbf78540dec8bf8601a62dacc8c7056d43f70ba1 Signed-off-by: mmis <michael.morris@ericsson.com>
2018-07-25Copy policy-endpoints from drools-pdp to commonmmis9-0/+1588
Issue-ID: POLICY-967 Change-Id: I374c155ee102c3e157c60d0a22d7191544abb76a Signed-off-by: mmis <michael.morris@ericsson.com>