aboutsummaryrefslogtreecommitdiffstats
path: root/models-tosca/src/test
AgeCommit message (Collapse)AuthorFilesLines
2024-08-15Increase coverage above 90% for modelswaynedunican2-5/+136
Differences between local sonar scan (90.5) and sonarcloud (89.7) after merge Pushing extra tests to ensure coverage is above 90 on sonarcloud Issue-ID: POLICY-5069 Change-Id: I684204545044e08e852acdb995fce54ceefb0523 Signed-off-by: waynedunican <wayne.dunican@est.tech>
2024-08-13Improve code coverage and sonar fixeswaynedunican8-17/+233
Increased code coverage to 90% SONAR - Removed TODO comments SONAR - Added NOSONAR where appropriate SONAR - Replaced stream.Collect() with stream.toList() where applicable SONAR - Made variables serializable or transient to comply with sonar rules Issue-ID: POLICY-5069 Change-Id: Ife256eaf4e6f427fe40b138bacc6f112dc5bcea4 Signed-off-by: waynedunican <wayne.dunican@est.tech>
2024-08-01Fix on persistence.xml after updating hibernate dependenciesadheli.tavares1-3/+5
- fix on side effects from drools-apps fix. - hibernate does not allow class annotated with @MappedSuperClass to have also @Table annotation. Issue-ID: POLICY-4955 Change-Id: I1493f58cd31646842220872c239629f3a499a9f3 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2024-06-20Convert models to JUnit 5waynedunican48-513/+545
Review for models-sim and models-tosca Issue-ID: POLICY-5042 Change-Id: I72533933b34df145e1ff4eb40ebafa93f85cca9a Signed-off-by: waynedunican <wayne.dunican@est.tech>
2024-04-10Dependency management updateadheli.tavares1-0/+1
- including dependencies to pom.xml files only where they are used, avoiding extra dependencies being added in all packages. Issue-ID: POLICY-4945 Change-Id: I85b18befe3fe2877c754b1ac818d1b4994f9f7f9 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2024-02-21Fix config files to remove outdated configuration for hibernateadheli.tavares7-45/+44
Issue-ID: POLICY-4929 Change-Id: Icd796030753c505c99c1840d8d11fb2f8300c15e Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2024-02-08Remove dmaap from modelsrameshiyer271-2/+2
Issue-ID: POLICY-4402 Change-Id: Icead1601984f463e557b969f2792f0f0aa05f060 Signed-off-by: rameshiyer27 <ramesh.murugan.iyer@est.tech>
2023-09-29Fix nexus and sonar vulnerabilitiesadheli.tavares1-3/+3
- IQ nexus dependencies - sonar hotspots and code smells Issue-ID: POLICY-4760 Change-Id: Ic4260c568f9d9164a33aacb34a5ff3a6f91b1bd8 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2023-09-22Java 17 Upgradeadheli.tavares4-46/+65
Issue-ID: POLICY-4669 Change-Id: I0157ae0ea7151658308c7e6d429098f16824c190 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2023-02-07Replace Eclipselink with Hibernateliamfallon7-175/+211
Issue-ID: POLICY-4533 Change-Id: I77a6c44c96013963e141265758629cae83e49876 Signed-off-by: liamfallon <liam.fallon@est.tech>
2022-09-16Remove unused imports in modelsliamfallon1-1/+0
Issue-ID: POLICY-4045 Change-Id: Iae24996aa0b1047e993c1e08ae1265152a598ece Signed-off-by: liamfallon <liam.fallon@est.tech>
2022-08-17Added onap.policies.monitoring.tcagen2 version 2.0.0jhh2-26/+69
Issue-ID: POLICY-4317 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I34158cd21777b6127fd4a306b73fa3446e302c99 Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
2022-02-16Fix return type of get node templates providerrameshiyer271-6/+3
The return type for fetching node templates can be just a List of ToscaNodetemplates. Removing the map with node template keys as it provides redundant keys in the output. Issue-ID: POLICY-3832 Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech> Change-Id: I43d357fc24af9fd4d127cce139b6d21c53cc98d1
2022-02-10Add policy metadataSet handling as node templatesrameshiyer273-0/+369
Each metadataSet is represented as a 'node_template' in Tosca mapped to a specific node type. Support added for db operations of node templates as independent entities. Detailed documentation available here : https://wiki.onap.org/display/DW/Enable+Handling+of+Policy+Type+Metadata Issue-ID: POLICY-3832 Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech> Change-Id: I6c189142b1778ba858aae27cd92d4f136d950208
2021-10-06Support in_range TOSCA Constraintliamfallon1-1/+25
The TOSCA in_range constraint is not supported, causing errors to be thrown in TOSCA control loop constraint edits. Issue-ID: POLICY-3695 Change-Id: I95dec4118ce8572c5b76d528878c6782856e0a53 Signed-off-by: liamfallon <liam.fallon@est.tech>
2021-06-03Fix junits for new bean validation field namesJim Hahn1-2/+2
Issue-ID: POLICY-3333 Change-Id: I339024677a2d090f61cc55d1b056b832c87d231a Signed-off-by: Jim Hahn <jrh3@att.com>
2021-04-08Use distinct names in DB junitsJim Hahn5-9/+14
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-26Fix Sonar Issues models-tosca-simplelapentafd9-16/+203
Tests refactoring to reduce number of assertions Issue-ID: POLICY-3094 Change-Id: I8a9a02100e5d103f574cf2cb89d2e924d0f56507 Signed-off-by: lapentafd <francesco.lapenta@est.tech>
2021-03-19Fix write failure on PDP statisticsliamfallon6-18/+39
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-15Fix Sonar Issues on policy-models-toscalapentafd7-30/+93
Tests refactoring to reduce number of assertions Removed lines 167-169 in PfKeyImplTest Issue-ID: POLICY-3094 Change-Id: I94ef11068811c81108b0fbf3e5b878d02ab25306 Signed-off-by: lapentafd <francesco.lapenta@est.tech>
2021-03-04Merge "Refactor models for common type handling"Liam Fallon5-32/+58
2021-03-03Refactor models for common type handlingliamfallon5-32/+58
Currently we have handling for "type" and "type_version" on TOSCA Policy class. However, the concept of a "type" and "type_version" also exists on the ToscaCapabilityAssignment, the ToscaNodeTemplate, and the ToscaRequriement classes. This review makes the type handling on Policy generic, thus extending it to the other three types. Issue-ID: POLICY-2983 Change-Id: Ia20e3a8c485f4841257075df08e0784eac415770 Signed-off-by: liamfallon <liam.fallon@est.tech>
2021-03-03Fix sonar issues on policy-modelslapentafd2-53/+56
Tests refactoring to reduce number of assertions to less then 25 Issue-ID: POLICY-3094 Change-Id: Icd3d83c7f8168dd81df13a584229eab36c646f37 Signed-off-by: lapentafd <francesco.lapenta@est.tech>
2021-02-19Refactor timestamp property in policy models to use Instantrameshiyer272-19/+20
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-18Merge "Remove more duplicate code from models"Ram Krishna Verma3-97/+103
2021-02-17Remove more duplicate code from modelsJim Hahn3-97/+103
Addressed sonar "duplicate code" issue by extracting a common ToscaNameVersion class from the XxxIdentifier classes. Also removed junit test for class that no longer exists and renamed another junit to match the renaming of the class being tested. Issue-ID: POLICY-2905 Change-Id: I4a28cd7de2478f2771a864439c0b440ad8310299 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-02-17Fix sonars from removal of duplicate codeJim Hahn3-5/+339
The work to remove duplicate code from models introduced as many new sonars as it eliminated. :-( Addressed the following new issues: - visibility of constructor - use of more specific assertThat() calls Also added two junit test file that were somehow previously left out. Issue-ID: POLICY-2905 Change-Id: I7a0206bd157412d3c6d98bfe21797f106b37ac65 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-02-16Fix duplicate code in Jpa classesJim Hahn3-2/+264
Addressed the following issues: - remove duplicate code; extracted a common class containing properties Issue-ID: POLICY-2905 Change-Id: I80c423ab45c0c6823d338a034762d222ec334288 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-02-07Make filters on TOSCA entities genericliamfallon8-221/+113
The classes PolicyTypeFilter and PolicyFilter only work on Policy types and policies. However they just filter on name/version/type/typeversion so there is no reason that the filters could not be applied to other entities. This commit adapts the PolicyTypeFilter to EntityFilter and PolicyFilter to TypedEntityFilter, so the filters can be applied to collections of any ToscaEntity class. Issue-ID: POLICY-2995 Change-Id: I8fcf76ee8c8497836b3286b35f928b0c341dac34 Signed-off-by: liamfallon <liam.fallon@est.tech>
2021-01-28Add copy constructors to conceptsliamfallon2-0/+108
Copy constructors for ToscaServiceTemplate and ToscaTopologyTemplate. Issue-ID: POLICY-2971 Change-Id: Idb4abf8bce40593e0bf18614b8c647688dd5748d Signed-off-by: liamfallon <liam.fallon@est.tech>
2021-01-19Merge "Add PfKey translation to ToscaConceptIdentifier"Pamela Dragosh2-4/+20
2021-01-18Create ToscaConceptIdentifier from ToscaEntityKeyliamfallon1-0/+1
THis change adds a method to create a ToscaConceptIdentifer from a ToscaEntityKey class. This method reduces the code vloume when translating between these identifiers. Issue-ID: POLICY-2971 Change-Id: Idd62339935d2ba78e6c60b40ee95fedac0642bef Signed-off-by: liamfallon <liam.fallon@est.tech>
2021-01-16Add PfKey translation to ToscaConceptIdentifierliamfallon2-4/+20
Concenience constructor to create a TosaConceptIdentifier from a PfKey and a method to create a PfConceptKey from a ToscaConceptIdentifier. Issue-ID: POLICY-2971 Change-Id: I402b2e12cc11976cd7e98436eb46486c35fdaa31 Signed-off-by: liamfallon <liam.fallon@est.tech>
2021-01-14Add copy constructor to ToscaNodeTemplateliamfallon1-0/+50
In order to support serialization and deserialization of ToscaNodeTemplate objects onto DMaaP, we need a copy constructor on the ToscaNodeTemplate object. Issue-ID: POLICY-2971 Change-Id: If6dc6c54d5673cef46734a88d0a91ae868c11dcb Signed-off-by: liamfallon <liam.fallon@est.tech>
2021-01-06Changed identifiers to concept identifiersliamfallon4-41/+44
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-23Add Service Template TOSCA handlingliamfallon5-31/+349
Today we can only handle a single service template in the database. We should be able to handle multiple service templates and assign arbitrary policy types and policies to maned and versioned service templates. This review brings in the Java API in models provider for handling service templates in this way and uses a simplistic single-teplate implementation in models-tosca, that will work but still only handles a single service template under the hood. Issue-ID: POLICY-2900 Change-Id: Ia02dea8abe44b7f407e685090a4b8e0360889653 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 Hahn21-266/+273
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-12-14JPA concepts for TOSCAliamfallon10-89/+311
Implement the Database persistence parts for the new TOSCA concepts so that those concepts can be written to and read from the database. First batch of comment fixes Issue-ID: POLICY-2900 Change-Id: I45191c1ff57cf1ea8563399db6cc8e51b2724813 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-12-03Add generic methods to TOSCA providers and utilsliamfallon3-0/+245
Generic methods for getting ehtire service templates are added to the TOSCA providers in models-tosca. These are needed to read service tempaltes containing entities that are not policy related. Issue-ID: POLICY-2900 Change-Id: If4c646037f51f8a18b66257426accc330905acf9 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-12-01Add extra authorative TOSCA conceptsliamfallon2-4/+4
This review brings in extra TOSCA concepts for Node types, nodes, and capabilities. The TOSCA handling is also amended to make the handling of equality consistent. Now, if filtering or ordering is required using an order rather than natural ordering, a comparator must be supplied by the user. Issue-ID: POLICY-2900 Change-Id: Ie40e86870b97eb993b1338bdc0666ac116f72f67 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-10-15Default should be an object on TOSCA propertiesliamfallon1-0/+57
Property default value is serialized to the database as Yaml and deserialized back into an object on a DB read. Issue-ID: POLICY-2844 Change-Id: I69f2843a93cd5f831359a0965223298b769498d9 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-08-24Merge "Remove legacy operational policy from models"Jim Hahn5-544/+6
2020-08-20Sonar Fixes policy/models, removing model-yamluj426b16-133/+149
Change-Id: Icd82ea1aef90e4d638b13958519aac5ed5a53f73 Issue-ID: POLICY-2714 Signed-off-by: uj426b <uj426b@att.com>
2020-08-19Upgrade new tcagen2 policy typePamela Dragosh7-15/+15
The old cdap policy type is deprecated by DCAE. Thus, we are simply replacing with the new tcagen2 policy type. Issue-ID: POLICY-2772 Change-Id: I1442340729b5f820f2e265b9b86f6f6f84f49bca Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
2020-08-14Remove legacy operational policy from modelsRam Krishna Verma5-544/+6
Removing all the legacy operational policy related concepts, providers, examples etc from models repo. Issue-ID: POLICY-2764 Change-Id: Ie820271381674ccc4eaef0bd6379f673f67701e7 Signed-off-by: Ram Krishna Verma <ram_krishna.verma@bell.ca>
2020-06-19Merge "Changes for Checkstyle 8.32"Ram Krishna Verma32-35/+0
2020-06-18Changes for Checkstyle 8.32liamfallon33-37/+0
Issue-ID: POLICY-2188 Change-Id: I6db16763c1d2d80ff934302081a8dfc16afa7d9a Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-06-18Replaced try/catch blocks in policy/models with assertj assertions.waynedunican1-8/+3
Issue-ID: POLICY-2451 Change-Id: I095beb674196d5ec5c4dd9b93d3a56cca5ee4788 Signed-off-by: waynedunican <wayne.dunican@est.tech>
2020-05-10Policy DB contents removed on DB deadlockliamfallon4-54/+61
When a DB deadlock occurs, the DB contents can sometimes be deleted becasue the DB removes the Service Template object and recreates a new one in two separate DB transactions. This change makes sure that the object remove and re-create is in a sngle DB transaction, so the operation will either happen or not happen so the DB will not be cleared. Legacy policy handling must also use the SimpleToscaProvider rather than accessing the DB directly, as SimpleToscaProvider keeps the DB structure correct. Issue-ID: POLICY-2548 Change-Id: I263a41cd1d8bec5d7b421045b3b14aad6e6c66d3 Signed-off-by: liamfallon <liam.fallon@est.tech>