summaryrefslogtreecommitdiffstats
path: root/plugins/plugins-executor/plugins-executor-javascript/src
AgeCommit message (Collapse)AuthorFilesLines
2021-08-27Fix sonars in apex-pdp #2Jim Hahn2-5/+6
plugins-events thru plugins-persistence-jpa-eclipselink Fixed: - use "var" - disambiguate method parameter types - rename parameter Issue-ID: POLICY-3093 Change-Id: Ife5897015be495403e731754d5862b803a217c87 Signed-off-by: Jim Hahn <jrh3@att.com>
2021-07-02Cleanup input & outputFields from Task definitiona.sreekumar1-5/+2
1) Remove the usage of inputField and outputField from Task definition. 2) Fix issues around populating events to task in case of State Finalizer Logic. Change-Id: Ief17f400729410b83c6b7c665980d443e0cf6f28 Issue-ID: POLICY-3336 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
2021-06-28Changes to support multiple outputs from a statea.sreekumar2-10/+26
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-02-18Fix sonars in apex-pdpJim Hahn1-2/+4
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>
2020-10-16Remove apex asciidoc documentsliamfallon1-30/+0
Apex documentation has now all been ported to use the ONAP recommended rst format. This review removes the old asciidoc documents. Issue-ID: POLICY-2824 Change-Id: I562bd344cb7d6ff36e7d54bdb8f95e3b656468f8 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-09-09APEX standalone support for ToscaPolicy formata.sreekumar1-56/+762
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-03Merge "Sonar Bug fixes"Pamela Dragosh1-1/+1
2020-09-03Sonar Bug fixeswaynedunican1-1/+1
Removal of remaining bugs in apex-pdp Issue-ID: POLICY-2774 Change-Id: I370796e7c8a41c116155155c33176512e9e0cd91 Signed-off-by: waynedunican <wayne.dunican@est.tech>
2020-09-03Clean up warnings and SONAR issuesliamfallon2-13/+6
Issue-ID: POLICY-2654 Change-Id: Ifd391ea9141d37cfd3ca4110d66c667962230ae1 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-07-13Remove old documentation from buildliamfallon4-143/+0
apex-pdp had an in-line docuemntation build system built on asciidoc. It has proven to be very difficult to maintain and keep up to date and it is incompatible with the ONAP official RST/ReadTheDocs docuementation system. In the Dublin release, we converted the asciidoc documentation to RST format, and hae been updating the RST documentation since. The asciidoc docuemntation system is now so out of date that it is being removed. In this change, the "site" directory is removed from all modules in apex-pdp and a profile called "apexSite" is removed from the pom.xml file in all modules. Issue-ID: POLICY-2686 Change-Id: I645f3ed101159d356cd90e619cef791067ad5eb5 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-06-23Remove thread in JavascriptExecutorhuaxing9-704/+103
This change is basically a rollback of https://gerrit.onap.org/r/c/policy/apex-pdp/+/104230, with minor refactoring. The problem that 104230 tried to address was supposed to be caused by https://jira.onap.org/browse/POLICY-2463. With this rollback, apex-pdp increases performance and reduces memory usage. Issue-ID: POLICY-2572 Signed-off-by: huaxing <huaxing.jin@est.tech> Change-Id: I3a52d0ead0c1e530d218f9e3aba8b3eb5558abaf
2020-06-19Changes for checkstyle 8.32liamfallon9-10/+0
Issue-ID: POLICY-2188 Change-Id: I56bbf3aa3bd9e1ef433cc93ad2be0c54d141a2a5 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-04-03Fix failing Kafka testsliamfallon2-5/+17
All the Kafka components need something near 10 seconds to come up completely. This review tweaks the timing to allow the test Kafka server to come up and to allow the consumers to connect to it. Issue-ID: POLICY-2106 Change-Id: I6dd8ace0848bdc2549e658ef8908b4d85d5ea789 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-04-02Fix hanging timeout on Executor testliamfallon2-11/+24
Issue-ID: POLICY-2106 Change-Id: I7bd44f8dfe349d73a4c8c4f978a30b455c45b2c7 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-03-30Fix hanging tests in JavascritExecutorliamfallon6-66/+419
Added tests to check threads start, execute, and stop correctly and fixed JavescriptExecutor class to handle startup and shutdown correctly without hanging. Issue-ID: POLICY-2106 Change-Id: I9ab41023aae2ab1cbcaea53fdf5d48eccd90a2f1 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-03-25Ignore JUnit tests that hang on awaitliamfallon4-2/+11
This change ignores the tests that are hanging in Jenkins until the Apex images are released. Once the images are released we'll fix these tests. Issue-ID: POLICY-2106 Change-Id: I6a733896da044d3f24443ac202d6122a341db135 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-03-25Add timeout on Javascript latch awaitsliamfallon1-2/+7
It is possible that the initiation and especially shutdown happens so fast that the execution thread counts down the latch before the caller calls await(), in which case the Javascript Rhino thread will hang. This review adds a timeout on the await calls. Issue-ID: POLICY-2106 Change-Id: Icfc6d4b478cca62522461c25d61ce9ee7328684a Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-03-24Launch separate threads for Javascript task executionliamfallon8-80/+330
When a policy is loaded, a separate thread is spawned for each Javascript script executor. This allows us to precompile the Javascript scripts and also to have a larger stack available for script execution. Issue-ID: POLICY-2106 Change-Id: I97323aafb623ba537ac1889b3c9504b345b4f67e Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-03-11Convert examples to Rhino Javascript formatliamfallon2-3/+2
All examples are converted to Rhino Javascript from Nashorn Javascript. Issue-ID: POLICY-2106 Change-Id: Ia6fec5b57b1e6131799b4b069968e4766ce54c96 Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-03-09Use Rhino javascript executor in apex-pdpliamfallon11-81/+126
Integation unit tests resultd in StackOverflowException errors in the Graal Javascript interpreter. Following extensive testing and trouobleshooting, it proved very difficult to fix these issues in Graal as the stck overflow errors were occurring in native class instantiation methods being invoked by Grall on the JVM. The alternative Rhino Javascript engine is developed by mozilla, and was incorporated into the Java 6 JVM and evolved into Nashorn in the Java 8 JVM. Oracle dropped Nashorn in Java 11. However, in parallel, Rhino development has continued. This review brings in the Rhino javascript engine into apex-pdp as the replacement for Nashorn and instead of Graal. Graal seems to be pretty unstable as yet so we may bring it in in future releases but for now Rhino is a more stable and reliable alternative. Issue-ID: POLICY-2106 Change-Id: I0edeff3b0bee404b38e3ebe22001a6e3375a44dc Signed-off-by: liamfallon <liam.fallon@est.tech>
2020-03-01Switch apex to Graal javascript engineliamfallon15-318/+1958
This is the main review to switch out the Nashorn Javascript interpreter and switch in the Graal javascript interpreter for apex Javascript tasks. The Graal Javascript dialect differs slightly from Nashorn in the way it accesses information passed over from the Java world so Javascript tasks need to be converted. Subsequent reviews will convert the JUnit tests marked @Ignore in previous reviews to this one and will convert the Javascript tasks into a format Graal can handle. Subsequent reviews will also convert the examples over to Graal format. Issue-ID: POLICY-2106 Change-Id: Ief582a36539e8a87724c17fb7e56864d5e471c07 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-07-10Add integration tests for executor propertiesliamfallon3-13/+19
Added integration test that sets properties in a dummy plugin and amends them in tasks in a policy. Variosu tests added to check combinations of where properties are set in plugins or in tasks or both. Implementaiton changed to: - Always pass in a Properies object, the properties object coming into the policy cannot be null because the task/TSL/SFL may wish to set it - Fix a bug where the properties were not passed from the ApexEvent to the engine event in the ApexEventUnmarshaller class Issue-ID: POLICY-1743 Change-Id: I6aa152b28d46cf3cc6fa56a1a95b76a8e55f5a49 Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-06-26Add passthrough properties for APEX engineliamfallon6-28/+37
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.sreekumar1-3/+3
Change-Id: Ifcd8866e65a7bc1238d5a4137f7bad288a5bfb3b Issue-ID: POLICY-1861 Signed-off-by: a.sreekumar <ajith.sreekumar@est.tech>
2019-03-19Fix checkstyle/Sonar issues on juint/sonar fixesliamfallon7-7/+11
Recent changes to increase code coverage and fox Sonar bugs have introduced checkstyle and further Sonar issues. This review cleans those up. Issue-ID: POLICY-1523 Change-Id: I829217ef77d52e57f9713cfeee5b122e1f25efbc Signed-off-by: liamfallon <liam.fallon@est.tech>
2019-03-06Increase test coverage for plugins-executor-jsHengye7-70/+535
Add junit test cases into apex-pdp/plugins/plugins-executor-javascript Issue-ID: POLICY-1523 Change-Id: Ie8017be2f7507fdb641a4020e13152c656cadf04 Signed-off-by: Hengye <yehui.wang@est.tech>
2018-09-13Sonar/Checkstyle in service/pluginsliamfallon3-26/+27
Sonar and Checkstyle changes in plugins and services, and knock on changes Issue-ID: POLICY-1034 Change-Id: Iff7df74e54fce2c661dcc2fae75ae93d4cacfe5b Signed-off-by: liamfallon <liam.fallon@ericsson.com>
2018-09-04Fix checkstyle issues in apex model basicliamfallon3-23/+23
CHeckstyle issues in apex model basic and knock on changes in other apex modules. Issue-ID: POLICY-1034 Change-Id: I65823f5e2e344526abc74b0812877113acb056ec Signed-off-by: liamfallon <liam.fallon@ericsson.com>
2018-08-05Adding Apex docs for Plugins moduleDinh Danh Le5-0/+173
Change-Id: Icf68473b472a5896972de5b07b275682a77a1c9f Signed-off-by: Dinh Danh Le <dinh.danh.le@ericsson.com> Issue-ID: POLICY-867
2018-06-11Adding plugin-executor module to apex-pdpramverma5-0/+482
Change-Id: I711eaaff3707aa6398c26f1a124fedeb1d0e11f4 Issue-ID: POLICY-862 Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>