summaryrefslogtreecommitdiffstats
path: root/testsuites/integration/integration-common/src/main/resources
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2020-03-05 10:50:48 +0000
committerliamfallon <liam.fallon@est.tech>2020-03-09 18:30:13 +0000
commit6bda5d7e4e80d1aefb4f19203361b7199448e70f (patch)
treeb28a68625cec91c57f0383d185f73fdf165ab558 /testsuites/integration/integration-common/src/main/resources
parentf876b34ec297495df20394c248b899d610e1bcce (diff)
Use Rhino javascript executor in apex-pdp
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>
Diffstat (limited to 'testsuites/integration/integration-common/src/main/resources')
-rw-r--r--testsuites/integration/integration-common/src/main/resources/examples/models/JMS/JMSTestModel.json2
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultStateLogic.javascript13
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultTaskLogic.javascript17
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalStateLogic.javascript11
-rw-r--r--testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalTaskLogic.javascript14
5 files changed, 28 insertions, 29 deletions
diff --git a/testsuites/integration/integration-common/src/main/resources/examples/models/JMS/JMSTestModel.json b/testsuites/integration/integration-common/src/main/resources/examples/models/JMS/JMSTestModel.json
index 78c8110b9..67fdcbfe5 100644
--- a/testsuites/integration/integration-common/src/main/resources/examples/models/JMS/JMSTestModel.json
+++ b/testsuites/integration/integration-common/src/main/resources/examples/models/JMS/JMSTestModel.json
@@ -342,7 +342,7 @@
"taskLogic": {
"key": "TaskLogic",
"logicFlavour": "JAVASCRIPT",
- "logic": "var outFieldType = Java.type(\"org.onap.policy.apex.testsuites.integration.common.testclasses.PingTestClass\");\nvar outValue = new outFieldType();\n\nvar inValue = executor.inFields.get(\"PingTestClass\");\n\nexecutor.logger.info(inValue.toString());\n\noutValue.setPingTime(inValue.getPingTime());\noutValue.setPongTime(new Date().getTime());\noutValue.setName(inValue.getName() + \"_out\");\n\noutValue.setDescription(\ninValue.getDescription() +\n\". So Romeo would, were he not Romeo call'd,\" +\n\" retain that dear perfection which he owes, without that title.\");\n\nexecutor.logger.info(outValue.toString();\nexecutor.outFields.put(\"PingTestClass\", outValue)\n\nvar returnValueType = Java.type(\"java.lang.Boolean\");\nvar returnValue = new returnValueType(true);"
+ "logic": "var outFieldType = org.onap.policy.apex.testsuites.integration.common.testclasses.PingTestClass;\nvar outValue = new outFieldType();\n\nvar inValue = executor.inFields.get(\"PingTestClass\");\n\nexecutor.logger.debug(inValue.toString());\n\noutValue.setPingTime(inValue.getPingTime());\noutValue.setPongTime(new Date().getTime());\noutValue.setName(inValue.getName() + \"_out\");\n\noutValue.setDescription(\ninValue.getDescription() +\n\". So Romeo would, were he not Romeo call'd,\" +\n\" retain that dear perfection which he owes, without that title.\");\n\nexecutor.logger.debug(outValue.toString());\nexecutor.outFields.put(\"PingTestClass\", outValue)\n\ntrue;"
}
}
}
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultStateLogic.javascript b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultStateLogic.javascript
index a3f1525d0..6d94ab1ab 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultStateLogic.javascript
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultStateLogic.javascript
@@ -6,23 +6,22 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-executor.logger.debug(executor.subject.getId());
+executor.logger.debug(executor.getSubject().getId());
var gc = executor.getContextAlbum("GlobalContextAlbum");
executor.logger.debug(gc.getName());
-executor.getSubject().getDefaultTaskKey().copyTo(executor.selectedTask);
-
-var returnValue = executor.isTrue;
+executor.getSubject().getDefaultTaskKey().copyTo(executor.selectedTask)
+true; \ No newline at end of file
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultTaskLogic.javascript b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultTaskLogic.javascript
index 36fd2c4a2..563572057 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultTaskLogic.javascript
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/DefaultTaskLogic.javascript
@@ -6,28 +6,29 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-executor.logger.debug(executor.subject.getId());
+executor.logger.debug(executor.getSubject().getId());
+executor.logger.debug(executor.getInFields());
+
var gc = executor.getContextAlbum("GlobalContextAlbum");
executor.logger.debug(gc.getName());
-executor.logger.debug(executor.inFields.get("TestSlogan"));
-var caseSelectedType = Java.type("java.lang.Byte");
+var caseSelectedType = java.lang.Byte;
executor.outFields.put("Test<STATE_NAME>CaseSelected", new caseSelectedType(<RANDOM_BYTE_VALUE>));
executor.outFields.put("Test<STATE_NAME>StateTime", java.lang.System.nanoTime());
-executor.logger.debug(executor.inFields.get("TestSlogan"));
+executor.logger.debug(executor.getOutFields());
-var returnValue = executor.isTrue;
+true;
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalStateLogic.javascript b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalStateLogic.javascript
index 5ee2a0448..4fcfda1c1 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalStateLogic.javascript
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalStateLogic.javascript
@@ -6,21 +6,20 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-executor.logger.debug(executor.subject.getId());
+executor.logger.debug(executor.getSubject().getId());
executor.subject.defaultTaskKey.copyTo(executor.selectedTask);
-var returnValue = executor.isTrue;
-
+true;
diff --git a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalTaskLogic.javascript b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalTaskLogic.javascript
index b29e96fcf..17d3d8a93 100644
--- a/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalTaskLogic.javascript
+++ b/testsuites/integration/integration-common/src/main/resources/org/onap/policy/apex/testsuites/integration/common/model/javascript/EvalTaskLogic.javascript
@@ -6,23 +6,23 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
+ *
* SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-executor.logger.debug(executor.subject.getId());
-executor.logger.debug(executor.inFields.get("name"));
+executor.logger.debug(executor.getSubject().getId());
+executor.logger.debug(executor.getInFields());
executor.outFields.put("State<STATE_NUMBER>Timestamp", java.lang.System.nanoTime());
-executor.logger.debug(executor.outFields.get("name"));
+executor.logger.debug(executor.getOutFields());
-var returnValue = executor.isTrue;
+true; \ No newline at end of file