aboutsummaryrefslogtreecommitdiffstats
path: root/models-pdp/src/test
AgeCommit message (Collapse)AuthorFilesLines
2021-03-22Fix 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> (cherry picked from commit d6db5582b6705c11abbf8b507aa423aa00bcd7ae)
2021-02-19Refactor timestamp property in policy models to use Instantrameshiyer274-13/+13
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-01-12Add more methods to query deployment statusJim Hahn1-2/+55
Issue-ID: POLICY-2648 Change-Id: I398fa1332eb5a862dabd97ed409ef6413bb0c202 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-01-08Add PDP-Policy deployment table to DBJim Hahn3-1/+347
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-06Changed identifiers to concept identifiersliamfallon7-80/+79
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 Hahn1-1/+1
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 Hahn6-85/+88
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.32liamfallon6-6/+1
Issue-ID: POLICY-2188 Change-Id: I6db16763c1d2d80ff934302081a8dfc16afa7d9a Signed-off-by: liamfallon <liam.fallon@est.tech>
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 entityhuaxing3-27/+194
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-22Handling supported policy type during PdpGroup Updatea.sreekumar2-6/+75
Change-Id: I469125c232af9d78a55c3dfa71cb701cb3864015 Issue-ID: POLICY-2023 Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
2020-01-10Remove supportedPolicyTypes from PdpStatusramverma1-7/+6
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>
2019-12-10Merge "Add JpaPdpStatistics entity"Ram Krishna Verma3-0/+77
2019-12-09Add JpaPdpStatistics entityshaoqiu3-0/+77
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 Hahn3-0/+435
Change-Id: Ia5134e2ba4faeefe8bcc1333abe6acc57972c243 Issue-ID: POLICY-2274 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-11-21Allow wild cards in supported type filterJim Hahn1-1/+38
PAP was rejecting deployment of policies whose supported type contained a wild card. This was due to the fact that it was querying the Pdp Groups using a filter on the supported type, which did not take wild cards into consideration. Updated the filtering. Change-Id: I50b3202a00ac85ff09a9861d8bbe1efb6dd49ae3 Issue-ID: POLICY-1636 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-11-15Support wild cards in "supported policy types"Jim Hahn1-3/+4
Refactored PfConceptKey, extracting most of it into PfKeyImpl. Added PfSearchableKey as a subclass of PfKeyImpl. Change-Id: I524f4ce9208fc9ba09e77db4cc7dde5a21e1d7fc Issue-ID: POLICY-2224 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-08-27Replace copyTo methods with copy constructorsJim Hahn3-9/+9
Deleted the copyTo() method from PfConcepts and replaced uses with deep-copy constructors. Also added mapMap() and makeCopy() methods to PfUtils to facilitate. Change-Id: Id6391bb806ef0dfab6c1089278bf2b514c7e303e Issue-ID: POLICY-1600 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-27Use ToStringTester from utils-testramverma1-5/+5
Changing ToStringTester from utils to utils-test Bump up common to 1.5.1-SNAPSHOT Change-Id: I7427673c73bd1cc52d5f24a0542e89eb33a39ae8 Issue-ID: POLICY-1746 Signed-off-by: ramverma <ram.krishna.verma@est.tech>
2019-06-18Change getCanonicalName to getName in modelsJim Hahn1-1/+1
Per javadocs, getName() should generally be used instead of Class.getCanonicalName(). This change only applies to classes; it does not apply to File objects. Note: this impacts the output from PfValidationMessage, as it will now list the names of embedded classes with a "$" separator instead of a ".". Change-Id: I2cd64bc0281dd324bf80eac57335a7299a516447 Issue-ID: POLICY-1646 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-17Fix simple sonar issues in models: errors to sim-pdpJim Hahn3-101/+106
models-errors models-pdp models-provider models-sim-pdp Also had to work around this checkstyle issue: src/test/java/org/onap/policy/models/sim/pdp/comm/ TestPdpStateChangeListener.java:[77,32] (javadoc) JavadocMethod: Unable to get class information for @throws tag 'PdpSimulatorException'. The error appears to be bogus, as PdpSimulatorException is on the "throws" line thus indicating that the class IS accessible to the above java file. Change-Id: Iaca58457a32b00121000fc0bab12a8be4cb19bac Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-17Fix simple sonar issues in modelsJim Hahn8-88/+119
Added @FunctionalInterface where needed. Replaced anonymous classes with lambda expressions. Replaced duplicate strings with a constant. Removed unused BeforeClass & AfterClass test methods. Removed some trailing spaces. Fixed: aai actor.appc actor.appclcm actor.sdnc actor.sdnr actor.so actor.vfc actorServiceProvider appc appclcm cds events Change-Id: I0e21cbb10db6d1217bbd0e00e6dd4fac3eb84e31 Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-25Add copy constructor for PdpStatus3.0.2-ONAPJim Hahn3-0/+176
Change-Id: Id818d3b16355ad3f3a96ff4456ec8e8062055f98 Issue-ID: POLICY-1645 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-25Populate policies, even if emptyJim Hahn1-0/+1
Modified PdpUpdate to create an empty policy list, by default, rather than leaving it null. Change-Id: I81906410bcc7da21d6471d496713ec9b375632a2 Issue-ID: POLICY-1692 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-16Fix null not accepted on PDP messageliamfallon1-0/+2
Issue-ID: POLICY-1648 Change-Id: I580d1c433cd3a5730b115ef6353770f17939cf3a Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-13Disallow empty subgroup list in group requestJim Hahn2-8/+21
Change-Id: I8a00caf1b22363fe3ab90bdf57244af687a2cb6d Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-12Check for duplicates in listsJim Hahn2-1/+10
Modified duplicate subgroup check to eliminate sonar issue. Added duplicate group check. Modified ModelsTest to exclude PdpMessage, which seemed to cause intermittent junit failures. Change-Id: Id281874506d3a39610739e24cee49360b345724f Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-12Remove version from PdpGroupliamfallon7-364/+98
Issue-ID: POLICY-1095 Change-Id: I91f495947fe77222804e7ab31c4dd7d7aee66b44 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-12Add validation methods for PAP REST APIJim Hahn5-13/+290
Also made the identifier classes comparable. Stupid tabs. Change-Id: I54c0595c6a2c61a1b72b58fe1d667657f9d5d71e Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-12UNit test and minor fixes for DB parsliamfallon1-9/+6
Add unit test for the new database provider driver parameter. Address the comments raised in the last review. Issue-ID: POLICY-1095 Change-Id: I9f629d9f4446d12bfb492e00e49e07b97ef5a490 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-11Fix database propertiesliamfallon2-46/+15
Issue-ID: POLICY-1095 Change-Id: I3edd70898836d3bd978643857d1ba29599b1cf6c Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-10Finish unit test on policy-modelsliamfallon1-1/+2
Unit test coverage well over 90% in policy-models-base policy-models-dao policy-models-pdp policy-models-tosca policy-models-provider Issue-ID: POLICY-1095 Change-Id: I7703e2ae8a93575ca478c3d809ff8c1fb9f0f334 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-09Complete unit test for models-pdpliamfallon2-122/+657
This review completes the unit test for the models-pdp module, for persistence of PDP groups and for PDP group filtering. Added unit test of filters for TOSCA policy types and policies. Added fix to allow filters to pass when the value being checked is null. Issue-ID: POLICY-1095 Change-Id: I982400ef39f0282d813d49e484a58207e03b8a63 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-08Add lists and tests for PDP filtersliamfallon9-52/+483
The policy type and policy filters for PDP groups are added in this review. Also filter tests for PDP group filter is completed. Issue-ID: POLICY-1095 Change-Id: Ia28776c809f2ab879af4007b3480621637a83f69 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-08Merge "Add bug fixes and tests for filters"Jorge Hernandez5-84/+500
2019-04-08Merge "Add PdpMessage.appliesTo()"Pamela Dragosh1-15/+118
2019-04-08Add bug fixes and tests for filtersliamfallon5-84/+500
Fixed bugs on filtering where lack of null checks was blocking all results. Added unit test for PDP related JPA objects. Fixed cascading and orphan control on JPA objects. Added partial testing of PdpProvider. Added partial testing of filters. Changed tag for content of operational policies from "Content" to "content". Issue-ID: POLICY-1095 Change-Id: Ieb22e06955a8434b490bae7d0f6b77d4479515e8 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-08Add unit test for PDP groupsliamfallon7-35/+865
Unit test for the JPA concepts in models-pdp. Issue-ID: POLICY-1095 Change-Id: Id33626f3789da45e36935edf564003651e9ce7c4 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-07Add PdpMessage.appliesTo()Jim Hahn1-15/+118
Added a method to determine if a message is applicable to a particular PDP. This is a common function that should have been added previously, as each PDP type has had to create an implementation of it. Nevertheless, this provides a "reference" implementation. Change-Id: I54073c77a9d2b4c1f902c5ac0bce9fa5fa485503 Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-05Complete filters for Database Fetchesliamfallon1-2/+2
This review completes the implementaiton of the filters for fetching policy types, policies, and PDP groups from the database. It also fixes bugs in Policy type creation. Yaml in some of the policy type examples modified so that it is syntatically correct. Proeprties now stored as a blob in DB as they can be big. Issue-ID: POLICY-1095 Change-Id: I6aef88ee2905afa58d778d82832f2b55d794fe9c Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-04Updates to models from scrum on 4/4Jim Hahn10-266/+62
Moved ToscaPolicyIdentXxx classes from models-pdp to models-tosca, and added methods to retrieve them from a ToscaPolicy. Removed version and instance fields from PdpStatus. Chose to leave "description" field in the PAP/PDP messages. The PDPs can ignore them or leave them null. In a PdpUpdate message, the description will be the description associated with the PdpGroup. In a PdpStatus message, the PDP could choose to provide a description of the PDP, itself (or the type of PDP). Added comments to that effect. Moved name, group, and subgroup fields into PdpMessage. Fixed typos in comments. Updated licenses. Change "long" to "Long" in PdpUpdate. Use lombok @ToString instead of override. Fixed merge conflict. Change-Id: Icd928f9a7630b838ad4b0b5556e899dc21b7872b Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-03Changing PAP model as per discussionramverma6-47/+50
1) Changing PAP models to use ToscaPolicyIdentifier instead of actual ToscaPolicy itself. 2) Deleting unused PdpHealthCheck message. As we decided to return heath check based on DB state. 3) Updating PdpStatus message to use ToscaPolicyIdentifier instead of actual ToscaPolicy itself. Pdp don't need to send the whole ToscaPolicy everytime in heartbeat to PAP. Instead the identifier is sufficient. Change-Id: I50ead8d8b6af118fd1da08071a2b0fc50584d4aa Issue-ID: POLICY-1443 Signed-off-by: ramverma <ram.krishna.verma@est.tech>
2019-04-02Add persistence for PDP conceptsliamfallon3-0/+354
This review adds the JPA annotations to PDP group/subgroup and PDP for persisting to the database. It also updates the Provider API as requested by other team members. Issue-ID: POLICY-1095 Change-Id: I8188afb763849ede9680f3751b464d9d76c27196 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-02Adding pdpHeartbeatIntervalMs to PdpUpdate messageramverma1-3/+4
Adding pdpHeartbeatIntervalMs to PdpUpdate message. The value of which can be used by Pdp to override its own interval for sending PdpStatus message as heartbeat to PAP. Change-Id: I720713b9b569cf09bf393ac797da29e7f330f8bf Issue-ID: POLICY-1443 Signed-off-by: ramverma <ram.krishna.verma@est.tech>
2019-04-02Merge "Remove pdpType from PdpUpdate"Liam Fallon1-3/+2