summaryrefslogtreecommitdiffstats
path: root/models-pdp/src/test
AgeCommit message (Collapse)AuthorFilesLines
2021-08-18Add PDP-TOPIC-CHECK messageJim Hahn2-2/+56
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 Hahn1-0/+5
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 Hahn1-39/+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 Hahn1-66/+142
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 Hahn1-31/+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.tavares2-3/+12
Issue-ID: POLICY-3383 Change-Id: I41e2668bdebd732149db0ccbe160b67b9952a8d9 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2021-06-23Add "source" to PAP-PDP messagesJim Hahn2-2/+4
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 Hahn5-25/+48
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-14Fix sonars in policy-modelsJim Hahn2-1/+80
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 messagewaynedunican1-5/+10
Issue-ID: POLICY-3323 Change-Id: I14dafe4a20f95e2ebe4279e5b6ae141e2ee4fc48 Signed-off-by: waynedunican <wayne.dunican@est.tech> Signed-off-by: WayneDunican <wayne.dunican@est.tech>
2021-04-22Add a new key class which uses @GeneratedValue to base classesktimoney2-6/+9
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 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>