aboutsummaryrefslogtreecommitdiffstats
path: root/services/services-engine/src/test/java/org
AgeCommit message (Collapse)AuthorFilesLines
2022-02-10Merge "rename metrics as per global constants for prometheus"Liam Fallon1-1/+24
2022-02-09rename metrics as per global constants for prometheusRashmi Pujar1-1/+24
Issue-ID: POLICY-3760 Signed-off-by: Rashmi Pujar <rashmi.pujar1@bell.ca> Change-Id: I0fb59e8d9c95fd81a1754bb769705ef753b9022d
2022-02-08Remove JAXB and XML, use GSON for JSONliamfallon3-10/+10
This review converst apex-pdp to use GSON for JSON handling. In order to preserve backward compatibility with the JAXB format of JSON, custom handling of maps was required. Therefore, the policy-common StandardCoder could not be used. There are a lot of small changes, removing annotations from concepts and tweaking of test data. However, this cleans up the code base so it is worth doing. Issue-ID: POLICY-1820 Change-Id: I213fa64f6d7f3f1df8d10f111d9fbedbe80f9fe0 Signed-off-by: liamfallon <liam.fallon@est.tech>
2022-01-24Add TOSCA policy status header field to APEX event create CLIRashmi Pujar7-27/+56
In order to expose the processing status of a TOSCA policy to APEX-PDP, a new header field for APEX concept "event" has been introduced to track this within an APEX policy implementation. This field will be leveraged to extract the TOSCA policy execution metrics. Note, that the field is marked as optional for backward compatibility. Unit tests have been augmented to test for the field wherever applicable and the default empty value is retained for the others. "example-grpc" module has been updated to include this field. Exposing the TOSCA policy execution metrics is outside the scope of this patch since the current changes are already very large owing to the atomic nature of the change introduced. Issue-ID: POLICY-3845 Signed-off-by: Rashmi Pujar <rashmi.pujar1@bell.ca> Change-Id: Ief6d70f9abcfc8414e10aa51a27815ee9028e4c8
2021-11-30Prometheus metrics for policy deploy/undeploy requests for APEXRashmi Pujar2-30/+4
Added counters for: - Policy deploy/undeploy requests total - Policy deploy/undeploy successful requests total - Policy deploy/undeploy failed requests total Cleaned up unused method resetAllStatistics. Fixed some checkstyle warnings Update to latest snapshot for parent, and common modules Depends on https://gerrit.onap.org/r/c/policy/parent/+/125974 for build to pass. Issue-ID: POLICY-3760 Change-Id: I4a9447c9caea7a018dba86057b9dae3871910709 Signed-off-by: Rashmi Pujar <rashmi.pujar1@bell.ca>
2021-08-27Address more sonars in apex-pdpJim Hahn1-5/+7
Fixed services-engine thru utilities. Fixed: - use "var" - use Files.delete() - only one method call in assert() Issue-ID: POLICY-3093 Change-Id: I6f62108c770c15e8b84bc51746066fefa409e0fc Signed-off-by: Jim Hahn <jrh3@att.com>
2021-08-27Address eclipse warnings in apex-pdpJim Hahn1-17/+8
Fixed: - deprecated mockito methods - unused mocks Issue-ID: POLICY-3093 Change-Id: I20d9aebb2a6390b2a3c95ae9ccc59b710b9e58ce Signed-off-by: Jim Hahn <jrh3@att.com>
2021-08-24Use CompareToBuilderJim Hahn11-495/+53
Also added lombok to test classes. Issue-ID: POLICY-3391 Change-Id: I9ecf479f3861a2e5211b037e885029d1719b6a56 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-08-02Use lombok annotations in apex-pdpJim Hahn2-5/+8
Updated projects: services-engine through utilities Issue-ID: POLICY-3391 Change-Id: I35ebb40d86e9bda360f7819516290b3fea88335c Signed-off-by: Jim Hahn <jrh3@att.com>
2021-07-12Update pdp statistics to count deploy/undeploy separately.adheli.tavares1-0/+106
Issue-ID: POLICY-3383 Change-Id: Ie9c5c7178c4c4302a0ba63ab42732f7157d302f8 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2021-06-28Changes to support multiple outputs from a statea.sreekumar1-2/+3
This review addresses two main changes: 1) inputFields and outputFields are not tied to task definition anymore. Instead inputEvent and outputEvents associated to a task is populated as part of the policy state definition, as the state definition have the information anyway. - Clean up of the usage of inputFields and outputFields in task definition will happen in a future review - inputFields and outputFields defined in task definition in policies until honolulu will not make the policy invalid as the changes are done in backward compatible way. 2) Multiple output events can come out of a final state now. - Define another policy state output with the relevant eventName in the command file - In the task logic, create a map to store the fields of the relevant outputEvent, and then just call "executor.addFieldsToOutput(<the_map_of_fields>)" These 2 steps are enough to send multiple events to relevant components as per the apex configuration. Change-Id: Id88ca402704106404f529e595e1a76f6bf167876 Issue-ID: POLICY-3336 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
2021-06-18Fix Sonar Issues in apex-pdp-services-enginelapentafd2-14/+22
Test refactoring and local-variable type inference replaced Issue-ID: POLICY-3093 Change-Id: I0c5506f27ea53da7740acce87a25060ba2bce7f4 Signed-off-by: lapentafd <francesco.lapenta@est.tech>
2021-05-07Merge "Code coverage for Service Engine Event"Jim Hahn3-0/+376
2021-05-07Code coverage for Service Engine Eventarkadiusz.adamski3-0/+376
- Increase code coverage for service engine events Issue-ID: POLICY-3092 Signed-off-by: arkadiusz.adamski <aadamski@est.tech> Change-Id: I40bda05fc53168d86ec4ac1c72b69a1badb02b38
2021-05-07Code coverage for File Carrier Pluginarkadiusz.adamski4-0/+596
- Increase code coverage for file carrier plugin in service engine Issue-ID: POLICY-3092 Signed-off-by: arkadiusz.adamski <aadamski@est.tech> Change-Id: I8c08ee55c9d31792e35a1acc79330c8eef42af56
2021-05-03Remove GroupValidationResultJim Hahn7-357/+153
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: I2c0c01fac355e6cde4d8d6998dc42f8a2e2ebb65 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-04-22Refactor of command line classesadheli.tavares2-39/+46
ApexCommandLineArguments class to have parse() overriden to keep remainingArgs taking the tosca file without -p. Issue-ID: POLICY-3129 Change-Id: Ib067bf4c32992c4477cb6751f65269c103513d10 Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
2021-04-15Code coverage for service engine event packagearkadiusz.adamski12-0/+1049
- Increase code coverage for service engine event package Issue-ID: POLICY-3092 Signed-off-by: arkadiusz.adamski <aadamski@est.tech> Change-Id: Iaed5fc31f242a47dd1dc46f5d5c74c43c720e9ee
2021-02-18Fix sonars in apex-pdpJim Hahn2-92/+42
Addressed the following issues: - initialize mocks before use - use parameterized queries - Random() is not secure - provide parameterized type for generics - unused imports - constructor visibility - use compute() instead of containsKey()/put() - make final fields static - rename constants to all upper case - no assert() in Thread.run() methods - nested try - nested if/else - too many break/continue - use try-with-resources - repeatable annotations - overlapping characters in reg ex - hashcode is not sufficient in compareTo() - need equals() with compareTo() - make class an interface - use parameterized test - multiple calls in assert() - log or re-throw - use different type of lambda - use parameterized logging - use StringBuilder instead of concatenation - use StandardCharsets.UTF_8 Issue-ID: POLICY-2906 Change-Id: I2cf8c885e3e22c2c6cbe6403a34906928afad022 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-02-11Changes related to multi policy handling improvement in APEXa.sreekumar1-53/+44
This review fixes an issue identified during testing the changes done for improving multiple policy handling in APEX. Changes done to a few test files in the previous review are reverted as well. Change-Id: I98324da708239d314aadd4c45dc377137fd552ba Issue-ID: POLICY-2883 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
2021-01-28Improve handling of multiple policy in APEX PDPa.sreekumar1-40/+35
Change-Id: Ic4adf5bd8876dc31fc93993298e90389baaa2c39 Issue-ID: POLICY-2883 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
2021-01-06Merge "Changed identifiers to concept identifiers"Liam Fallon1-9/+9
2021-01-04Changed identifiers to concept identifiersliamfallon1-9/+9
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: I5df89d023949cdf0f649951dbbd81a0b30f44ef6 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-12-17Prune superfluous log and exception messagesgregory.hayes3-24/+36
Large volume exception messages should not be repeated in log messages or in rethrown exceptions. Jira-Link: https://jira.onap.org/browse/POLICY-2885 Issue-ID: POLICY-2885 Signed-off-by: gregory.hayes <gregory.hayes@est.tech> Change-Id: I345531d3a7640cc5ad9dbfc367052b9c8cc19387
2020-09-09APEX standalone support for ToscaPolicy formata.sreekumar10-386/+201
Legacy format support is removed, and Tosca format support is added. Change-Id: I3cfc181ccb5471a5d224c0162af18c1fa0fdbc70 Issue-ID: POLICY-2812 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
2020-09-04Remove client code from apex-pdpliamfallon5-591/+0
Removal of the deployment and monitoring client from the apex-pdp as the functionality is replaced by the Policy Framework deployment using PAP and the Policy Framework monitoring GUI. Code in the engine proper that was used to administer apex-pdp over the Web Socket port is also removed, as this code was only used by the apex-pdp legacy GUIs. Issue-ID: POLICY-2621 Change-Id: Ib9fc4a667a4bc79377bb7b82fae6a2bd520a3e3d Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-09-03Clean up warnings and SONAR issuesliamfallon3-109/+93
Issue-ID: POLICY-2654 Change-Id: Ifd391ea9141d37cfd3ca4110d66c667962230ae1 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-08-07Handling apex-pdp multi policy deployment failure:puthuparambil.aditya1-6/+13
1.Include the list of duplicate parameters in the logs for easier troubleshooting 2.Also fix 4 Sonar blockers in ApexMainTest.java Issue-ID: POLICY-2712 Signed-off-by: puthuparambil.aditya <aditya.puthuparambil@bell.ca> Change-Id: I145a7e03f76f880f8e3cbde97284748468b354a5
2020-07-21Fix assertTrue in apex-pdp/model apex-pdp/plugins, apex-pdp/services and ↵JvD_Ericsson1-1/+1
apex-pdp/testsuites Replace assertTrue with assertEquals and assertFalse with assertNotEquals in apex-pdp/model, apex-pdp/plugins, apex-pdp/services and apex-pdp/testsuites Issue-ID: POLICY-2690 Change-Id: If088371cf012d5648e04ade2aa4d49b38945f6d2 Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech>
2020-07-15Replace try/catch with assertjwaynedunican11-1437/+989
Replaced try/catch blocks with assertj assertions in apex-pdp. Last batch of changes Issue-ID: POLICY-2451 Change-Id: I39bd02fdbd8389818dcf1b786189c1e344ddcea5 Signed-off-by: waynedunican <wayne.dunican@est.tech>
2020-06-19Changes for checkstyle 8.32liamfallon18-20/+1
Issue-ID: POLICY-2188 Change-Id: I56bbf3aa3bd9e1ef433cc93ad2be0c54d141a2a5 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-06-12Improve robustness of unit testinghuaxing1-20/+23
Issue-ID: POLICY-2630 Signed-off-by: huaxing <huaxing.jin@est.tech> Change-Id: I6475f9272c1a770836af537c13b23e486b66ac3e
2020-04-06Fix intermittent unit test failures WebSocketliamfallon1-6/+9
The Web Socket server is marked as started before the start process has complted. This change fixes that issue. Issue-ID: POLICY-1470 Change-Id: I5b5ef5832893d884a6551b0516df91cb71d6c622 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-03-04replace test sleep() with awaitality packageHenry.Sun1-32/+16
Signed-off-by: Henry.Sun <henry.a.sun@est.tech> Change-Id: I305771ddef42bd3032ad52f4c5ecd55b01ed5a1a Issue-ID: POLICY-1914 Signed-off-by: Henry.Sun <henry.a.sun@est.tech>
2020-02-26Fix Java 11/Checkstyle/Sonar warningsliamfallon5-55/+55
A number of Java 11, checkstyle, and SONAR warnings have crept into the Apex codebase over the last number of reviews. This change fixes those issues. Issue-ID: POLICY-1913 Change-Id: I2afd607e80f48323355380fb2fe5e048e18879f9 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-01-23Remove apex-pdp TextFileUtils classliamfallon4-96/+101
This class was moved to policy-common some time ago. Removing it in apex-pdp. Issue-ID: POLICY-1913 Change-Id: I982fbd799334b34f1526e19f339236b52205b91e Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-01-23Run apex-pdp in Java 11: base changesliamfallon2-129/+122
This change brings in the minimum changes to get apex-pdp running in Java 11. Other reviews will bring in changes to remove Java 11 warnings and to convert apex-pdp Javascript handling from the now deprecated nashorn engine. Issue-ID: POLICY-1581 Change-Id: I879bbae08d4e67aca3f1bfeedeca639d8dbbc281 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-01-08Populate the PdpStatistics data in heartbeatshaoqiu2-8/+38
Apex to populate the PdpStatistics data in every heartbeat sent to PAP Issue-ID: POLICY-2302 Change-Id: I2d3a6c1e8605d53bf754a135980527bd50762abd Signed-off-by: shaoqiu <tim.huang@est.tech>
2019-12-04Minor changes for new Eclipse checkstyle checksliamfallon12-213/+222
The laest Eclipse checkstyle version 8.26.0 does more thorough checking and identified a number of small issues in the apex-pdp codebase. This review fixes those issues. Issue-ID: POLICY-1913 Change-Id: I30ba25e3e425c6d54c77f925e8da3ab841a8357c Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-11-28Replace getCaononicalName() with getName() in code baseliamfallon2-9/+13
Issue-ID: POLICY-1861 Change-Id: Iccbdcbc5b5978305c56ab74c01a52a562697bee1 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-11-01Resolve mapping between TOSCA policies and APEX policy modelsa.sreekumar1-17/+70
Change-Id: Ifaedc5074bcc51a5d495e342feae89b6a2aac1cf Issue-ID: POLICY-1626 Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
2019-06-28Replace non-Javadoc comments with inheritDocsliamfallon5-143/+60
Copyright headers not changed as this review only amends comments. Issue-ID: POLICY-1791 Change-Id: Icbeb2c6e591b3b160ae102bb67aef2d407924a4d Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-06-27Add period after inheritDoc for Sonarliamfallon1-6/+7
Issue-ID: POLICY-1791 Change-Id: I60f65fb60ca77fe97bd1c23822038b835bd98a11 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-06-26Add passthrough properties for APEX engineliamfallon4-70/+51
APEX event receiver and sender plugins sometimes need to exchange information with tasks, especially in the case of REST communication. This change enables passthrough of Properties from the event carrier technology plugins to APEX task, task selection, and state finalizer logics. Apologies for the size of the review but this change involves passinng the properties through all the APEX components, hence the large number of small changes. Issue-ID: POLICY-1742 Change-Id: I219fd69550f06702ef64adbb165fe7baac422e96 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-06-21Replace uses of getCanonicalName() with getName() in APEXa.sreekumar5-23/+22
Change-Id: Ifcd8866e65a7bc1238d5a4137f7bad288a5bfb3b Issue-ID: POLICY-1861 Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
2019-06-19Fix junit tests in apex-pdpliamfallon3-310/+286
Sonar fix broke some of the junit tests for parameters; fixed those. Issue-ID: POLICY-1791 Change-Id: If39472b9936d5312a1d4109ad83610f5913d3e34 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-01-15Fix crashing unit tests in Apexliamfallon1-14/+15
Issue-ID: POLICY-1403 Change-Id: Ie9d2cc46f3daf4d6b2eb2774a8be8c35e0c45754 Signed-off-by: liamfallon <liam.fallon@est.tech>
2018-12-26Rename test classes in apex-pdp/servicesParshad Patel15-49/+49
Make test classes name consitence by adding 'Test' at end of junit test classes and adding 'Support' or 'Dummy' at start of util or dummy type of test classes Issue-ID: POLICY-1263 Change-Id: I951f4e30736144010d69a0fb3b9181f7fee76013 Signed-off-by: Parshad Patel <pars.patel@samsung.com>
2018-12-18Add Java property parameters for HTTPSliamfallon5-0/+411
Issue-ID: POLICY-1222 Change-Id: I4a683cf2f52e7f1d28164954f84d0744b5ca7e9c Signed-off-by: liamfallon <liam.fallon@est.tech>
2018-11-12Clean up eclipse and document warningsliamfallon1-4/+4
Parent versions in some POMs only called on the test profile were incorrect Warnings in Eclipse on POM including from outside its project are fixed Some checkstyle fixes Some javadoc warnings fixed Issue-ID: POLICY-954 Change-Id: I640bc842dc79a9fa580015abb9a76c84a7845efe Signed-off-by: liamfallon <liam.fallon@ericsson.com>