aboutsummaryrefslogtreecommitdiffstats
path: root/models-pdp/src
AgeCommit message (Collapse)AuthorFilesLines
2023-02-07Replace Eclipselink with Hibernateliamfallon3-46/+36
Issue-ID: POLICY-4533 Change-Id: I77a6c44c96013963e141265758629cae83e49876 Signed-off-by: liamfallon <liam.fallon@est.tech>
2022-12-18Upgrade the H2 database to the latest versionliamfallon3-21/+22
The latest verison of H2 does not allow colums called "user" or indexes using an underscore in their name. Issue-ID: POLICY-4488 Change-Id: I1db62768b0c0f85543c2f7d3681243f8386825e7 Signed-off-by: liamfallon <liam.fallon@est.tech>
2022-02-16Fix issue with GeneratedValue in PfGeneratedIdKeya.sreekumar4-484/+61
PfGeneratedIdKey class (which is used as a composite key in JpaPolicyAudit and JpaPdpStatistics) uses GeneratedValue in a wrong way and not according to the specification. This review fixes it. PfGeneratedIdKey class is removed, and the generatedId is directly specified in the JpaPolicyAudit and JpaPdpStatistics classes. Note: These classes are only used by PAP, so the related methods for db interaction is removed as PAP directly talks to DB using spring repository layer. Also the only end result this change brings is that the 'generatedId' alone will be used as the primary key instead of 'generatedId, name and version' together. Corresponding changes in DB Migrator: https://gerrit.onap.org/r/c/policy/docker/+/127139 PAP: https://gerrit.onap.org/r/c/policy/pap/+/127130 Change-Id: Ib4ea8b60ffe5c2480746569c0354bf474a6b7006 Issue-ID: POLICY-3897 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
2022-01-11Fix issues in existing entity classesa.sreekumar1-4/+3
Issues identified in the entity classes are fixed in this review. Some fixes doesn't affect the table structure at all. Tables actually affected by some of these fixes are not really used today, and doesn't contain any data. A separate review is raised for the db-migrator changes. Change-Id: I0efdf2c5f17e12225f1b443b5fe8e27c578229f7 Issue-ID: POLICY-3871 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
2021-08-20Fix sonars in modelsJim Hahn4-1/+9
Fixed: - use "var" - change constructor to protected - add equals() to subclasses Issue-ID: POLICY-3094 Change-Id: Ia62716b1a740b4475e54e496330f50aa7fb404d7 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-08-18Add PDP-TOPIC-CHECK messageJim Hahn5-6/+119
Added a new PdpMessage subclass that a PDP can use to verify its ability to send/receive to/from the PDP-PAP topic before it sends its first registration message. Issue-ID: POLICY-3531 Change-Id: Ied61caa805e93e25732385bf91272b4fc248fd69 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-07-28Add junit test for empty statistics filterJim Hahn2-1/+13
Also removed the version field from the filter, as it is not applicable to the PDP instance name. Issue-ID: POLICY-3511 Change-Id: I17e8d2d6646a27736a827b9e9e17881d6b0a3795 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-07-23Remove unused statistics methodsJim Hahn2-67/+0
The getPdpStatistics method should be removed as they're functionality has been subsumed by getFilteredPdpStatistics. Issue-ID: POLICY-3511 Change-Id: I98da98ac483705bea46ebaa0619257195be6b518 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-07-23Limit the number of statistics records returnedJim Hahn3-82/+158
Added limit of MAX records (100). Also, if unspecified, or negative, it defaults to MAX records. Issue-ID: POLICY-3511 Change-Id: I0170951cd79818af5944adf5d29480bad4de815b Signed-off-by: Jim Hahn <jrh3@att.com>
2021-07-12Remove unused DAO statistics methodsJim Hahn2-71/+0
The PDP statistics provider had several filter methods, at least one of which has now been subsumed by another and is no longer being used. Issue-ID: POLICY-3405 Change-Id: If603eaf3df36fd4e6e3555376bf1b95144ec8eb1 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-07-07Update pdp statistics to count deploy/undeploy separately.adheli.tavares4-11/+46
Issue-ID: POLICY-3383 Change-Id: I41e2668bdebd732149db0ccbe160b67b9952a8d9 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2021-06-28Update policy-models for checkstyle 8.43liamfallon1-6/+6
Issue-ID: POLICY-3209 Change-Id: Ic45f889ab4d0ed24f6c1fc1aaece0601636e7a10 Signed-off-by: liamfallon <liam.fallon@est.tech>
2021-06-23Add "source" to PAP-PDP messagesJim Hahn4-4/+18
Added a "source" field to the PdpStateChange and PdpUpdate messages so that PAP can record a unique name in the message, for logging purposes. In a separate review, planning to add a method in policy-common for creating the unique name. Once that has been created, it will be used by PAP, to populate the "source" field, and all PDPs, to populate the "name" field in the PdpStatus messages. Issue-ID: POLICY-3409 Change-Id: I86c97702abe62a5672720330df50b7b106187661 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-06-22Add timestamp to Pdp recordsJim Hahn7-42/+85
To support the case where multiple PAPs are running, added a timestamp to the PDP records so the PAPs can all be kept in sync as far as when a PDP was last responsive. Issue-ID: POLICY-2898 Change-Id: Ia7e0fd17363ff5827564cbc1537e516156b7f53a Signed-off-by: Jim Hahn <jrh3@att.com>
2021-06-21Fix new checkstyle issues in modelsJim Hahn2-2/+2
The new version of checkstyle identified new issues. Fixed those. Issue-ID: POLICY-3094 Change-Id: I85314bc0249cba0020a0aefbc250851a2b646dd9 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-06-21Use lombok for errors pap, pdp, sim-dmaap, sim-pdpJim Hahn2-14/+4
Issue-ID: POLICY-3396 Change-Id: Ib2c9bc5dc199e15ae9ca077031c0f2cfbc5b6a81 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-06-14Fix sonars in policy-modelsJim Hahn5-13/+178
Fixed: - too many parameters in method call Fixed it by introducing PfFilterParameters. However, classes having the Builder annotation are not easily subclassed, so introduced an interface, too. Issue-ID: POLICY-3094 Change-Id: Ida99522a542b1296b367c55b7e8f8e83783c2e4f Signed-off-by: Jim Hahn <jrh3@att.com>
2021-05-27Remove policies field from PdpUpdate messagewaynedunican2-15/+14
Issue-ID: POLICY-3323 Change-Id: I14dafe4a20f95e2ebe4279e5b6ae141e2ee4fc48 Signed-off-by: waynedunican <wayne.dunican@est.tech> Signed-off-by: WayneDunican <wayne.dunican@est.tech>
2021-05-10Fix sonars in policy modelsJim Hahn13-43/+39
Fixed: - use "var" Issue-ID: POLICY-3094 Change-Id: Id5ea7ab049c2018744afa75a55d44e47f216d5bc Signed-off-by: Jim Hahn <jrh3@att.com>
2021-04-29Remove GroupValidationResultJim Hahn3-18/+10
Removed GroupValidationResult, replacing it with BeanValidationResult. Modified the ParameterGroup subclasses to use BeanValidator, adding annotations where needed to trigger the validations that had been automatically performed by GroupValidationResult. Issue-ID: POLICY-2059 Change-Id: I245e4a647fcbb718faa63a7543f9f81c85da958c Signed-off-by: Jim Hahn <jrh3@att.com>
2021-04-22Add a new key class which uses @GeneratedValue to base classesktimoney5-34/+77
This will provide an alternative unique key. It will be used in place of PfTimestampKey in the PdpStatistics table. We make use of the @GeneratedValue annotation to provide this feature. Added DummyGeneratedIdEntity and unit tests Added PfFilterFactory class Added new filter classes Issue-ID: POLICY-3189 Change-Id: I097eab318d2cb958e1157e35825fd6d35d429a25 Signed-off-by: ktimoney <kevin.timoney@est.tech>
2021-04-08Use distinct names in DB junitsJim Hahn2-3/+3
Junits for models often use the same memory DB name which may leave garbage in the DB from one test to the next. Modified the code to use distinct names for each XxxTest class. Issue-ID: POLICY-3171 Change-Id: I2a4a0b4949d532d6949f5d39396288c54d03688b Signed-off-by: Jim Hahn <jrh3@att.com>
2021-03-19Fix write failure on PDP statisticsliamfallon3-7/+16
Due to the precision of time stamps being saved to the nearest second, a millisecond precision timestamp was being compared to a second precision timestamp, causing the write to fail. This change fixes that. A unit test is also added to test for this on the provider. In addition, a USE-MARIADB flag is being introduced, which allows unit tests to be run against a locally installed MariaDB instance so that the unit tests can be verified against MariaDB locally rather than H2, the default in Gerrit. Issue-ID: POLICY-3146 Change-Id: I878f160956e89506743dc074679ee81ac1c48216 Signed-off-by: liamfallon <liam.fallon@est.tech>
2021-03-16Fix Sonar Issues in models-pdplapentafd4-14/+127
Tests refactoring to reduce number of assertions Issue-ID: POLICY-3094 Change-Id: I23369c341c43df71b84392501d33739453f7c81f Signed-off-by: lapentafd <francesco.lapenta@est.tech>
2021-02-19Refactor timestamp property in policy models to use Instantrameshiyer277-27/+27
Updated JPA classes to use java.sql.TImestamp rather than Instant. Issue-ID: POLICY-3069 Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech> Change-Id: If5b874ec96931d4b8dd142d46a9980e83a4708fc
2021-02-12Alter PDP_UPDATE message to store lists of delpoyed/undeployed policieswaynedunican1-0/+12
Update the PdpUpdate class to store lists of deployed and undeployed policies while maintaining it's current original full list of policies. This will ensure that the changes to send policy updates only in the PDP_UPDATE message will not effect the PDPs they can support updated policies. Issue-ID: POLICY-2112 Change-Id: I1a6e9d426ed3a8a3b4469a8b72ef57441e50545e Signed-off-by: waynedunican <wayne.dunican@est.tech>
2021-01-19Remove "Jpa" from table nameJim Hahn1-1/+1
The DB table names of the various JpaXxx classes do not include the "Jpa" prefix. Removed it from the new Jpa class. Issue-ID: POLICY-2648 Change-Id: I7f56502d75db05631749780138e989009eb93c83 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-01-12Add more methods to query deployment statusJim Hahn2-2/+90
Issue-ID: POLICY-2648 Change-Id: I398fa1332eb5a862dabd97ed409ef6413bb0c202 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-01-08Add PDP-Policy deployment table to DBJim Hahn6-2/+695
Added a table to record the PDP policy deployment status, which is required for making PAP stateless. Issue-ID: POLICY-2648 Change-Id: Ibe40ce00aca7a600051edcac49e55651c1c0164f Signed-off-by: Jim Hahn <jrh3@att.com>
2021-01-06Use annotations on parameterized typesJim Hahn3-22/+10
Updated the code to place validation annotations directly on the annotated types instead of using the @Items and @Entries annotations. Also added/updated junits for validation code. Issue-ID: POLICY-2648 Change-Id: Ia535da07a38cec77a74c5c3215b5ae784d7a4e1a Signed-off-by: Jim Hahn <jrh3@att.com>
2021-01-06Changed identifiers to concept identifiersliamfallon12-114/+111
The policy models tosca classes ToscaPolicyIdentifier and ToscaPolicyIdentifierOptVersion can be used to identify any TOSCA concept, not just TOSCA policies so they are renamed to ToscaConceptIdentifier and ToscaCinceptIdentifierOptVersion respectively. The class ToscaPolicyTypeIdentifier is redundant and is replaced by ToscaConceptIdentifier. Issue-ID: POLICY-2900 Change-Id: Id0a37c42ea4e74f07b47e1694c4f8291c35879c9 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-12-21Use annotations to do validationJim Hahn5-57/+49
Modified models to use annotations instead of function calls for most field validations. Created a few new validation annotations for use within models. Per review comments: - renamed Key to VerifyKey - enhanced VerifyKey to imply "@Valid", unless disabled Issue-ID: POLICY-2648 Change-Id: I2b53f218b0a2ab1ed1f5e278816a3509f1408972 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-12-17Use ValidationResult for models v2.0Jim Hahn12-292/+151
Policy models uses PfValidationXxx classes which are totally unrelated to ValidationResult in policy common. This precludes the use of various utility methods and annotations for doing validation. Modified policy models to use ValidationResult instead. This approach uses function calls, though a future approach could make use of annotations instead. Issue-ID: POLICY-2648 Change-Id: I9760f1dc46902ab6bef7f440f3caf5e951660a5d Signed-off-by: Jim Hahn <jrh3@att.com>
2020-07-21Fix some sonars in policy-modelsJim Hahn6-14/+17
Fixed the following sonar issues in some of the project directories: - use assertNull, assertEquals, etc. - swap assertEquals arguments - extract a constant - don't invoke toString() in logger calls - TODOs - generic types Issue-ID: POLICY-2714 Change-Id: Id8803f9bf617ea9fc173a67b8606600709b55bdc Signed-off-by: Jim Hahn <jrh3@att.com>
2020-06-18Changes for Checkstyle 8.32liamfallon10-14/+1
Issue-ID: POLICY-2188 Change-Id: I6db16763c1d2d80ff934302081a8dfc16afa7d9a Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-04-07Address sonar issues in modelsJim Hahn2-16/+15
Addressed the following sonar issues: - use RE2 instead of java.util Pattern for "+" and "*" - don't use deprecated methods - for Date(long), sonar appeared not to parse the argument's type correctly. Modified the code slightly to make sonar happy - duplicate blocks of code - either log or throw - missing assert in junit - for SDNR & VFC, eliminated threads, as they are unnecessary - duplicate code block in different branches - useless assignments - redeclaring abstract methods - cyclomatic complexity - used lombok in some cases (e.g., EqualsAndHashCode) - assert argument order - actually deleted ControlLoopTargetType, because it is not needed and sonar complains regardless of which order is used - add private constructor to utility classes - use StandardCharsets instead of literals Also: - added logback-test.xml to SO to eliminate the voluminous output from the junit test Issue-ID: POLICY-2305 Change-Id: I586c331781bedbd54a115a71847d04d293689445 Signed-off-by: Jim Hahn <jrh3@att.com>
2020-04-03Models junits are failing locallyJim Hahn6-128/+129
Junits were failing in my local eclipse environment. Fixed the following: - more cases of "is marked @NonNull but is null" (I thought Liam had already fixed all of these, but I'm still seeing errors, so fixed some more) - comparing "Instant" values in event time stamps assumes that the times will be different, but may not be, if the JVM is fast enough. Modified the test to set the times of the new events to Instant+1, to ensure that they are different from the original Issue-ID: POLICY-2305 Change-Id: Ic05bc6a58b559ba589583ce887711ee01f76691c Signed-off-by: Jim Hahn <jrh3@att.com>
2020-02-18Add safe entity delete, fix multiple entity getliamfallon1-4/+3
This review implements checks on whether entities are being used or referenced propr to allowing deletes. The review also fixes bugs on multiple entity get returning 4040 not found Issue-ID: POLICY-1402 Change-Id: I9cebb9a873098740e9ff4be6284d6307e19838bd Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-02-18Merge "add unit test for pdpstatistics provider"Liam Fallon1-0/+233
2020-02-18Add missing classes to persistence.xmlliamfallon1-0/+2
The recent policy-models changes cascade database changes to some new classes. THis change adds these classes to persistence.xml. Issue-ID: POLICY-1402 Change-Id: I4d9953c8423dc6e33f6852744c394c9cfbc21ac6 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-02-18add unit test for pdpstatistics providerning.xi1-0/+233
Issue-ID: POLICY-2314 Signed-off-by: ning.xi <ning.xi@est.tech> Change-Id: Ifb23ab301a326cc30950ecc2f115979fa261bc68
2020-02-17Add/Update test cases for PdpStatistics entityhuaxing5-42/+204
Add test cases for PdpStatistics / PdpEngineWorkerStatistics / JpaPdpStatistics. Add lombok.Data annotation to PdpStatistics and PdpEngineWorkerStatistics to facilitate testing. Issue-ID: POLICY-1628 Signed-off-by: huaxing <huaxing.jin@est.tech> Change-Id: I4269678641716a56db260ad67a30c97b904123cd
2020-01-23Handling supported policy type during PdpGroup Updatea.sreekumar1-3/+8
Change-Id: I62fbfeb80b81f4cc6dc0049bbd4ab9dcc5065773 Issue-ID: POLICY-2023 Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
2020-01-22Handling supported policy type during PdpGroup Updatea.sreekumar5-25/+109
Change-Id: I469125c232af9d78a55c3dfa71cb701cb3864015 Issue-ID: POLICY-2023 Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
2020-01-10Remove supportedPolicyTypes from PdpStatusramverma2-14/+11
Removing supportedPolicyTypes from PdpStatus in policy/models as it is no longer expected from the Pdps to send it as part of the heartbeat or initial registration message. Instead the PdpGroupName is expected from the Pdps in the initial registration message. Issue-ID: POLICY-2256 Change-Id: I14b76a737027e146d69d89c2fe2c3f098a89e196 Signed-off-by: ramverma <ram.krishna.verma@est.tech>
2020-01-08update Db provider to support query numberning.xi1-5/+8
Issue-ID: POLICY-1629 Signed-off-by: ning.xi <ning.xi@est.tech> Change-Id: I42c9542adc44d52b760a70e710ab4cc6fa8a1b3b
2019-12-20pdp statistics database provider implementationning.xi1-0/+208
Issue-ID: POLICY-1629 Signed-off-by: ning.xi <ning.xi@est.tech> Change-Id: Ife65d50c862ed90c3c9a3cea91a2b9a8d874fa14
2019-12-10Merge "Add JpaPdpStatistics entity"Ram Krishna Verma7-0/+427
2019-12-09Add JpaPdpStatistics entityshaoqiu7-0/+427
Add JpaPdpStatistics entity which will be used in provider. Add Pdp Statistics entities Issue-ID: POLICY-1628 Signed-off-by: shaoqiu <tim.huang@est.tech> Change-Id: Iab12eb02e2e7f0e366aff64fa665b5d6674f2905 Signed-off-by: shaoqiu <tim.huang@est.tech>
2019-12-06Add models to support deltas to policy deploymentsJim Hahn6-0/+706
Change-Id: Ia5134e2ba4faeefe8bcc1333abe6acc57972c243 Issue-ID: POLICY-2274 Signed-off-by: Jim Hahn <jrh3@att.com>