aboutsummaryrefslogtreecommitdiffstats
path: root/models-base/src/test
AgeCommit message (Collapse)AuthorFilesLines
2019-12-11Merge "Fix minor checksyle issues in models"Pamela Dragosh2-3/+6
2019-12-10Fix minor checksyle issues in modelsliamfallon2-3/+6
New checkstyle profile flagged some minor issues in policy models. Issue-ID: POLICY-2165 Change-Id: I17ed070a3d55601ad31e48fdfd29fff01d29fa42 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-12-09Add JpaPdpStatistics entityshaoqiu1-0/+95
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-11-15Support wild cards in "supported policy types"Jim Hahn3-39/+219
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 Hahn9-78/+88
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-08-07replace hashCode function with compareToHenry.Sun1-1/+1
Issue-ID: POLICY-1600 Change-Id: If660cbe84424e492b6db3ab11ef97b37f046b3aa Signed-off-by: Henry.Sun <henry.a.sun@est.tech>
2019-06-18Change getCanonicalName to getName in modelsJim Hahn2-5/+5
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 more sonar issues in models: yaml to daoJim Hahn16-579/+388
Extracted common Strings into constants. Reduced "cyclomatic complexity" in some return statements. Used assertj to eliminate "log or rethrow" messages in junit tests. models-yaml models-base models-dao Change-Id: I20548d4cf5e67d085245e0d54df8ba0116ec86ec Issue-ID: POLICY-1791 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-06-14Allow multiple versions of entities to be returnedliamfallon1-3/+3
Fix .gitreviw file to point at "master" rather than "dublin" Allow return of multiple versions of policy types and data types in TOSCA service templates and multiple policies in TOSCA topology templates. Because the return type is a list of singleton maps, utility methods were added to return flat maps of poliicy types, data types, and policies keyed by a compound ToscaEntityKey name/version key. Issue-ID: POLICY-1807 Change-Id: I355038aaca26f41064d0e3cb3b45b1de2294cf5f Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-05-22Fix name/version regexp in model keysliamfallon2-11/+11
The regular expressions for checking names and versions in policy key names and versions were not expressive enough to restrict all error names and versions. Issue-ID: POLICY-1777 Change-Id: I037eca051f6c7a9f1e7182150d40d8b8d906a75c Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-05-21Add version on legacy get/deleteliamfallon3-5/+5
Issue-ID: POLICY-1777 Change-Id: I5b07ad1acdb4a614a50cb15978130c19bc5786f7 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-14Add prefix matching for policy versionJim Hahn1-1/+50
Re-introduced regular expressions to match policy version so that the policy version found in the metadata, which is just the major number, can be matched with a policy's version, which is of the form, major.minor.patch. Simplified equals() test, as we already know "text!=null". Added filterPrefixPred() and modified policy filter to use it when matching versions, as it is simpler to use when matching a version prefix. Also added tests to PfObjectFilterTest to test each of the XxxPred() methods. Change-Id: I0734873f701a539e883fe25b8eecfdde60cc8b6d Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-09Add unit tests for policy type and policy filtersliamfallon1-1/+0
THis review adds unit tests for the authorative concepts in the models-tosc module and adds unit tests for the authorative and and database providers. Issue-ID: POLICY-1095 Change-Id: If98deea99658056030dd47725b0c0a4266d84106 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-09Complete unit test for models-pdpliamfallon1-8/+0
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 bug fixes and tests for filtersliamfallon1-8/+13
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-07Clean up a couple of array listsJim Hahn1-0/+10
Initialized initial array size for empty list. Add some junit tests to ensure that the returned lists are mutable. Updated license in filter class. Change-Id: I9c151eb50355a71f4d34ac46b41f8278cf913664 Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-04-06Fix bugs on filtersliamfallon5-0/+302
Filters were not being invoked from providers. Filter for getting latest version was filtering out everything Filter on PDP state was not implemented. Issue-ID: POLICY-1095 Change-Id: If43ce48a57b010e05f75db8cfa80e63f2719ace1 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-05Add unit tests for models-baseliamfallon3-5/+41
Brings coverage in models-base up over 99% Issue-ID: POLICY-1095 Change-Id: Ie1c9f3f132715275f44f349a415a8bb34a0115c9 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-04-01Refactor to authorative TOSCA serializtionliamfallon6-12/+243
This review refactors the TOSCA support to use authorative serialization and mapping. It removes the JPA entities from the Proider interface It brings the mapping support from and to authorative concepts out of the JSON serialization classes directly into the JPA classes It adapts the unit tests to work with the refactored structure. Apologies for the review size but it all had to be done in a single block of work. Issue-ID: POLICY-1095 Change-Id: I4827d1dc67ef7aac98cba230ffcd79c6de71e805 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-03-26Add Legacy Op Policy Persistenceliamfallon5-22/+156
Legacy operational policies now fully supported for serialization and persistence from provider through to database and back. Unit test coverage completed also Issue-ID: POLICY-1095 Change-Id: I65755859c94b50edee537d2685f51a7838c6541f Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-03-26Add ErrorResponse to policy framework exceptionsliamfallon2-8/+12
The ErrorResponse object is now contained in Policy Framework exceptions. Issue-ID: POLICY-1095 Change-Id: Ib0ce6cdbbead939afefc4afa3f507eb1a28c4a5c Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-03-25Add PolicyIdentOptVersionJim Hahn3-106/+441
Added additional PolicyIdentXxx classes. Added PdpDeployPolicies, which makes use of it, thus eliminating the need for PdpPolicies, which will be deleted once the PAP has been modified to use the new code. Added Validated class to facilitate field validation. Added utility methods to Validated class. Use new validator methods in PolicyIdentXxx classes. Use addError() method in validator class. Use parameter types instead of "?". Use static Validator instead of local. Get "result" from each call to a validateXxx() method. Derived PolicyIdentOptVersion from PfConceptKey. Moved PolicyIdent classes to models-pdp. Added PolicyIdent classes to models-pap. Also removed copy constructors from classes in models-pap, as those are plain POJOs that will not be copied. Copy constructors will be added to new classes that will be added to models-pdp in a separate review. Forgot to include the new Ident classes in models-pap. Change-Id: I923132c464c7802ee3e9225685cde44f36c64620 Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-03-22Add models-pdp to models repoJim Hahn2-0/+106
Also changed supportedPolicyTypes to PfConceptKey. Updated licenses. Removed trailing whitespace from pom. Provide default request id. Rebased to fix merge conflict. Added SupportedPolicyType class. Renamed SupportedPolicyType to PolicyTypeIdent, and moved it to models-base. Also updated models-pap to use it. Deleted models-pdp Policy and replaced it with ToscaPolicy. Updated test method name. Change-Id: Id65f769c2f308c6b56e79978bd50b84f2e0b3d02 Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-03-21Add copy constructors for models-papJim Hahn1-2/+18
Also added a method to PfUtils to simplify cloning lists. Change-Id: Iae667be02cced57b0b9578e0a96c5cda38111b97 Issue-ID: POLICY-1542 Signed-off-by: Jim Hahn <jrh3@att.com>
2019-03-21Add interface to get info from exceptionsliamfallon1-0/+64
Interface allows uniform geting of information from checked and runtime model exceptions Issue-ID: POLICY-1195 Change-Id: I913b98a4d4b705ed256714392cafc72d6a71877f Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-03-14Add DAO Enabled Tosca Modelliamfallon15-67/+1107
Add DAO annotations to TOSCA model Add keying between concepts and define foreign keys in objects for translation to DB schema Added provider interface, factory, and stubbed implementation. Completed unit test for models-base Completed unit test for models-dao Completed unit test for models-tosca Issue-ID: POLICY-1195 Change-Id: I53a0ba8b7a679b6887b38bdab184b60315e0cf5b Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-03-05Add DAO module for Modelsliamfallon8-8/+382
This patch set fixes some typos and license headers. Issue-ID: POLICY-1195 Change-Id: I2d15b00fcb50ea92746ab7c5a87b57efa07196fe Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-02-28Add basic model object conceptsliamfallon5-0/+485
This review introduces the basic concepts that all model objects inherit from. Using this approach, all concepts that inherit from these types can use standardized DAO handling and marrshal/unmarshal handling This approach is a more generic version of the approach used in the APEX PDP for model handling. The APEX model handling will inherit this module. Issue-ID: POLICY-1264 Change-Id: I35b76659ab66cf3f33bee59a5528e49c7edf7796 Signed-off-by: liamfallon <liam.fallon@est.tech>