aboutsummaryrefslogtreecommitdiffstats
path: root/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm
AgeCommit message (Collapse)AuthorFilesLines
2020-01-14Sonar cleanup overrides and fixesPamela Dragosh1-4/+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-10-29Cleanup eclipse warnings in commonJim Hahn1-1/+1
Issue-ID: POLICY-2204 Signed-off-by: Jim Hahn <jrh3@att.com> Change-Id: If55ea1a804997ab751f15813e6b643572d4f189f
2019-07-30Fix managed noop topic sourceJim Hahn2-12/+9
NOOP topic sources configured via TopicParameterGroup are left unmanaged. Removed a new override method, as it did not pass the "managed" flag down, while the method that already existed in the superclass already works correctly. Also restored "null" lists to TopicParameterGroup so-as not to break the behavior of its validate() method. Change-Id: Id392a3263c3bd1c8f278461715b441719817c47c Issue-ID: POLICY-1953 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-07-29Add addTopic(List<TopicParams>)Jim Hahn5-11/+136
New services are typically configured using TopicParameters. These are converted into Properties before being passed to TopicEndpoint.addTopic(), which then converts them into BusTopicParams before configuring a given topic. Added TopicEndpoint.addTopic(List<TopicParams>), which makes it possible to configure the topics without going into the intermediate Properties. Furthermore, because TopicParams is a subclass of BusTopicParams, no conversion is needed for that either, so the TopicParams can be passed directly into the configuration classes. Incorporated changes from review. Change-Id: Id87e2c6812e36ae1a3ac680e6b35208667971782 Issue-ID: POLICY-1953 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-07-25Changes to add missing topic parametersa.sreekumar1-100/+5
Changes to support parameters which would be critical to run in a secure environment. Change-Id: Ia7df174261041b35e57b9f1f2be7552e5dcd2cec Issue-ID: POLICY-1744 Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
2019-07-05Fix sonar issues in policy/endpointsJim Hahn22-172/+284
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-06-26Fix some sonar issues in policy-endpointsJim Hahn6-636/+244
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-12Apply simple sonar fixesJim Hahn5-37/+27
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-03-19Add method to support configure all topics at onceJorge Hernandez2-0/+16
regardless of type (source or sink) Change-Id: Idaebae611746e364364d35375519173a7461ae61 Issue-ID: POLICY-1608 Signed-off-by: Jorge Hernandez <jorge.hernandez-herrero@att.com>
2019-03-19Merge "TopicSinkClient support for unmanaged topics"Pamela Dragosh1-9/+22
2019-03-18TopicSinkClient support for unmanaged topicsJorge Hernandez1-9/+22
Change-Id: I6b92dcc0f225aa712b34adb9a1f9ab47df412c81 Issue-ID: POLICY-1608 Signed-off-by: Jorge Hernandez <jorge.hernandez-herrero@att.com>
2019-03-13Add Network Logging FeatureDaniel Cruz5-26/+21
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>
2019-03-11Add ServiceManager classJim Hahn1-3/+0
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-06Adding client class for sending message to topicramverma2-0/+155
1) Adding TopicSinkClient class for sending messages to topic. The same class will be used for PAP->PDP & PDP->PAP communication. 2) Once this review is through, will raise another one to remove PdpClient from policy/pap. Change-Id: I7253683d9e88885cfbe2ac9041d01da239b9321b Issue-ID: POLICY-1443 Signed-off-by: ramverma <ram.krishna.verma@est.tech>
2019-02-21Support for lab contextual topic names.Jorge Hernandez12-39/+106
This work allows a drools application, with its drl template to refer to the topic name by its invariable canonical name, ie. POLICY-CL-MGT. Since the drl is a design time artifact, it is desired to know topics by its canonical non-changeable name. The actual per lab environment topic name may change on a per deployment basis, for example POLICY-CL-MGT-WINDRIVER or POLICY-CL-MGT-TLAB. The template can still use POLICY-CL-MGT without modification but the actual installation configuration would use the "effectiveTopic" property to point to the right topic on a per lab basis. This also helps with installation (long story) since the canonical topics will be known ahead of time. Change-Id: I8322bf7e427569c37a76eea5ce6d5b9547cb2ff3 Issue-ID: POLICY-1534 Signed-off-by: Jorge Hernandez <jorge.hernandez-herrero@att.com>
2019-02-13Add gson handler and testsJim Hahn2-1/+12
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-08Return true only if thread has been really startedKrzysztof Opasiak1-1/+2
Accortding to doc start() should return true if start operation was successful. Unfortunately value of this.alive may change between end of synchronized block and return for example when other thread executes stop() in parallel. Change-Id: I4103f0f4c65620c47b4acf2d276f104937b91187 Issue-ID: POLICY-1387 Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2019-01-31Fix potential race conditionKrzysztof Opasiak1-1/+1
init() is currently called outside of synhronized block. This is may lead to race condition as init() creates new bus consumer (this.consumer) which is the copied and nulled in stop() synchronized block. This may lead to race condition if: Thread #1 Thread #2 this.alive = true; this.alive = false consumerCopy = this.consumer; this.consumer = new Consumer(); // false if(consumerCopy != null) { consumerCopy.close(); } else { log.warn(); } As a result, new BusConsumers are being created but they are never close(). Issue-ID: POLICY-1387 Change-Id: I2eadb12ef1c4b07b9e47dc6ebc096acc713299a0 Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2019-01-31Exteract common paramsKrzysztof Opasiak1-36/+21
Most of parameters used to initialize consumers are repeated in every branch. Instead of having 3 copies of the same code let's extract all common values and then add only those which are specific to given consumer type. Change-Id: I5884f6dd77a7e2f1a7f7614c909c1cad4826d4f1 Issue-ID: POLICY-1387 Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2019-01-31Don't reinit allowSelfSignedCertsKrzysztof Opasiak1-8/+4
allowselfsignedcerts field is defined and initialized in BusTopicBase so there is need to overwrite it once agin with the same value. Change-Id: Id0a389921954606392eb2cb3c23cd0d8ee3dc4ae Issue-ID: POLICY-1387 Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2019-01-31Remove constant from Topic interfaceKrzysztof Opasiak1-11/+7
Fix sonar issue: Move constants to a class or enum Issue-ID: POLICY-1486 Depends-On: I453a14c3dda337f2a4d08914ead32b37adc17353 Change-Id: I6baac1fe6e692074bca971f3c35bb2a29cb49205 Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2019-01-31Use helper class to retrieve network loggerKrzysztof Opasiak3-14/+18
Instead of abusing constant from Topic interface use new dedicated helper class to retrive network logger. Issue-ID: POLICY-1486 Change-Id: Ia715aafb578aeb2842566de2623e8d22e42652fc Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2019-01-23Add gson support to policy-endpointsJim Hahn1-1/+11
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-15Remove policy-endpoints checkstyle suppressionsJim Hahn8-1128/+1215
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>
2019-01-11Adding NOOP sources supportJorge Hernandez12-736/+1204
In addition, Noop* classes have been refactored to increase code reuse and clean some checkstyle issues. Additional Junits have been added for existing functionality. Change-Id: I072f9ff2f415630ac82eca949a8360249f73da86 Issue-ID: POLICY-1397 Signed-off-by: Jorge Hernandez <jorge.hernandez-herrero@att.com>
2018-11-27Fix checkstyle issue in policy commonKrishnakumar Jinka1-31/+34
Move method into class it is being called. Fix minor checkstyle formatting in the class. The changes have side effects hence revert some changes. Modify the javadoc tags Issue-ID: POLICY-1251 Change-Id: Iecb513dafe3f60628664f3e60d6c49d3e4ce3148 Signed-off-by: kris.jinka <kris.jinka@samsung.com>
2018-11-06Update dmaap code for 1.1.9Pamela Dragosh2-7/+7
The new version has changed class names. Issue-ID: POLICY-1229 Change-Id: Id268b1a57667ffa3b5950dba7c10db2181586245 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-09-29Fix RestManager test issueJim Hahn2-2/+2
Apparently drools-pdp code depends on Dmaap topic factories throwing IllegalArgumentException instead of IllegalStateException (which is what the other topic factories throw) when an unknown topic name is requested. Therefore, the change to make them consistent has been backed out. Change-Id: Ia3d7e26a61027977eb626c9ddad6369982eae002 Issue-ID: POLICY-1148 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-09-28Add junit coverage to rest of policy-endpoint busJim Hahn5-11/+27
Also extracted out common code from tests. Fix checkstyle issues. Be consistent in returning IllegalStateException when topic is not found by any Topic Factory. Added/updated some comments. Use better name for "validate" argument. Renamed test() to testDestroy(). Added NoopTopicPropertyBuilder. Renamed BusTopicTestBase to TopicTestBase. Change-Id: Id4c7ab9f2b5572dc5195b0da116e285c5e9b6f06 Issue-ID: POLICY-1148 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-09-27Add coverage for policy-endpoints busJim Hahn2-11/+26
Added license. Fix checkstyle warnings. Change-Id: I2279b8b80b3dc175583353ced3d71c3a5cc4f975 Issue-ID: POLICY-1148 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-09-26Add junit coverage to policy-commonJim Hahn3-9/+23
Added coverage tests for policy-endpoints. Fixed new checkstyle warnings. Use powermock version from parent pom. Replaced literals with constants in new tests. Moved test superclass higher up the class hierarchy so it can be re-used. Removed powermock version. Change-Id: I7d3d45132cd0973f4d02d3af320a1d53a1234e4d Issue-ID: POLICY-1148 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-09-21Fix policy/common checkstyle issuesPamela Dragosh11-119/+15
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-08-20Use builder for http and jersey clientKrishnajinka5-64/+129
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 Dragosh12-128/+148
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-14Modify topic factory to use builder paramKrishnajinka6-369/+257
Fix sonar issue with method build using more than 7 params Use BusTopicParams to send parameters into methods Issue-ID: POLICY-1017 Change-Id: I194284da63cb95f91ce2e8a8c21a526a5ab9f6f3 Signed-off-by: Krishnajinka <kris.jinka@samsung.com>
2018-08-13Remove simple checkstylePamela Dragosh30-426/+433
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-06Apply builder pattern for topic cnsmer prdcrkrishnajinka15-538/+711
Modify endpoints event bus related classes to use builder pattern in particular apply bus topic params object instead of using parameters as it is. Rework based on commnts Issue-ID: POLICY-1017 Change-Id: I572a72fa525cf4f664eb70d0415be73116499bd2 Signed-off-by: krisjinka <kris.jinka@samsung.com>
2018-08-03Use builder in Bus DMaap UEB Topic constrctrKrishnajinka5-124/+307
Constructors of the Bus Dmaap Ueb topic source class using many param Refactor to use builder pattern for clean code implementation. Issue-ID: POLICY-1017 Change-Id: Iea75b64ad232e83541a60a03a19cbb598c370cff Signed-off-by: Krishnajinka <kris.jinka@samsung.com>
2018-07-31Copy policy-endpoints from drools-pdp to commonmmis33-2994/+2558
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-28support ueb/dmaap https related configurationJorge Hernandez3-5/+11
Change-Id: Ide2e3524cbbf0a8caf36ad48c003b7500482ad4a Issue-ID: POLICY-941 Signed-off-by: Jorge Hernandez <jh1730@att.com>
2018-07-25Copy policy-endpoints from drools-pdp to commonmmis45-0/+5931
Issue-ID: POLICY-967 Change-Id: I374c155ee102c3e157c60d0a22d7191544abb76a Signed-off-by: mmis <michael.morris@ericsson.com>