summaryrefslogtreecommitdiffstats
path: root/feature-pooling-dmaap/src
AgeCommit message (Collapse)AuthorFilesLines
2020-09-30Fix new sonars in drools-pdpJim Hahn2-96/+84
Addressed the following sonar issues: - extract common test method - too many assertions in test method - don't always return the same value Issue-ID: POLICY-2616 Change-Id: Iab836cdcd667b35e2db9db7d6ffc7896df33e1c8 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-08-25Address more sonars in drools-pdpJim Hahn4-9/+22
Addressed the following sonars: - either log or rethrow - call "remove()" for thread-local-storage - use assertEquals - only one method call in exception test - swap arguments in assertEquals - add assertion to assertThatThrownBy() - explain @Ignore Also addressed eclipse warnings: - unused fields and methods Issue-ID: POLICY-2616 Change-Id: I6590c0d2b103885bc933014d48bf5fd92401cd80 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-07-06Use apache TripleHAHN III3-26/+26
Replaced policy-utils/Triple with apache Triple. Issue-ID: POLICY-2694 Change-Id: I160f90c03f18b7da8dec5d0a00f809bcfb29680b Signed-off-by: Jim Hahn <jrh3@att.com>
2020-06-29Clean up of Pair classes - drools-pdpwaynedunican8-192/+177
Removed Pair class from drools-pdp and replaced with Apache Common Pair class Issue-ID: POLICY-2202 Change-Id: Ica2a5b734fb6eebfc0713027c1c4dc3b8d3882c8 Signed-off-by: waynedunican <wayne.dunican@est.tech>
2020-06-19Address checkstyle version issues in drools-pdpJim Hahn4-55/+53
Also added serializationId to several classes to address eclipse warnings. Issue-ID: POLICY-2188 Change-Id: I3df5e8abaad8da9261c0d5cd19a93ed68dceb870 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-06-16Merge "reduce sonar issue - 2 rev"Liam Fallon2-17/+19
2020-06-15reduce sonar issue - 2 revTaka Cho2-17/+19
In some conditions for assertTrue, sonarcloud recommends using assertEquals Assert.assertTrue(a.equals(b)); Assert.assertTrue(a == b); Assert.assertTrue(a == null); Assert.assertTrue(a != null); Assert.assertFalse(a.equals(b)); Compliant Solution Assert.assertEquals(a, b); Assert.assertSame(a, b); Assert.assertNull(a); Assert.assertNotNull(a); Assert.assertNotEquals(a, b); Issue-ID: POLICY-2616 Change-Id: Ib362573bd865d1b561916bf64640c8ddeaa02546 Signed-off-by: Taka Cho <takamune.cho@att.com>
2020-06-10reduce sonar issue - drools-pdpTaka Cho1-1/+2
remove unused import rename the method name Issue-ID: POLICY-2616 Change-Id: I15845159063ec5fa3cfb34a59b9c433ba3201ccc Signed-off-by: Taka Cho <takamune.cho@att.com>
2020-04-06Address sonar issues in drools-pdpJim Hahn9-84/+82
Addressed the following sonar issues: - add "final" to public static fields - commented code; some were bogus - just updated the comments so sonar is happy - use "{}" instead of string concatenation - junit should assert something - when using logger, invoke compute-intensive tasks conditionally - use superclass name instead of subclass name to access static fields - don't always return the same value - remove "transient" from fields of classes that aren't Serializable - don't nest try/catch blocks - use appropriate class name in Logger.getLogger() - use Predicate<T> instead of Function<T,Boolean> - remove unused parameters from private methods - either log or throw - remove duplicate methods - use remove() TLS instead of set(null) - null check is implicit in instanceof check - do something with return value - don't use volatile - don't return "null" list; used Optional instead - add no-arg constructor to non-Serializable superclass - add callSuper=true for EqualsAndHashCode - don't declare "throws XXX" where XXX is a subclass of RuntimeException - remove serialVersionUID field if the class isn't Serializable Also addressed some eclipse warnings: - unused fields - suppress generic typic cast warnings Issue-ID: POLICY-2305 Change-Id: I906d5bf71c1f86531423e23b3667a585cdba45e1 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-11-08Miscellaneous code clean upjhh9-59/+58
Issue-ID: POLICY-2203 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I5731d4636bd2aaecbc486406298bcba1b19e8f4d Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
2019-10-31upgrade to 7.28.0.Final drools librariesjhh2-5/+5
commons-lang does not seem to be packaged anymore (commons-lang3 still does, which is the desired one). There are some @SupressWarning that seem to have no effect that were removed. Some libraries that were explicitly added are transitively used now in the latest version of drools, hence some rework in the dependency and exclude sections. We will need to generate a clm report to verify. Issue-ID: POLICY-1407 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I44e09183caca72f5f33bdec0b8fa88b0b4793055 Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
2019-08-13Fix sonar issues in drools-pdpJim Hahn2-32/+35
Address sonar issue, "Move constants to a class or enum", by moving them from interfaces to classes: ActiveStandbyFeatureApi StateManagementFeatureApi PolicyResourceLockFeatureApi PolicySessionFeatureApi DroolsController DroolsControllerFeatureApi PolicyControllerFeatureApi PolicyEngineFeatureApi HealthCheck SystemPersistence EventProtocolCoder PolicyController PolicyEngine TestTransaction MdcTransaction Address sonar issue, "Move constants to a class or enum", by change the interface to a class: DroolsProperties Address sonar issue, "Override the "equals" method in this class", by adding equals & hashCode to: DroolsPdpEntity DroolsPdpImpl Use lombok for a number of getters & setters. Address sonar issue, "Define a constant instead of duplicating this literal" in: DroolsPdpsElectionHandler JpaDroolsPdpsConnector MavenDroolsController GenericEventProtocolCoder GsonProtocolCoderToolset RestManager Address sonar issue, "Remove the parentheses around the parameter" in: MavenDroolsController Address sonar issue, "Replace this lambda with a method reference" in: LifecycleFsm Address sonar issue, "Move this constructor to comply with Java Code Conventions" in: LifecycleStateRunning Address sonar issue, "Replace this 'switch' statement by 'if' statements to increase readability", as specified in: PolicyEngineManager Address sonar issue, "Rename field to prevent any misunderstanding/clash with field" in: MdcTransactionImpl Address sonar issue, "Either log or rethrow this exception", in: RestManager Address sonar issue, "Rename this constant name to" uppercase, by replacing enums with static lists in: RestManager Addressed review comments: Fixed license dates. Renamed getSiteName/setSiteName methods to getSite/setSite in the interface to match the field names in the implementation classes. Renamed *Instance classes to *Constants. Next round of review comments. Change-Id: I1c26af9f194833dd773f2b25dc5f60cde163201c Issue-ID: POLICY-1968 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-07-11Fix checkstyle issues in policy-managementJim Hahn4-4/+4
Also deleted the checkstyle suppression file. Moved classes into their own source files per checkstyle. Change-Id: I586223aac0e5b7623cfd7b0acfceca4742ecc013 Issue-ID: POLICY-1908-mgmt-style Signed-off-by: Jim Hahn <jrh3@att.com>
2019-07-08Fix drools-pdp due to sonar changes in commonJim Hahn3-42/+44
Fixed breakages due to changes made in policy/common to satisfy sonar. Change-Id: I26a38340707b2903e089350c31c5dfdb5c019ee0 Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-03-06Merge "Replace PropertyConfiguration"Liam Fallon1-9/+10
2019-03-04Replace PropertyConfigurationJim Hahn1-9/+10
Modified code to use BeanConfigurator instead of PropertyConfiguration. Change-Id: I296d9047262fbc87f04c3db92f23181f588bfeda Issue-ID: POLICY-1444 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-03-01move all hard install config to environment varsJorge Hernandez1-10/+12
+ support multiple system properties files with variable interpolation loaded at initialization + support of configurable JVM options (-X, etc ..). + rearrange aaf configuration to avoid {{}} installation variables and use dynamic enviroment variables. + miscellaneous clean up in areas touched and checkstyle. Change-Id: I71ad839778e17eb57c098a2c5cc2bf96e468669a Issue-ID: POLICY-1524 Signed-off-by: Jorge Hernandez <jorge.hernandez-herrero@att.com>
2019-02-22Add getEffectiveTopic method to pooling testJim Hahn1-0/+5
A new method, getEffectiveTopic(), was added to the Topic interface. A test class in the pooling feature uses that interface, thus the method had to be added to the implementation within that test class. Note: until this is merged, drools-pdp will not build. Change-Id: Ib82e7a0d23f5b8e8eda08e8fc570e96543497da2 Issue-ID: POLICY-1534 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-02-21Moving hard install config to environment varsJorge Hernandez1-7/+7
Change-Id: I01e0cf2e2399ec81337961e0a2b3a349c34f55c4 Issue-ID: POLICY-1517 Signed-off-by: Jorge Hernandez <jorge.hernandez-herrero@att.com>
2019-02-18Remove unneeded "throws"Jim Hahn1-6/+3
Fixed sonar issue: - remove the declaration of thrown exception 'com.google.gson.JsonParseException' which is a runtime exception Change-Id: Ice29a875891a06a55932fcf80107d4dec2b10d1f Issue-ID: POLICY-1533 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-01-16Remove jackson from feature-pooling-dmaapJim Hahn11-95/+124
Modified code to use gson instead of jackson. Change-Id: I5a1b2dacdc1801b1110154ed7c3c81e0713ef369 Issue-ID: POLICY-1431 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-01-08Replace expectException with AssertJJim Hahn2-70/+15
Change-Id: I5c9c5e962a7e2a5617405d534c0719f4bdb6ff1c Issue-ID: POLICY-1393 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-11-29Remove Factory from various drools-pdp classesJim Hahn8-550/+588
Also merged changes from 'Rename test classes in drools-pdp'. Change-Id: I4d0a3a1b0b5523eadf38d1edb5aa86c404b69d19 Issue-ID: POLICY-1288 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-11-28Rename test classes in drools-pdpParshad Patel18-23/+24
Make test classes name consistence Issue-ID: POLICY-1281 Change-Id: I9632831dd36b1d362aeadfb53fda600762c835ca Signed-off-by: Parshad Patel <pars.patel@samsung.com>
2018-10-05Add coverage to policy-coreJim Hahn1-1/+1
Added easy junit test coverage cases. Fixed sonar issue: removed sleep from DroolsContainerTest. Fixed sonar bug in ClassExtractors. Change-Id: I942badf17c42346c1735bc3951450fc31c02a769 Issue-ID: POLICY-1148 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-10-02Add junit coverage to drools-pdpJim Hahn2-5/+5
Added coverage to distributed locking. Added coverage to test-transaction - still more to do. Added coverage to healthcheck - still more to do. Also fixed "code smell" in pooling. Also fixed "code smell" in session persistence. Fixed typo in comment. Removed unneeded setUp() method from test. Fixed new checkstyle errors. Fixed another new checkstyle error. Change-Id: I0d2ab13fcbd64486af88affb02e114e624c6a3d1 Issue-ID: POLICY-1148 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-10-01Set drools-pdp checkstyle configPamela Dragosh2-2/+2
Fixed last remaining checkstyle issues along with setting the pom.xml to the correct path setting. Fixed forbidden summary fragments, not allowed to prepend summary with "This method returns" Issue-ID: POLICY-1153 Change-Id: I267842080494132a7b5507731e14f027a3f6fe44 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-09-21new sonar issues in drools-pdpJim Hahn1-1/+1
No "@Test" methods - renamed class from XxxTest to XxxMock. Changed functional call syntax. Change-Id: I954c2549705e80c00aed8ecbcb19f386cc8b0310 Issue-ID: POLICY-1137 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-09-13Fix checkstyle for features submodules.Pamela Dragosh55-259/+430
These are the remaining submodules that have checkstyle. Pretty clean compile after this. There were a couple of sonar fixes in there also. Issue-ID: POLICY-882 Change-Id: I8191ea1aa261f4a7b9d3d21c108572fd31db1b8c Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-09-11Revert back to Drools 6.5.0.FinalJim Hahn1-1/+1
Decided to abandon the conversion to Drools 7.9.0.Final. This undoes the associated changes. Change-Id: I457266d09f7e481da5c0415290241a348786f8ea Issue-ID: POLICY-1093 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-09-10Switch to drools 7.9.0.FinalJim Hahn1-1/+1
Note: This will break policy/drools-applications until the corresponding change is merged there, too. Reformatted lengthy line. Change-Id: I4ae7838dfbc2d537580636eccc545710b5ebc799 Issue-ID: POLICY-1093 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-07-30Copy policy-endpoints from drools-pdp to commonmmis3-19/+14
Issue-ID: POLICY-967 Change-Id: Ib19d3a89ffa328c39f7871bff59efb3dd1617f7a Signed-off-by: mmis <michael.morris@ericsson.com>
2018-07-25Copy policy-endpoints from drools-pdp to commonmmis10-119/+115
Removed policy-endpoints, and 3 classes from policy-core. Replaced refenences to the deleted classes with references to the corresponding classes in policy-common Issue-ID: POLICY-967 Change-Id: I547cde4894424b8f40b7ddd4e2342ebb729cb588 Signed-off-by: mmis <michael.morris@ericsson.com>
2018-07-13Don't stop controller on dmaap failureJim Hahn11-569/+83
Modified feature-pooling-dmaap so that it continues to work even if it's unable to communicate with the internal DMaaP topic. When that happens, it simply starts processing locally, until communication is re-established and it receives a bucket assignment. Fixed typo in comment. Added to comment for State.internalTopicFailed(). Removed extra space before @Ignore. Change-Id: I9c851c66c9162c608f2df98e11d49fc526539434 Issue-ID: POLICY-878 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-06-20Merge "Remove references to SpecPropertyConfiguration"Pamela Dragosh8-384/+58
2018-06-19Merge "Add setXxx methods for @Property annotation"Liam Fallon2-2/+45
2018-06-19Remove references to SpecPropertyConfigurationJim Hahn8-384/+58
Change-Id: Ib4779611f124277cf8be2b3eddfe41bf69dfd74b Issue-ID: POLICY-907 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-06-18Add setXxx methods for @Property annotationJim Hahn2-2/+45
We'll be modifying the PropertyConfiguration class so that, instead of directly setting values in private fields, it will use public setXxx methods. Consequently, we have to add the setXxx methods to the PropertyConfiguration subclasses so that they're available when the superclass is modified policy/common. Change-Id: Idff9942eabec182670cbb427b960f6308a2ca30c Issue-ID: POLICY-906 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-06-18Fix fortify issue with pooling extractor classJim Hahn6-29/+17
The pooling extractor class was using reflection to extract values from private fields. It has been modified to only extract from public fields or to use public getXxx() methods instead. Change-Id: I3aafe9ebfcd41d0e71dc3529030597609b704f53 Issue-ID: POLICY-906 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-05-24Change extractor log level from warn to infov1.2.32.0.0-ONAPbeijing2.0.0-ONAPJim Hahn1-1/+1
Change-Id: I26ae7c0c83b5e3c6b128af262bd334b09696590d Issue-ID: POLICY-870 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-05-09Discard Forward to wrong hostJim Hahn4-1/+16
Changed to discard Forward message if the channel does not match the host that received it. Change-Id: I9235bd3b0c5eb264f9b1cfe53552fadf66a0edc2 Issue-ID: POLICY-787 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-05-09Change pooling property namev1.2.1Jim Hahn1-9/+18
Removed "AMSTERDAM_" prefix from pooling topic property name. Added feature-specific conf file with pooling topic property. Enabled distributed locking DB properties. Change distributed locking DB name to "pooling" to match the code. Add default value to feature-specific conf file. Change "_" in default topic name to "-". Change-Id: I53de51787694e5920dc9ced07b5a9ac60bb63e45 Issue-ID: POLICY-782 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-05-08Removed unneeded extractor propertiesJim Hahn1-4/+2
Change-Id: I5a52ba7358d27a2db0176cb02289b1bdcce0e9e2 Issue-ID: POLICY-783 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-05-04Fix various problems in poolingJim Hahn15-281/+217
Renamed META-INF SessionAPI to EngineAPI, as it implements the latter. Created default PoolingFeature.factory object. Don't delete a controller's pooling manager when stop is called; do that in afterHalt and afterShutdown. This enables it to be restarted as long as the controller still exists. Only stop & start the internal DMaaP topic at the engine level instead of the controller level. This is necessary to prevent sinks for ALL controllers from being started each time an individual controller starts. Clear all bucket assignments when controller is stopped. Mark test methods with @Override annotation. Add default property file for pooling feature. Add license to default property file. Remove tests for doDeleteManager(), as it no longer exists. Changed " = " to "=" in the property file. Change-Id: I80c0c3f1879b5a320044db93e3dfa3b7281cda51 Issue-ID: POLICY-774 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-04-21Sonar fixes for latest pooling codeJim Hahn10-40/+103
Made changes to pooling code to address new sonar issues. Add comments to awaitActive() methods. Change-Id: I390173de00135a0a5fe50af82ed4ba780df9df80 Issue-ID: POLICY-728 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-04-20Add comprehensive junit tests for pooling featureJim Hahn25-391/+1201
Added FeatureTest.java and FeatureTest2.java. Fixed a number of issues that were identified via the above tests. Moved fixes of policy-endpoints to other JIRA tickets. Resolved potential sonar issue with commented-out code by making STD_XXX constants into plain variables to they could be changed via a method call. Changed stdEventWaitMs to stdEventWaitSec. Change-Id: Icf8fcc9b0dfe2578aa0787e0c9224a6f76a068ee Issue-ID: POLICY-748 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-04-16Merge "Sonar fixes to pooling"Jorge Hernandez40-1168/+2493
2018-04-16Sonar fixes to poolingJim Hahn41-1168/+2506
Made various changes to the pooling feature to address some of the sonar issues. Remove duplicate classes, Pair & Triple. Fix sonar issue about duplicate process(xxx) methods. Remove extra items from pom.xml and add assembly builder. Fix license text in pom.xml, inadvertently reformatted. Fix a few typos in comments and change LinkedList to Queue. Move assembly.xml to correct source directory. Replace ScheduledFuture<?> with CancellableScheduledTask, to satisfy sonar. Eliminate "TODO" items: add logging, delay after sending Offline message. Add more logging in process(Message) methods. Begin creating end-to-end junit test, fixed bugs found as a result. Restore logback-test.xml to WARN. Fix merge conflict - restored test properties file. Change-Id: Ic70a8cee49678ea0fc3da309699aec1f6088fe70 Issue-ID: POLICY-728 Signed-off-by: Jim Hahn <jrh3@att.com>
2018-04-16Add missing licensesPamela Dragosh2-0/+32
Adding missing licenses to files that should not harm compilation, JUnit tests and instantiation. Issue-ID: POLICY-741 Change-Id: I3075e3493676ee28693323f978c0b5b210b20a34 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2018-03-28Add pooling capabilityJim Hahn77-0/+13321
Add an optional feature that that supports session pooling, wherein more than one host can be active at a time. Use beforeInsert() instead of beforeOffer(), where possible. Move request-id-extraction from policy-managment to feature-pooling. Combined AdditionalProperties into PoolingProperties. Finished junit tests for DmaapManager. Adjusted filters for all XxxState classes, and added testGetFilter to all XxxStateTest classes. Always publish Offline message when the internal topic fails. Remove DelayedExtractor, as it isn't needed. Renamed ExtractorMap to ClassExtractors, and added property name prefix to the constructor to give more control over property naming to invokers. Remove State copy constructor. Use class name instead of class in ClassExtractors map. Remove BucketAssignments from ProcessingState. Remove some TODO items. Add META-INF for implemented feature APIs. Fix ClassExtractor bug where it can't find a field in a superclass, and add a test for classes defined in another file. Add assembly and rename project directory. Add more junit coverage. Change-Id: I7f132f84a7b284a58ab09c9069db19b853acd7e9 Issue-ID: POLICY-577 Signed-off-by: Jim Hahn <jrh3@att.com>